PR 87488: Add --with-diagnostics-urls configuration option
[official-gcc.git] / gcc / doc / invoke.texi
blob597151670be75b09bbced0f941c8743107cbc1cb
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.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2020 Free Software Foundation, Inc.
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.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
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{}
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
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
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}.
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.
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.
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.
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}}.
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.
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.
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.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
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
177 @c man begin OPTIONS
179 @node Option Summary
180 @section Option Summary
182 Here is a summary of all the options, grouped by type.  Explanations are
183 in the following sections.
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}}
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}
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=@var{n}  -Wabi-tag  -Wcomma-subscript  -Wconversion-null @gol
235 -Wctor-dtor-privacy @gol
236 -Wdelete-non-virtual-dtor  -Wdeprecated-copy  -Wdeprecated-copy-dtor @gol
237 -Wliteral-suffix -Wmismatched-tags @gol
238 -Wmultiple-inheritance  -Wno-init-list-lifetime @gol
239 -Wnamespaces  -Wnarrowing @gol
240 -Wpessimizing-move  -Wredundant-move -Wredundant-tags @gol
241 -Wnoexcept  -Wnoexcept-type  -Wclass-memaccess @gol
242 -Wnon-virtual-dtor  -Wreorder  -Wregister @gol
243 -Weffc++  -Wstrict-null-sentinel  -Wtemplates @gol
244 -Wno-non-template-friend  -Wold-style-cast @gol
245 -Woverloaded-virtual  -Wno-pmf-conversions @gol
246 -Wno-class-conversion  -Wno-terminate @gol
247 -Wsign-promo  -Wvirtual-inheritance  -Wvolatile}
249 @item Objective-C and Objective-C++ Language Options
250 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
251 Objective-C and Objective-C++ Dialects}.
252 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
253 -fgnu-runtime  -fnext-runtime @gol
254 -fno-nil-receivers @gol
255 -fobjc-abi-version=@var{n} @gol
256 -fobjc-call-cxx-cdtors @gol
257 -fobjc-direct-dispatch @gol
258 -fobjc-exceptions @gol
259 -fobjc-gc @gol
260 -fobjc-nilcheck @gol
261 -fobjc-std=objc1 @gol
262 -fno-local-ivars @gol
263 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
264 -freplace-objc-classes @gol
265 -fzero-link @gol
266 -gen-decls @gol
267 -Wassign-intercept @gol
268 -Wno-protocol  -Wselector @gol
269 -Wstrict-selector-match @gol
270 -Wundeclared-selector}
272 @item Diagnostic Message Formatting Options
273 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
274 @gccoptlist{-fmessage-length=@var{n}  @gol
275 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
276 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
277 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
278 -fdiagnostics-format=@r{[}text@r{|}json@r{]}  @gol
279 -fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
280 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
281 -fno-diagnostics-show-cwe  @gol
282 -fdiagnostics-minimum-margin-width=@var{width} @gol
283 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
284 -fdiagnostics-show-template-tree  -fno-elide-type @gol
285 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
286 -fdiagnostics-show-path-depths @gol
287 -fno-show-column}
289 @item Warning Options
290 @xref{Warning Options,,Options to Request or Suppress Warnings}.
291 @gccoptlist{-fanalyzer -fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
292 -pedantic-errors @gol
293 -w  -Wextra  -Wall  -Waddress  -Waddress-of-packed-member @gol
294 -Waggregate-return  -Waligned-new @gol
295 -Walloc-zero  -Walloc-size-larger-than=@var{byte-size} @gol
296 -Walloca  -Walloca-larger-than=@var{byte-size} @gol
297 -Wno-aggressive-loop-optimizations @gol
298 -Wno-analyzer-double-fclose @gol
299 -Wno-analyzer-double-free @gol
300 -Wno-analyzer-exposure-through-output-file @gol
301 -Wno-analyzer-file-leak @gol
302 -Wno-analyzer-free-of-non-heap @gol
303 -Wno-analyzer-malloc-leak @gol
304 -Wno-analyzer-possible-null-argument @gol
305 -Wno-analyzer-possible-null-dereference @gol
306 -Wno-analyzer-null-argument @gol
307 -Wno-analyzer-null-dereference @gol
308 -Wno-analyzer-stale-setjmp-buffer @gol
309 -Wno-analyzer-tainted-array-index @gol
310 -Wno-analyzer-unsafe-call-within-signal-handler @gol
311 -Wno-analyzer-use-after-free @gol
312 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
313 -Wno-analyzer-use-of-uninitialized-value @gol
314 -Wanalyzer-too-complex @gol
315 -Warith-conversion @gol
316 -Warray-bounds  -Warray-bounds=@var{n} @gol
317 -Wno-attributes  -Wattribute-alias=@var{n}  @gol
318 -Wbool-compare  -Wbool-operation @gol
319 -Wno-builtin-declaration-mismatch @gol
320 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
321 -Wc11-c2x-compat @gol
322 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
323 -Wc++20-compat  @gol
324 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
325 -Wchar-subscripts  -Wcatch-value  -Wcatch-value=@var{n} @gol
326 -Wclobbered  -Wcomment  -Wconditionally-supported @gol
327 -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wdangling-else  -Wdate-time @gol
328 -Wdelete-incomplete @gol
329 -Wno-attribute-warning @gol
330 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
331 -Wdisabled-optimization @gol
332 -Wno-discarded-qualifiers  -Wno-discarded-array-qualifiers @gol
333 -Wno-div-by-zero  -Wdouble-promotion @gol
334 -Wduplicated-branches  -Wduplicated-cond @gol
335 -Wempty-body  -Wenum-compare  -Wenum-conversion @gol
336 -Wno-endif-labels  -Wexpansion-to-defined @gol
337 -Werror  -Werror=*  -Wextra-semi  -Wfatal-errors @gol
338 -Wfloat-equal  -Wformat  -Wformat=2 @gol
339 -Wno-format-contains-nul  -Wno-format-extra-args  @gol
340 -Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
341 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
342 -Wformat-y2k  -Wframe-address @gol
343 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
344 -Wjump-misses-init @gol
345 -Whsa  -Wif-not-aligned @gol
346 -Wignored-qualifiers  -Wignored-attributes  -Wincompatible-pointer-types @gol
347 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
348 -Wimplicit-function-declaration  -Wimplicit-int @gol
349 -Winaccessible-base @gol
350 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
351 -Wno-int-to-pointer-cast  -Winvalid-memory-model  -Wno-invalid-offsetof @gol
352 -Wzero-length-bounds @gol
353 -Winvalid-pch  -Wlarger-than=@var{byte-size} @gol
354 -Wlogical-op  -Wlogical-not-parentheses  -Wlong-long @gol
355 -Wmain  -Wmaybe-uninitialized  -Wmemset-elt-size  -Wmemset-transposed-args @gol
356 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
357 -Wmissing-field-initializers  -Wmissing-format-attribute @gol
358 -Wmissing-include-dirs  -Wmissing-noreturn  -Wmissing-profile @gol
359 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
360 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
361 -Wnull-dereference  -Wodr  -Wno-overflow  -Wopenmp-simd  @gol
362 -Woverride-init-side-effects  -Woverlength-strings @gol
363 -Wpacked  -Wpacked-bitfield-compat -Wpacked-not-aligned  -Wpadded @gol
364 -Wparentheses  -Wno-pedantic-ms-format @gol
365 -Wplacement-new  -Wplacement-new=@var{n} @gol
366 -Wpointer-arith  -Wpointer-compare  -Wno-pointer-to-int-cast @gol
367 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
368 -Wrestrict  -Wno-return-local-addr @gol
369 -Wreturn-type  -Wsequence-point  -Wshadow  -Wno-shadow-ivar @gol
370 -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local @gol
371 -Wshift-overflow  -Wshift-overflow=@var{n} @gol
372 -Wshift-count-negative  -Wshift-count-overflow  -Wshift-negative-value @gol
373 -Wsign-compare  -Wsign-conversion  -Wfloat-conversion @gol
374 -Wno-scalar-storage-order  -Wsizeof-pointer-div @gol
375 -Wsizeof-pointer-memaccess  -Wsizeof-array-argument @gol
376 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
377 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
378 -Wstring-compare @gol
379 -Wstringop-overflow=@var{n}  -Wstringop-truncation  -Wsubobject-linkage @gol
380 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
381 -Wsuggest-final-types @gol  -Wsuggest-final-methods  -Wsuggest-override @gol
382 -Wswitch  -Wswitch-bool  -Wswitch-default  -Wswitch-enum @gol
383 -Wswitch-unreachable  -Wsync-nand @gol
384 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
385 -Wtype-limits  -Wundef @gol
386 -Wuninitialized  -Wunknown-pragmas @gol
387 -Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
388 -Wunused-label  -Wunused-local-typedefs  -Wunused-macros @gol
389 -Wunused-parameter  -Wno-unused-result @gol
390 -Wunused-value  -Wunused-variable @gol
391 -Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
392 -Wunused-but-set-parameter  -Wunused-but-set-variable @gol
393 -Wuseless-cast  -Wvariadic-macros  -Wvector-operation-performance @gol
394 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wvolatile-register-var @gol
395 -Wwrite-strings @gol
396 -Wzero-as-null-pointer-constant}
398 @item Static Analyzer Options
399 @gccoptlist{-Wanalyzer-double-fclose @gol
400 -Wanalyzer-double-free @gol
401 -Wanalyzer-exposure-through-output-file @gol
402 -Wanalyzer-file-leak @gol
403 -Wanalyzer-free-of-non-heap @gol
404 -Wanalyzer-malloc-leak @gol
405 -Wanalyzer-null-argument @gol
406 -Wanalyzer-null-dereference @gol
407 -Wanalyzer-possible-null-argument @gol
408 -Wanalyzer-possible-null-dereference @gol
409 -Wanalyzer-stale-setjmp-buffer @gol
410 -Wanalyzer-tainted-array-index @gol
411 -Wanalyzer-unsafe-call-within-signal-handler @gol
412 -Wanalyzer-use-after-free @gol
413 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
414 -Wanalyzer-use-of-uninitialized-value @gol
415 -Wanalyzer-too-complex  @gol
416 -fanalyzer-call-summaries @gol
417 -fanalyzer-checker=@var{name} @gol
418 -fanalyzer-fine-grained @gol
419 -fanalyzer-state-merge @gol
420 -fanalyzer-state-purge @gol
421 -fanalyzer-transitivity @gol
422 -fanalyzer-verbose-edges @gol
423 -fanalyzer-verbose-state-changes @gol
424 -fanalyzer-verbosity=@var{level} @gol
425 -fdump-analyzer @gol
426 -fdump-analyzer-stderr @gol
427 -fdump-analyzer-callgraph @gol
428 -fdump-analyzer-exploded-graph @gol
429 -fdump-analyzer-exploded-nodes @gol
430 -fdump-analyzer-exploded-nodes-2 @gol
431 -fdump-analyzer-exploded-nodes-3 @gol
432 -fdump-analyzer-state-purge @gol
433 -fdump-analyzer-supergraph @gol
436 @item C and Objective-C-only Warning Options
437 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
438 -Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
439 -Wold-style-declaration  -Wold-style-definition @gol
440 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
441 -Wdeclaration-after-statement  -Wpointer-sign}
443 @item Debugging Options
444 @xref{Debugging Options,,Options for Debugging Your Program}.
445 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
446 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
447 -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
448 -gas-loc-support  -gno-as-loc-support @gol
449 -gas-locview-support  -gno-as-locview-support @gol
450 -gcolumn-info  -gno-column-info @gol
451 -gstatement-frontiers  -gno-statement-frontiers @gol
452 -gvariable-location-views  -gno-variable-location-views @gol
453 -ginternal-reset-location-views  -gno-internal-reset-location-views @gol
454 -ginline-points  -gno-inline-points @gol
455 -gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
456 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
457 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
458 -fno-eliminate-unused-debug-types @gol
459 -femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
460 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
461 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
462 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
463 -fvar-tracking  -fvar-tracking-assignments}
465 @item Optimization Options
466 @xref{Optimize Options,,Options that Control Optimization}.
467 @gccoptlist{-faggressive-loop-optimizations @gol
468 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
469 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
470 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
471 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
472 -fno-allocation-dce -fallow-store-data-races @gol
473 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
474 -fauto-inc-dec  -fbranch-probabilities @gol
475 -fcaller-saves @gol
476 -fcombine-stack-adjustments  -fconserve-stack @gol
477 -fcompare-elim  -fcprop-registers  -fcrossjumping @gol
478 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
479 -fcx-limited-range @gol
480 -fdata-sections  -fdce  -fdelayed-branch @gol
481 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
482 -fdevirtualize-at-ltrans  -fdse @gol
483 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
484 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
485 -ffinite-loops @gol
486 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
487 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
488 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
489 -fif-conversion2  -findirect-inlining @gol
490 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
491 -finline-small-functions  -fipa-cp  -fipa-cp-clone @gol
492 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
493 -fipa-reference  -fipa-reference-addressable @gol
494 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
495 -flive-patching=@var{level} @gol
496 -fira-region=@var{region}  -fira-hoist-pressure @gol
497 -fira-loop-pressure  -fno-ira-share-save-slots @gol
498 -fno-ira-share-spill-slots @gol
499 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
500 -fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
501 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
502 -floop-block  -floop-interchange  -floop-strip-mine @gol
503 -floop-unroll-and-jam  -floop-nest-optimize @gol
504 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
505 -flto-partition=@var{alg}  -fmerge-all-constants @gol
506 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
507 -fmove-loop-invariants  -fno-branch-count-reg @gol
508 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
509 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
510 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
511 -fno-sched-spec  -fno-signed-zeros @gol
512 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
513 -fomit-frame-pointer  -foptimize-sibling-calls @gol
514 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
515 -fprefetch-loop-arrays @gol
516 -fprofile-correction @gol
517 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training @gol
518 -fprofile-values -fprofile-reorder-functions @gol
519 -freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
520 -freorder-blocks-algorithm=@var{algorithm} @gol
521 -freorder-blocks-and-partition  -freorder-functions @gol
522 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
523 -frounding-math  -fsave-optimization-record @gol
524 -fsched2-use-superblocks  -fsched-pressure @gol
525 -fsched-spec-load  -fsched-spec-load-dangerous @gol
526 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
527 -fsched-group-heuristic  -fsched-critical-path-heuristic @gol
528 -fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
529 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
530 -fschedule-fusion @gol
531 -fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
532 -fselective-scheduling  -fselective-scheduling2 @gol
533 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
534 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
535 -fsignaling-nans @gol
536 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
537 -fsplit-paths @gol
538 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
539 -fstdarg-opt  -fstore-merging  -fstrict-aliasing @gol
540 -fthread-jumps  -ftracer  -ftree-bit-ccp @gol
541 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
542 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
543 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
544 -ftree-loop-if-convert  -ftree-loop-im @gol
545 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
546 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
547 -ftree-loop-vectorize @gol
548 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
549 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
550 -ftree-switch-conversion  -ftree-tail-merge @gol
551 -ftree-ter  -ftree-vectorize  -ftree-vrp  -funconstrained-commons @gol
552 -funit-at-a-time  -funroll-all-loops  -funroll-loops @gol
553 -funsafe-math-optimizations  -funswitch-loops @gol
554 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
555 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin @gol
556 --param @var{name}=@var{value}
557 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og}
559 @item Program Instrumentation Options
560 @xref{Instrumentation Options,,Program Instrumentation Options}.
561 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
562 -fprofile-abs-path @gol
563 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
564 -fprofile-note=@var{path}  -fprofile-update=@var{method} @gol
565 -fprofile-filter-files=@var{regex}  -fprofile-exclude-files=@var{regex} @gol
566 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
567 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
568 -fsanitize-undefined-trap-on-error  -fbounds-check @gol
569 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
570 -fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
571 -fstack-protector-explicit  -fstack-check @gol
572 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
573 -fno-stack-limit  -fsplit-stack @gol
574 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
575 -fvtv-counts  -fvtv-debug @gol
576 -finstrument-functions @gol
577 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
578 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
580 @item Preprocessor Options
581 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
582 @gccoptlist{-A@var{question}=@var{answer} @gol
583 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
584 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
585 -dD  -dI  -dM  -dN  -dU @gol
586 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
587 -fexec-charset=@var{charset}  -fextended-identifiers  @gol
588 -finput-charset=@var{charset}  -fmacro-prefix-map=@var{old}=@var{new}  @gol
589 -fmax-include-depth=@var{depth} @gol
590 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
591 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
592 -fwide-exec-charset=@var{charset}  -fworking-directory @gol
593 -H  -imacros @var{file}  -include @var{file} @gol
594 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT @gol
595 -no-integrated-cpp  -P  -pthread  -remap @gol
596 -traditional  -traditional-cpp  -trigraphs @gol
597 -U@var{macro}  -undef  @gol
598 -Wp,@var{option}  -Xpreprocessor @var{option}}
600 @item Assembler Options
601 @xref{Assembler Options,,Passing Options to the Assembler}.
602 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
604 @item Linker Options
605 @xref{Link Options,,Options for Linking}.
606 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
607 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
608 -e @var{entry}  --entry=@var{entry} @gol
609 -pie  -pthread  -r  -rdynamic @gol
610 -s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
611 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
612 -shared  -shared-libgcc  -symbolic @gol
613 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
614 -u @var{symbol}  -z @var{keyword}}
616 @item Directory Options
617 @xref{Directory Options,,Options for Directory Search}.
618 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
619 -idirafter @var{dir} @gol
620 -imacros @var{file}  -imultilib @var{dir} @gol
621 -iplugindir=@var{dir}  -iprefix @var{file} @gol
622 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
623 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
624 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
625 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
627 @item Code Generation Options
628 @xref{Code Gen Options,,Options for Code Generation Conventions}.
629 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
630 -ffixed-@var{reg}  -fexceptions @gol
631 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
632 -fasynchronous-unwind-tables @gol
633 -fno-gnu-unique @gol
634 -finhibit-size-directive  -fcommon  -fno-ident @gol
635 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
636 -fno-jump-tables @gol
637 -frecord-gcc-switches @gol
638 -freg-struct-return  -fshort-enums  -fshort-wchar @gol
639 -fverbose-asm  -fpack-struct[=@var{n}]  @gol
640 -fleading-underscore  -ftls-model=@var{model} @gol
641 -fstack-reuse=@var{reuse_level} @gol
642 -ftrampolines  -ftrapv  -fwrapv @gol
643 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
644 -fstrict-volatile-bitfields  -fsync-libcalls}
646 @item Developer Options
647 @xref{Developer Options,,GCC Developer Options}.
648 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
649 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
650 -fchecking  -fchecking=@var{n}
651 -fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
652 -fdisable-ipa-@var{pass_name} @gol
653 -fdisable-rtl-@var{pass_name} @gol
654 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
655 -fdisable-tree-@var{pass_name} @gol
656 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
657 -fdump-debug  -fdump-earlydebug @gol
658 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
659 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
660 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
661 -fdump-lang-all @gol
662 -fdump-lang-@var{switch} @gol
663 -fdump-lang-@var{switch}-@var{options} @gol
664 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
665 -fdump-passes @gol
666 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
667 -fdump-statistics @gol
668 -fdump-tree-all @gol
669 -fdump-tree-@var{switch} @gol
670 -fdump-tree-@var{switch}-@var{options} @gol
671 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
672 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
673 -fenable-@var{kind}-@var{pass} @gol
674 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
675 -fira-verbose=@var{n} @gol
676 -flto-report  -flto-report-wpa  -fmem-report-wpa @gol
677 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
678 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
679 -fprofile-report @gol
680 -frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
681 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
682 -fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
683 -fvar-tracking-assignments-toggle  -gtoggle @gol
684 -print-file-name=@var{library}  -print-libgcc-file-name @gol
685 -print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
686 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
687 -print-sysroot  -print-sysroot-headers-suffix @gol
688 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
690 @item Machine-Dependent Options
691 @xref{Submodel Options,,Machine-Dependent Options}.
692 @c This list is ordered alphanumerically by subsection name.
693 @c Try and put the significant identifier (CPU or system) first,
694 @c so users have a clue at guessing where the ones they want will be.
696 @emph{AArch64 Options}
697 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
698 -mgeneral-regs-only @gol
699 -mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
700 -mstrict-align  -mno-strict-align @gol
701 -momit-leaf-frame-pointer @gol
702 -mtls-dialect=desc  -mtls-dialect=traditional @gol
703 -mtls-size=@var{size} @gol
704 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
705 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
706 -mpc-relative-literal-loads @gol
707 -msign-return-address=@var{scope} @gol
708 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
709 +@var{b-key}]|@var{bti} @gol
710 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
711 -moverride=@var{string}  -mverbose-cost-dump @gol
712 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
713 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
714 -moutline-atomics }
716 @emph{Adapteva Epiphany Options}
717 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
718 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
719 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
720 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
721 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
722 -msplit-vecmove-early  -m1reg-@var{reg}}
724 @emph{AMD GCN Options}
725 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
727 @emph{ARC Options}
728 @gccoptlist{-mbarrel-shifter  -mjli-always @gol
729 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
730 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
731 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
732 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
733 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
734 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
735 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
736 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
737 -mvolatile-cache  -mtp-regno=@var{regno} @gol
738 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
739 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
740 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
741 -mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
742 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
743 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
744 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
745 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
747 @emph{ARM Options}
748 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
749 -mabi=@var{name} @gol
750 -mapcs-stack-check  -mno-apcs-stack-check @gol
751 -mapcs-reentrant  -mno-apcs-reentrant @gol
752 -mgeneral-regs-only @gol
753 -msched-prolog  -mno-sched-prolog @gol
754 -mlittle-endian  -mbig-endian @gol
755 -mbe8  -mbe32 @gol
756 -mfloat-abi=@var{name} @gol
757 -mfp16-format=@var{name}
758 -mthumb-interwork  -mno-thumb-interwork @gol
759 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
760 -mtune=@var{name}  -mprint-tune-info @gol
761 -mstructure-size-boundary=@var{n} @gol
762 -mabort-on-noreturn @gol
763 -mlong-calls  -mno-long-calls @gol
764 -msingle-pic-base  -mno-single-pic-base @gol
765 -mpic-register=@var{reg} @gol
766 -mnop-fun-dllimport @gol
767 -mpoke-function-name @gol
768 -mthumb  -marm  -mflip-thumb @gol
769 -mtpcs-frame  -mtpcs-leaf-frame @gol
770 -mcaller-super-interworking  -mcallee-super-interworking @gol
771 -mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
772 -mword-relocations @gol
773 -mfix-cortex-m3-ldrd @gol
774 -munaligned-access @gol
775 -mneon-for-64bits @gol
776 -mslow-flash-data @gol
777 -masm-syntax-unified @gol
778 -mrestrict-it @gol
779 -mverbose-cost-dump @gol
780 -mpure-code @gol
781 -mcmse @gol
782 -mfdpic}
784 @emph{AVR Options}
785 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
786 -mbranch-cost=@var{cost} @gol
787 -mcall-prologues  -mgas-isr-prologues  -mint8 @gol
788 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
789 -mn_flash=@var{size}  -mno-interrupts @gol
790 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
791 -mfract-convert-truncate @gol
792 -mshort-calls  -nodevicelib  -nodevicespecs @gol
793 -Waddr-space-convert  -Wmisspelled-isr}
795 @emph{Blackfin Options}
796 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
797 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
798 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
799 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
800 -mno-id-shared-library  -mshared-library-id=@var{n} @gol
801 -mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
802 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
803 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
804 -micplb}
806 @emph{C6X Options}
807 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
808 -msim  -msdata=@var{sdata-type}}
810 @emph{CRIS Options}
811 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
812 -mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
813 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
814 -mstack-align  -mdata-align  -mconst-align @gol
815 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
816 -melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
817 -mmul-bug-workaround  -mno-mul-bug-workaround}
819 @emph{CR16 Options}
820 @gccoptlist{-mmac @gol
821 -mcr16cplus  -mcr16c @gol
822 -msim  -mint32  -mbit-ops
823 -mdata-model=@var{model}}
825 @emph{C-SKY Options}
826 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
827 -mbig-endian  -EB  -mlittle-endian  -EL @gol
828 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
829 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
830 -mdsp  -medsp  -mvdsp @gol
831 -mdiv  -msmart  -mhigh-registers  -manchor @gol
832 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
833 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog}
835 @emph{Darwin Options}
836 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
837 -arch_only  -bind_at_load  -bundle  -bundle_loader @gol
838 -client_name  -compatibility_version  -current_version @gol
839 -dead_strip @gol
840 -dependency-file  -dylib_file  -dylinker_install_name @gol
841 -dynamic  -dynamiclib  -exported_symbols_list @gol
842 -filelist  -flat_namespace  -force_cpusubtype_ALL @gol
843 -force_flat_namespace  -headerpad_max_install_names @gol
844 -iframework @gol
845 -image_base  -init  -install_name  -keep_private_externs @gol
846 -multi_module  -multiply_defined  -multiply_defined_unused @gol
847 -noall_load   -no_dead_strip_inits_and_terms @gol
848 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
849 -pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
850 -private_bundle  -read_only_relocs  -sectalign @gol
851 -sectobjectsymbols  -whyload  -seg1addr @gol
852 -sectcreate  -sectobjectsymbols  -sectorder @gol
853 -segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
854 -seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
855 -segprot  -segs_read_only_addr  -segs_read_write_addr @gol
856 -single_module  -static  -sub_library  -sub_umbrella @gol
857 -twolevel_namespace  -umbrella  -undefined @gol
858 -unexported_symbols_list  -weak_reference_mismatches @gol
859 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
860 -mkernel  -mone-byte-bool}
862 @emph{DEC Alpha Options}
863 @gccoptlist{-mno-fp-regs  -msoft-float @gol
864 -mieee  -mieee-with-inexact  -mieee-conformant @gol
865 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
866 -mtrap-precision=@var{mode}  -mbuild-constants @gol
867 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
868 -mbwx  -mmax  -mfix  -mcix @gol
869 -mfloat-vax  -mfloat-ieee @gol
870 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
871 -msmall-text  -mlarge-text @gol
872 -mmemory-latency=@var{time}}
874 @emph{eBPF Options}
875 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
876 -mframe-limit=@var{bytes}}
878 @emph{FR30 Options}
879 @gccoptlist{-msmall-model  -mno-lsim}
881 @emph{FT32 Options}
882 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
884 @emph{FRV Options}
885 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
886 -mhard-float  -msoft-float @gol
887 -malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
888 -mdouble  -mno-double @gol
889 -mmedia  -mno-media  -mmuladd  -mno-muladd @gol
890 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
891 -mlinked-fp  -mlong-calls  -malign-labels @gol
892 -mlibrary-pic  -macc-4  -macc-8 @gol
893 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
894 -moptimize-membar  -mno-optimize-membar @gol
895 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
896 -mvliw-branch  -mno-vliw-branch @gol
897 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
898 -mno-nested-cond-exec  -mtomcat-stats @gol
899 -mTLS  -mtls @gol
900 -mcpu=@var{cpu}}
902 @emph{GNU/Linux Options}
903 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
904 -tno-android-cc  -tno-android-ld}
906 @emph{H8/300 Options}
907 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
909 @emph{HPPA Options}
910 @gccoptlist{-march=@var{architecture-type} @gol
911 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
912 -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
913 -mfixed-range=@var{register-range} @gol
914 -mjump-in-delay  -mlinker-opt  -mlong-calls @gol
915 -mlong-load-store  -mno-disable-fpregs @gol
916 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
917 -mno-jump-in-delay  -mno-long-load-store @gol
918 -mno-portable-runtime  -mno-soft-float @gol
919 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
920 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
921 -mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
922 -munix=@var{unix-std}  -nolibdld  -static  -threads}
924 @emph{IA-64 Options}
925 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
926 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
927 -mconstant-gp  -mauto-pic  -mfused-madd @gol
928 -minline-float-divide-min-latency @gol
929 -minline-float-divide-max-throughput @gol
930 -mno-inline-float-divide @gol
931 -minline-int-divide-min-latency @gol
932 -minline-int-divide-max-throughput  @gol
933 -mno-inline-int-divide @gol
934 -minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
935 -mno-inline-sqrt @gol
936 -mdwarf2-asm  -mearly-stop-bits @gol
937 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
938 -mtune=@var{cpu-type}  -milp32  -mlp64 @gol
939 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
940 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
941 -msched-spec-ldc  -msched-spec-control-ldc @gol
942 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
943 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
944 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
945 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
947 @emph{LM32 Options}
948 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
949 -msign-extend-enabled  -muser-enabled}
951 @emph{M32R/D Options}
952 @gccoptlist{-m32r2  -m32rx  -m32r @gol
953 -mdebug @gol
954 -malign-loops  -mno-align-loops @gol
955 -missue-rate=@var{number} @gol
956 -mbranch-cost=@var{number} @gol
957 -mmodel=@var{code-size-model-type} @gol
958 -msdata=@var{sdata-type} @gol
959 -mno-flush-func  -mflush-func=@var{name} @gol
960 -mno-flush-trap  -mflush-trap=@var{number} @gol
961 -G @var{num}}
963 @emph{M32C Options}
964 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
966 @emph{M680x0 Options}
967 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
968 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
969 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
970 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
971 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
972 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
973 -malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
974 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
975 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
977 @emph{MCore Options}
978 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
979 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
980 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
981 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
982 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
984 @emph{MeP Options}
985 @gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
986 -mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
987 -mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
988 -mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
989 -mtiny=@var{n}}
991 @emph{MicroBlaze Options}
992 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
993 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
994 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
995 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
996 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
997 -mpic-data-is-text-relative}
999 @emph{MIPS Options}
1000 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
1001 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
1002 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
1003 -mips16  -mno-mips16  -mflip-mips16 @gol
1004 -minterlink-compressed  -mno-interlink-compressed @gol
1005 -minterlink-mips16  -mno-interlink-mips16 @gol
1006 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
1007 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1008 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1009 -mno-float  -msingle-float  -mdouble-float @gol
1010 -modd-spreg  -mno-odd-spreg @gol
1011 -mabs=@var{mode}  -mnan=@var{encoding} @gol
1012 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1013 -mmcu  -mmno-mcu @gol
1014 -meva  -mno-eva @gol
1015 -mvirt  -mno-virt @gol
1016 -mxpa  -mno-xpa @gol
1017 -mcrc  -mno-crc @gol
1018 -mginv  -mno-ginv @gol
1019 -mmicromips  -mno-micromips @gol
1020 -mmsa  -mno-msa @gol
1021 -mloongson-mmi  -mno-loongson-mmi @gol
1022 -mloongson-ext  -mno-loongson-ext @gol
1023 -mloongson-ext2  -mno-loongson-ext2 @gol
1024 -mfpu=@var{fpu-type} @gol
1025 -msmartmips  -mno-smartmips @gol
1026 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1027 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1028 -mlong64  -mlong32  -msym32  -mno-sym32 @gol
1029 -G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1030 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1031 -membedded-data  -mno-embedded-data @gol
1032 -muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1033 -mcode-readable=@var{setting} @gol
1034 -msplit-addresses  -mno-split-addresses @gol
1035 -mexplicit-relocs  -mno-explicit-relocs @gol
1036 -mcheck-zero-division  -mno-check-zero-division @gol
1037 -mdivide-traps  -mdivide-breaks @gol
1038 -mload-store-pairs  -mno-load-store-pairs @gol
1039 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1040 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1041 -mfix-24k  -mno-fix-24k @gol
1042 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1043 -mfix-r5900  -mno-fix-r5900 @gol
1044 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1045 -mfix-vr4120  -mno-fix-vr4120 @gol
1046 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1047 -mflush-func=@var{func}  -mno-flush-func @gol
1048 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1049 -mcompact-branches=@var{policy} @gol
1050 -mfp-exceptions  -mno-fp-exceptions @gol
1051 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1052 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1053 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1054 -mframe-header-opt  -mno-frame-header-opt}
1056 @emph{MMIX Options}
1057 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1058 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1059 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1060 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1062 @emph{MN10300 Options}
1063 @gccoptlist{-mmult-bug  -mno-mult-bug @gol
1064 -mno-am33  -mam33  -mam33-2  -mam34 @gol
1065 -mtune=@var{cpu-type} @gol
1066 -mreturn-pointer-on-d0 @gol
1067 -mno-crt0  -mrelax  -mliw  -msetlb}
1069 @emph{Moxie Options}
1070 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1072 @emph{MSP430 Options}
1073 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1074 -mwarn-mcu @gol
1075 -mcode-region=  -mdata-region= @gol
1076 -msilicon-errata=  -msilicon-errata-warn= @gol
1077 -mhwmult=  -minrt  -mtiny-printf}
1079 @emph{NDS32 Options}
1080 @gccoptlist{-mbig-endian  -mlittle-endian @gol
1081 -mreduced-regs  -mfull-regs @gol
1082 -mcmov  -mno-cmov @gol
1083 -mext-perf  -mno-ext-perf @gol
1084 -mext-perf2  -mno-ext-perf2 @gol
1085 -mext-string  -mno-ext-string @gol
1086 -mv3push  -mno-v3push @gol
1087 -m16bit  -mno-16bit @gol
1088 -misr-vector-size=@var{num} @gol
1089 -mcache-block-size=@var{num} @gol
1090 -march=@var{arch} @gol
1091 -mcmodel=@var{code-model} @gol
1092 -mctor-dtor  -mrelax}
1094 @emph{Nios II Options}
1095 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1096 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1097 -mel  -meb @gol
1098 -mno-bypass-cache  -mbypass-cache @gol
1099 -mno-cache-volatile  -mcache-volatile @gol
1100 -mno-fast-sw-div  -mfast-sw-div @gol
1101 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1102 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1103 -mcustom-fpu-cfg=@var{name} @gol
1104 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1105 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1107 @emph{Nvidia PTX Options}
1108 @gccoptlist{-m32  -m64  -mmainkernel  -moptimize}
1110 @emph{OpenRISC Options}
1111 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1112 -msoft-mul  -msoft-div @gol
1113 -msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1114 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
1116 @emph{PDP-11 Options}
1117 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1118 -mint32  -mno-int16  -mint16  -mno-int32 @gol
1119 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1121 @emph{picoChip Options}
1122 @gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1123 -msymbol-as-address  -mno-inefficient-warnings}
1125 @emph{PowerPC Options}
1126 See RS/6000 and PowerPC Options.
1128 @emph{PRU Options}
1129 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1130 -mabi=@var{variant} @gol}
1132 @emph{RISC-V Options}
1133 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1134 -mplt  -mno-plt @gol
1135 -mabi=@var{ABI-string} @gol
1136 -mfdiv  -mno-fdiv @gol
1137 -mdiv  -mno-div @gol
1138 -march=@var{ISA-string} @gol
1139 -mtune=@var{processor-string} @gol
1140 -mpreferred-stack-boundary=@var{num} @gol
1141 -msmall-data-limit=@var{N-bytes} @gol
1142 -msave-restore  -mno-save-restore @gol
1143 -mstrict-align  -mno-strict-align @gol
1144 -mcmodel=medlow  -mcmodel=medany @gol
1145 -mexplicit-relocs  -mno-explicit-relocs @gol
1146 -mrelax  -mno-relax @gol
1147 -mriscv-attribute  -mmo-riscv-attribute @gol
1148 -malign-data=@var{type}}
1150 @emph{RL78 Options}
1151 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1152 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1153 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1155 @emph{RS/6000 and PowerPC Options}
1156 @gccoptlist{-mcpu=@var{cpu-type} @gol
1157 -mtune=@var{cpu-type} @gol
1158 -mcmodel=@var{code-model} @gol
1159 -mpowerpc64 @gol
1160 -maltivec  -mno-altivec @gol
1161 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1162 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1163 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1164 -mfprnd  -mno-fprnd @gol
1165 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1166 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1167 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1168 -malign-power  -malign-natural @gol
1169 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1170 -mupdate  -mno-update @gol
1171 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1172 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1173 -mstrict-align  -mno-strict-align  -mrelocatable @gol
1174 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1175 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1176 -mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1177 -mprioritize-restricted-insns=@var{priority} @gol
1178 -msched-costly-dep=@var{dependence_type} @gol
1179 -minsert-sched-nops=@var{scheme} @gol
1180 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1181 -mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1182 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1183 -mtraceback=@var{traceback_type} @gol
1184 -maix-struct-return  -msvr4-struct-return @gol
1185 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1186 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1187 -mblock-move-inline-limit=@var{num} @gol
1188 -mblock-compare-inline-limit=@var{num} @gol
1189 -mblock-compare-inline-loop-limit=@var{num} @gol
1190 -mstring-compare-inline-limit=@var{num} @gol
1191 -misel  -mno-isel @gol
1192 -mvrsave  -mno-vrsave @gol
1193 -mmulhw  -mno-mulhw @gol
1194 -mdlmzb  -mno-dlmzb @gol
1195 -mprototype  -mno-prototype @gol
1196 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1197 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1198 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1199 -mno-recip-precision @gol
1200 -mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1201 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1202 -msave-toc-indirect  -mno-save-toc-indirect @gol
1203 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1204 -mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1205 -mquad-memory  -mno-quad-memory @gol
1206 -mquad-memory-atomic  -mno-quad-memory-atomic @gol
1207 -mcompat-align-parm  -mno-compat-align-parm @gol
1208 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1209 -mgnu-attribute  -mno-gnu-attribute @gol
1210 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1211 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1212 -mpcrel -mno-pcrel}
1214 @emph{RX Options}
1215 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1216 -mcpu=@gol
1217 -mbig-endian-data  -mlittle-endian-data @gol
1218 -msmall-data @gol
1219 -msim  -mno-sim@gol
1220 -mas100-syntax  -mno-as100-syntax@gol
1221 -mrelax@gol
1222 -mmax-constant-size=@gol
1223 -mint-register=@gol
1224 -mpid@gol
1225 -mallow-string-insns  -mno-allow-string-insns@gol
1226 -mjsr@gol
1227 -mno-warn-multiple-fast-interrupts@gol
1228 -msave-acc-in-interrupts}
1230 @emph{S/390 and zSeries Options}
1231 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1232 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1233 -mlong-double-64  -mlong-double-128 @gol
1234 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1235 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1236 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1237 -mhtm  -mvx  -mzvector @gol
1238 -mtpf-trace  -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
1239 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1240 -mhotpatch=@var{halfwords},@var{halfwords}}
1242 @emph{Score Options}
1243 @gccoptlist{-meb  -mel @gol
1244 -mnhwloop @gol
1245 -muls @gol
1246 -mmac @gol
1247 -mscore5  -mscore5u  -mscore7  -mscore7d}
1249 @emph{SH Options}
1250 @gccoptlist{-m1  -m2  -m2e @gol
1251 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1252 -m3  -m3e @gol
1253 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1254 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1255 -mb  -ml  -mdalign  -mrelax @gol
1256 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1257 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1258 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1259 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1260 -maccumulate-outgoing-args @gol
1261 -matomic-model=@var{atomic-model} @gol
1262 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1263 -mcbranch-force-delay-slot @gol
1264 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1265 -mpretend-cmove  -mtas}
1267 @emph{Solaris 2 Options}
1268 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1269 -pthreads}
1271 @emph{SPARC Options}
1272 @gccoptlist{-mcpu=@var{cpu-type} @gol
1273 -mtune=@var{cpu-type} @gol
1274 -mcmodel=@var{code-model} @gol
1275 -mmemory-model=@var{mem-model} @gol
1276 -m32  -m64  -mapp-regs  -mno-app-regs @gol
1277 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1278 -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1279 -mhard-quad-float  -msoft-quad-float @gol
1280 -mstack-bias  -mno-stack-bias @gol
1281 -mstd-struct-return  -mno-std-struct-return @gol
1282 -munaligned-doubles  -mno-unaligned-doubles @gol
1283 -muser-mode  -mno-user-mode @gol
1284 -mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1285 -mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1286 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1287 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1288 -mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1289 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1290 -mlra  -mno-lra}
1292 @emph{System V Options}
1293 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1295 @emph{TILE-Gx Options}
1296 @gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1297 -mcmodel=@var{code-model}}
1299 @emph{TILEPro Options}
1300 @gccoptlist{-mcpu=@var{cpu}  -m32}
1302 @emph{V850 Options}
1303 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1304 -mprolog-function  -mno-prolog-function  -mspace @gol
1305 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1306 -mapp-regs  -mno-app-regs @gol
1307 -mdisable-callt  -mno-disable-callt @gol
1308 -mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1309 -mv850e  -mv850  -mv850e3v5 @gol
1310 -mloop @gol
1311 -mrelax @gol
1312 -mlong-jumps @gol
1313 -msoft-float @gol
1314 -mhard-float @gol
1315 -mgcc-abi @gol
1316 -mrh850-abi @gol
1317 -mbig-switch}
1319 @emph{VAX Options}
1320 @gccoptlist{-mg  -mgnu  -munix}
1322 @emph{Visium Options}
1323 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1324 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1326 @emph{VMS Options}
1327 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1328 -mpointer-size=@var{size}}
1330 @emph{VxWorks Options}
1331 @gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1332 -Xbind-lazy  -Xbind-now}
1334 @emph{x86 Options}
1335 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1336 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1337 -mfpmath=@var{unit} @gol
1338 -masm=@var{dialect}  -mno-fancy-math-387 @gol
1339 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1340 -mno-wide-multiply  -mrtd  -malign-double @gol
1341 -mpreferred-stack-boundary=@var{num} @gol
1342 -mincoming-stack-boundary=@var{num} @gol
1343 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 @gol
1344 -mrecip  -mrecip=@var{opt} @gol
1345 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1346 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1347 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1348 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1349 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1350 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1351 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1352 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1353 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1354 -mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1355 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1356 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1357 -mrdseed  -msgx -mavx512vp2intersect@gol
1358 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1359 -minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1360 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1361 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1362 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1363 -mregparm=@var{num}  -msseregparm @gol
1364 -mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1365 -mpc32  -mpc64  -mpc80  -mstackrealign @gol
1366 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1367 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1368 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1369 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1370 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1371 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1372 -malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1373 -mstack-protector-guard-reg=@var{reg} @gol
1374 -mstack-protector-guard-offset=@var{offset} @gol
1375 -mstack-protector-guard-symbol=@var{symbol} @gol
1376 -mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1377 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1378 -mindirect-branch-register}
1380 @emph{x86 Windows Options}
1381 @gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1382 -mnop-fun-dllimport  -mthread @gol
1383 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1385 @emph{Xstormy16 Options}
1386 @gccoptlist{-msim}
1388 @emph{Xtensa Options}
1389 @gccoptlist{-mconst16  -mno-const16 @gol
1390 -mfused-madd  -mno-fused-madd @gol
1391 -mforce-no-pic @gol
1392 -mserialize-volatile  -mno-serialize-volatile @gol
1393 -mtext-section-literals  -mno-text-section-literals @gol
1394 -mauto-litpools  -mno-auto-litpools @gol
1395 -mtarget-align  -mno-target-align @gol
1396 -mlongcalls  -mno-longcalls}
1398 @emph{zSeries Options}
1399 See S/390 and zSeries Options.
1400 @end table
1403 @node Overall Options
1404 @section Options Controlling the Kind of Output
1406 Compilation can involve up to four stages: preprocessing, compilation
1407 proper, assembly and linking, always in that order.  GCC is capable of
1408 preprocessing and compiling several files either into several
1409 assembler input files, or into one assembler input file; then each
1410 assembler input file produces an object file, and linking combines all
1411 the object files (those newly compiled, and those specified as input)
1412 into an executable file.
1414 @cindex file name suffix
1415 For any given input file, the file name suffix determines what kind of
1416 compilation is done:
1418 @table @gcctabopt
1419 @item @var{file}.c
1420 C source code that must be preprocessed.
1422 @item @var{file}.i
1423 C source code that should not be preprocessed.
1425 @item @var{file}.ii
1426 C++ source code that should not be preprocessed.
1428 @item @var{file}.m
1429 Objective-C source code.  Note that you must link with the @file{libobjc}
1430 library to make an Objective-C program work.
1432 @item @var{file}.mi
1433 Objective-C source code that should not be preprocessed.
1435 @item @var{file}.mm
1436 @itemx @var{file}.M
1437 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1438 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1439 to a literal capital M@.
1441 @item @var{file}.mii
1442 Objective-C++ source code that should not be preprocessed.
1444 @item @var{file}.h
1445 C, C++, Objective-C or Objective-C++ header file to be turned into a
1446 precompiled header (default), or C, C++ header file to be turned into an
1447 Ada spec (via the @option{-fdump-ada-spec} switch).
1449 @item @var{file}.cc
1450 @itemx @var{file}.cp
1451 @itemx @var{file}.cxx
1452 @itemx @var{file}.cpp
1453 @itemx @var{file}.CPP
1454 @itemx @var{file}.c++
1455 @itemx @var{file}.C
1456 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1457 the last two letters must both be literally @samp{x}.  Likewise,
1458 @samp{.C} refers to a literal capital C@.
1460 @item @var{file}.mm
1461 @itemx @var{file}.M
1462 Objective-C++ source code that must be preprocessed.
1464 @item @var{file}.mii
1465 Objective-C++ source code that should not be preprocessed.
1467 @item @var{file}.hh
1468 @itemx @var{file}.H
1469 @itemx @var{file}.hp
1470 @itemx @var{file}.hxx
1471 @itemx @var{file}.hpp
1472 @itemx @var{file}.HPP
1473 @itemx @var{file}.h++
1474 @itemx @var{file}.tcc
1475 C++ header file to be turned into a precompiled header or Ada spec.
1477 @item @var{file}.f
1478 @itemx @var{file}.for
1479 @itemx @var{file}.ftn
1480 Fixed form Fortran source code that should not be preprocessed.
1482 @item @var{file}.F
1483 @itemx @var{file}.FOR
1484 @itemx @var{file}.fpp
1485 @itemx @var{file}.FPP
1486 @itemx @var{file}.FTN
1487 Fixed form Fortran source code that must be preprocessed (with the traditional
1488 preprocessor).
1490 @item @var{file}.f90
1491 @itemx @var{file}.f95
1492 @itemx @var{file}.f03
1493 @itemx @var{file}.f08
1494 Free form Fortran source code that should not be preprocessed.
1496 @item @var{file}.F90
1497 @itemx @var{file}.F95
1498 @itemx @var{file}.F03
1499 @itemx @var{file}.F08
1500 Free form Fortran source code that must be preprocessed (with the
1501 traditional preprocessor).
1503 @item @var{file}.go
1504 Go source code.
1506 @item @var{file}.brig
1507 BRIG files (binary representation of HSAIL).
1509 @item @var{file}.d
1510 D source code.
1512 @item @var{file}.di
1513 D interface file.
1515 @item @var{file}.dd
1516 D documentation code (Ddoc).
1518 @item @var{file}.ads
1519 Ada source code file that contains a library unit declaration (a
1520 declaration of a package, subprogram, or generic, or a generic
1521 instantiation), or a library unit renaming declaration (a package,
1522 generic, or subprogram renaming declaration).  Such files are also
1523 called @dfn{specs}.
1525 @item @var{file}.adb
1526 Ada source code file containing a library unit body (a subprogram or
1527 package body).  Such files are also called @dfn{bodies}.
1529 @c GCC also knows about some suffixes for languages not yet included:
1530 @c Ratfor:
1531 @c @var{file}.r
1533 @item @var{file}.s
1534 Assembler code.
1536 @item @var{file}.S
1537 @itemx @var{file}.sx
1538 Assembler code that must be preprocessed.
1540 @item @var{other}
1541 An object file to be fed straight into linking.
1542 Any file name with no recognized suffix is treated this way.
1543 @end table
1545 @opindex x
1546 You can specify the input language explicitly with the @option{-x} option:
1548 @table @gcctabopt
1549 @item -x @var{language}
1550 Specify explicitly the @var{language} for the following input files
1551 (rather than letting the compiler choose a default based on the file
1552 name suffix).  This option applies to all following input files until
1553 the next @option{-x} option.  Possible values for @var{language} are:
1554 @smallexample
1555 c  c-header  cpp-output
1556 c++  c++-header  c++-cpp-output
1557 objective-c  objective-c-header  objective-c-cpp-output
1558 objective-c++ objective-c++-header objective-c++-cpp-output
1559 assembler  assembler-with-cpp
1562 f77  f77-cpp-input f95  f95-cpp-input
1564 brig
1565 @end smallexample
1567 @item -x none
1568 Turn off any specification of a language, so that subsequent files are
1569 handled according to their file name suffixes (as they are if @option{-x}
1570 has not been used at all).
1571 @end table
1573 If you only want some of the stages of compilation, you can use
1574 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1575 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1576 @command{gcc} is to stop.  Note that some combinations (for example,
1577 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1579 @table @gcctabopt
1580 @item -c
1581 @opindex c
1582 Compile or assemble the source files, but do not link.  The linking
1583 stage simply is not done.  The ultimate output is in the form of an
1584 object file for each source file.
1586 By default, the object file name for a source file is made by replacing
1587 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1589 Unrecognized input files, not requiring compilation or assembly, are
1590 ignored.
1592 @item -S
1593 @opindex S
1594 Stop after the stage of compilation proper; do not assemble.  The output
1595 is in the form of an assembler code file for each non-assembler input
1596 file specified.
1598 By default, the assembler file name for a source file is made by
1599 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1601 Input files that don't require compilation are ignored.
1603 @item -E
1604 @opindex E
1605 Stop after the preprocessing stage; do not run the compiler proper.  The
1606 output is in the form of preprocessed source code, which is sent to the
1607 standard output.
1609 Input files that don't require preprocessing are ignored.
1611 @cindex output file option
1612 @item -o @var{file}
1613 @opindex o
1614 Place output in file @var{file}.  This applies to whatever
1615 sort of output is being produced, whether it be an executable file,
1616 an object file, an assembler file or preprocessed C code.
1618 If @option{-o} is not specified, the default is to put an executable
1619 file in @file{a.out}, the object file for
1620 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1621 assembler file in @file{@var{source}.s}, a precompiled header file in
1622 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1623 standard output.
1625 @item -v
1626 @opindex v
1627 Print (on standard error output) the commands executed to run the stages
1628 of compilation.  Also print the version number of the compiler driver
1629 program and of the preprocessor and the compiler proper.
1631 @item -###
1632 @opindex ###
1633 Like @option{-v} except the commands are not executed and arguments
1634 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1635 This is useful for shell scripts to capture the driver-generated command lines.
1637 @item --help
1638 @opindex help
1639 Print (on the standard output) a description of the command-line options
1640 understood by @command{gcc}.  If the @option{-v} option is also specified
1641 then @option{--help} is also passed on to the various processes
1642 invoked by @command{gcc}, so that they can display the command-line options
1643 they accept.  If the @option{-Wextra} option has also been specified
1644 (prior to the @option{--help} option), then command-line options that
1645 have no documentation associated with them are also displayed.
1647 @item --target-help
1648 @opindex target-help
1649 Print (on the standard output) a description of target-specific command-line
1650 options for each tool.  For some targets extra target-specific
1651 information may also be printed.
1653 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1654 Print (on the standard output) a description of the command-line
1655 options understood by the compiler that fit into all specified classes
1656 and qualifiers.  These are the supported classes:
1658 @table @asis
1659 @item @samp{optimizers}
1660 Display all of the optimization options supported by the
1661 compiler.
1663 @item @samp{warnings}
1664 Display all of the options controlling warning messages
1665 produced by the compiler.
1667 @item @samp{target}
1668 Display target-specific options.  Unlike the
1669 @option{--target-help} option however, target-specific options of the
1670 linker and assembler are not displayed.  This is because those
1671 tools do not currently support the extended @option{--help=} syntax.
1673 @item @samp{params}
1674 Display the values recognized by the @option{--param}
1675 option.
1677 @item @var{language}
1678 Display the options supported for @var{language}, where
1679 @var{language} is the name of one of the languages supported in this
1680 version of GCC@.
1682 @item @samp{common}
1683 Display the options that are common to all languages.
1684 @end table
1686 These are the supported qualifiers:
1688 @table @asis
1689 @item @samp{undocumented}
1690 Display only those options that are undocumented.
1692 @item @samp{joined}
1693 Display options taking an argument that appears after an equal
1694 sign in the same continuous piece of text, such as:
1695 @samp{--help=target}.
1697 @item @samp{separate}
1698 Display options taking an argument that appears as a separate word
1699 following the original option, such as: @samp{-o output-file}.
1700 @end table
1702 Thus for example to display all the undocumented target-specific
1703 switches supported by the compiler, use:
1705 @smallexample
1706 --help=target,undocumented
1707 @end smallexample
1709 The sense of a qualifier can be inverted by prefixing it with the
1710 @samp{^} character, so for example to display all binary warning
1711 options (i.e., ones that are either on or off and that do not take an
1712 argument) that have a description, use:
1714 @smallexample
1715 --help=warnings,^joined,^undocumented
1716 @end smallexample
1718 The argument to @option{--help=} should not consist solely of inverted
1719 qualifiers.
1721 Combining several classes is possible, although this usually
1722 restricts the output so much that there is nothing to display.  One
1723 case where it does work, however, is when one of the classes is
1724 @var{target}.  For example, to display all the target-specific
1725 optimization options, use:
1727 @smallexample
1728 --help=target,optimizers
1729 @end smallexample
1731 The @option{--help=} option can be repeated on the command line.  Each
1732 successive use displays its requested class of options, skipping
1733 those that have already been displayed.  If @option{--help} is also
1734 specified anywhere on the command line then this takes precedence
1735 over any @option{--help=} option.
1737 If the @option{-Q} option appears on the command line before the
1738 @option{--help=} option, then the descriptive text displayed by
1739 @option{--help=} is changed.  Instead of describing the displayed
1740 options, an indication is given as to whether the option is enabled,
1741 disabled or set to a specific value (assuming that the compiler
1742 knows this at the point where the @option{--help=} option is used).
1744 Here is a truncated example from the ARM port of @command{gcc}:
1746 @smallexample
1747   % gcc -Q -mabi=2 --help=target -c
1748   The following options are target specific:
1749   -mabi=                                2
1750   -mabort-on-noreturn                   [disabled]
1751   -mapcs                                [disabled]
1752 @end smallexample
1754 The output is sensitive to the effects of previous command-line
1755 options, so for example it is possible to find out which optimizations
1756 are enabled at @option{-O2} by using:
1758 @smallexample
1759 -Q -O2 --help=optimizers
1760 @end smallexample
1762 Alternatively you can discover which binary optimizations are enabled
1763 by @option{-O3} by using:
1765 @smallexample
1766 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1767 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1768 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1769 @end smallexample
1771 @item --version
1772 @opindex version
1773 Display the version number and copyrights of the invoked GCC@.
1775 @item -pass-exit-codes
1776 @opindex pass-exit-codes
1777 Normally the @command{gcc} program exits with the code of 1 if any
1778 phase of the compiler returns a non-success return code.  If you specify
1779 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1780 the numerically highest error produced by any phase returning an error
1781 indication.  The C, C++, and Fortran front ends return 4 if an internal
1782 compiler error is encountered.
1784 @item -pipe
1785 @opindex pipe
1786 Use pipes rather than temporary files for communication between the
1787 various stages of compilation.  This fails to work on some systems where
1788 the assembler is unable to read from a pipe; but the GNU assembler has
1789 no trouble.
1791 @item -specs=@var{file}
1792 @opindex specs
1793 Process @var{file} after the compiler reads in the standard @file{specs}
1794 file, in order to override the defaults which the @command{gcc} driver
1795 program uses when determining what switches to pass to @command{cc1},
1796 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
1797 @option{-specs=@var{file}} can be specified on the command line, and they
1798 are processed in order, from left to right.  @xref{Spec Files}, for
1799 information about the format of the @var{file}.
1801 @item -wrapper
1802 @opindex wrapper
1803 Invoke all subcommands under a wrapper program.  The name of the
1804 wrapper program and its parameters are passed as a comma separated
1805 list.
1807 @smallexample
1808 gcc -c t.c -wrapper gdb,--args
1809 @end smallexample
1811 @noindent
1812 This invokes all subprograms of @command{gcc} under
1813 @samp{gdb --args}, thus the invocation of @command{cc1} is
1814 @samp{gdb --args cc1 @dots{}}.
1816 @item -ffile-prefix-map=@var{old}=@var{new}
1817 @opindex ffile-prefix-map
1818 When compiling files residing in directory @file{@var{old}}, record
1819 any references to them in the result of the compilation as if the
1820 files resided in directory @file{@var{new}} instead.  Specifying this
1821 option is equivalent to specifying all the individual
1822 @option{-f*-prefix-map} options.  This can be used to make reproducible
1823 builds that are location independent.  See also
1824 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1826 @item -fplugin=@var{name}.so
1827 @opindex fplugin
1828 Load the plugin code in file @var{name}.so, assumed to be a
1829 shared object to be dlopen'd by the compiler.  The base name of
1830 the shared object file is used to identify the plugin for the
1831 purposes of argument parsing (See
1832 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1833 Each plugin should define the callback functions specified in the
1834 Plugins API.
1836 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1837 @opindex fplugin-arg
1838 Define an argument called @var{key} with a value of @var{value}
1839 for the plugin called @var{name}.
1841 @item -fdump-ada-spec@r{[}-slim@r{]}
1842 @opindex fdump-ada-spec
1843 For C and C++ source and include files, generate corresponding Ada specs.
1844 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1845 GNAT User's Guide}, which provides detailed documentation on this feature.
1847 @item -fada-spec-parent=@var{unit}
1848 @opindex fada-spec-parent
1849 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1850 Ada specs as child units of parent @var{unit}.
1852 @item -fdump-go-spec=@var{file}
1853 @opindex fdump-go-spec
1854 For input files in any language, generate corresponding Go
1855 declarations in @var{file}.  This generates Go @code{const},
1856 @code{type}, @code{var}, and @code{func} declarations which may be a
1857 useful way to start writing a Go interface to code written in some
1858 other language.
1860 @include @value{srcdir}/../libiberty/at-file.texi
1861 @end table
1863 @node Invoking G++
1864 @section Compiling C++ Programs
1866 @cindex suffixes for C++ source
1867 @cindex C++ source file suffixes
1868 C++ source files conventionally use one of the suffixes @samp{.C},
1869 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1870 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1871 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1872 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1873 files with these names and compiles them as C++ programs even if you
1874 call the compiler the same way as for compiling C programs (usually
1875 with the name @command{gcc}).
1877 @findex g++
1878 @findex c++
1879 However, the use of @command{gcc} does not add the C++ library.
1880 @command{g++} is a program that calls GCC and automatically specifies linking
1881 against the C++ library.  It treats @samp{.c},
1882 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1883 files unless @option{-x} is used.  This program is also useful when
1884 precompiling a C header file with a @samp{.h} extension for use in C++
1885 compilations.  On many systems, @command{g++} is also installed with
1886 the name @command{c++}.
1888 @cindex invoking @command{g++}
1889 When you compile C++ programs, you may specify many of the same
1890 command-line options that you use for compiling programs in any
1891 language; or command-line options meaningful for C and related
1892 languages; or options that are meaningful only for C++ programs.
1893 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1894 explanations of options for languages related to C@.
1895 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1896 explanations of options that are meaningful only for C++ programs.
1898 @node C Dialect Options
1899 @section Options Controlling C Dialect
1900 @cindex dialect options
1901 @cindex language dialect options
1902 @cindex options, dialect
1904 The following options control the dialect of C (or languages derived
1905 from C, such as C++, Objective-C and Objective-C++) that the compiler
1906 accepts:
1908 @table @gcctabopt
1909 @cindex ANSI support
1910 @cindex ISO support
1911 @item -ansi
1912 @opindex ansi
1913 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1914 equivalent to @option{-std=c++98}.
1916 This turns off certain features of GCC that are incompatible with ISO
1917 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1918 such as the @code{asm} and @code{typeof} keywords, and
1919 predefined macros such as @code{unix} and @code{vax} that identify the
1920 type of system you are using.  It also enables the undesirable and
1921 rarely used ISO trigraph feature.  For the C compiler,
1922 it disables recognition of C++ style @samp{//} comments as well as
1923 the @code{inline} keyword.
1925 The alternate keywords @code{__asm__}, @code{__extension__},
1926 @code{__inline__} and @code{__typeof__} continue to work despite
1927 @option{-ansi}.  You would not want to use them in an ISO C program, of
1928 course, but it is useful to put them in header files that might be included
1929 in compilations done with @option{-ansi}.  Alternate predefined macros
1930 such as @code{__unix__} and @code{__vax__} are also available, with or
1931 without @option{-ansi}.
1933 The @option{-ansi} option does not cause non-ISO programs to be
1934 rejected gratuitously.  For that, @option{-Wpedantic} is required in
1935 addition to @option{-ansi}.  @xref{Warning Options}.
1937 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1938 option is used.  Some header files may notice this macro and refrain
1939 from declaring certain functions or defining certain macros that the
1940 ISO standard doesn't call for; this is to avoid interfering with any
1941 programs that might use these names for other things.
1943 Functions that are normally built in but do not have semantics
1944 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1945 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1946 built-in functions provided by GCC}, for details of the functions
1947 affected.
1949 @item -std=
1950 @opindex std
1951 Determine the language standard. @xref{Standards,,Language Standards
1952 Supported by GCC}, for details of these standard versions.  This option
1953 is currently only supported when compiling C or C++.
1955 The compiler can accept several base standards, such as @samp{c90} or
1956 @samp{c++98}, and GNU dialects of those standards, such as
1957 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1958 compiler accepts all programs following that standard plus those
1959 using GNU extensions that do not contradict it.  For example,
1960 @option{-std=c90} turns off certain features of GCC that are
1961 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1962 keywords, but not other GNU extensions that do not have a meaning in
1963 ISO C90, such as omitting the middle term of a @code{?:}
1964 expression. On the other hand, when a GNU dialect of a standard is
1965 specified, all features supported by the compiler are enabled, even when
1966 those features change the meaning of the base standard.  As a result, some
1967 strict-conforming programs may be rejected.  The particular standard
1968 is used by @option{-Wpedantic} to identify which features are GNU
1969 extensions given that version of the standard. For example
1970 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1971 comments, while @option{-std=gnu99 -Wpedantic} does not.
1973 A value for this option must be provided; possible values are
1975 @table @samp
1976 @item c90
1977 @itemx c89
1978 @itemx iso9899:1990
1979 Support all ISO C90 programs (certain GNU extensions that conflict
1980 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1982 @item iso9899:199409
1983 ISO C90 as modified in amendment 1.
1985 @item c99
1986 @itemx c9x
1987 @itemx iso9899:1999
1988 @itemx iso9899:199x
1989 ISO C99.  This standard is substantially completely supported, modulo
1990 bugs and floating-point issues
1991 (mainly but not entirely relating to optional C99 features from
1992 Annexes F and G).  See
1993 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1994 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1996 @item c11
1997 @itemx c1x
1998 @itemx iso9899:2011
1999 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2000 substantially completely supported, modulo bugs, floating-point issues
2001 (mainly but not entirely relating to optional C11 features from
2002 Annexes F and G) and the optional Annexes K (Bounds-checking
2003 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2005 @item c17
2006 @itemx c18
2007 @itemx iso9899:2017
2008 @itemx iso9899:2018
2009 ISO C17, the 2017 revision of the ISO C standard
2010 (published in 2018).  This standard is
2011 same as C11 except for corrections of defects (all of which are also
2012 applied with @option{-std=c11}) and a new value of
2013 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2015 @item c2x
2016 The next version of the ISO C standard, still under development.  The
2017 support for this version is experimental and incomplete.
2019 @item gnu90
2020 @itemx gnu89
2021 GNU dialect of ISO C90 (including some C99 features).
2023 @item gnu99
2024 @itemx gnu9x
2025 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2027 @item gnu11
2028 @itemx gnu1x
2029 GNU dialect of ISO C11.
2030 The name @samp{gnu1x} is deprecated.
2032 @item gnu17
2033 @itemx gnu18
2034 GNU dialect of ISO C17.  This is the default for C code.
2036 @item gnu2x
2037 The next version of the ISO C standard, still under development, plus
2038 GNU extensions.  The support for this version is experimental and
2039 incomplete.
2041 @item c++98
2042 @itemx c++03
2043 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2044 additional defect reports. Same as @option{-ansi} for C++ code.
2046 @item gnu++98
2047 @itemx gnu++03
2048 GNU dialect of @option{-std=c++98}.
2050 @item c++11
2051 @itemx c++0x
2052 The 2011 ISO C++ standard plus amendments.
2053 The name @samp{c++0x} is deprecated.
2055 @item gnu++11
2056 @itemx gnu++0x
2057 GNU dialect of @option{-std=c++11}.
2058 The name @samp{gnu++0x} is deprecated.
2060 @item c++14
2061 @itemx c++1y
2062 The 2014 ISO C++ standard plus amendments.
2063 The name @samp{c++1y} is deprecated.
2065 @item gnu++14
2066 @itemx gnu++1y
2067 GNU dialect of @option{-std=c++14}.
2068 This is the default for C++ code.
2069 The name @samp{gnu++1y} is deprecated.
2071 @item c++17
2072 @itemx c++1z
2073 The 2017 ISO C++ standard plus amendments.
2074 The name @samp{c++1z} is deprecated.
2076 @item gnu++17
2077 @itemx gnu++1z
2078 GNU dialect of @option{-std=c++17}.
2079 The name @samp{gnu++1z} is deprecated.
2081 @item c++2a
2082 The next revision of the ISO C++ standard, tentatively planned for
2083 2020.  Support is highly experimental, and will almost certainly
2084 change in incompatible ways in future releases.
2086 @item gnu++2a
2087 GNU dialect of @option{-std=c++2a}.  Support is highly experimental,
2088 and will almost certainly change in incompatible ways in future
2089 releases.
2090 @end table
2092 @item -fgnu89-inline
2093 @opindex fgnu89-inline
2094 The option @option{-fgnu89-inline} tells GCC to use the traditional
2095 GNU semantics for @code{inline} functions when in C99 mode.
2096 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2097 Using this option is roughly equivalent to adding the
2098 @code{gnu_inline} function attribute to all inline functions
2099 (@pxref{Function Attributes}).
2101 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2102 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2103 specifies the default behavior).
2104 This option is not supported in @option{-std=c90} or
2105 @option{-std=gnu90} mode.
2107 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2108 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2109 in effect for @code{inline} functions.  @xref{Common Predefined
2110 Macros,,,cpp,The C Preprocessor}.
2112 @item -fpermitted-flt-eval-methods=@var{style}
2113 @opindex fpermitted-flt-eval-methods
2114 @opindex fpermitted-flt-eval-methods=c11
2115 @opindex fpermitted-flt-eval-methods=ts-18661-3
2116 ISO/IEC TS 18661-3 defines new permissible values for
2117 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2118 a semantic type that is an interchange or extended format should be
2119 evaluated to the precision and range of that type.  These new values are
2120 a superset of those permitted under C99/C11, which does not specify the
2121 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2122 conforming to C11 may not have been written expecting the possibility of
2123 the new values.
2125 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2126 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2127 or the extended set of values specified in ISO/IEC TS 18661-3.
2129 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2131 The default when in a standards compliant mode (@option{-std=c11} or similar)
2132 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2133 dialect (@option{-std=gnu11} or similar) is
2134 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2136 @item -aux-info @var{filename}
2137 @opindex aux-info
2138 Output to the given filename prototyped declarations for all functions
2139 declared and/or defined in a translation unit, including those in header
2140 files.  This option is silently ignored in any language other than C@.
2142 Besides declarations, the file indicates, in comments, the origin of
2143 each declaration (source file and line), whether the declaration was
2144 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2145 @samp{O} for old, respectively, in the first character after the line
2146 number and the colon), and whether it came from a declaration or a
2147 definition (@samp{C} or @samp{F}, respectively, in the following
2148 character).  In the case of function definitions, a K&R-style list of
2149 arguments followed by their declarations is also provided, inside
2150 comments, after the declaration.
2152 @item -fallow-parameterless-variadic-functions
2153 @opindex fallow-parameterless-variadic-functions
2154 Accept variadic functions without named parameters.
2156 Although it is possible to define such a function, this is not very
2157 useful as it is not possible to read the arguments.  This is only
2158 supported for C as this construct is allowed by C++.
2160 @item -fno-asm
2161 @opindex fno-asm
2162 @opindex fasm
2163 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2164 keyword, so that code can use these words as identifiers.  You can use
2165 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2166 instead.  @option{-ansi} implies @option{-fno-asm}.
2168 In C++, this switch only affects the @code{typeof} keyword, since
2169 @code{asm} and @code{inline} are standard keywords.  You may want to
2170 use the @option{-fno-gnu-keywords} flag instead, which has the same
2171 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2172 switch only affects the @code{asm} and @code{typeof} keywords, since
2173 @code{inline} is a standard keyword in ISO C99.
2175 @item -fno-builtin
2176 @itemx -fno-builtin-@var{function}
2177 @opindex fno-builtin
2178 @opindex fbuiltin
2179 @cindex built-in functions
2180 Don't recognize built-in functions that do not begin with
2181 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2182 functions provided by GCC}, for details of the functions affected,
2183 including those which are not built-in functions when @option{-ansi} or
2184 @option{-std} options for strict ISO C conformance are used because they
2185 do not have an ISO standard meaning.
2187 GCC normally generates special code to handle certain built-in functions
2188 more efficiently; for instance, calls to @code{alloca} may become single
2189 instructions which adjust the stack directly, and calls to @code{memcpy}
2190 may become inline copy loops.  The resulting code is often both smaller
2191 and faster, but since the function calls no longer appear as such, you
2192 cannot set a breakpoint on those calls, nor can you change the behavior
2193 of the functions by linking with a different library.  In addition,
2194 when a function is recognized as a built-in function, GCC may use
2195 information about that function to warn about problems with calls to
2196 that function, or to generate more efficient code, even if the
2197 resulting code still contains calls to that function.  For example,
2198 warnings are given with @option{-Wformat} for bad calls to
2199 @code{printf} when @code{printf} is built in and @code{strlen} is
2200 known not to modify global memory.
2202 With the @option{-fno-builtin-@var{function}} option
2203 only the built-in function @var{function} is
2204 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2205 function is named that is not built-in in this version of GCC, this
2206 option is ignored.  There is no corresponding
2207 @option{-fbuiltin-@var{function}} option; if you wish to enable
2208 built-in functions selectively when using @option{-fno-builtin} or
2209 @option{-ffreestanding}, you may define macros such as:
2211 @smallexample
2212 #define abs(n)          __builtin_abs ((n))
2213 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2214 @end smallexample
2216 @item -fgimple
2217 @opindex fgimple
2219 Enable parsing of function definitions marked with @code{__GIMPLE}.
2220 This is an experimental feature that allows unit testing of GIMPLE
2221 passes.
2223 @item -fhosted
2224 @opindex fhosted
2225 @cindex hosted environment
2227 Assert that compilation targets a hosted environment.  This implies
2228 @option{-fbuiltin}.  A hosted environment is one in which the
2229 entire standard library is available, and in which @code{main} has a return
2230 type of @code{int}.  Examples are nearly everything except a kernel.
2231 This is equivalent to @option{-fno-freestanding}.
2233 @item -ffreestanding
2234 @opindex ffreestanding
2235 @cindex hosted environment
2237 Assert that compilation targets a freestanding environment.  This
2238 implies @option{-fno-builtin}.  A freestanding environment
2239 is one in which the standard library may not exist, and program startup may
2240 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2241 This is equivalent to @option{-fno-hosted}.
2243 @xref{Standards,,Language Standards Supported by GCC}, for details of
2244 freestanding and hosted environments.
2246 @item -fopenacc
2247 @opindex fopenacc
2248 @cindex OpenACC accelerator programming
2249 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2250 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2251 compiler generates accelerated code according to the OpenACC Application
2252 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2253 implies @option{-pthread}, and thus is only supported on targets that
2254 have support for @option{-pthread}.
2256 @item -fopenacc-dim=@var{geom}
2257 @opindex fopenacc-dim
2258 @cindex OpenACC accelerator programming
2259 Specify default compute dimensions for parallel offload regions that do
2260 not explicitly specify.  The @var{geom} value is a triple of
2261 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2262 can be omitted, to use a target-specific default value.
2264 @item -fopenmp
2265 @opindex fopenmp
2266 @cindex OpenMP parallel
2267 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2268 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2269 compiler generates parallel code according to the OpenMP Application
2270 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2271 implies @option{-pthread}, and thus is only supported on targets that
2272 have support for @option{-pthread}. @option{-fopenmp} implies
2273 @option{-fopenmp-simd}.
2275 @item -fopenmp-simd
2276 @opindex fopenmp-simd
2277 @cindex OpenMP SIMD
2278 @cindex SIMD
2279 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2280 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2281 are ignored.
2283 @item -fgnu-tm
2284 @opindex fgnu-tm
2285 When the option @option{-fgnu-tm} is specified, the compiler
2286 generates code for the Linux variant of Intel's current Transactional
2287 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2288 an experimental feature whose interface may change in future versions
2289 of GCC, as the official specification changes.  Please note that not
2290 all architectures are supported for this feature.
2292 For more information on GCC's support for transactional memory,
2293 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2294 Transactional Memory Library}.
2296 Note that the transactional memory feature is not supported with
2297 non-call exceptions (@option{-fnon-call-exceptions}).
2299 @item -fms-extensions
2300 @opindex fms-extensions
2301 Accept some non-standard constructs used in Microsoft header files.
2303 In C++ code, this allows member names in structures to be similar
2304 to previous types declarations.
2306 @smallexample
2307 typedef int UOW;
2308 struct ABC @{
2309   UOW UOW;
2311 @end smallexample
2313 Some cases of unnamed fields in structures and unions are only
2314 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2315 fields within structs/unions}, for details.
2317 Note that this option is off for all targets except for x86
2318 targets using ms-abi.
2320 @item -fplan9-extensions
2321 @opindex fplan9-extensions
2322 Accept some non-standard constructs used in Plan 9 code.
2324 This enables @option{-fms-extensions}, permits passing pointers to
2325 structures with anonymous fields to functions that expect pointers to
2326 elements of the type of the field, and permits referring to anonymous
2327 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2328 struct/union fields within structs/unions}, for details.  This is only
2329 supported for C, not C++.
2331 @item -fcond-mismatch
2332 @opindex fcond-mismatch
2333 Allow conditional expressions with mismatched types in the second and
2334 third arguments.  The value of such an expression is void.  This option
2335 is not supported for C++.
2337 @item -flax-vector-conversions
2338 @opindex flax-vector-conversions
2339 Allow implicit conversions between vectors with differing numbers of
2340 elements and/or incompatible element types.  This option should not be
2341 used for new code.
2343 @item -funsigned-char
2344 @opindex funsigned-char
2345 Let the type @code{char} be unsigned, like @code{unsigned char}.
2347 Each kind of machine has a default for what @code{char} should
2348 be.  It is either like @code{unsigned char} by default or like
2349 @code{signed char} by default.
2351 Ideally, a portable program should always use @code{signed char} or
2352 @code{unsigned char} when it depends on the signedness of an object.
2353 But many programs have been written to use plain @code{char} and
2354 expect it to be signed, or expect it to be unsigned, depending on the
2355 machines they were written for.  This option, and its inverse, let you
2356 make such a program work with the opposite default.
2358 The type @code{char} is always a distinct type from each of
2359 @code{signed char} or @code{unsigned char}, even though its behavior
2360 is always just like one of those two.
2362 @item -fsigned-char
2363 @opindex fsigned-char
2364 Let the type @code{char} be signed, like @code{signed char}.
2366 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2367 the negative form of @option{-funsigned-char}.  Likewise, the option
2368 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2370 @item -fsigned-bitfields
2371 @itemx -funsigned-bitfields
2372 @itemx -fno-signed-bitfields
2373 @itemx -fno-unsigned-bitfields
2374 @opindex fsigned-bitfields
2375 @opindex funsigned-bitfields
2376 @opindex fno-signed-bitfields
2377 @opindex fno-unsigned-bitfields
2378 These options control whether a bit-field is signed or unsigned, when the
2379 declaration does not use either @code{signed} or @code{unsigned}.  By
2380 default, such a bit-field is signed, because this is consistent: the
2381 basic integer types such as @code{int} are signed types.
2383 @item -fsso-struct=@var{endianness}
2384 @opindex fsso-struct
2385 Set the default scalar storage order of structures and unions to the
2386 specified endianness.  The accepted values are @samp{big-endian},
2387 @samp{little-endian} and @samp{native} for the native endianness of
2388 the target (the default).  This option is not supported for C++.
2390 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2391 code that is not binary compatible with code generated without it if the
2392 specified endianness is not the native endianness of the target.
2393 @end table
2395 @node C++ Dialect Options
2396 @section Options Controlling C++ Dialect
2398 @cindex compiler options, C++
2399 @cindex C++ options, command-line
2400 @cindex options, C++
2401 This section describes the command-line options that are only meaningful
2402 for C++ programs.  You can also use most of the GNU compiler options
2403 regardless of what language your program is in.  For example, you
2404 might compile a file @file{firstClass.C} like this:
2406 @smallexample
2407 g++ -g -fstrict-enums -O -c firstClass.C
2408 @end smallexample
2410 @noindent
2411 In this example, only @option{-fstrict-enums} is an option meant
2412 only for C++ programs; you can use the other options with any
2413 language supported by GCC@.
2415 Some options for compiling C programs, such as @option{-std}, are also
2416 relevant for C++ programs.
2417 @xref{C Dialect Options,,Options Controlling C Dialect}.
2419 Here is a list of options that are @emph{only} for compiling C++ programs:
2421 @table @gcctabopt
2423 @item -fabi-version=@var{n}
2424 @opindex fabi-version
2425 Use version @var{n} of the C++ ABI@.  The default is version 0.
2427 Version 0 refers to the version conforming most closely to
2428 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2429 will change in different versions of G++ as ABI bugs are fixed.
2431 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2433 Version 2 is the version of the C++ ABI that first appeared in G++
2434 3.4, and was the default through G++ 4.9.
2436 Version 3 corrects an error in mangling a constant address as a
2437 template argument.
2439 Version 4, which first appeared in G++ 4.5, implements a standard
2440 mangling for vector types.
2442 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2443 attribute const/volatile on function pointer types, decltype of a
2444 plain decl, and use of a function parameter in the declaration of
2445 another parameter.
2447 Version 6, which first appeared in G++ 4.7, corrects the promotion
2448 behavior of C++11 scoped enums and the mangling of template argument
2449 packs, const/static_cast, prefix ++ and --, and a class scope function
2450 used as a template argument.
2452 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2453 builtin type and corrects the mangling of lambdas in default argument
2454 scope.
2456 Version 8, which first appeared in G++ 4.9, corrects the substitution
2457 behavior of function types with function-cv-qualifiers.
2459 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2460 @code{nullptr_t}.
2462 Version 10, which first appeared in G++ 6.1, adds mangling of
2463 attributes that affect type identity, such as ia32 calling convention
2464 attributes (e.g.@: @samp{stdcall}).
2466 Version 11, which first appeared in G++ 7, corrects the mangling of
2467 sizeof... expressions and operator names.  For multiple entities with
2468 the same name within a function, that are declared in different scopes,
2469 the mangling now changes starting with the twelfth occurrence.  It also
2470 implies @option{-fnew-inheriting-ctors}.
2472 Version 12, which first appeared in G++ 8, corrects the calling
2473 conventions for empty classes on the x86_64 target and for classes
2474 with only deleted copy/move constructors.  It accidentally changes the
2475 calling convention for classes with a deleted copy constructor and a
2476 trivial move constructor.
2478 Version 13, which first appeared in G++ 8.2, fixes the accidental
2479 change in version 12.
2481 Version 14, which first appeared in G++ 10, corrects the mangling of
2482 the nullptr expression.
2484 See also @option{-Wabi}.
2486 @item -fabi-compat-version=@var{n}
2487 @opindex fabi-compat-version
2488 On targets that support strong aliases, G++
2489 works around mangling changes by creating an alias with the correct
2490 mangled name when defining a symbol with an incorrect mangled name.
2491 This switch specifies which ABI version to use for the alias.
2493 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2494 compatibility).  If another ABI version is explicitly selected, this
2495 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2496 use @option{-fabi-compat-version=2}.
2498 If this option is not provided but @option{-Wabi=@var{n}} is, that
2499 version is used for compatibility aliases.  If this option is provided
2500 along with @option{-Wabi} (without the version), the version from this
2501 option is used for the warning.
2503 @item -fno-access-control
2504 @opindex fno-access-control
2505 @opindex faccess-control
2506 Turn off all access checking.  This switch is mainly useful for working
2507 around bugs in the access control code.
2509 @item -faligned-new
2510 @opindex faligned-new
2511 Enable support for C++17 @code{new} of types that require more
2512 alignment than @code{void* ::operator new(std::size_t)} provides.  A
2513 numeric argument such as @code{-faligned-new=32} can be used to
2514 specify how much alignment (in bytes) is provided by that function,
2515 but few users will need to override the default of
2516 @code{alignof(std::max_align_t)}.
2518 This flag is enabled by default for @option{-std=c++17}.
2520 @item -fchar8_t
2521 @itemx -fno-char8_t
2522 @opindex fchar8_t
2523 @opindex fno-char8_t
2524 Enable support for @code{char8_t} as adopted for C++2a.  This includes
2525 the addition of a new @code{char8_t} fundamental type, changes to the
2526 types of UTF-8 string and character literals, new signatures for
2527 user-defined literals, associated standard library updates, and new
2528 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2530 This option enables functions to be overloaded for ordinary and UTF-8
2531 strings:
2533 @smallexample
2534 int f(const char *);    // #1
2535 int f(const char8_t *); // #2
2536 int v1 = f("text");     // Calls #1
2537 int v2 = f(u8"text");   // Calls #2
2538 @end smallexample
2540 @noindent
2541 and introduces new signatures for user-defined literals:
2543 @smallexample
2544 int operator""_udl1(char8_t);
2545 int v3 = u8'x'_udl1;
2546 int operator""_udl2(const char8_t*, std::size_t);
2547 int v4 = u8"text"_udl2;
2548 template<typename T, T...> int operator""_udl3();
2549 int v5 = u8"text"_udl3;
2550 @end smallexample
2552 @noindent
2553 The change to the types of UTF-8 string and character literals introduces
2554 incompatibilities with ISO C++11 and later standards.  For example, the
2555 following code is well-formed under ISO C++11, but is ill-formed when
2556 @option{-fchar8_t} is specified.
2558 @smallexample
2559 char ca[] = u8"xx";     // error: char-array initialized from wide
2560                         //        string
2561 const char *cp = u8"xx";// error: invalid conversion from
2562                         //        `const char8_t*' to `const char*'
2563 int f(const char*);
2564 auto v = f(u8"xx");     // error: invalid conversion from
2565                         //        `const char8_t*' to `const char*'
2566 std::string s@{u8"xx"@};  // error: no matching function for call to
2567                         //        `std::basic_string<char>::basic_string()'
2568 using namespace std::literals;
2569 s = u8"xx"s;            // error: conversion from
2570                         //        `basic_string<char8_t>' to non-scalar
2571                         //        type `basic_string<char>' requested
2572 @end smallexample
2574 @item -fcheck-new
2575 @opindex fcheck-new
2576 Check that the pointer returned by @code{operator new} is non-null
2577 before attempting to modify the storage allocated.  This check is
2578 normally unnecessary because the C++ standard specifies that
2579 @code{operator new} only returns @code{0} if it is declared
2580 @code{throw()}, in which case the compiler always checks the
2581 return value even without this option.  In all other cases, when
2582 @code{operator new} has a non-empty exception specification, memory
2583 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2584 @samp{new (nothrow)}.
2586 @item -fconcepts
2587 @itemx -fconcepts-ts
2588 @opindex fconcepts
2589 @opindex fconcepts-ts
2590 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2591 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2593 With @option{-std=c++2a} and above, Concepts are part of the language
2594 standard, so @option{-fconcepts} defaults to on.  But the standard
2595 specification of Concepts differs significantly from the TS, so some
2596 constructs that were allowed in the TS but didn't make it into the
2597 standard can still be enabled by @option{-fconcepts-ts}.
2599 @item -fconstexpr-depth=@var{n}
2600 @opindex fconstexpr-depth
2601 Set the maximum nested evaluation depth for C++11 constexpr functions
2602 to @var{n}.  A limit is needed to detect endless recursion during
2603 constant expression evaluation.  The minimum specified by the standard
2604 is 512.
2606 @item -fconstexpr-cache-depth=@var{n}
2607 @opindex fconstexpr-cache-depth
2608 Set the maximum level of nested evaluation depth for C++11 constexpr
2609 functions that will be cached to @var{n}.  This is a heuristic that
2610 trades off compilation speed (when the cache avoids repeated
2611 calculations) against memory consumption (when the cache grows very
2612 large from highly recursive evaluations).  The default is 8.  Very few
2613 users are likely to want to adjust it, but if your code does heavy
2614 constexpr calculations you might want to experiment to find which
2615 value works best for you.
2617 @item -fconstexpr-loop-limit=@var{n}
2618 @opindex fconstexpr-loop-limit
2619 Set the maximum number of iterations for a loop in C++14 constexpr functions
2620 to @var{n}.  A limit is needed to detect infinite loops during
2621 constant expression evaluation.  The default is 262144 (1<<18).
2623 @item -fconstexpr-ops-limit=@var{n}
2624 @opindex fconstexpr-ops-limit
2625 Set the maximum number of operations during a single constexpr evaluation.
2626 Even when number of iterations of a single loop is limited with the above limit,
2627 if there are several nested loops and each of them has many iterations but still
2628 smaller than the above limit, or if in a body of some loop or even outside
2629 of a loop too many expressions need to be evaluated, the resulting constexpr
2630 evaluation might take too long.
2631 The default is 33554432 (1<<25).
2633 @item -fcoroutines
2634 @opindex fcoroutines
2635 Enable support for the C++ coroutines extension (experimental).
2637 @item -fno-elide-constructors
2638 @opindex fno-elide-constructors
2639 @opindex felide-constructors
2640 The C++ standard allows an implementation to omit creating a temporary
2641 that is only used to initialize another object of the same type.
2642 Specifying this option disables that optimization, and forces G++ to
2643 call the copy constructor in all cases.  This option also causes G++
2644 to call trivial member functions which otherwise would be expanded inline.
2646 In C++17, the compiler is required to omit these temporaries, but this
2647 option still affects trivial member functions.
2649 @item -fno-enforce-eh-specs
2650 @opindex fno-enforce-eh-specs
2651 @opindex fenforce-eh-specs
2652 Don't generate code to check for violation of exception specifications
2653 at run time.  This option violates the C++ standard, but may be useful
2654 for reducing code size in production builds, much like defining
2655 @code{NDEBUG}.  This does not give user code permission to throw
2656 exceptions in violation of the exception specifications; the compiler
2657 still optimizes based on the specifications, so throwing an
2658 unexpected exception results in undefined behavior at run time.
2660 @item -fextern-tls-init
2661 @itemx -fno-extern-tls-init
2662 @opindex fextern-tls-init
2663 @opindex fno-extern-tls-init
2664 The C++11 and OpenMP standards allow @code{thread_local} and
2665 @code{threadprivate} variables to have dynamic (runtime)
2666 initialization.  To support this, any use of such a variable goes
2667 through a wrapper function that performs any necessary initialization.
2668 When the use and definition of the variable are in the same
2669 translation unit, this overhead can be optimized away, but when the
2670 use is in a different translation unit there is significant overhead
2671 even if the variable doesn't actually need dynamic initialization.  If
2672 the programmer can be sure that no use of the variable in a
2673 non-defining TU needs to trigger dynamic initialization (either
2674 because the variable is statically initialized, or a use of the
2675 variable in the defining TU will be executed before any uses in
2676 another TU), they can avoid this overhead with the
2677 @option{-fno-extern-tls-init} option.
2679 On targets that support symbol aliases, the default is
2680 @option{-fextern-tls-init}.  On targets that do not support symbol
2681 aliases, the default is @option{-fno-extern-tls-init}.
2683 @item -fno-gnu-keywords
2684 @opindex fno-gnu-keywords
2685 @opindex fgnu-keywords
2686 Do not recognize @code{typeof} as a keyword, so that code can use this
2687 word as an identifier.  You can use the keyword @code{__typeof__} instead.
2688 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2689 @option{-std=c++98}, @option{-std=c++11}, etc.
2691 @item -fno-implicit-templates
2692 @opindex fno-implicit-templates
2693 @opindex fimplicit-templates
2694 Never emit code for non-inline templates that are instantiated
2695 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2696 If you use this option, you must take care to structure your code to
2697 include all the necessary explicit instantiations to avoid getting
2698 undefined symbols at link time.
2699 @xref{Template Instantiation}, for more information.
2701 @item -fno-implicit-inline-templates
2702 @opindex fno-implicit-inline-templates
2703 @opindex fimplicit-inline-templates
2704 Don't emit code for implicit instantiations of inline templates, either.
2705 The default is to handle inlines differently so that compiles with and
2706 without optimization need the same set of explicit instantiations.
2708 @item -fno-implement-inlines
2709 @opindex fno-implement-inlines
2710 @opindex fimplement-inlines
2711 To save space, do not emit out-of-line copies of inline functions
2712 controlled by @code{#pragma implementation}.  This causes linker
2713 errors if these functions are not inlined everywhere they are called.
2715 @item -fms-extensions
2716 @opindex fms-extensions
2717 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2718 int and getting a pointer to member function via non-standard syntax.
2720 @item -fnew-inheriting-ctors
2721 @opindex fnew-inheriting-ctors
2722 Enable the P0136 adjustment to the semantics of C++11 constructor
2723 inheritance.  This is part of C++17 but also considered to be a Defect
2724 Report against C++11 and C++14.  This flag is enabled by default
2725 unless @option{-fabi-version=10} or lower is specified.
2727 @item -fnew-ttp-matching
2728 @opindex fnew-ttp-matching
2729 Enable the P0522 resolution to Core issue 150, template template
2730 parameters and default arguments: this allows a template with default
2731 template arguments as an argument for a template template parameter
2732 with fewer template parameters.  This flag is enabled by default for
2733 @option{-std=c++17}.
2735 @item -fno-nonansi-builtins
2736 @opindex fno-nonansi-builtins
2737 @opindex fnonansi-builtins
2738 Disable built-in declarations of functions that are not mandated by
2739 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2740 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2742 @item -fnothrow-opt
2743 @opindex fnothrow-opt
2744 Treat a @code{throw()} exception specification as if it were a
2745 @code{noexcept} specification to reduce or eliminate the text size
2746 overhead relative to a function with no exception specification.  If
2747 the function has local variables of types with non-trivial
2748 destructors, the exception specification actually makes the
2749 function smaller because the EH cleanups for those variables can be
2750 optimized away.  The semantic effect is that an exception thrown out of
2751 a function with such an exception specification results in a call
2752 to @code{terminate} rather than @code{unexpected}.
2754 @item -fno-operator-names
2755 @opindex fno-operator-names
2756 @opindex foperator-names
2757 Do not treat the operator name keywords @code{and}, @code{bitand},
2758 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2759 synonyms as keywords.
2761 @item -fno-optional-diags
2762 @opindex fno-optional-diags
2763 @opindex foptional-diags
2764 Disable diagnostics that the standard says a compiler does not need to
2765 issue.  Currently, the only such diagnostic issued by G++ is the one for
2766 a name having multiple meanings within a class.
2768 @item -fpermissive
2769 @opindex fpermissive
2770 Downgrade some diagnostics about nonconformant code from errors to
2771 warnings.  Thus, using @option{-fpermissive} allows some
2772 nonconforming code to compile.
2774 @item -fno-pretty-templates
2775 @opindex fno-pretty-templates
2776 @opindex fpretty-templates
2777 When an error message refers to a specialization of a function
2778 template, the compiler normally prints the signature of the
2779 template followed by the template arguments and any typedefs or
2780 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2781 rather than @code{void f(int)}) so that it's clear which template is
2782 involved.  When an error message refers to a specialization of a class
2783 template, the compiler omits any template arguments that match
2784 the default template arguments for that template.  If either of these
2785 behaviors make it harder to understand the error message rather than
2786 easier, you can use @option{-fno-pretty-templates} to disable them.
2788 @item -fno-rtti
2789 @opindex fno-rtti
2790 @opindex frtti
2791 Disable generation of information about every class with virtual
2792 functions for use by the C++ run-time type identification features
2793 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
2794 of the language, you can save some space by using this flag.  Note that
2795 exception handling uses the same information, but G++ generates it as
2796 needed. The @code{dynamic_cast} operator can still be used for casts that
2797 do not require run-time type information, i.e.@: casts to @code{void *} or to
2798 unambiguous base classes.
2800 Mixing code compiled with @option{-frtti} with that compiled with
2801 @option{-fno-rtti} may not work.  For example, programs may
2802 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
2803 for a class compiled with @option{-frtti}.  
2805 @item -fsized-deallocation
2806 @opindex fsized-deallocation
2807 Enable the built-in global declarations
2808 @smallexample
2809 void operator delete (void *, std::size_t) noexcept;
2810 void operator delete[] (void *, std::size_t) noexcept;
2811 @end smallexample
2812 as introduced in C++14.  This is useful for user-defined replacement
2813 deallocation functions that, for example, use the size of the object
2814 to make deallocation faster.  Enabled by default under
2815 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
2816 warns about places that might want to add a definition.
2818 @item -fstrict-enums
2819 @opindex fstrict-enums
2820 Allow the compiler to optimize using the assumption that a value of
2821 enumerated type can only be one of the values of the enumeration (as
2822 defined in the C++ standard; basically, a value that can be
2823 represented in the minimum number of bits needed to represent all the
2824 enumerators).  This assumption may not be valid if the program uses a
2825 cast to convert an arbitrary integer value to the enumerated type.
2827 @item -fstrong-eval-order
2828 @opindex fstrong-eval-order
2829 Evaluate member access, array subscripting, and shift expressions in
2830 left-to-right order, and evaluate assignment in right-to-left order,
2831 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
2832 @option{-fstrong-eval-order=some} enables just the ordering of member
2833 access and shift expressions, and is the default without
2834 @option{-std=c++17}.
2836 @item -ftemplate-backtrace-limit=@var{n}
2837 @opindex ftemplate-backtrace-limit
2838 Set the maximum number of template instantiation notes for a single
2839 warning or error to @var{n}.  The default value is 10.
2841 @item -ftemplate-depth=@var{n}
2842 @opindex ftemplate-depth
2843 Set the maximum instantiation depth for template classes to @var{n}.
2844 A limit on the template instantiation depth is needed to detect
2845 endless recursions during template class instantiation.  ANSI/ISO C++
2846 conforming programs must not rely on a maximum depth greater than 17
2847 (changed to 1024 in C++11).  The default value is 900, as the compiler
2848 can run out of stack space before hitting 1024 in some situations.
2850 @item -fno-threadsafe-statics
2851 @opindex fno-threadsafe-statics
2852 @opindex fthreadsafe-statics
2853 Do not emit the extra code to use the routines specified in the C++
2854 ABI for thread-safe initialization of local statics.  You can use this
2855 option to reduce code size slightly in code that doesn't need to be
2856 thread-safe.
2858 @item -fuse-cxa-atexit
2859 @opindex fuse-cxa-atexit
2860 Register destructors for objects with static storage duration with the
2861 @code{__cxa_atexit} function rather than the @code{atexit} function.
2862 This option is required for fully standards-compliant handling of static
2863 destructors, but only works if your C library supports
2864 @code{__cxa_atexit}.
2866 @item -fno-use-cxa-get-exception-ptr
2867 @opindex fno-use-cxa-get-exception-ptr
2868 @opindex fuse-cxa-get-exception-ptr
2869 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2870 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2871 if the runtime routine is not available.
2873 @item -fvisibility-inlines-hidden
2874 @opindex fvisibility-inlines-hidden
2875 This switch declares that the user does not attempt to compare
2876 pointers to inline functions or methods where the addresses of the two functions
2877 are taken in different shared objects.
2879 The effect of this is that GCC may, effectively, mark inline methods with
2880 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2881 appear in the export table of a DSO and do not require a PLT indirection
2882 when used within the DSO@.  Enabling this option can have a dramatic effect
2883 on load and link times of a DSO as it massively reduces the size of the
2884 dynamic export table when the library makes heavy use of templates.
2886 The behavior of this switch is not quite the same as marking the
2887 methods as hidden directly, because it does not affect static variables
2888 local to the function or cause the compiler to deduce that
2889 the function is defined in only one shared object.
2891 You may mark a method as having a visibility explicitly to negate the
2892 effect of the switch for that method.  For example, if you do want to
2893 compare pointers to a particular inline method, you might mark it as
2894 having default visibility.  Marking the enclosing class with explicit
2895 visibility has no effect.
2897 Explicitly instantiated inline methods are unaffected by this option
2898 as their linkage might otherwise cross a shared library boundary.
2899 @xref{Template Instantiation}.
2901 @item -fvisibility-ms-compat
2902 @opindex fvisibility-ms-compat
2903 This flag attempts to use visibility settings to make GCC's C++
2904 linkage model compatible with that of Microsoft Visual Studio.
2906 The flag makes these changes to GCC's linkage model:
2908 @enumerate
2909 @item
2910 It sets the default visibility to @code{hidden}, like
2911 @option{-fvisibility=hidden}.
2913 @item
2914 Types, but not their members, are not hidden by default.
2916 @item
2917 The One Definition Rule is relaxed for types without explicit
2918 visibility specifications that are defined in more than one
2919 shared object: those declarations are permitted if they are
2920 permitted when this option is not used.
2921 @end enumerate
2923 In new code it is better to use @option{-fvisibility=hidden} and
2924 export those classes that are intended to be externally visible.
2925 Unfortunately it is possible for code to rely, perhaps accidentally,
2926 on the Visual Studio behavior.
2928 Among the consequences of these changes are that static data members
2929 of the same type with the same name but defined in different shared
2930 objects are different, so changing one does not change the other;
2931 and that pointers to function members defined in different shared
2932 objects may not compare equal.  When this flag is given, it is a
2933 violation of the ODR to define types with the same name differently.
2935 @item -fno-weak
2936 @opindex fno-weak
2937 @opindex fweak
2938 Do not use weak symbol support, even if it is provided by the linker.
2939 By default, G++ uses weak symbols if they are available.  This
2940 option exists only for testing, and should not be used by end-users;
2941 it results in inferior code and has no benefits.  This option may
2942 be removed in a future release of G++.
2944 @item -nostdinc++
2945 @opindex nostdinc++
2946 Do not search for header files in the standard directories specific to
2947 C++, but do still search the other standard directories.  (This option
2948 is used when building the C++ library.)
2949 @end table
2951 In addition, these optimization, warning, and code generation options
2952 have meanings only for C++ programs:
2954 @table @gcctabopt
2955 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2956 @opindex Wabi
2957 @opindex Wno-abi
2958 Warn when G++ it generates code that is probably not compatible with
2959 the vendor-neutral C++ ABI@.  Since G++ now defaults to updating the
2960 ABI with each major release, normally @option{-Wabi} will warn only if
2961 there is a check added later in a release series for an ABI issue
2962 discovered since the initial release.  @option{-Wabi} will warn about
2963 more things if an older ABI version is selected (with
2964 @option{-fabi-version=@var{n}}).
2966 @option{-Wabi} can also be used with an explicit version number to
2967 warn about compatibility with a particular @option{-fabi-version}
2968 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2969 @option{-fabi-version=2}.
2971 If an explicit version number is provided and
2972 @option{-fabi-compat-version} is not specified, the version number
2973 from this option is used for compatibility aliases.  If no explicit
2974 version number is provided with this option, but
2975 @option{-fabi-compat-version} is specified, that version number is
2976 used for ABI warnings.
2978 Although an effort has been made to warn about
2979 all such cases, there are probably some cases that are not warned about,
2980 even though G++ is generating incompatible code.  There may also be
2981 cases where warnings are emitted even though the code that is generated
2982 is compatible.
2984 You should rewrite your code to avoid these warnings if you are
2985 concerned about the fact that code generated by G++ may not be binary
2986 compatible with code generated by other compilers.
2988 Known incompatibilities in @option{-fabi-version=2} (which was the
2989 default from GCC 3.4 to 4.9) include:
2991 @itemize @bullet
2993 @item
2994 A template with a non-type template parameter of reference type was
2995 mangled incorrectly:
2996 @smallexample
2997 extern int N;
2998 template <int &> struct S @{@};
2999 void n (S<N>) @{2@}
3000 @end smallexample
3002 This was fixed in @option{-fabi-version=3}.
3004 @item
3005 SIMD vector types declared using @code{__attribute ((vector_size))} were
3006 mangled in a non-standard way that does not allow for overloading of
3007 functions taking vectors of different sizes.
3009 The mangling was changed in @option{-fabi-version=4}.
3011 @item
3012 @code{__attribute ((const))} and @code{noreturn} were mangled as type
3013 qualifiers, and @code{decltype} of a plain declaration was folded away.
3015 These mangling issues were fixed in @option{-fabi-version=5}.
3017 @item
3018 Scoped enumerators passed as arguments to a variadic function are
3019 promoted like unscoped enumerators, causing @code{va_arg} to complain.
3020 On most targets this does not actually affect the parameter passing
3021 ABI, as there is no way to pass an argument smaller than @code{int}.
3023 Also, the ABI changed the mangling of template argument packs,
3024 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
3025 a class scope function used as a template argument.
3027 These issues were corrected in @option{-fabi-version=6}.
3029 @item
3030 Lambdas in default argument scope were mangled incorrectly, and the
3031 ABI changed the mangling of @code{nullptr_t}.
3033 These issues were corrected in @option{-fabi-version=7}.
3035 @item
3036 When mangling a function type with function-cv-qualifiers, the
3037 un-qualified function type was incorrectly treated as a substitution
3038 candidate.
3040 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
3042 @item
3043 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
3044 unaligned accesses.  Note that this did not affect the ABI of a
3045 function with a @code{nullptr_t} parameter, as parameters have a
3046 minimum alignment.
3048 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
3050 @item
3051 Target-specific attributes that affect the identity of a type, such as
3052 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3053 did not affect the mangled name, leading to name collisions when
3054 function pointers were used as template arguments.
3056 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3058 @end itemize
3060 It also warns about psABI-related changes.  The known psABI changes at this
3061 point include:
3063 @itemize @bullet
3065 @item
3066 For SysV/x86-64, unions with @code{long double} members are 
3067 passed in memory as specified in psABI.  For example:
3069 @smallexample
3070 union U @{
3071   long double ld;
3072   int i;
3074 @end smallexample
3076 @noindent
3077 @code{union U} is always passed in memory.
3079 @end itemize
3081 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3082 @opindex Wabi-tag
3083 @opindex Wabi-tag
3084 Warn when a type with an ABI tag is used in a context that does not
3085 have that ABI tag.  See @ref{C++ Attributes} for more information
3086 about ABI tags.
3088 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3089 @opindex Wcomma-subscript
3090 @opindex Wno-comma-subscript
3091 Warn about uses of a comma expression within a subscripting expression.
3092 This usage was deprecated in C++2a.  However, a comma expression wrapped
3093 in @code{( )} is not deprecated.  Example:
3095 @smallexample
3096 @group
3097 void f(int *a, int b, int c) @{
3098     a[b,c];     // deprecated
3099     a[(b,c)];   // OK
3101 @end group
3102 @end smallexample
3104 Enabled by default with @option{-std=c++2a}.
3106 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3107 @opindex Wctor-dtor-privacy
3108 @opindex Wno-ctor-dtor-privacy
3109 Warn when a class seems unusable because all the constructors or
3110 destructors in that class are private, and it has neither friends nor
3111 public static member functions.  Also warn if there are no non-private
3112 methods, and there's at least one private member function that isn't
3113 a constructor or destructor.
3115 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3116 @opindex Wdelete-non-virtual-dtor
3117 @opindex Wno-delete-non-virtual-dtor
3118 Warn when @code{delete} is used to destroy an instance of a class that
3119 has virtual functions and non-virtual destructor. It is unsafe to delete
3120 an instance of a derived class through a pointer to a base class if the
3121 base class does not have a virtual destructor.  This warning is enabled
3122 by @option{-Wall}.
3124 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3125 @opindex Wdeprecated-copy
3126 @opindex Wno-deprecated-copy
3127 Warn that the implicit declaration of a copy constructor or copy
3128 assignment operator is deprecated if the class has a user-provided
3129 copy constructor or copy assignment operator, in C++11 and up.  This
3130 warning is enabled by @option{-Wextra}.  With
3131 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3132 user-provided destructor.
3134 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3135 @opindex Winit-list-lifetime
3136 @opindex Wno-init-list-lifetime
3137 Do not warn about uses of @code{std::initializer_list} that are likely
3138 to result in dangling pointers.  Since the underlying array for an
3139 @code{initializer_list} is handled like a normal C++ temporary object,
3140 it is easy to inadvertently keep a pointer to the array past the end
3141 of the array's lifetime.  For example:
3143 @itemize @bullet
3144 @item
3145 If a function returns a temporary @code{initializer_list}, or a local
3146 @code{initializer_list} variable, the array's lifetime ends at the end
3147 of the return statement, so the value returned has a dangling pointer.
3149 @item
3150 If a new-expression creates an @code{initializer_list}, the array only
3151 lives until the end of the enclosing full-expression, so the
3152 @code{initializer_list} in the heap has a dangling pointer.
3154 @item
3155 When an @code{initializer_list} variable is assigned from a
3156 brace-enclosed initializer list, the temporary array created for the
3157 right side of the assignment only lives until the end of the
3158 full-expression, so at the next statement the @code{initializer_list}
3159 variable has a dangling pointer.
3161 @smallexample
3162 // li's initial underlying array lives as long as li
3163 std::initializer_list<int> li = @{ 1,2,3 @};
3164 // assignment changes li to point to a temporary array
3165 li = @{ 4, 5 @};
3166 // now the temporary is gone and li has a dangling pointer
3167 int i = li.begin()[0] // undefined behavior
3168 @end smallexample
3170 @item
3171 When a list constructor stores the @code{begin} pointer from the
3172 @code{initializer_list} argument, this doesn't extend the lifetime of
3173 the array, so if a class variable is constructed from a temporary
3174 @code{initializer_list}, the pointer is left dangling by the end of
3175 the variable declaration statement.
3177 @end itemize
3179 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3180 @opindex Wliteral-suffix
3181 @opindex Wno-literal-suffix
3182 Warn when a string or character literal is followed by a ud-suffix which does
3183 not begin with an underscore.  As a conforming extension, GCC treats such
3184 suffixes as separate preprocessing tokens in order to maintain backwards
3185 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3186 For example:
3188 @smallexample
3189 #define __STDC_FORMAT_MACROS
3190 #include <inttypes.h>
3191 #include <stdio.h>
3193 int main() @{
3194   int64_t i64 = 123;
3195   printf("My int64: %" PRId64"\n", i64);
3197 @end smallexample
3199 In this case, @code{PRId64} is treated as a separate preprocessing token.
3201 Additionally, warn when a user-defined literal operator is declared with
3202 a literal suffix identifier that doesn't begin with an underscore. Literal
3203 suffix identifiers that don't begin with an underscore are reserved for
3204 future standardization.
3206 This warning is enabled by default.
3208 @item -Wlto-type-mismatch
3209 @opindex Wlto-type-mismatch
3210 @opindex Wno-lto-type-mismatch
3212 During the link-time optimization warn about type mismatches in
3213 global declarations from different compilation units.
3214 Requires @option{-flto} to be enabled.  Enabled by default.
3216 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3217 @opindex Wnarrowing
3218 @opindex Wno-narrowing
3219 For C++11 and later standards, narrowing conversions are diagnosed by default,
3220 as required by the standard.  A narrowing conversion from a constant produces
3221 an error, and a narrowing conversion from a non-constant produces a warning,
3222 but @option{-Wno-narrowing} suppresses the diagnostic.
3223 Note that this does not affect the meaning of well-formed code;
3224 narrowing conversions are still considered ill-formed in SFINAE contexts.
3226 With @option{-Wnarrowing} in C++98, warn when a narrowing
3227 conversion prohibited by C++11 occurs within
3228 @samp{@{ @}}, e.g.
3230 @smallexample
3231 int i = @{ 2.2 @}; // error: narrowing from double to int
3232 @end smallexample
3234 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3236 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3237 @opindex Wnoexcept
3238 @opindex Wno-noexcept
3239 Warn when a noexcept-expression evaluates to false because of a call
3240 to a function that does not have a non-throwing exception
3241 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3242 the compiler to never throw an exception.
3244 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3245 @opindex Wnoexcept-type
3246 @opindex Wno-noexcept-type
3247 Warn if the C++17 feature making @code{noexcept} part of a function
3248 type changes the mangled name of a symbol relative to C++14.  Enabled
3249 by @option{-Wabi} and @option{-Wc++17-compat}.
3251 As an example:
3253 @smallexample
3254 template <class T> void f(T t) @{ t(); @};
3255 void g() noexcept;
3256 void h() @{ f(g); @} 
3257 @end smallexample
3259 @noindent
3260 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3261 C++17 it calls @code{f<void(*)()noexcept>}.
3263 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3264 @opindex Wclass-memaccess
3265 @opindex Wno-class-memaccess
3266 Warn when the destination of a call to a raw memory function such as
3267 @code{memset} or @code{memcpy} is an object of class type, and when writing
3268 into such an object might bypass the class non-trivial or deleted constructor
3269 or copy assignment, violate const-correctness or encapsulation, or corrupt
3270 virtual table pointers.  Modifying the representation of such objects may
3271 violate invariants maintained by member functions of the class.  For example,
3272 the call to @code{memset} below is undefined because it modifies a non-trivial
3273 class object and is, therefore, diagnosed.  The safe way to either initialize
3274 or clear the storage of objects of such types is by using the appropriate
3275 constructor or assignment operator, if one is available.
3276 @smallexample
3277 std::string str = "abc";
3278 memset (&str, 0, sizeof str);
3279 @end smallexample
3280 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3281 Explicitly casting the pointer to the class object to @code{void *} or
3282 to a type that can be safely accessed by the raw memory function suppresses
3283 the warning.
3285 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3286 @opindex Wnon-virtual-dtor
3287 @opindex Wno-non-virtual-dtor
3288 Warn when a class has virtual functions and an accessible non-virtual
3289 destructor itself or in an accessible polymorphic base class, in which
3290 case it is possible but unsafe to delete an instance of a derived
3291 class through a pointer to the class itself or base class.  This
3292 warning is automatically enabled if @option{-Weffc++} is specified.
3294 @item -Wregister @r{(C++ and Objective-C++ only)}
3295 @opindex Wregister
3296 @opindex Wno-register
3297 Warn on uses of the @code{register} storage class specifier, except
3298 when it is part of the GNU @ref{Explicit Register Variables} extension.
3299 The use of the @code{register} keyword as storage class specifier has
3300 been deprecated in C++11 and removed in C++17.
3301 Enabled by default with @option{-std=c++17}.
3303 @item -Wreorder @r{(C++ and Objective-C++ only)}
3304 @opindex Wreorder
3305 @opindex Wno-reorder
3306 @cindex reordering, warning
3307 @cindex warning for reordering of member initializers
3308 Warn when the order of member initializers given in the code does not
3309 match the order in which they must be executed.  For instance:
3311 @smallexample
3312 struct A @{
3313   int i;
3314   int j;
3315   A(): j (0), i (1) @{ @}
3317 @end smallexample
3319 @noindent
3320 The compiler rearranges the member initializers for @code{i}
3321 and @code{j} to match the declaration order of the members, emitting
3322 a warning to that effect.  This warning is enabled by @option{-Wall}.
3324 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3325 @opindex Wpessimizing-move
3326 @opindex Wno-pessimizing-move
3327 This warning warns when a call to @code{std::move} prevents copy
3328 elision.  A typical scenario when copy elision can occur is when returning in
3329 a function with a class return type, when the expression being returned is the
3330 name of a non-volatile automatic object, and is not a function parameter, and
3331 has the same type as the function return type.
3333 @smallexample
3334 struct T @{
3335 @dots{}
3337 T fn()
3339   T t;
3340   @dots{}
3341   return std::move (t);
3343 @end smallexample
3345 But in this example, the @code{std::move} call prevents copy elision.
3347 This warning is enabled by @option{-Wall}.
3349 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3350 @opindex Wredundant-move
3351 @opindex Wno-redundant-move
3352 This warning warns about redundant calls to @code{std::move}; that is, when
3353 a move operation would have been performed even without the @code{std::move}
3354 call.  This happens because the compiler is forced to treat the object as if
3355 it were an rvalue in certain situations such as returning a local variable,
3356 where copy elision isn't applicable.  Consider:
3358 @smallexample
3359 struct T @{
3360 @dots{}
3362 T fn(T t)
3364   @dots{}
3365   return std::move (t);
3367 @end smallexample
3369 Here, the @code{std::move} call is redundant.  Because G++ implements Core
3370 Issue 1579, another example is:
3372 @smallexample
3373 struct T @{ // convertible to U
3374 @dots{}
3376 struct U @{
3377 @dots{}
3379 U fn()
3381   T t;
3382   @dots{}
3383   return std::move (t);
3385 @end smallexample
3386 In this example, copy elision isn't applicable because the type of the
3387 expression being returned and the function return type differ, yet G++
3388 treats the return value as if it were designated by an rvalue.
3390 This warning is enabled by @option{-Wextra}.
3392 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3393 @opindex Wredundant-tags
3394 @opindex Wno-redundant-tags
3395 Warn about redundant class-key and enum-key in references to class types
3396 and enumerated types in contexts where the key can be eliminated without
3397 causing an ambiguity.  For example
3399 @smallexample
3400 struct foo;
3401 struct foo *p;   // -Wredundant-tags, keyword struct can be eliminated
3403 void foo ();   // "hides" struct foo
3404 void bar (struct foo&);   // no warning, keyword struct cannot be eliminated
3405 @end smallexample
3407 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3408 @opindex fext-numeric-literals
3409 @opindex fno-ext-numeric-literals
3410 Accept imaginary, fixed-point, or machine-defined
3411 literal number suffixes as GNU extensions.
3412 When this option is turned off these suffixes are treated
3413 as C++11 user-defined literal numeric suffixes.
3414 This is on by default for all pre-C++11 dialects and all GNU dialects:
3415 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3416 @option{-std=gnu++14}.
3417 This option is off by default
3418 for ISO C++11 onwards (@option{-std=c++11}, ...).
3419 @end table
3421 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3423 @table @gcctabopt
3424 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3425 @opindex Weffc++
3426 @opindex Wno-effc++
3427 Warn about violations of the following style guidelines from Scott Meyers'
3428 @cite{Effective C++} series of books:
3430 @itemize @bullet
3431 @item
3432 Define a copy constructor and an assignment operator for classes
3433 with dynamically-allocated memory.
3435 @item
3436 Prefer initialization to assignment in constructors.
3438 @item
3439 Have @code{operator=} return a reference to @code{*this}.
3441 @item
3442 Don't try to return a reference when you must return an object.
3444 @item
3445 Distinguish between prefix and postfix forms of increment and
3446 decrement operators.
3448 @item
3449 Never overload @code{&&}, @code{||}, or @code{,}.
3451 @end itemize
3453 This option also enables @option{-Wnon-virtual-dtor}, which is also
3454 one of the effective C++ recommendations.  However, the check is
3455 extended to warn about the lack of virtual destructor in accessible
3456 non-polymorphic bases classes too.
3458 When selecting this option, be aware that the standard library
3459 headers do not obey all of these guidelines; use @samp{grep -v}
3460 to filter out those warnings.
3462 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3463 @opindex Wstrict-null-sentinel
3464 @opindex Wno-strict-null-sentinel
3465 Warn about the use of an uncasted @code{NULL} as sentinel.  When
3466 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3467 to @code{__null}.  Although it is a null pointer constant rather than a
3468 null pointer, it is guaranteed to be of the same size as a pointer.
3469 But this use is not portable across different compilers.
3471 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3472 @opindex Wno-non-template-friend
3473 @opindex Wnon-template-friend
3474 Disable warnings when non-template friend functions are declared
3475 within a template.  In very old versions of GCC that predate implementation
3476 of the ISO standard, declarations such as 
3477 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3478 could be interpreted as a particular specialization of a template
3479 function; the warning exists to diagnose compatibility problems, 
3480 and is enabled by default.
3482 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3483 @opindex Wold-style-cast
3484 @opindex Wno-old-style-cast
3485 Warn if an old-style (C-style) cast to a non-void type is used within
3486 a C++ program.  The new-style casts (@code{dynamic_cast},
3487 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3488 less vulnerable to unintended effects and much easier to search for.
3490 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3491 @opindex Woverloaded-virtual
3492 @opindex Wno-overloaded-virtual
3493 @cindex overloaded virtual function, warning
3494 @cindex warning for overloaded virtual function
3495 Warn when a function declaration hides virtual functions from a
3496 base class.  For example, in:
3498 @smallexample
3499 struct A @{
3500   virtual void f();
3503 struct B: public A @{
3504   void f(int);
3506 @end smallexample
3508 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3509 like:
3511 @smallexample
3512 B* b;
3513 b->f();
3514 @end smallexample
3516 @noindent
3517 fails to compile.
3519 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3520 @opindex Wno-pmf-conversions
3521 @opindex Wpmf-conversions
3522 Disable the diagnostic for converting a bound pointer to member function
3523 to a plain pointer.
3525 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3526 @opindex Wsign-promo
3527 @opindex Wno-sign-promo
3528 Warn when overload resolution chooses a promotion from unsigned or
3529 enumerated type to a signed type, over a conversion to an unsigned type of
3530 the same size.  Previous versions of G++ tried to preserve
3531 unsignedness, but the standard mandates the current behavior.
3533 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3534 @opindex Wtemplates
3535 @opindex Wno-templates
3536 Warn when a primary template declaration is encountered.  Some coding
3537 rules disallow templates, and this may be used to enforce that rule.
3538 The warning is inactive inside a system header file, such as the STL, so
3539 one can still use the STL.  One may also instantiate or specialize
3540 templates.
3542 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3543 @opindex Wmismatched-tags
3544 @opindex Wno-mismatched-tags
3545 Warn for declarations of structs, classes, and class templates and their
3546 specializations with a class-key that does not match either the definition
3547 or the first declaration if no definition is provided.
3549 For example, the declaration of @code{struct Object} in the argument list
3550 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
3551 class-key @code{struct} or replace it with @code{class} to match its definition.
3552 @smallexample
3553 class Object @{
3554 public:
3555   virtual ~Object () = 0;
3557 void draw (struct Object*);
3558 @end smallexample
3560 It is not wrong to declare a class with the class-key @code{struct} as
3561 the example above shows.  The @option{-Wmismatched-tags} option is intended
3562 to help achieve a consistent style of class declarations.  In code that is
3563 intended to be portable to Windows-based compilers the warning helps prevent
3564 unresolved references due to the difference in the mangling of symbols
3565 declared with different class-keys.  The option can be used either on its
3566 own or in conjunction with @option{-Wredundant-tags}.
3568 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3569 @opindex Wmultiple-inheritance
3570 @opindex Wno-multiple-inheritance
3571 Warn when a class is defined with multiple direct base classes.  Some
3572 coding rules disallow multiple inheritance, and this may be used to
3573 enforce that rule.  The warning is inactive inside a system header file,
3574 such as the STL, so one can still use the STL.  One may also define
3575 classes that indirectly use multiple inheritance.
3577 @item -Wvirtual-inheritance
3578 @opindex Wvirtual-inheritance
3579 @opindex Wno-virtual-inheritance
3580 Warn when a class is defined with a virtual direct base class.  Some
3581 coding rules disallow multiple inheritance, and this may be used to
3582 enforce that rule.  The warning is inactive inside a system header file,
3583 such as the STL, so one can still use the STL.  One may also define
3584 classes that indirectly use virtual inheritance.
3586 @item -Wnamespaces
3587 @opindex Wnamespaces
3588 @opindex Wno-namespaces
3589 Warn when a namespace definition is opened.  Some coding rules disallow
3590 namespaces, and this may be used to enforce that rule.  The warning is
3591 inactive inside a system header file, such as the STL, so one can still
3592 use the STL.  One may also use using directives and qualified names.
3594 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3595 @opindex Wterminate
3596 @opindex Wno-terminate
3597 Disable the warning about a throw-expression that will immediately
3598 result in a call to @code{terminate}.
3600 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3601 @opindex Wno-class-conversion
3602 @opindex Wclass-conversion
3603 Disable the warning about the case when a conversion function converts an
3604 object to the same type, to a base class of that type, or to void; such
3605 a conversion function will never be called.
3607 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3608 @opindex Wvolatile
3609 @opindex Wno-volatile
3610 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
3611 postfix and prefix @code{++} and @code{--} expressions of
3612 @code{volatile}-qualified types, using simple assignments where the left
3613 operand is a @code{volatile}-qualified non-class type for their value,
3614 compound assignments where the left operand is a @code{volatile}-qualified
3615 non-class type, @code{volatile}-qualified function return type,
3616 @code{volatile}-qualified parameter type, and structured bindings of a
3617 @code{volatile}-qualified type.  This usage was deprecated in C++20.
3619 Enabled by default with @option{-std=c++2a}.
3620 @end table
3622 @node Objective-C and Objective-C++ Dialect Options
3623 @section Options Controlling Objective-C and Objective-C++ Dialects
3625 @cindex compiler options, Objective-C and Objective-C++
3626 @cindex Objective-C and Objective-C++ options, command-line
3627 @cindex options, Objective-C and Objective-C++
3628 (NOTE: This manual does not describe the Objective-C and Objective-C++
3629 languages themselves.  @xref{Standards,,Language Standards
3630 Supported by GCC}, for references.)
3632 This section describes the command-line options that are only meaningful
3633 for Objective-C and Objective-C++ programs.  You can also use most of
3634 the language-independent GNU compiler options.
3635 For example, you might compile a file @file{some_class.m} like this:
3637 @smallexample
3638 gcc -g -fgnu-runtime -O -c some_class.m
3639 @end smallexample
3641 @noindent
3642 In this example, @option{-fgnu-runtime} is an option meant only for
3643 Objective-C and Objective-C++ programs; you can use the other options with
3644 any language supported by GCC@.
3646 Note that since Objective-C is an extension of the C language, Objective-C
3647 compilations may also use options specific to the C front-end (e.g.,
3648 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
3649 C++-specific options (e.g., @option{-Wabi}).
3651 Here is a list of options that are @emph{only} for compiling Objective-C
3652 and Objective-C++ programs:
3654 @table @gcctabopt
3655 @item -fconstant-string-class=@var{class-name}
3656 @opindex fconstant-string-class
3657 Use @var{class-name} as the name of the class to instantiate for each
3658 literal string specified with the syntax @code{@@"@dots{}"}.  The default
3659 class name is @code{NXConstantString} if the GNU runtime is being used, and
3660 @code{NSConstantString} if the NeXT runtime is being used (see below).  The
3661 @option{-fconstant-cfstrings} option, if also present, overrides the
3662 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3663 to be laid out as constant CoreFoundation strings.
3665 @item -fgnu-runtime
3666 @opindex fgnu-runtime
3667 Generate object code compatible with the standard GNU Objective-C
3668 runtime.  This is the default for most types of systems.
3670 @item -fnext-runtime
3671 @opindex fnext-runtime
3672 Generate output compatible with the NeXT runtime.  This is the default
3673 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
3674 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3675 used.
3677 @item -fno-nil-receivers
3678 @opindex fno-nil-receivers
3679 @opindex fnil-receivers
3680 Assume that all Objective-C message dispatches (@code{[receiver
3681 message:arg]}) in this translation unit ensure that the receiver is
3682 not @code{nil}.  This allows for more efficient entry points in the
3683 runtime to be used.  This option is only available in conjunction with
3684 the NeXT runtime and ABI version 0 or 1.
3686 @item -fobjc-abi-version=@var{n}
3687 @opindex fobjc-abi-version
3688 Use version @var{n} of the Objective-C ABI for the selected runtime.
3689 This option is currently supported only for the NeXT runtime.  In that
3690 case, Version 0 is the traditional (32-bit) ABI without support for
3691 properties and other Objective-C 2.0 additions.  Version 1 is the
3692 traditional (32-bit) ABI with support for properties and other
3693 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
3694 nothing is specified, the default is Version 0 on 32-bit target
3695 machines, and Version 2 on 64-bit target machines.
3697 @item -fobjc-call-cxx-cdtors
3698 @opindex fobjc-call-cxx-cdtors
3699 For each Objective-C class, check if any of its instance variables is a
3700 C++ object with a non-trivial default constructor.  If so, synthesize a
3701 special @code{- (id) .cxx_construct} instance method which runs
3702 non-trivial default constructors on any such instance variables, in order,
3703 and then return @code{self}.  Similarly, check if any instance variable
3704 is a C++ object with a non-trivial destructor, and if so, synthesize a
3705 special @code{- (void) .cxx_destruct} method which runs
3706 all such default destructors, in reverse order.
3708 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3709 methods thusly generated only operate on instance variables
3710 declared in the current Objective-C class, and not those inherited
3711 from superclasses.  It is the responsibility of the Objective-C
3712 runtime to invoke all such methods in an object's inheritance
3713 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
3714 by the runtime immediately after a new object instance is allocated;
3715 the @code{- (void) .cxx_destruct} methods are invoked immediately
3716 before the runtime deallocates an object instance.
3718 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3719 support for invoking the @code{- (id) .cxx_construct} and
3720 @code{- (void) .cxx_destruct} methods.
3722 @item -fobjc-direct-dispatch
3723 @opindex fobjc-direct-dispatch
3724 Allow fast jumps to the message dispatcher.  On Darwin this is
3725 accomplished via the comm page.
3727 @item -fobjc-exceptions
3728 @opindex fobjc-exceptions
3729 Enable syntactic support for structured exception handling in
3730 Objective-C, similar to what is offered by C++.  This option
3731 is required to use the Objective-C keywords @code{@@try},
3732 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3733 @code{@@synchronized}.  This option is available with both the GNU
3734 runtime and the NeXT runtime (but not available in conjunction with
3735 the NeXT runtime on Mac OS X 10.2 and earlier).
3737 @item -fobjc-gc
3738 @opindex fobjc-gc
3739 Enable garbage collection (GC) in Objective-C and Objective-C++
3740 programs.  This option is only available with the NeXT runtime; the
3741 GNU runtime has a different garbage collection implementation that
3742 does not require special compiler flags.
3744 @item -fobjc-nilcheck
3745 @opindex fobjc-nilcheck
3746 For the NeXT runtime with version 2 of the ABI, check for a nil
3747 receiver in method invocations before doing the actual method call.
3748 This is the default and can be disabled using
3749 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
3750 checked for nil in this way no matter what this flag is set to.
3751 Currently this flag does nothing when the GNU runtime, or an older
3752 version of the NeXT runtime ABI, is used.
3754 @item -fobjc-std=objc1
3755 @opindex fobjc-std
3756 Conform to the language syntax of Objective-C 1.0, the language
3757 recognized by GCC 4.0.  This only affects the Objective-C additions to
3758 the C/C++ language; it does not affect conformance to C/C++ standards,
3759 which is controlled by the separate C/C++ dialect option flags.  When
3760 this option is used with the Objective-C or Objective-C++ compiler,
3761 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3762 This is useful if you need to make sure that your Objective-C code can
3763 be compiled with older versions of GCC@.
3765 @item -freplace-objc-classes
3766 @opindex freplace-objc-classes
3767 Emit a special marker instructing @command{ld(1)} not to statically link in
3768 the resulting object file, and allow @command{dyld(1)} to load it in at
3769 run time instead.  This is used in conjunction with the Fix-and-Continue
3770 debugging mode, where the object file in question may be recompiled and
3771 dynamically reloaded in the course of program execution, without the need
3772 to restart the program itself.  Currently, Fix-and-Continue functionality
3773 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3774 and later.
3776 @item -fzero-link
3777 @opindex fzero-link
3778 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3779 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3780 compile time) with static class references that get initialized at load time,
3781 which improves run-time performance.  Specifying the @option{-fzero-link} flag
3782 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3783 to be retained.  This is useful in Zero-Link debugging mode, since it allows
3784 for individual class implementations to be modified during program execution.
3785 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3786 regardless of command-line options.
3788 @item -fno-local-ivars
3789 @opindex fno-local-ivars
3790 @opindex flocal-ivars
3791 By default instance variables in Objective-C can be accessed as if
3792 they were local variables from within the methods of the class they're
3793 declared in.  This can lead to shadowing between instance variables
3794 and other variables declared either locally inside a class method or
3795 globally with the same name.  Specifying the @option{-fno-local-ivars}
3796 flag disables this behavior thus avoiding variable shadowing issues.
3798 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3799 @opindex fivar-visibility
3800 Set the default instance variable visibility to the specified option
3801 so that instance variables declared outside the scope of any access
3802 modifier directives default to the specified visibility.
3804 @item -gen-decls
3805 @opindex gen-decls
3806 Dump interface declarations for all classes seen in the source file to a
3807 file named @file{@var{sourcename}.decl}.
3809 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3810 @opindex Wassign-intercept
3811 @opindex Wno-assign-intercept
3812 Warn whenever an Objective-C assignment is being intercepted by the
3813 garbage collector.
3815 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3816 @opindex Wno-protocol
3817 @opindex Wprotocol
3818 If a class is declared to implement a protocol, a warning is issued for
3819 every method in the protocol that is not implemented by the class.  The
3820 default behavior is to issue a warning for every method not explicitly
3821 implemented in the class, even if a method implementation is inherited
3822 from the superclass.  If you use the @option{-Wno-protocol} option, then
3823 methods inherited from the superclass are considered to be implemented,
3824 and no warning is issued for them.
3826 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3827 @opindex Wselector
3828 @opindex Wno-selector
3829 Warn if multiple methods of different types for the same selector are
3830 found during compilation.  The check is performed on the list of methods
3831 in the final stage of compilation.  Additionally, a check is performed
3832 for each selector appearing in a @code{@@selector(@dots{})}
3833 expression, and a corresponding method for that selector has been found
3834 during compilation.  Because these checks scan the method table only at
3835 the end of compilation, these warnings are not produced if the final
3836 stage of compilation is not reached, for example because an error is
3837 found during compilation, or because the @option{-fsyntax-only} option is
3838 being used.
3840 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3841 @opindex Wstrict-selector-match
3842 @opindex Wno-strict-selector-match
3843 Warn if multiple methods with differing argument and/or return types are
3844 found for a given selector when attempting to send a message using this
3845 selector to a receiver of type @code{id} or @code{Class}.  When this flag
3846 is off (which is the default behavior), the compiler omits such warnings
3847 if any differences found are confined to types that share the same size
3848 and alignment.
3850 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3851 @opindex Wundeclared-selector
3852 @opindex Wno-undeclared-selector
3853 Warn if a @code{@@selector(@dots{})} expression referring to an
3854 undeclared selector is found.  A selector is considered undeclared if no
3855 method with that name has been declared before the
3856 @code{@@selector(@dots{})} expression, either explicitly in an
3857 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3858 an @code{@@implementation} section.  This option always performs its
3859 checks as soon as a @code{@@selector(@dots{})} expression is found,
3860 while @option{-Wselector} only performs its checks in the final stage of
3861 compilation.  This also enforces the coding style convention
3862 that methods and selectors must be declared before being used.
3864 @item -print-objc-runtime-info
3865 @opindex print-objc-runtime-info
3866 Generate C header describing the largest structure that is passed by
3867 value, if any.
3869 @end table
3871 @node Diagnostic Message Formatting Options
3872 @section Options to Control Diagnostic Messages Formatting
3873 @cindex options to control diagnostics formatting
3874 @cindex diagnostic messages
3875 @cindex message formatting
3877 Traditionally, diagnostic messages have been formatted irrespective of
3878 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
3879 options described below
3880 to control the formatting algorithm for diagnostic messages, 
3881 e.g.@: how many characters per line, how often source location
3882 information should be reported.  Note that some language front ends may not
3883 honor these options.
3885 @table @gcctabopt
3886 @item -fmessage-length=@var{n}
3887 @opindex fmessage-length
3888 Try to format error messages so that they fit on lines of about
3889 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
3890 done; each error message appears on a single line.  This is the
3891 default for all front ends.
3893 Note - this option also affects the display of the @samp{#error} and
3894 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3895 function/type/variable attribute.  It does not however affect the
3896 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3898 @item -fdiagnostics-show-location=once
3899 @opindex fdiagnostics-show-location
3900 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
3901 reporter to emit source location information @emph{once}; that is, in
3902 case the message is too long to fit on a single physical line and has to
3903 be wrapped, the source location won't be emitted (as prefix) again,
3904 over and over, in subsequent continuation lines.  This is the default
3905 behavior.
3907 @item -fdiagnostics-show-location=every-line
3908 Only meaningful in line-wrapping mode.  Instructs the diagnostic
3909 messages reporter to emit the same source location information (as
3910 prefix) for physical lines that result from the process of breaking
3911 a message which is too long to fit on a single line.
3913 @item -fdiagnostics-color[=@var{WHEN}]
3914 @itemx -fno-diagnostics-color
3915 @opindex fdiagnostics-color
3916 @cindex highlight, color
3917 @vindex GCC_COLORS @r{environment variable}
3918 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
3919 or @samp{auto}.  The default depends on how the compiler has been configured,
3920 it can be any of the above @var{WHEN} options or also @samp{never}
3921 if @env{GCC_COLORS} environment variable isn't present in the environment,
3922 and @samp{auto} otherwise.
3923 @samp{auto} makes GCC use color only when the standard error is a terminal,
3924 and when not executing in an emacs shell.
3925 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3926 aliases for @option{-fdiagnostics-color=always} and
3927 @option{-fdiagnostics-color=never}, respectively.
3929 The colors are defined by the environment variable @env{GCC_COLORS}.
3930 Its value is a colon-separated list of capabilities and Select Graphic
3931 Rendition (SGR) substrings. SGR commands are interpreted by the
3932 terminal or terminal emulator.  (See the section in the documentation
3933 of your text terminal for permitted values and their meanings as
3934 character attributes.)  These substring values are integers in decimal
3935 representation and can be concatenated with semicolons.
3936 Common values to concatenate include
3937 @samp{1} for bold,
3938 @samp{4} for underline,
3939 @samp{5} for blink,
3940 @samp{7} for inverse,
3941 @samp{39} for default foreground color,
3942 @samp{30} to @samp{37} for foreground colors,
3943 @samp{90} to @samp{97} for 16-color mode foreground colors,
3944 @samp{38;5;0} to @samp{38;5;255}
3945 for 88-color and 256-color modes foreground colors,
3946 @samp{49} for default background color,
3947 @samp{40} to @samp{47} for background colors,
3948 @samp{100} to @samp{107} for 16-color mode background colors,
3949 and @samp{48;5;0} to @samp{48;5;255}
3950 for 88-color and 256-color modes background colors.
3952 The default @env{GCC_COLORS} is
3953 @smallexample
3954 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3955 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3956 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3957 type-diff=01;32
3958 @end smallexample
3959 @noindent
3960 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3961 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3962 @samp{01} is bold, and @samp{31} is red.
3963 Setting @env{GCC_COLORS} to the empty string disables colors.
3964 Supported capabilities are as follows.
3966 @table @code
3967 @item error=
3968 @vindex error GCC_COLORS @r{capability}
3969 SGR substring for error: markers.
3971 @item warning=
3972 @vindex warning GCC_COLORS @r{capability}
3973 SGR substring for warning: markers.
3975 @item note=
3976 @vindex note GCC_COLORS @r{capability}
3977 SGR substring for note: markers.
3979 @item path=
3980 @vindex path GCC_COLORS @r{capability}
3981 SGR substring for colorizing paths of control-flow events as printed
3982 via @option{-fdiagnostics-path-format=}, such as the identifiers of
3983 individual events and lines indicating interprocedural calls and returns.
3985 @item range1=
3986 @vindex range1 GCC_COLORS @r{capability}
3987 SGR substring for first additional range.
3989 @item range2=
3990 @vindex range2 GCC_COLORS @r{capability}
3991 SGR substring for second additional range.
3993 @item locus=
3994 @vindex locus GCC_COLORS @r{capability}
3995 SGR substring for location information, @samp{file:line} or
3996 @samp{file:line:column} etc.
3998 @item quote=
3999 @vindex quote GCC_COLORS @r{capability}
4000 SGR substring for information printed within quotes.
4002 @item fixit-insert=
4003 @vindex fixit-insert GCC_COLORS @r{capability}
4004 SGR substring for fix-it hints suggesting text to
4005 be inserted or replaced.
4007 @item fixit-delete=
4008 @vindex fixit-delete GCC_COLORS @r{capability}
4009 SGR substring for fix-it hints suggesting text to
4010 be deleted.
4012 @item diff-filename=
4013 @vindex diff-filename GCC_COLORS @r{capability}
4014 SGR substring for filename headers within generated patches.
4016 @item diff-hunk=
4017 @vindex diff-hunk GCC_COLORS @r{capability}
4018 SGR substring for the starts of hunks within generated patches.
4020 @item diff-delete=
4021 @vindex diff-delete GCC_COLORS @r{capability}
4022 SGR substring for deleted lines within generated patches.
4024 @item diff-insert=
4025 @vindex diff-insert GCC_COLORS @r{capability}
4026 SGR substring for inserted lines within generated patches.
4028 @item type-diff=
4029 @vindex type-diff GCC_COLORS @r{capability}
4030 SGR substring for highlighting mismatching types within template
4031 arguments in the C++ frontend.
4032 @end table
4034 @item -fdiagnostics-urls[=@var{WHEN}]
4035 @opindex fdiagnostics-urls
4036 @cindex urls
4037 @vindex GCC_URLS @r{environment variable}
4038 @vindex TERM_URLS @r{environment variable}
4039 Use escape sequences to embed URLs in diagnostics.  For example, when
4040 @option{-fdiagnostics-show-option} emits text showing the command-line
4041 option controlling a diagnostic, embed a URL for documentation of that
4042 option.
4044 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4045 @samp{auto} makes GCC use URL escape sequences only when the standard error
4046 is a terminal, and when not executing in an emacs shell or any graphical
4047 terminal which is known to be incompatible with this feature, see below.
4049 The default depends on how the compiler has been configured.
4050 It can be any of the above @var{WHEN} options.
4052 GCC can also be configured (via the
4053 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4054 so that the default is affected by environment variables.
4055 Under such a configuration, GCC defaults to using @samp{auto}
4056 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4057 present and non-empty in the environment of the compiler, or @samp{never}
4058 if neither are.
4060 However, even with @option{-fdiagnostics-urls=always} the behavior is
4061 dependent on those environment variables:
4062 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4063 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
4064 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4065 Any other non-empty value enables the feature.
4066 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4067 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4068 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4070 At this time GCC tries to detect also a few terminals that are known to
4071 not implement the URL feature, and have bugs or at least had bugs in
4072 some versions that are still in use, where the URL escapes are likely
4073 to misbehave, i.e. print garbage on the screen.
4074 That list is currently xfce4-terminal, certain known to be buggy
4075 gnome-terminal versions, the linux console, and mingw.
4076 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4078 @item -fno-diagnostics-show-option
4079 @opindex fno-diagnostics-show-option
4080 @opindex fdiagnostics-show-option
4081 By default, each diagnostic emitted includes text indicating the
4082 command-line option that directly controls the diagnostic (if such an
4083 option is known to the diagnostic machinery).  Specifying the
4084 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4086 @item -fno-diagnostics-show-caret
4087 @opindex fno-diagnostics-show-caret
4088 @opindex fdiagnostics-show-caret
4089 By default, each diagnostic emitted includes the original source line
4090 and a caret @samp{^} indicating the column.  This option suppresses this
4091 information.  The source line is truncated to @var{n} characters, if
4092 the @option{-fmessage-length=n} option is given.  When the output is done
4093 to the terminal, the width is limited to the width given by the
4094 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4096 @item -fno-diagnostics-show-labels
4097 @opindex fno-diagnostics-show-labels
4098 @opindex fdiagnostics-show-labels
4099 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4100 diagnostics can label ranges of source code with pertinent information, such
4101 as the types of expressions:
4103 @smallexample
4104     printf ("foo %s bar", long_i + long_j);
4105                  ~^       ~~~~~~~~~~~~~~~
4106                   |              |
4107                   char *         long int
4108 @end smallexample
4110 This option suppresses the printing of these labels (in the example above,
4111 the vertical bars and the ``char *'' and ``long int'' text).
4113 @item -fno-diagnostics-show-cwe
4114 @opindex fno-diagnostics-show-cwe
4115 @opindex fdiagnostics-show-cwe
4116 Diagnostic messages can optionally have an associated
4117 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4118 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4119 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
4120 By default, if this information is present, it will be printed with
4121 the diagnostic.  This option suppresses the printing of this metadata.
4123 @item -fno-diagnostics-show-line-numbers
4124 @opindex fno-diagnostics-show-line-numbers
4125 @opindex fdiagnostics-show-line-numbers
4126 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4127 a left margin is printed, showing line numbers.  This option suppresses this
4128 left margin.
4130 @item -fdiagnostics-minimum-margin-width=@var{width}
4131 @opindex fdiagnostics-minimum-margin-width
4132 This option controls the minimum width of the left margin printed by
4133 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
4135 @item -fdiagnostics-parseable-fixits
4136 @opindex fdiagnostics-parseable-fixits
4137 Emit fix-it hints in a machine-parseable format, suitable for consumption
4138 by IDEs.  For each fix-it, a line will be printed after the relevant
4139 diagnostic, starting with the string ``fix-it:''.  For example:
4141 @smallexample
4142 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4143 @end smallexample
4145 The location is expressed as a half-open range, expressed as a count of
4146 bytes, starting at byte 1 for the initial column.  In the above example,
4147 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4148 given string:
4150 @smallexample
4151 00000000011111111112222222222
4152 12345678901234567890123456789
4153   gtk_widget_showall (dlg);
4154   ^^^^^^^^^^^^^^^^^^
4155   gtk_widget_show_all
4156 @end smallexample
4158 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4159 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4160 (e.g. vertical tab as ``\013'').
4162 An empty replacement string indicates that the given range is to be removed.
4163 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4164 be inserted at the given position.
4166 @item -fdiagnostics-generate-patch
4167 @opindex fdiagnostics-generate-patch
4168 Print fix-it hints to stderr in unified diff format, after any diagnostics
4169 are printed.  For example:
4171 @smallexample
4172 --- test.c
4173 +++ test.c
4174 @@ -42,5 +42,5 @@
4176  void show_cb(GtkDialog *dlg)
4177  @{
4178 -  gtk_widget_showall(dlg);
4179 +  gtk_widget_show_all(dlg);
4180  @}
4182 @end smallexample
4184 The diff may or may not be colorized, following the same rules
4185 as for diagnostics (see @option{-fdiagnostics-color}).
4187 @item -fdiagnostics-show-template-tree
4188 @opindex fdiagnostics-show-template-tree
4190 In the C++ frontend, when printing diagnostics showing mismatching
4191 template types, such as:
4193 @smallexample
4194   could not convert 'std::map<int, std::vector<double> >()'
4195     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4196 @end smallexample
4198 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4199 tree-like structure showing the common and differing parts of the types,
4200 such as:
4202 @smallexample
4203   map<
4204     [...],
4205     vector<
4206       [double != float]>>
4207 @end smallexample
4209 The parts that differ are highlighted with color (``double'' and
4210 ``float'' in this case).
4212 @item -fno-elide-type
4213 @opindex fno-elide-type
4214 @opindex felide-type
4215 By default when the C++ frontend prints diagnostics showing mismatching
4216 template types, common parts of the types are printed as ``[...]'' to
4217 simplify the error message.  For example:
4219 @smallexample
4220   could not convert 'std::map<int, std::vector<double> >()'
4221     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4222 @end smallexample
4224 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4225 This flag also affects the output of the
4226 @option{-fdiagnostics-show-template-tree} flag.
4228 @item -fdiagnostics-path-format=@var{KIND}
4229 @opindex fdiagnostics-path-format
4230 Specify how to print paths of control-flow events for diagnostics that
4231 have such a path associated with them.
4233 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4234 the default.
4236 @samp{none} means to not print diagnostic paths.
4238 @samp{separate-events} means to print a separate ``note'' diagnostic for
4239 each event within the diagnostic.  For example:
4241 @smallexample
4242 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4243 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4244 test.c:27:3: note: (2) when 'i < count'
4245 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4246 @end smallexample
4248 @samp{inline-events} means to print the events ``inline'' within the source
4249 code.  This view attempts to consolidate the events into runs of
4250 sufficiently-close events, printing them as labelled ranges within the source.
4252 For example, the same events as above might be printed as:
4254 @smallexample
4255   'test': events 1-3
4256     |
4257     |   25 |   list = PyList_New(0);
4258     |      |          ^~~~~~~~~~~~~
4259     |      |          |
4260     |      |          (1) when 'PyList_New' fails, returning NULL
4261     |   26 |
4262     |   27 |   for (i = 0; i < count; i++) @{
4263     |      |   ~~~
4264     |      |   |
4265     |      |   (2) when 'i < count'
4266     |   28 |     item = PyLong_FromLong(random());
4267     |   29 |     PyList_Append(list, item);
4268     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
4269     |      |     |
4270     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4271     |
4272 @end smallexample
4274 Interprocedural control flow is shown by grouping the events by stack frame,
4275 and using indentation to show how stack frames are nested, pushed, and popped.
4277 For example:
4279 @smallexample
4280   'test': events 1-2
4281     |
4282     |  133 | @{
4283     |      | ^
4284     |      | |
4285     |      | (1) entering 'test'
4286     |  134 |   boxed_int *obj = make_boxed_int (i);
4287     |      |                    ~~~~~~~~~~~~~~~~~~
4288     |      |                    |
4289     |      |                    (2) calling 'make_boxed_int'
4290     |
4291     +--> 'make_boxed_int': events 3-4
4292            |
4293            |  120 | @{
4294            |      | ^
4295            |      | |
4296            |      | (3) entering 'make_boxed_int'
4297            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4298            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4299            |      |                                    |
4300            |      |                                    (4) calling 'wrapped_malloc'
4301            |
4302            +--> 'wrapped_malloc': events 5-6
4303                   |
4304                   |    7 | @{
4305                   |      | ^
4306                   |      | |
4307                   |      | (5) entering 'wrapped_malloc'
4308                   |    8 |   return malloc (size);
4309                   |      |          ~~~~~~~~~~~~~
4310                   |      |          |
4311                   |      |          (6) calling 'malloc'
4312                   |
4313     <-------------+
4314     |
4315  'test': event 7
4316     |
4317     |  138 |   free_boxed_int (obj);
4318     |      |   ^~~~~~~~~~~~~~~~~~~~
4319     |      |   |
4320     |      |   (7) calling 'free_boxed_int'
4321     |
4322 (etc)
4323 @end smallexample
4325 @item -fdiagnostics-show-path-depths
4326 @opindex fdiagnostics-show-path-depths
4327 This option provides additional information when printing control-flow paths
4328 associated with a diagnostic.
4330 If this is option is provided then the stack depth will be printed for
4331 each run of events within @option{-fdiagnostics-path-format=separate-events}.
4333 This is intended for use by GCC developers and plugin developers when
4334 debugging diagnostics that report interprocedural control flow.
4336 @item -fno-show-column
4337 @opindex fno-show-column
4338 @opindex fshow-column
4339 Do not print column numbers in diagnostics.  This may be necessary if
4340 diagnostics are being scanned by a program that does not understand the
4341 column numbers, such as @command{dejagnu}.
4343 @item -fdiagnostics-format=@var{FORMAT}
4344 @opindex fdiagnostics-format
4345 Select a different format for printing diagnostics.
4346 @var{FORMAT} is @samp{text} or @samp{json}.
4347 The default is @samp{text}.
4349 The @samp{json} format consists of a top-level JSON array containing JSON
4350 objects representing the diagnostics.
4352 The JSON is emitted as one line, without formatting; the examples below
4353 have been formatted for clarity.
4355 Diagnostics can have child diagnostics.  For example, this error and note:
4357 @smallexample
4358 misleading-indentation.c:15:3: warning: this 'if' clause does not
4359   guard... [-Wmisleading-indentation]
4360    15 |   if (flag)
4361       |   ^~
4362 misleading-indentation.c:17:5: note: ...this statement, but the latter
4363   is misleadingly indented as if it were guarded by the 'if'
4364    17 |     y = 2;
4365       |     ^
4366 @end smallexample
4368 @noindent
4369 might be printed in JSON form (after formatting) like this:
4371 @smallexample
4373     @{
4374         "kind": "warning",
4375         "locations": [
4376             @{
4377                 "caret": @{
4378                     "column": 3,
4379                     "file": "misleading-indentation.c",
4380                     "line": 15
4381                 @},
4382                 "finish": @{
4383                     "column": 4,
4384                     "file": "misleading-indentation.c",
4385                     "line": 15
4386                 @}
4387             @}
4388         ],
4389         "message": "this \u2018if\u2019 clause does not guard...",
4390         "option": "-Wmisleading-indentation",
4391         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4392         "children": [
4393             @{
4394                 "kind": "note",
4395                 "locations": [
4396                     @{
4397                         "caret": @{
4398                             "column": 5,
4399                             "file": "misleading-indentation.c",
4400                             "line": 17
4401                         @}
4402                     @}
4403                 ],
4404                 "message": "...this statement, but the latter is @dots{}"
4405             @}
4406         ]
4407     @},
4408     @dots{}
4410 @end smallexample
4412 @noindent
4413 where the @code{note} is a child of the @code{warning}.
4415 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
4416 an @code{option} key describing the command-line option controlling the
4417 warning.
4419 A diagnostic can contain zero or more locations.  Each location has up
4420 to three positions within it: a @code{caret} position and optional
4421 @code{start} and @code{finish} positions.  A location can also have
4422 an optional @code{label} string.  For example, this error:
4424 @smallexample
4425 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4426    'struct s'@} and 'T' @{aka 'struct t'@})
4427    64 |   return callee_4a () + callee_4b ();
4428       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4429       |          |              |
4430       |          |              T @{aka struct t@}
4431       |          S @{aka struct s@}
4432 @end smallexample
4434 @noindent
4435 has three locations.  Its primary location is at the ``+'' token at column
4436 23.  It has two secondary locations, describing the left and right-hand sides
4437 of the expression, which have labels.  It might be printed in JSON form as:
4439 @smallexample
4440     @{
4441         "children": [],
4442         "kind": "error",
4443         "locations": [
4444             @{
4445                 "caret": @{
4446                     "column": 23, "file": "bad-binary-ops.c", "line": 64
4447                 @}
4448             @},
4449             @{
4450                 "caret": @{
4451                     "column": 10, "file": "bad-binary-ops.c", "line": 64
4452                 @},
4453                 "finish": @{
4454                     "column": 21, "file": "bad-binary-ops.c", "line": 64
4455                 @},
4456                 "label": "S @{aka struct s@}"
4457             @},
4458             @{
4459                 "caret": @{
4460                     "column": 25, "file": "bad-binary-ops.c", "line": 64
4461                 @},
4462                 "finish": @{
4463                     "column": 36, "file": "bad-binary-ops.c", "line": 64
4464                 @},
4465                 "label": "T @{aka struct t@}"
4466             @}
4467         ],
4468         "message": "invalid operands to binary + @dots{}"
4469     @}
4470 @end smallexample
4472 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4473 consisting of half-open intervals, similar to the output of
4474 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
4475 with a replacement fix-it hint:
4477 @smallexample
4478 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4479   mean 'color'?
4480     8 |   return ptr->colour;
4481       |               ^~~~~~
4482       |               color
4483 @end smallexample
4485 @noindent
4486 might be printed in JSON form as:
4488 @smallexample
4489     @{
4490         "children": [],
4491         "fixits": [
4492             @{
4493                 "next": @{
4494                     "column": 21,
4495                     "file": "demo.c",
4496                     "line": 8
4497                 @},
4498                 "start": @{
4499                     "column": 15,
4500                     "file": "demo.c",
4501                     "line": 8
4502                 @},
4503                 "string": "color"
4504             @}
4505         ],
4506         "kind": "error",
4507         "locations": [
4508             @{
4509                 "caret": @{
4510                     "column": 15,
4511                     "file": "demo.c",
4512                     "line": 8
4513                 @},
4514                 "finish": @{
4515                     "column": 20,
4516                     "file": "demo.c",
4517                     "line": 8
4518                 @}
4519             @}
4520         ],
4521         "message": "\u2018struct s\u2019 has no member named @dots{}"
4522     @}
4523 @end smallexample
4525 @noindent
4526 where the fix-it hint suggests replacing the text from @code{start} up
4527 to but not including @code{next} with @code{string}'s value.  Deletions
4528 are expressed via an empty value for @code{string}, insertions by
4529 having @code{start} equal @code{next}.
4531 If the diagnostic has a path of control-flow events associated with it,
4532 it has a @code{path} array of objects representing the events.  Each
4533 event object has a @code{description} string, a @code{location} object,
4534 along with a @code{function} string and a @code{depth} number for
4535 representing interprocedural paths.  The @code{function} represents the
4536 current function at that event, and the @code{depth} represents the
4537 stack depth relative to some baseline: the higher, the more frames are
4538 within the stack.
4540 For example, the intraprocedural example shown for
4541 @option{-fdiagnostics-path-format=} might have this JSON for its path:
4543 @smallexample
4544     "path": [
4545         @{
4546             "depth": 0,
4547             "description": "when 'PyList_New' fails, returning NULL",
4548             "function": "test",
4549             "location": @{
4550                 "column": 10,
4551                 "file": "test.c",
4552                 "line": 25
4553             @}
4554         @},
4555         @{
4556             "depth": 0,
4557             "description": "when 'i < count'",
4558             "function": "test",
4559             "location": @{
4560                 "column": 3,
4561                 "file": "test.c",
4562                 "line": 27
4563             @}
4564         @},
4565         @{
4566             "depth": 0,
4567             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4568             "function": "test",
4569             "location": @{
4570                 "column": 5,
4571                 "file": "test.c",
4572                 "line": 29
4573             @}
4574         @}
4575     ]
4576 @end smallexample
4578 @end table
4580 @node Warning Options
4581 @section Options to Request or Suppress Warnings
4582 @cindex options to control warnings
4583 @cindex warning messages
4584 @cindex messages, warning
4585 @cindex suppressing warnings
4587 Warnings are diagnostic messages that report constructions that
4588 are not inherently erroneous but that are risky or suggest there
4589 may have been an error.
4591 The following language-independent options do not enable specific
4592 warnings but control the kinds of diagnostics produced by GCC@.
4594 @table @gcctabopt
4595 @cindex syntax checking
4596 @item -fsyntax-only
4597 @opindex fsyntax-only
4598 Check the code for syntax errors, but don't do anything beyond that.
4600 @item -fmax-errors=@var{n}
4601 @opindex fmax-errors
4602 Limits the maximum number of error messages to @var{n}, at which point
4603 GCC bails out rather than attempting to continue processing the source
4604 code.  If @var{n} is 0 (the default), there is no limit on the number
4605 of error messages produced.  If @option{-Wfatal-errors} is also
4606 specified, then @option{-Wfatal-errors} takes precedence over this
4607 option.
4609 @item -w
4610 @opindex w
4611 Inhibit all warning messages.
4613 @item -Werror
4614 @opindex Werror
4615 @opindex Wno-error
4616 Make all warnings into errors.
4618 @item -Werror=
4619 @opindex Werror=
4620 @opindex Wno-error=
4621 Make the specified warning into an error.  The specifier for a warning
4622 is appended; for example @option{-Werror=switch} turns the warnings
4623 controlled by @option{-Wswitch} into errors.  This switch takes a
4624 negative form, to be used to negate @option{-Werror} for specific
4625 warnings; for example @option{-Wno-error=switch} makes
4626 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4627 is in effect.
4629 The warning message for each controllable warning includes the
4630 option that controls the warning.  That option can then be used with
4631 @option{-Werror=} and @option{-Wno-error=} as described above.
4632 (Printing of the option in the warning message can be disabled using the
4633 @option{-fno-diagnostics-show-option} flag.)
4635 Note that specifying @option{-Werror=}@var{foo} automatically implies
4636 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
4637 imply anything.
4639 @item -Wfatal-errors
4640 @opindex Wfatal-errors
4641 @opindex Wno-fatal-errors
4642 This option causes the compiler to abort compilation on the first error
4643 occurred rather than trying to keep going and printing further error
4644 messages.
4646 @end table
4648 You can request many specific warnings with options beginning with
4649 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4650 implicit declarations.  Each of these specific warning options also
4651 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4652 example, @option{-Wno-implicit}.  This manual lists only one of the
4653 two forms, whichever is not the default.  For further
4654 language-specific options also refer to @ref{C++ Dialect Options} and
4655 @ref{Objective-C and Objective-C++ Dialect Options}.
4657 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4658 options, such as @option{-Wunused}, which may turn on further options,
4659 such as @option{-Wunused-value}. The combined effect of positive and
4660 negative forms is that more specific options have priority over less
4661 specific ones, independently of their position in the command-line. For
4662 options of the same specificity, the last one takes effect. Options
4663 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4664 as if they appeared at the end of the command-line.
4666 When an unrecognized warning option is requested (e.g.,
4667 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4668 that the option is not recognized.  However, if the @option{-Wno-} form
4669 is used, the behavior is slightly different: no diagnostic is
4670 produced for @option{-Wno-unknown-warning} unless other diagnostics
4671 are being produced.  This allows the use of new @option{-Wno-} options
4672 with old compilers, but if something goes wrong, the compiler
4673 warns that an unrecognized option is present.
4675 The effectiveness of some warnings depends on optimizations also being
4676 enabled. For example @option{-Wsuggest-final-types} is more effective
4677 with link-time optimization and @option{-Wmaybe-uninitialized} will not
4678 warn at all unless optimization is enabled.
4680 @table @gcctabopt
4681 @item -Wpedantic
4682 @itemx -pedantic
4683 @opindex pedantic
4684 @opindex Wpedantic
4685 @opindex Wno-pedantic
4686 Issue all the warnings demanded by strict ISO C and ISO C++;
4687 reject all programs that use forbidden extensions, and some other
4688 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
4689 version of the ISO C standard specified by any @option{-std} option used.
4691 Valid ISO C and ISO C++ programs should compile properly with or without
4692 this option (though a rare few require @option{-ansi} or a
4693 @option{-std} option specifying the required version of ISO C)@.  However,
4694 without this option, certain GNU extensions and traditional C and C++
4695 features are supported as well.  With this option, they are rejected.
4697 @option{-Wpedantic} does not cause warning messages for use of the
4698 alternate keywords whose names begin and end with @samp{__}.  This alternate
4699 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4700 i.e. @samp{__intN__}.
4701 Pedantic warnings are also disabled in the expression that follows
4702 @code{__extension__}.  However, only system header files should use
4703 these escape routes; application programs should avoid them.
4704 @xref{Alternate Keywords}.
4706 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4707 C conformance.  They soon find that it does not do quite what they want:
4708 it finds some non-ISO practices, but not all---only those for which
4709 ISO C @emph{requires} a diagnostic, and some others for which
4710 diagnostics have been added.
4712 A feature to report any failure to conform to ISO C might be useful in
4713 some instances, but would require considerable additional work and would
4714 be quite different from @option{-Wpedantic}.  We don't have plans to
4715 support such a feature in the near future.
4717 Where the standard specified with @option{-std} represents a GNU
4718 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4719 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4720 extended dialect is based.  Warnings from @option{-Wpedantic} are given
4721 where they are required by the base standard.  (It does not make sense
4722 for such warnings to be given only for features not in the specified GNU
4723 C dialect, since by definition the GNU dialects of C include all
4724 features the compiler supports with the given option, and there would be
4725 nothing to warn about.)
4727 @item -pedantic-errors
4728 @opindex pedantic-errors
4729 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4730 requires a diagnostic, in some cases where there is undefined behavior
4731 at compile-time and in some other cases that do not prevent compilation
4732 of programs that are valid according to the standard. This is not
4733 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4734 by this option and not enabled by the latter and vice versa.
4736 @item -Wall
4737 @opindex Wall
4738 @opindex Wno-all
4739 This enables all the warnings about constructions that some users
4740 consider questionable, and that are easy to avoid (or modify to
4741 prevent the warning), even in conjunction with macros.  This also
4742 enables some language-specific warnings described in @ref{C++ Dialect
4743 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4745 @option{-Wall} turns on the following warning flags:
4747 @gccoptlist{-Waddress   @gol
4748 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
4749 -Wbool-compare  @gol
4750 -Wbool-operation  @gol
4751 -Wc++11-compat  -Wc++14-compat  @gol
4752 -Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
4753 -Wchar-subscripts  @gol
4754 -Wcomment  @gol
4755 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4756 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4757 -Wenum-conversion @r{in C/ObjC;} @gol
4758 -Wformat   @gol
4759 -Wint-in-bool-context  @gol
4760 -Wimplicit @r{(C and Objective-C only)} @gol
4761 -Wimplicit-int @r{(C and Objective-C only)} @gol
4762 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4763 -Winit-self @r{(only for C++)} @gol
4764 -Wzero-length-bounds @gol
4765 -Wlogical-not-parentheses @gol
4766 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
4767 -Wmaybe-uninitialized @gol
4768 -Wmemset-elt-size @gol
4769 -Wmemset-transposed-args @gol
4770 -Wmisleading-indentation @r{(only for C/C++)} @gol
4771 -Wmissing-attributes @gol
4772 -Wmissing-braces @r{(only for C/ObjC)} @gol
4773 -Wmultistatement-macros  @gol
4774 -Wnarrowing @r{(only for C++)}  @gol
4775 -Wnonnull  @gol
4776 -Wnonnull-compare  @gol
4777 -Wopenmp-simd @gol
4778 -Wparentheses  @gol
4779 -Wpessimizing-move @r{(only for C++)}  @gol
4780 -Wpointer-sign  @gol
4781 -Wreorder   @gol
4782 -Wrestrict   @gol
4783 -Wreturn-type  @gol
4784 -Wsequence-point  @gol
4785 -Wsign-compare @r{(only in C++)}  @gol
4786 -Wsizeof-pointer-div @gol
4787 -Wsizeof-pointer-memaccess @gol
4788 -Wstrict-aliasing  @gol
4789 -Wstrict-overflow=1  @gol
4790 -Wswitch  @gol
4791 -Wtautological-compare  @gol
4792 -Wtrigraphs  @gol
4793 -Wuninitialized  @gol
4794 -Wunknown-pragmas  @gol
4795 -Wunused-function  @gol
4796 -Wunused-label     @gol
4797 -Wunused-value     @gol
4798 -Wunused-variable  @gol
4799 -Wvolatile-register-var}
4801 Note that some warning flags are not implied by @option{-Wall}.  Some of
4802 them warn about constructions that users generally do not consider
4803 questionable, but which occasionally you might wish to check for;
4804 others warn about constructions that are necessary or hard to avoid in
4805 some cases, and there is no simple way to modify the code to suppress
4806 the warning. Some of them are enabled by @option{-Wextra} but many of
4807 them must be enabled individually.
4809 @item -Wextra
4810 @opindex W
4811 @opindex Wextra
4812 @opindex Wno-extra
4813 This enables some extra warning flags that are not enabled by
4814 @option{-Wall}. (This option used to be called @option{-W}.  The older
4815 name is still supported, but the newer name is more descriptive.)
4817 @gccoptlist{-Wclobbered  @gol
4818 -Wcast-function-type  @gol
4819 -Wdeprecated-copy @r{(C++ only)} @gol
4820 -Wempty-body  @gol
4821 -Wignored-qualifiers @gol
4822 -Wimplicit-fallthrough=3 @gol
4823 -Wmissing-field-initializers  @gol
4824 -Wmissing-parameter-type @r{(C only)}  @gol
4825 -Wold-style-declaration @r{(C only)}  @gol
4826 -Woverride-init  @gol
4827 -Wsign-compare @r{(C only)} @gol
4828 -Wstring-compare @gol
4829 -Wredundant-move @r{(only for C++)}  @gol
4830 -Wtype-limits  @gol
4831 -Wuninitialized  @gol
4832 -Wshift-negative-value @r{(in C++03 and in C99 and newer)}  @gol
4833 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4834 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4837 The option @option{-Wextra} also prints warning messages for the
4838 following cases:
4840 @itemize @bullet
4842 @item
4843 A pointer is compared against integer zero with @code{<}, @code{<=},
4844 @code{>}, or @code{>=}.
4846 @item
4847 (C++ only) An enumerator and a non-enumerator both appear in a
4848 conditional expression.
4850 @item
4851 (C++ only) Ambiguous virtual bases.
4853 @item
4854 (C++ only) Subscripting an array that has been declared @code{register}.
4856 @item
4857 (C++ only) Taking the address of a variable that has been declared
4858 @code{register}.
4860 @item
4861 (C++ only) A base class is not initialized in the copy constructor
4862 of a derived class.
4864 @end itemize
4866 @item -Wchar-subscripts
4867 @opindex Wchar-subscripts
4868 @opindex Wno-char-subscripts
4869 Warn if an array subscript has type @code{char}.  This is a common cause
4870 of error, as programmers often forget that this type is signed on some
4871 machines.
4872 This warning is enabled by @option{-Wall}.
4874 @item -Wno-coverage-mismatch
4875 @opindex Wno-coverage-mismatch
4876 @opindex Wcoverage-mismatch
4877 Warn if feedback profiles do not match when using the
4878 @option{-fprofile-use} option.
4879 If a source file is changed between compiling with @option{-fprofile-generate}
4880 and with @option{-fprofile-use}, the files with the profile feedback can fail
4881 to match the source file and GCC cannot use the profile feedback
4882 information.  By default, this warning is enabled and is treated as an
4883 error.  @option{-Wno-coverage-mismatch} can be used to disable the
4884 warning or @option{-Wno-error=coverage-mismatch} can be used to
4885 disable the error.  Disabling the error for this warning can result in
4886 poorly optimized code and is useful only in the
4887 case of very minor changes such as bug fixes to an existing code-base.
4888 Completely disabling the warning is not recommended.
4890 @item -Wno-cpp
4891 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4893 Suppress warning messages emitted by @code{#warning} directives.
4895 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4896 @opindex Wdouble-promotion
4897 @opindex Wno-double-promotion
4898 Give a warning when a value of type @code{float} is implicitly
4899 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
4900 floating-point unit implement @code{float} in hardware, but emulate
4901 @code{double} in software.  On such a machine, doing computations
4902 using @code{double} values is much more expensive because of the
4903 overhead required for software emulation.
4905 It is easy to accidentally do computations with @code{double} because
4906 floating-point literals are implicitly of type @code{double}.  For
4907 example, in:
4908 @smallexample
4909 @group
4910 float area(float radius)
4912    return 3.14159 * radius * radius;
4914 @end group
4915 @end smallexample
4916 the compiler performs the entire computation with @code{double}
4917 because the floating-point literal is a @code{double}.
4919 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4920 @opindex Wduplicate-decl-specifier
4921 @opindex Wno-duplicate-decl-specifier
4922 Warn if a declaration has duplicate @code{const}, @code{volatile},
4923 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
4924 @option{-Wall}.
4926 @item -Wformat
4927 @itemx -Wformat=@var{n}
4928 @opindex Wformat
4929 @opindex Wno-format
4930 @opindex ffreestanding
4931 @opindex fno-builtin
4932 @opindex Wformat=
4933 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4934 the arguments supplied have types appropriate to the format string
4935 specified, and that the conversions specified in the format string make
4936 sense.  This includes standard functions, and others specified by format
4937 attributes (@pxref{Function Attributes}), in the @code{printf},
4938 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4939 not in the C standard) families (or other target-specific families).
4940 Which functions are checked without format attributes having been
4941 specified depends on the standard version selected, and such checks of
4942 functions without the attribute specified are disabled by
4943 @option{-ffreestanding} or @option{-fno-builtin}.
4945 The formats are checked against the format features supported by GNU
4946 libc version 2.2.  These include all ISO C90 and C99 features, as well
4947 as features from the Single Unix Specification and some BSD and GNU
4948 extensions.  Other library implementations may not support all these
4949 features; GCC does not support warning about features that go beyond a
4950 particular library's limitations.  However, if @option{-Wpedantic} is used
4951 with @option{-Wformat}, warnings are given about format features not
4952 in the selected standard version (but not for @code{strfmon} formats,
4953 since those are not in any version of the C standard).  @xref{C Dialect
4954 Options,,Options Controlling C Dialect}.
4956 @table @gcctabopt
4957 @item -Wformat=1
4958 @itemx -Wformat
4959 @opindex Wformat
4960 @opindex Wformat=1
4961 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4962 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
4963 @option{-Wformat} also checks for null format arguments for several
4964 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
4965 aspects of this level of format checking can be disabled by the
4966 options: @option{-Wno-format-contains-nul},
4967 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4968 @option{-Wformat} is enabled by @option{-Wall}.
4970 @item -Wno-format-contains-nul
4971 @opindex Wno-format-contains-nul
4972 @opindex Wformat-contains-nul
4973 If @option{-Wformat} is specified, do not warn about format strings that
4974 contain NUL bytes.
4976 @item -Wno-format-extra-args
4977 @opindex Wno-format-extra-args
4978 @opindex Wformat-extra-args
4979 If @option{-Wformat} is specified, do not warn about excess arguments to a
4980 @code{printf} or @code{scanf} format function.  The C standard specifies
4981 that such arguments are ignored.
4983 Where the unused arguments lie between used arguments that are
4984 specified with @samp{$} operand number specifications, normally
4985 warnings are still given, since the implementation could not know what
4986 type to pass to @code{va_arg} to skip the unused arguments.  However,
4987 in the case of @code{scanf} formats, this option suppresses the
4988 warning if the unused arguments are all pointers, since the Single
4989 Unix Specification says that such unused arguments are allowed.
4991 @item -Wformat-overflow
4992 @itemx -Wformat-overflow=@var{level}
4993 @opindex Wformat-overflow
4994 @opindex Wno-format-overflow
4995 Warn about calls to formatted input/output functions such as @code{sprintf}
4996 and @code{vsprintf} that might overflow the destination buffer.  When the
4997 exact number of bytes written by a format directive cannot be determined
4998 at compile-time it is estimated based on heuristics that depend on the
4999 @var{level} argument and on optimization.  While enabling optimization
5000 will in most cases improve the accuracy of the warning, it may also
5001 result in false positives.
5003 @table @gcctabopt
5004 @item -Wformat-overflow
5005 @itemx -Wformat-overflow=1
5006 @opindex Wformat-overflow
5007 @opindex Wno-format-overflow
5008 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5009 employs a conservative approach that warns only about calls that most
5010 likely overflow the buffer.  At this level, numeric arguments to format
5011 directives with unknown values are assumed to have the value of one, and
5012 strings of unknown length to be empty.  Numeric arguments that are known
5013 to be bounded to a subrange of their type, or string arguments whose output
5014 is bounded either by their directive's precision or by a finite set of
5015 string literals, are assumed to take on the value within the range that
5016 results in the most bytes on output.  For example, the call to @code{sprintf}
5017 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5018 the terminating NUL character (@code{'\0'}) appended by the function
5019 to the destination buffer will be written past its end.  Increasing
5020 the size of the buffer by a single byte is sufficient to avoid the
5021 warning, though it may not be sufficient to avoid the overflow.
5023 @smallexample
5024 void f (int a, int b)
5026   char buf [13];
5027   sprintf (buf, "a = %i, b = %i\n", a, b);
5029 @end smallexample
5031 @item -Wformat-overflow=2
5032 Level @var{2} warns also about calls that might overflow the destination
5033 buffer given an argument of sufficient length or magnitude.  At level
5034 @var{2}, unknown numeric arguments are assumed to have the minimum
5035 representable value for signed types with a precision greater than 1, and
5036 the maximum representable value otherwise.  Unknown string arguments whose
5037 length cannot be assumed to be bounded either by the directive's precision,
5038 or by a finite set of string literals they may evaluate to, or the character
5039 array they may point to, are assumed to be 1 character long.
5041 At level @var{2}, the call in the example above is again diagnosed, but
5042 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5043 @code{%i} directive will write some of its digits beyond the end of
5044 the destination buffer.  To make the call safe regardless of the values
5045 of the two variables, the size of the destination buffer must be increased
5046 to at least 34 bytes.  GCC includes the minimum size of the buffer in
5047 an informational note following the warning.
5049 An alternative to increasing the size of the destination buffer is to
5050 constrain the range of formatted values.  The maximum length of string
5051 arguments can be bounded by specifying the precision in the format
5052 directive.  When numeric arguments of format directives can be assumed
5053 to be bounded by less than the precision of their type, choosing
5054 an appropriate length modifier to the format specifier will reduce
5055 the required buffer size.  For example, if @var{a} and @var{b} in the
5056 example above can be assumed to be within the precision of
5057 the @code{short int} type then using either the @code{%hi} format
5058 directive or casting the argument to @code{short} reduces the maximum
5059 required size of the buffer to 24 bytes.
5061 @smallexample
5062 void f (int a, int b)
5064   char buf [23];
5065   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5067 @end smallexample
5068 @end table
5070 @item -Wno-format-zero-length
5071 @opindex Wno-format-zero-length
5072 @opindex Wformat-zero-length
5073 If @option{-Wformat} is specified, do not warn about zero-length formats.
5074 The C standard specifies that zero-length formats are allowed.
5077 @item -Wformat=2
5078 @opindex Wformat=2
5079 Enable @option{-Wformat} plus additional format checks.  Currently
5080 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5081 -Wformat-y2k}.
5083 @item -Wformat-nonliteral
5084 @opindex Wformat-nonliteral
5085 @opindex Wno-format-nonliteral
5086 If @option{-Wformat} is specified, also warn if the format string is not a
5087 string literal and so cannot be checked, unless the format function
5088 takes its format arguments as a @code{va_list}.
5090 @item -Wformat-security
5091 @opindex Wformat-security
5092 @opindex Wno-format-security
5093 If @option{-Wformat} is specified, also warn about uses of format
5094 functions that represent possible security problems.  At present, this
5095 warns about calls to @code{printf} and @code{scanf} functions where the
5096 format string is not a string literal and there are no format arguments,
5097 as in @code{printf (foo);}.  This may be a security hole if the format
5098 string came from untrusted input and contains @samp{%n}.  (This is
5099 currently a subset of what @option{-Wformat-nonliteral} warns about, but
5100 in future warnings may be added to @option{-Wformat-security} that are not
5101 included in @option{-Wformat-nonliteral}.)
5103 @item -Wformat-signedness
5104 @opindex Wformat-signedness
5105 @opindex Wno-format-signedness
5106 If @option{-Wformat} is specified, also warn if the format string
5107 requires an unsigned argument and the argument is signed and vice versa.
5109 @item -Wformat-truncation
5110 @itemx -Wformat-truncation=@var{level}
5111 @opindex Wformat-truncation
5112 @opindex Wno-format-truncation
5113 Warn about calls to formatted input/output functions such as @code{snprintf}
5114 and @code{vsnprintf} that might result in output truncation.  When the exact
5115 number of bytes written by a format directive cannot be determined at
5116 compile-time it is estimated based on heuristics that depend on
5117 the @var{level} argument and on optimization.  While enabling optimization
5118 will in most cases improve the accuracy of the warning, it may also result
5119 in false positives.  Except as noted otherwise, the option uses the same
5120 logic @option{-Wformat-overflow}.
5122 @table @gcctabopt
5123 @item -Wformat-truncation
5124 @itemx -Wformat-truncation=1
5125 @opindex Wformat-truncation
5126 @opindex Wno-format-truncation
5127 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5128 employs a conservative approach that warns only about calls to bounded
5129 functions whose return value is unused and that will most likely result
5130 in output truncation.
5132 @item -Wformat-truncation=2
5133 Level @var{2} warns also about calls to bounded functions whose return
5134 value is used and that might result in truncation given an argument of
5135 sufficient length or magnitude.
5136 @end table
5138 @item -Wformat-y2k
5139 @opindex Wformat-y2k
5140 @opindex Wno-format-y2k
5141 If @option{-Wformat} is specified, also warn about @code{strftime}
5142 formats that may yield only a two-digit year.
5143 @end table
5145 @item -Wnonnull
5146 @opindex Wnonnull
5147 @opindex Wno-nonnull
5148 Warn about passing a null pointer for arguments marked as
5149 requiring a non-null value by the @code{nonnull} function attribute.
5151 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
5152 can be disabled with the @option{-Wno-nonnull} option.
5154 @item -Wnonnull-compare
5155 @opindex Wnonnull-compare
5156 @opindex Wno-nonnull-compare
5157 Warn when comparing an argument marked with the @code{nonnull}
5158 function attribute against null inside the function.
5160 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
5161 can be disabled with the @option{-Wno-nonnull-compare} option.
5163 @item -Wnull-dereference
5164 @opindex Wnull-dereference
5165 @opindex Wno-null-dereference
5166 Warn if the compiler detects paths that trigger erroneous or
5167 undefined behavior due to dereferencing a null pointer.  This option
5168 is only active when @option{-fdelete-null-pointer-checks} is active,
5169 which is enabled by optimizations in most targets.  The precision of
5170 the warnings depends on the optimization options used.
5172 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
5173 @opindex Winaccessible-base
5174 @opindex Wno-inaccessible-base
5175 Warn when a base class is inaccessible in a class derived from it due to
5176 ambiguity.  The warning is enabled by default.  Note the warning for virtual
5177 bases is enabled by the @option{-Wextra} option.
5178 @smallexample
5179 @group
5180 struct A @{ int a; @};
5182 struct B : A @{ @};
5184 struct C : B, A @{ @};
5185 @end group
5186 @end smallexample
5188 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5189 @opindex Winit-self
5190 @opindex Wno-init-self
5191 Warn about uninitialized variables that are initialized with themselves.
5192 Note this option can only be used with the @option{-Wuninitialized} option.
5194 For example, GCC warns about @code{i} being uninitialized in the
5195 following snippet only when @option{-Winit-self} has been specified:
5196 @smallexample
5197 @group
5198 int f()
5200   int i = i;
5201   return i;
5203 @end group
5204 @end smallexample
5206 This warning is enabled by @option{-Wall} in C++.
5208 @item -Wimplicit-int @r{(C and Objective-C only)}
5209 @opindex Wimplicit-int
5210 @opindex Wno-implicit-int
5211 Warn when a declaration does not specify a type.
5212 This warning is enabled by @option{-Wall}.
5214 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
5215 @opindex Wimplicit-function-declaration
5216 @opindex Wno-implicit-function-declaration
5217 Give a warning whenever a function is used before being declared. In
5218 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
5219 enabled by default and it is made into an error by
5220 @option{-pedantic-errors}. This warning is also enabled by
5221 @option{-Wall}.
5223 @item -Wimplicit @r{(C and Objective-C only)}
5224 @opindex Wimplicit
5225 @opindex Wno-implicit
5226 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5227 This warning is enabled by @option{-Wall}.
5229 @item -Wimplicit-fallthrough
5230 @opindex Wimplicit-fallthrough
5231 @opindex Wno-implicit-fallthrough
5232 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5233 and @option{-Wno-implicit-fallthrough} is the same as
5234 @option{-Wimplicit-fallthrough=0}.
5236 @item -Wimplicit-fallthrough=@var{n}
5237 @opindex Wimplicit-fallthrough=
5238 Warn when a switch case falls through.  For example:
5240 @smallexample
5241 @group
5242 switch (cond)
5243   @{
5244   case 1:
5245     a = 1;
5246     break;
5247   case 2:
5248     a = 2;
5249   case 3:
5250     a = 3;
5251     break;
5252   @}
5253 @end group
5254 @end smallexample
5256 This warning does not warn when the last statement of a case cannot
5257 fall through, e.g. when there is a return statement or a call to function
5258 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
5259 also takes into account control flow statements, such as ifs, and only
5260 warns when appropriate.  E.g.@:
5262 @smallexample
5263 @group
5264 switch (cond)
5265   @{
5266   case 1:
5267     if (i > 3) @{
5268       bar (5);
5269       break;
5270     @} else if (i < 1) @{
5271       bar (0);
5272     @} else
5273       return;
5274   default:
5275     @dots{}
5276   @}
5277 @end group
5278 @end smallexample
5280 Since there are occasions where a switch case fall through is desirable,
5281 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5282 to be used along with a null statement to suppress this warning that
5283 would normally occur:
5285 @smallexample
5286 @group
5287 switch (cond)
5288   @{
5289   case 1:
5290     bar (0);
5291     __attribute__ ((fallthrough));
5292   default:
5293     @dots{}
5294   @}
5295 @end group
5296 @end smallexample
5298 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5299 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
5300 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5301 Instead of these attributes, it is also possible to add a fallthrough comment
5302 to silence the warning.  The whole body of the C or C++ style comment should
5303 match the given regular expressions listed below.  The option argument @var{n}
5304 specifies what kind of comments are accepted:
5306 @itemize @bullet
5308 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5310 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5311 expression, any comment is used as fallthrough comment.
5313 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
5314 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5316 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5317 following regular expressions:
5319 @itemize @bullet
5321 @item @code{-fallthrough}
5323 @item @code{@@fallthrough@@}
5325 @item @code{lint -fallthrough[ \t]*}
5327 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5329 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5331 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5333 @end itemize
5335 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5336 following regular expressions:
5338 @itemize @bullet
5340 @item @code{-fallthrough}
5342 @item @code{@@fallthrough@@}
5344 @item @code{lint -fallthrough[ \t]*}
5346 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5348 @end itemize
5350 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5351 fallthrough comments, only attributes disable the warning.
5353 @end itemize
5355 The comment needs to be followed after optional whitespace and other comments
5356 by @code{case} or @code{default} keywords or by a user label that precedes some
5357 @code{case} or @code{default} label.
5359 @smallexample
5360 @group
5361 switch (cond)
5362   @{
5363   case 1:
5364     bar (0);
5365     /* FALLTHRU */
5366   default:
5367     @dots{}
5368   @}
5369 @end group
5370 @end smallexample
5372 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5374 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5375 @opindex Wif-not-aligned
5376 @opindex Wno-if-not-aligned
5377 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5378 should be issued.  This is enabled by default.
5379 Use @option{-Wno-if-not-aligned} to disable it.
5381 @item -Wignored-qualifiers @r{(C and C++ only)}
5382 @opindex Wignored-qualifiers
5383 @opindex Wno-ignored-qualifiers
5384 Warn if the return type of a function has a type qualifier
5385 such as @code{const}.  For ISO C such a type qualifier has no effect,
5386 since the value returned by a function is not an lvalue.
5387 For C++, the warning is only emitted for scalar types or @code{void}.
5388 ISO C prohibits qualified @code{void} return types on function
5389 definitions, so such return types always receive a warning
5390 even without this option.
5392 This warning is also enabled by @option{-Wextra}.
5394 @item -Wignored-attributes @r{(C and C++ only)}
5395 @opindex Wignored-attributes
5396 @opindex Wno-ignored-attributes
5397 Warn when an attribute is ignored.  This is different from the
5398 @option{-Wattributes} option in that it warns whenever the compiler decides
5399 to drop an attribute, not that the attribute is either unknown, used in a
5400 wrong place, etc.  This warning is enabled by default.
5402 @item -Wmain
5403 @opindex Wmain
5404 @opindex Wno-main
5405 Warn if the type of @code{main} is suspicious.  @code{main} should be
5406 a function with external linkage, returning int, taking either zero
5407 arguments, two, or three arguments of appropriate types.  This warning
5408 is enabled by default in C++ and is enabled by either @option{-Wall}
5409 or @option{-Wpedantic}.
5411 @item -Wmisleading-indentation @r{(C and C++ only)}
5412 @opindex Wmisleading-indentation
5413 @opindex Wno-misleading-indentation
5414 Warn when the indentation of the code does not reflect the block structure.
5415 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5416 @code{for} clauses with a guarded statement that does not use braces,
5417 followed by an unguarded statement with the same indentation.
5419 In the following example, the call to ``bar'' is misleadingly indented as
5420 if it were guarded by the ``if'' conditional.
5422 @smallexample
5423   if (some_condition ())
5424     foo ();
5425     bar ();  /* Gotcha: this is not guarded by the "if".  */
5426 @end smallexample
5428 In the case of mixed tabs and spaces, the warning uses the
5429 @option{-ftabstop=} option to determine if the statements line up
5430 (defaulting to 8).
5432 The warning is not issued for code involving multiline preprocessor logic
5433 such as the following example.
5435 @smallexample
5436   if (flagA)
5437     foo (0);
5438 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5439   if (flagB)
5440 #endif
5441     foo (1);
5442 @end smallexample
5444 The warning is not issued after a @code{#line} directive, since this
5445 typically indicates autogenerated code, and no assumptions can be made
5446 about the layout of the file that the directive references.
5448 This warning is enabled by @option{-Wall} in C and C++.
5450 @item -Wmissing-attributes
5451 @opindex Wmissing-attributes
5452 @opindex Wno-missing-attributes
5453 Warn when a declaration of a function is missing one or more attributes
5454 that a related function is declared with and whose absence may adversely
5455 affect the correctness or efficiency of generated code.  For example,
5456 the warning is issued for declarations of aliases that use attributes
5457 to specify less restrictive requirements than those of their targets.
5458 This typically represents a potential optimization opportunity.
5459 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5460 issued when the alias is more restrictive than the target, which could
5461 lead to incorrect code generation.
5462 Attributes considered include @code{alloc_align}, @code{alloc_size},
5463 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5464 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5465 @code{returns_nonnull}, and @code{returns_twice}.
5467 In C++, the warning is issued when an explicit specialization of a primary
5468 template declared with attribute @code{alloc_align}, @code{alloc_size},
5469 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5470 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
5471 @code{error}, and @code{warning} suppress the warning.
5472 (@pxref{Function Attributes}).
5474 You can use the @code{copy} attribute to apply the same
5475 set of attributes to a declaration as that on another declaration without
5476 explicitly enumerating the attributes. This attribute can be applied
5477 to declarations of functions (@pxref{Common Function Attributes}),
5478 variables (@pxref{Common Variable Attributes}), or types
5479 (@pxref{Common Type Attributes}).
5481 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5483 For example, since the declaration of the primary function template
5484 below makes use of both attribute @code{malloc} and @code{alloc_size}
5485 the declaration of the explicit specialization of the template is
5486 diagnosed because it is missing one of the attributes.
5488 @smallexample
5489 template <class T>
5490 T* __attribute__ ((malloc, alloc_size (1)))
5491 allocate (size_t);
5493 template <>
5494 void* __attribute__ ((malloc))   // missing alloc_size
5495 allocate<void> (size_t);
5496 @end smallexample
5498 @item -Wmissing-braces
5499 @opindex Wmissing-braces
5500 @opindex Wno-missing-braces
5501 Warn if an aggregate or union initializer is not fully bracketed.  In
5502 the following example, the initializer for @code{a} is not fully
5503 bracketed, but that for @code{b} is fully bracketed.  This warning is
5504 enabled by @option{-Wall} in C.
5506 @smallexample
5507 int a[2][2] = @{ 0, 1, 2, 3 @};
5508 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5509 @end smallexample
5511 This warning is enabled by @option{-Wall}.
5513 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5514 @opindex Wmissing-include-dirs
5515 @opindex Wno-missing-include-dirs
5516 Warn if a user-supplied include directory does not exist.
5518 @item -Wmissing-profile
5519 @opindex Wmissing-profile
5520 @opindex Wno-missing-profile
5521 Warn if feedback profiles are missing when using the
5522 @option{-fprofile-use} option.
5523 This option diagnoses those cases where a new function or a new file is added
5524 to the user code between compiling with @option{-fprofile-generate} and with
5525 @option{-fprofile-use}, without regenerating the profiles.  In these cases, the
5526 profile feedback data files do not contain any profile feedback information for
5527 the newly added function or file respectively.  Also, in the case when profile
5528 count data (.gcda) files are removed, GCC cannot use any profile feedback
5529 information.  In all these cases, warnings are issued to inform the user that a
5530 profile generation step is due.  @option{-Wno-missing-profile} can be used to
5531 disable the warning.  Ignoring the warning can result in poorly optimized code.
5532 Completely disabling the warning is not recommended and should be done only
5533 when non-existent profile data is justified.
5535 @item -Wmultistatement-macros
5536 @opindex Wmultistatement-macros
5537 @opindex Wno-multistatement-macros
5538 Warn about unsafe multiple statement macros that appear to be guarded
5539 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5540 @code{while}, in which only the first statement is actually guarded after
5541 the macro is expanded.
5543 For example:
5545 @smallexample
5546 #define DOIT x++; y++
5547 if (c)
5548   DOIT;
5549 @end smallexample
5551 will increment @code{y} unconditionally, not just when @code{c} holds.
5552 The can usually be fixed by wrapping the macro in a do-while loop:
5553 @smallexample
5554 #define DOIT do @{ x++; y++; @} while (0)
5555 if (c)
5556   DOIT;
5557 @end smallexample
5559 This warning is enabled by @option{-Wall} in C and C++.
5561 @item -Wparentheses
5562 @opindex Wparentheses
5563 @opindex Wno-parentheses
5564 Warn if parentheses are omitted in certain contexts, such
5565 as when there is an assignment in a context where a truth value
5566 is expected, or when operators are nested whose precedence people
5567 often get confused about.
5569 Also warn if a comparison like @code{x<=y<=z} appears; this is
5570 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5571 interpretation from that of ordinary mathematical notation.
5573 Also warn for dangerous uses of the GNU extension to
5574 @code{?:} with omitted middle operand. When the condition
5575 in the @code{?}: operator is a boolean expression, the omitted value is
5576 always 1.  Often programmers expect it to be a value computed
5577 inside the conditional expression instead.
5579 For C++ this also warns for some cases of unnecessary parentheses in
5580 declarations, which can indicate an attempt at a function call instead
5581 of a declaration:
5582 @smallexample
5584   // Declares a local variable called mymutex.
5585   std::unique_lock<std::mutex> (mymutex);
5586   // User meant std::unique_lock<std::mutex> lock (mymutex);
5588 @end smallexample
5590 This warning is enabled by @option{-Wall}.
5592 @item -Wsequence-point
5593 @opindex Wsequence-point
5594 @opindex Wno-sequence-point
5595 Warn about code that may have undefined semantics because of violations
5596 of sequence point rules in the C and C++ standards.
5598 The C and C++ standards define the order in which expressions in a C/C++
5599 program are evaluated in terms of @dfn{sequence points}, which represent
5600 a partial ordering between the execution of parts of the program: those
5601 executed before the sequence point, and those executed after it.  These
5602 occur after the evaluation of a full expression (one which is not part
5603 of a larger expression), after the evaluation of the first operand of a
5604 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5605 function is called (but after the evaluation of its arguments and the
5606 expression denoting the called function), and in certain other places.
5607 Other than as expressed by the sequence point rules, the order of
5608 evaluation of subexpressions of an expression is not specified.  All
5609 these rules describe only a partial order rather than a total order,
5610 since, for example, if two functions are called within one expression
5611 with no sequence point between them, the order in which the functions
5612 are called is not specified.  However, the standards committee have
5613 ruled that function calls do not overlap.
5615 It is not specified when between sequence points modifications to the
5616 values of objects take effect.  Programs whose behavior depends on this
5617 have undefined behavior; the C and C++ standards specify that ``Between
5618 the previous and next sequence point an object shall have its stored
5619 value modified at most once by the evaluation of an expression.
5620 Furthermore, the prior value shall be read only to determine the value
5621 to be stored.''.  If a program breaks these rules, the results on any
5622 particular implementation are entirely unpredictable.
5624 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5625 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
5626 diagnosed by this option, and it may give an occasional false positive
5627 result, but in general it has been found fairly effective at detecting
5628 this sort of problem in programs.
5630 The C++17 standard will define the order of evaluation of operands in
5631 more cases: in particular it requires that the right-hand side of an
5632 assignment be evaluated before the left-hand side, so the above
5633 examples are no longer undefined.  But this warning will still warn
5634 about them, to help people avoid writing code that is undefined in C
5635 and earlier revisions of C++.
5637 The standard is worded confusingly, therefore there is some debate
5638 over the precise meaning of the sequence point rules in subtle cases.
5639 Links to discussions of the problem, including proposed formal
5640 definitions, may be found on the GCC readings page, at
5641 @uref{http://gcc.gnu.org/@/readings.html}.
5643 This warning is enabled by @option{-Wall} for C and C++.
5645 @item -Wno-return-local-addr
5646 @opindex Wno-return-local-addr
5647 @opindex Wreturn-local-addr
5648 Do not warn about returning a pointer (or in C++, a reference) to a
5649 variable that goes out of scope after the function returns.
5651 @item -Wreturn-type
5652 @opindex Wreturn-type
5653 @opindex Wno-return-type
5654 Warn whenever a function is defined with a return type that defaults
5655 to @code{int}.  Also warn about any @code{return} statement with no
5656 return value in a function whose return type is not @code{void}
5657 (falling off the end of the function body is considered returning
5658 without a value).
5660 For C only, warn about a @code{return} statement with an expression in a
5661 function whose return type is @code{void}, unless the expression type is
5662 also @code{void}.  As a GNU extension, the latter case is accepted
5663 without a warning unless @option{-Wpedantic} is used.  Attempting
5664 to use the return value of a non-@code{void} function other than @code{main}
5665 that flows off the end by reaching the closing curly brace that terminates
5666 the function is undefined.
5668 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5669 than @code{main} results in undefined behavior even when the value of
5670 the function is not used.
5672 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5674 @item -Wshift-count-negative
5675 @opindex Wshift-count-negative
5676 @opindex Wno-shift-count-negative
5677 Warn if shift count is negative. This warning is enabled by default.
5679 @item -Wshift-count-overflow
5680 @opindex Wshift-count-overflow
5681 @opindex Wno-shift-count-overflow
5682 Warn if shift count >= width of type. This warning is enabled by default.
5684 @item -Wshift-negative-value
5685 @opindex Wshift-negative-value
5686 @opindex Wno-shift-negative-value
5687 Warn if left shifting a negative value.  This warning is enabled by
5688 @option{-Wextra} in C99 and C++11 modes (and newer).
5690 @item -Wshift-overflow
5691 @itemx -Wshift-overflow=@var{n}
5692 @opindex Wshift-overflow
5693 @opindex Wno-shift-overflow
5694 Warn about left shift overflows.  This warning is enabled by
5695 default in C99 and C++11 modes (and newer).
5697 @table @gcctabopt
5698 @item -Wshift-overflow=1
5699 This is the warning level of @option{-Wshift-overflow} and is enabled
5700 by default in C99 and C++11 modes (and newer).  This warning level does
5701 not warn about left-shifting 1 into the sign bit.  (However, in C, such
5702 an overflow is still rejected in contexts where an integer constant expression
5703 is required.)  No warning is emitted in C++2A mode (and newer), as signed left
5704 shifts always wrap.
5706 @item -Wshift-overflow=2
5707 This warning level also warns about left-shifting 1 into the sign bit,
5708 unless C++14 mode (or newer) is active.
5709 @end table
5711 @item -Wswitch
5712 @opindex Wswitch
5713 @opindex Wno-switch
5714 Warn whenever a @code{switch} statement has an index of enumerated type
5715 and lacks a @code{case} for one or more of the named codes of that
5716 enumeration.  (The presence of a @code{default} label prevents this
5717 warning.)  @code{case} labels outside the enumeration range also
5718 provoke warnings when this option is used (even if there is a
5719 @code{default} label).
5720 This warning is enabled by @option{-Wall}.
5722 @item -Wswitch-default
5723 @opindex Wswitch-default
5724 @opindex Wno-switch-default
5725 Warn whenever a @code{switch} statement does not have a @code{default}
5726 case.
5728 @item -Wswitch-enum
5729 @opindex Wswitch-enum
5730 @opindex Wno-switch-enum
5731 Warn whenever a @code{switch} statement has an index of enumerated type
5732 and lacks a @code{case} for one or more of the named codes of that
5733 enumeration.  @code{case} labels outside the enumeration range also
5734 provoke warnings when this option is used.  The only difference
5735 between @option{-Wswitch} and this option is that this option gives a
5736 warning about an omitted enumeration code even if there is a
5737 @code{default} label.
5739 @item -Wswitch-bool
5740 @opindex Wswitch-bool
5741 @opindex Wno-switch-bool
5742 Warn whenever a @code{switch} statement has an index of boolean type
5743 and the case values are outside the range of a boolean type.
5744 It is possible to suppress this warning by casting the controlling
5745 expression to a type other than @code{bool}.  For example:
5746 @smallexample
5747 @group
5748 switch ((int) (a == 4))
5749   @{
5750   @dots{}
5751   @}
5752 @end group
5753 @end smallexample
5754 This warning is enabled by default for C and C++ programs.
5756 @item -Wswitch-outside-range
5757 @opindex Wswitch-outside-range
5758 @opindex Wno-switch-outside-range
5759 Warn whenever a @code{switch} case has a value that is outside of its
5760 respective type range.  This warning is enabled by default for
5761 C and C++ programs.
5763 @item -Wswitch-unreachable
5764 @opindex Wswitch-unreachable
5765 @opindex Wno-switch-unreachable
5766 Warn whenever a @code{switch} statement contains statements between the
5767 controlling expression and the first case label, which will never be
5768 executed.  For example:
5769 @smallexample
5770 @group
5771 switch (cond)
5772   @{
5773    i = 15;
5774   @dots{}
5775    case 5:
5776   @dots{}
5777   @}
5778 @end group
5779 @end smallexample
5780 @option{-Wswitch-unreachable} does not warn if the statement between the
5781 controlling expression and the first case label is just a declaration:
5782 @smallexample
5783 @group
5784 switch (cond)
5785   @{
5786    int i;
5787   @dots{}
5788    case 5:
5789    i = 5;
5790   @dots{}
5791   @}
5792 @end group
5793 @end smallexample
5794 This warning is enabled by default for C and C++ programs.
5796 @item -Wsync-nand @r{(C and C++ only)}
5797 @opindex Wsync-nand
5798 @opindex Wno-sync-nand
5799 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5800 built-in functions are used.  These functions changed semantics in GCC 4.4.
5802 @item -Wunused-but-set-parameter
5803 @opindex Wunused-but-set-parameter
5804 @opindex Wno-unused-but-set-parameter
5805 Warn whenever a function parameter is assigned to, but otherwise unused
5806 (aside from its declaration).
5808 To suppress this warning use the @code{unused} attribute
5809 (@pxref{Variable Attributes}).
5811 This warning is also enabled by @option{-Wunused} together with
5812 @option{-Wextra}.
5814 @item -Wunused-but-set-variable
5815 @opindex Wunused-but-set-variable
5816 @opindex Wno-unused-but-set-variable
5817 Warn whenever a local variable is assigned to, but otherwise unused
5818 (aside from its declaration).
5819 This warning is enabled by @option{-Wall}.
5821 To suppress this warning use the @code{unused} attribute
5822 (@pxref{Variable Attributes}).
5824 This warning is also enabled by @option{-Wunused}, which is enabled
5825 by @option{-Wall}.
5827 @item -Wunused-function
5828 @opindex Wunused-function
5829 @opindex Wno-unused-function
5830 Warn whenever a static function is declared but not defined or a
5831 non-inline static function is unused.
5832 This warning is enabled by @option{-Wall}.
5834 @item -Wunused-label
5835 @opindex Wunused-label
5836 @opindex Wno-unused-label
5837 Warn whenever a label is declared but not used.
5838 This warning is enabled by @option{-Wall}.
5840 To suppress this warning use the @code{unused} attribute
5841 (@pxref{Variable Attributes}).
5843 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5844 @opindex Wunused-local-typedefs
5845 @opindex Wno-unused-local-typedefs
5846 Warn when a typedef locally defined in a function is not used.
5847 This warning is enabled by @option{-Wall}.
5849 @item -Wunused-parameter
5850 @opindex Wunused-parameter
5851 @opindex Wno-unused-parameter
5852 Warn whenever a function parameter is unused aside from its declaration.
5854 To suppress this warning use the @code{unused} attribute
5855 (@pxref{Variable Attributes}).
5857 @item -Wno-unused-result
5858 @opindex Wunused-result
5859 @opindex Wno-unused-result
5860 Do not warn if a caller of a function marked with attribute
5861 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5862 its return value. The default is @option{-Wunused-result}.
5864 @item -Wunused-variable
5865 @opindex Wunused-variable
5866 @opindex Wno-unused-variable
5867 Warn whenever a local or static variable is unused aside from its
5868 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5869 but not for C++. This warning is enabled by @option{-Wall}.
5871 To suppress this warning use the @code{unused} attribute
5872 (@pxref{Variable Attributes}).
5874 @item -Wunused-const-variable
5875 @itemx -Wunused-const-variable=@var{n}
5876 @opindex Wunused-const-variable
5877 @opindex Wno-unused-const-variable
5878 Warn whenever a constant static variable is unused aside from its declaration.
5879 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5880 for C, but not for C++. In C this declares variable storage, but in C++ this
5881 is not an error since const variables take the place of @code{#define}s.
5883 To suppress this warning use the @code{unused} attribute
5884 (@pxref{Variable Attributes}).
5886 @table @gcctabopt
5887 @item -Wunused-const-variable=1
5888 This is the warning level that is enabled by @option{-Wunused-variable} for
5889 C.  It warns only about unused static const variables defined in the main
5890 compilation unit, but not about static const variables declared in any
5891 header included.
5893 @item -Wunused-const-variable=2
5894 This warning level also warns for unused constant static variables in
5895 headers (excluding system headers).  This is the warning level of
5896 @option{-Wunused-const-variable} and must be explicitly requested since
5897 in C++ this isn't an error and in C it might be harder to clean up all
5898 headers included.
5899 @end table
5901 @item -Wunused-value
5902 @opindex Wunused-value
5903 @opindex Wno-unused-value
5904 Warn whenever a statement computes a result that is explicitly not
5905 used. To suppress this warning cast the unused expression to
5906 @code{void}. This includes an expression-statement or the left-hand
5907 side of a comma expression that contains no side effects. For example,
5908 an expression such as @code{x[i,j]} causes a warning, while
5909 @code{x[(void)i,j]} does not.
5911 This warning is enabled by @option{-Wall}.
5913 @item -Wunused
5914 @opindex Wunused
5915 @opindex Wno-unused
5916 All the above @option{-Wunused} options combined.
5918 In order to get a warning about an unused function parameter, you must
5919 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5920 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5922 @item -Wuninitialized
5923 @opindex Wuninitialized
5924 @opindex Wno-uninitialized
5925 Warn if an automatic variable is used without first being initialized.
5926 In C++, warn if a non-static reference or non-static @code{const}
5927 member appears in a class without constructors.
5929 If you want to warn about code that uses the uninitialized value of the
5930 variable in its own initializer, use the @option{-Winit-self} option.
5932 These warnings occur for individual uninitialized elements of
5933 structure, union or array variables as well as for variables that are
5934 uninitialized as a whole.  They do not occur for variables or elements
5935 declared @code{volatile}.  Because these warnings depend on
5936 optimization, the exact variables or elements for which there are
5937 warnings depend on the precise optimization options and version of GCC
5938 used.
5940 Note that there may be no warning about a variable that is used only
5941 to compute a value that itself is never used, because such
5942 computations may be deleted by data flow analysis before the warnings
5943 are printed.
5945 @item -Winvalid-memory-model
5946 @opindex Winvalid-memory-model
5947 @opindex Wno-invalid-memory-model
5948 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5949 and the C11 atomic generic functions with a memory consistency argument
5950 that is either invalid for the operation or outside the range of values
5951 of the @code{memory_order} enumeration.  For example, since the
5952 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5953 defined for the relaxed, release, and sequentially consistent memory
5954 orders the following code is diagnosed:
5956 @smallexample
5957 void store (int *i)
5959   __atomic_store_n (i, 0, memory_order_consume);
5961 @end smallexample
5963 @option{-Winvalid-memory-model} is enabled by default.
5965 @item -Wmaybe-uninitialized
5966 @opindex Wmaybe-uninitialized
5967 @opindex Wno-maybe-uninitialized
5968 For an automatic (i.e.@: local) variable, if there exists a path from the
5969 function entry to a use of the variable that is initialized, but there exist
5970 some other paths for which the variable is not initialized, the compiler
5971 emits a warning if it cannot prove the uninitialized paths are not
5972 executed at run time.
5974 These warnings are only possible in optimizing compilation, because otherwise
5975 GCC does not keep track of the state of variables.
5977 These warnings are made optional because GCC may not be able to determine when
5978 the code is correct in spite of appearing to have an error.  Here is one
5979 example of how this can happen:
5981 @smallexample
5982 @group
5984   int x;
5985   switch (y)
5986     @{
5987     case 1: x = 1;
5988       break;
5989     case 2: x = 4;
5990       break;
5991     case 3: x = 5;
5992     @}
5993   foo (x);
5995 @end group
5996 @end smallexample
5998 @noindent
5999 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6000 always initialized, but GCC doesn't know this. To suppress the
6001 warning, you need to provide a default case with assert(0) or
6002 similar code.
6004 @cindex @code{longjmp} warnings
6005 This option also warns when a non-volatile automatic variable might be
6006 changed by a call to @code{longjmp}.
6007 The compiler sees only the calls to @code{setjmp}.  It cannot know
6008 where @code{longjmp} will be called; in fact, a signal handler could
6009 call it at any point in the code.  As a result, you may get a warning
6010 even when there is in fact no problem because @code{longjmp} cannot
6011 in fact be called at the place that would cause a problem.
6013 Some spurious warnings can be avoided if you declare all the functions
6014 you use that never return as @code{noreturn}.  @xref{Function
6015 Attributes}.
6017 This warning is enabled by @option{-Wall} or @option{-Wextra}.
6019 @item -Wunknown-pragmas
6020 @opindex Wunknown-pragmas
6021 @opindex Wno-unknown-pragmas
6022 @cindex warning for unknown pragmas
6023 @cindex unknown pragmas, warning
6024 @cindex pragmas, warning of unknown
6025 Warn when a @code{#pragma} directive is encountered that is not understood by 
6026 GCC@.  If this command-line option is used, warnings are even issued
6027 for unknown pragmas in system header files.  This is not the case if
6028 the warnings are only enabled by the @option{-Wall} command-line option.
6030 @item -Wno-pragmas
6031 @opindex Wno-pragmas
6032 @opindex Wpragmas
6033 Do not warn about misuses of pragmas, such as incorrect parameters,
6034 invalid syntax, or conflicts between pragmas.  See also
6035 @option{-Wunknown-pragmas}.
6037 @item -Wno-prio-ctor-dtor
6038 @opindex Wno-prio-ctor-dtor
6039 @opindex Wprio-ctor-dtor
6040 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6041 The use of constructor and destructor attributes allow you to assign a
6042 priority to the constructor/destructor to control its order of execution
6043 before @code{main} is called or after it returns.  The priority values must be
6044 greater than 100 as the compiler reserves priority values between 0--100 for
6045 the implementation.
6047 @item -Wstrict-aliasing
6048 @opindex Wstrict-aliasing
6049 @opindex Wno-strict-aliasing
6050 This option is only active when @option{-fstrict-aliasing} is active.
6051 It warns about code that might break the strict aliasing rules that the
6052 compiler is using for optimization.  The warning does not catch all
6053 cases, but does attempt to catch the more common pitfalls.  It is
6054 included in @option{-Wall}.
6055 It is equivalent to @option{-Wstrict-aliasing=3}
6057 @item -Wstrict-aliasing=n
6058 @opindex Wstrict-aliasing=n
6059 This option is only active when @option{-fstrict-aliasing} is active.
6060 It warns about code that might break the strict aliasing rules that the
6061 compiler is using for optimization.
6062 Higher levels correspond to higher accuracy (fewer false positives).
6063 Higher levels also correspond to more effort, similar to the way @option{-O} 
6064 works.
6065 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6067 Level 1: Most aggressive, quick, least accurate.
6068 Possibly useful when higher levels
6069 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6070 false negatives.  However, it has many false positives.
6071 Warns for all pointer conversions between possibly incompatible types,
6072 even if never dereferenced.  Runs in the front end only.
6074 Level 2: Aggressive, quick, not too precise.
6075 May still have many false positives (not as many as level 1 though),
6076 and few false negatives (but possibly more than level 1).
6077 Unlike level 1, it only warns when an address is taken.  Warns about
6078 incomplete types.  Runs in the front end only.
6080 Level 3 (default for @option{-Wstrict-aliasing}):
6081 Should have very few false positives and few false
6082 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
6083 Takes care of the common pun+dereference pattern in the front end:
6084 @code{*(int*)&some_float}.
6085 If optimization is enabled, it also runs in the back end, where it deals
6086 with multiple statement cases using flow-sensitive points-to information.
6087 Only warns when the converted pointer is dereferenced.
6088 Does not warn about incomplete types.
6090 @item -Wstrict-overflow
6091 @itemx -Wstrict-overflow=@var{n}
6092 @opindex Wstrict-overflow
6093 @opindex Wno-strict-overflow
6094 This option is only active when signed overflow is undefined.
6095 It warns about cases where the compiler optimizes based on the
6096 assumption that signed overflow does not occur.  Note that it does not
6097 warn about all cases where the code might overflow: it only warns
6098 about cases where the compiler implements some optimization.  Thus
6099 this warning depends on the optimization level.
6101 An optimization that assumes that signed overflow does not occur is
6102 perfectly safe if the values of the variables involved are such that
6103 overflow never does, in fact, occur.  Therefore this warning can
6104 easily give a false positive: a warning about code that is not
6105 actually a problem.  To help focus on important issues, several
6106 warning levels are defined.  No warnings are issued for the use of
6107 undefined signed overflow when estimating how many iterations a loop
6108 requires, in particular when determining whether a loop will be
6109 executed at all.
6111 @table @gcctabopt
6112 @item -Wstrict-overflow=1
6113 Warn about cases that are both questionable and easy to avoid.  For
6114 example the compiler simplifies
6115 @code{x + 1 > x} to @code{1}.  This level of
6116 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6117 are not, and must be explicitly requested.
6119 @item -Wstrict-overflow=2
6120 Also warn about other cases where a comparison is simplified to a
6121 constant.  For example: @code{abs (x) >= 0}.  This can only be
6122 simplified when signed integer overflow is undefined, because
6123 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6124 zero.  @option{-Wstrict-overflow} (with no level) is the same as
6125 @option{-Wstrict-overflow=2}.
6127 @item -Wstrict-overflow=3
6128 Also warn about other cases where a comparison is simplified.  For
6129 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6131 @item -Wstrict-overflow=4
6132 Also warn about other simplifications not covered by the above cases.
6133 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6135 @item -Wstrict-overflow=5
6136 Also warn about cases where the compiler reduces the magnitude of a
6137 constant involved in a comparison.  For example: @code{x + 2 > y} is
6138 simplified to @code{x + 1 >= y}.  This is reported only at the
6139 highest warning level because this simplification applies to many
6140 comparisons, so this warning level gives a very large number of
6141 false positives.
6142 @end table
6144 @item -Wstring-compare
6145 @opindex Wstring-compare
6146 @opindex Wno-string-compare
6147 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6148 determined to be either zero or non-zero in tests for such equality
6149 owing to the length of one argument being greater than the size of
6150 the array the other argument is stored in (or the bound in the case
6151 of @code{strncmp}).  Such calls could be mistakes.  For example,
6152 the call to @code{strcmp} below is diagnosed because its result is
6153 necessarily non-zero irrespective of the contents of the array @code{a}.
6155 @smallexample
6156 extern char a[4];
6157 void f (char *d)
6159   strcpy (d, "string");
6160   @dots{}
6161   if (0 == strcmp (a, d))   // cannot be true
6162     puts ("a and d are the same");
6164 @end smallexample
6166 @option{-Wstring-compare} is enabled by @option{-Wextra}.
6168 @item -Wstringop-overflow
6169 @itemx -Wstringop-overflow=@var{type}
6170 @opindex Wstringop-overflow
6171 @opindex Wno-stringop-overflow
6172 Warn for calls to string manipulation functions such as @code{memcpy} and
6173 @code{strcpy} that are determined to overflow the destination buffer.  The
6174 optional argument is one greater than the type of Object Size Checking to
6175 perform to determine the size of the destination.  @xref{Object Size Checking}.
6176 The argument is meaningful only for functions that operate on character arrays
6177 but not for raw memory functions like @code{memcpy} which always make use
6178 of Object Size type-0.  The option also warns for calls that specify a size
6179 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6180 The option produces the best results with optimization enabled but can detect
6181 a small subset of simple buffer overflows even without optimization in
6182 calls to the GCC built-in functions like @code{__builtin_memcpy} that
6183 correspond to the standard functions.  In any case, the option warns about
6184 just a subset of buffer overflows detected by the corresponding overflow
6185 checking built-ins.  For example, the option will issue a warning for
6186 the @code{strcpy} call below because it copies at least 5 characters
6187 (the string @code{"blue"} including the terminating NUL) into the buffer
6188 of size 4.
6190 @smallexample
6191 enum Color @{ blue, purple, yellow @};
6192 const char* f (enum Color clr)
6194   static char buf [4];
6195   const char *str;
6196   switch (clr)
6197     @{
6198       case blue: str = "blue"; break;
6199       case purple: str = "purple"; break;
6200       case yellow: str = "yellow"; break;
6201     @}
6203   return strcpy (buf, str);   // warning here
6205 @end smallexample
6207 Option @option{-Wstringop-overflow=2} is enabled by default.
6209 @table @gcctabopt
6210 @item -Wstringop-overflow
6211 @itemx -Wstringop-overflow=1
6212 @opindex Wstringop-overflow
6213 @opindex Wno-stringop-overflow
6214 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6215 to determine the sizes of destination objects.  This is the default setting
6216 of the option.  At this setting the option will not warn for writes past
6217 the end of subobjects of larger objects accessed by pointers unless the
6218 size of the largest surrounding object is known.  When the destination may
6219 be one of several objects it is assumed to be the largest one of them.  On
6220 Linux systems, when optimization is enabled at this setting the option warns
6221 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6222 a non-zero value.
6224 @item -Wstringop-overflow=2
6225 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6226 to determine the sizes of destination objects.  At this setting the option
6227 will warn about overflows when writing to members of the largest complete
6228 objects whose exact size is known.  It will, however, not warn for excessive
6229 writes to the same members of unknown objects referenced by pointers since
6230 they may point to arrays containing unknown numbers of elements.
6232 @item -Wstringop-overflow=3
6233 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6234 to determine the sizes of destination objects.  At this setting the option
6235 warns about overflowing the smallest object or data member.  This is the
6236 most restrictive setting of the option that may result in warnings for safe
6237 code.
6239 @item -Wstringop-overflow=4
6240 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6241 to determine the sizes of destination objects.  At this setting the option
6242 will warn about overflowing any data members, and when the destination is
6243 one of several objects it uses the size of the largest of them to decide
6244 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
6245 setting of the option may result in warnings for benign code.
6246 @end table
6248 @item -Wstringop-truncation
6249 @opindex Wstringop-truncation
6250 @opindex Wno-stringop-truncation
6251 Warn for calls to bounded string manipulation functions such as @code{strncat},
6252 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6253 or leave the destination unchanged.
6255 In the following example, the call to @code{strncat} specifies a bound that
6256 is less than the length of the source string.  As a result, the copy of
6257 the source will be truncated and so the call is diagnosed.  To avoid the
6258 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6260 @smallexample
6261 void append (char *buf, size_t bufsize)
6263   strncat (buf, ".txt", 3);
6265 @end smallexample
6267 As another example, the following call to @code{strncpy} results in copying
6268 to @code{d} just the characters preceding the terminating NUL, without
6269 appending the NUL to the end.  Assuming the result of @code{strncpy} is
6270 necessarily a NUL-terminated string is a common mistake, and so the call
6271 is diagnosed.  To avoid the warning when the result is not expected to be
6272 NUL-terminated, call @code{memcpy} instead.
6274 @smallexample
6275 void copy (char *d, const char *s)
6277   strncpy (d, s, strlen (s));
6279 @end smallexample
6281 In the following example, the call to @code{strncpy} specifies the size
6282 of the destination buffer as the bound.  If the length of the source
6283 string is equal to or greater than this size the result of the copy will
6284 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
6285 the warning, specify @code{sizeof buf - 1} as the bound and set the last
6286 element of the buffer to @code{NUL}.
6288 @smallexample
6289 void copy (const char *s)
6291   char buf[80];
6292   strncpy (buf, s, sizeof buf);
6293   @dots{}
6295 @end smallexample
6297 In situations where a character array is intended to store a sequence
6298 of bytes with no terminating @code{NUL} such an array may be annotated
6299 with attribute @code{nonstring} to avoid this warning.  Such arrays,
6300 however, are not suitable arguments to functions that expect
6301 @code{NUL}-terminated strings.  To help detect accidental misuses of
6302 such arrays GCC issues warnings unless it can prove that the use is
6303 safe.  @xref{Common Variable Attributes}.
6305 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6306 @opindex Wsuggest-attribute=
6307 @opindex Wno-suggest-attribute=
6308 Warn for cases where adding an attribute may be beneficial. The
6309 attributes currently supported are listed below.
6311 @table @gcctabopt
6312 @item -Wsuggest-attribute=pure
6313 @itemx -Wsuggest-attribute=const
6314 @itemx -Wsuggest-attribute=noreturn
6315 @itemx -Wmissing-noreturn
6316 @itemx -Wsuggest-attribute=malloc
6317 @opindex Wsuggest-attribute=pure
6318 @opindex Wno-suggest-attribute=pure
6319 @opindex Wsuggest-attribute=const
6320 @opindex Wno-suggest-attribute=const
6321 @opindex Wsuggest-attribute=noreturn
6322 @opindex Wno-suggest-attribute=noreturn
6323 @opindex Wmissing-noreturn
6324 @opindex Wno-missing-noreturn
6325 @opindex Wsuggest-attribute=malloc
6326 @opindex Wno-suggest-attribute=malloc
6328 Warn about functions that might be candidates for attributes
6329 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6330 only warns for functions visible in other compilation units or (in the case of
6331 @code{pure} and @code{const}) if it cannot prove that the function returns
6332 normally. A function returns normally if it doesn't contain an infinite loop or
6333 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
6334 requires option @option{-fipa-pure-const}, which is enabled by default at
6335 @option{-O} and higher.  Higher optimization levels improve the accuracy
6336 of the analysis.
6338 @item -Wsuggest-attribute=format
6339 @itemx -Wmissing-format-attribute
6340 @opindex Wsuggest-attribute=format
6341 @opindex Wmissing-format-attribute
6342 @opindex Wno-suggest-attribute=format
6343 @opindex Wno-missing-format-attribute
6344 @opindex Wformat
6345 @opindex Wno-format
6347 Warn about function pointers that might be candidates for @code{format}
6348 attributes.  Note these are only possible candidates, not absolute ones.
6349 GCC guesses that function pointers with @code{format} attributes that
6350 are used in assignment, initialization, parameter passing or return
6351 statements should have a corresponding @code{format} attribute in the
6352 resulting type.  I.e.@: the left-hand side of the assignment or
6353 initialization, the type of the parameter variable, or the return type
6354 of the containing function respectively should also have a @code{format}
6355 attribute to avoid the warning.
6357 GCC also warns about function definitions that might be
6358 candidates for @code{format} attributes.  Again, these are only
6359 possible candidates.  GCC guesses that @code{format} attributes
6360 might be appropriate for any function that calls a function like
6361 @code{vprintf} or @code{vscanf}, but this might not always be the
6362 case, and some functions for which @code{format} attributes are
6363 appropriate may not be detected.
6365 @item -Wsuggest-attribute=cold
6366 @opindex Wsuggest-attribute=cold
6367 @opindex Wno-suggest-attribute=cold
6369 Warn about functions that might be candidates for @code{cold} attribute.  This
6370 is based on static detection and generally will only warn about functions which
6371 always leads to a call to another @code{cold} function such as wrappers of
6372 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6373 @end table
6375 @item -Wsuggest-final-types
6376 @opindex Wno-suggest-final-types
6377 @opindex Wsuggest-final-types
6378 Warn about types with virtual methods where code quality would be improved
6379 if the type were declared with the C++11 @code{final} specifier, 
6380 or, if possible,
6381 declared in an anonymous namespace. This allows GCC to more aggressively
6382 devirtualize the polymorphic calls. This warning is more effective with 
6383 link-time optimization, 
6384 where the information about the class hierarchy graph is
6385 more complete.
6387 @item -Wsuggest-final-methods
6388 @opindex Wno-suggest-final-methods
6389 @opindex Wsuggest-final-methods
6390 Warn about virtual methods where code quality would be improved if the method
6391 were declared with the C++11 @code{final} specifier, 
6392 or, if possible, its type were
6393 declared in an anonymous namespace or with the @code{final} specifier.
6394 This warning is
6395 more effective with link-time optimization, where the information about the
6396 class hierarchy graph is more complete. It is recommended to first consider
6397 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6398 annotations.
6400 @item -Wsuggest-override
6401 Warn about overriding virtual functions that are not marked with the override
6402 keyword.
6404 @item -Walloc-zero
6405 @opindex Wno-alloc-zero
6406 @opindex Walloc-zero
6407 Warn about calls to allocation functions decorated with attribute
6408 @code{alloc_size} that specify zero bytes, including those to the built-in
6409 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6410 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
6411 when called with a zero size differs among implementations (and in the case
6412 of @code{realloc} has been deprecated) relying on it may result in subtle
6413 portability bugs and should be avoided.
6415 @item -Walloc-size-larger-than=@var{byte-size}
6416 @opindex Walloc-size-larger-than=
6417 @opindex Wno-alloc-size-larger-than
6418 Warn about calls to functions decorated with attribute @code{alloc_size}
6419 that attempt to allocate objects larger than the specified number of bytes,
6420 or where the result of the size computation in an integer type with infinite
6421 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6422 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6423 Warnings controlled by the option can be disabled either by specifying
6424 @var{byte-size} of @samp{SIZE_MAX} or more or by
6425 @option{-Wno-alloc-size-larger-than}.
6426 @xref{Function Attributes}.
6428 @item -Wno-alloc-size-larger-than
6429 @opindex Wno-alloc-size-larger-than
6430 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
6431 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6432 larger.
6434 @item -Walloca
6435 @opindex Wno-alloca
6436 @opindex Walloca
6437 This option warns on all uses of @code{alloca} in the source.
6439 @item -Walloca-larger-than=@var{byte-size}
6440 @opindex Walloca-larger-than=
6441 @opindex Wno-alloca-larger-than
6442 This option warns on calls to @code{alloca} with an integer argument whose
6443 value is either zero, or that is not bounded by a controlling predicate
6444 that limits its value to at most @var{byte-size}.  It also warns for calls
6445 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
6446 types are considered unbounded even if they appear to be constrained to
6447 the expected range.
6449 For example, a bounded case of @code{alloca} could be:
6451 @smallexample
6452 void func (size_t n)
6454   void *p;
6455   if (n <= 1000)
6456     p = alloca (n);
6457   else
6458     p = malloc (n);
6459   f (p);
6461 @end smallexample
6463 In the above example, passing @code{-Walloca-larger-than=1000} would not
6464 issue a warning because the call to @code{alloca} is known to be at most
6465 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
6466 the compiler would emit a warning.
6468 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6469 controlling predicate constraining its integer argument.  For example:
6471 @smallexample
6472 void func ()
6474   void *p = alloca (n);
6475   f (p);
6477 @end smallexample
6479 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6480 a warning, but this time because of the lack of bounds checking.
6482 Note, that even seemingly correct code involving signed integers could
6483 cause a warning:
6485 @smallexample
6486 void func (signed int n)
6488   if (n < 500)
6489     @{
6490       p = alloca (n);
6491       f (p);
6492     @}
6494 @end smallexample
6496 In the above example, @var{n} could be negative, causing a larger than
6497 expected argument to be implicitly cast into the @code{alloca} call.
6499 This option also warns when @code{alloca} is used in a loop.
6501 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6502 but is usually only effective  when @option{-ftree-vrp} is active (default
6503 for @option{-O2} and above).
6505 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6507 @item -Wno-alloca-larger-than
6508 @opindex Wno-alloca-larger-than
6509 Disable @option{-Walloca-larger-than=} warnings.  The option is
6510 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6512 @item -Wno-analyzer-double-fclose
6513 @opindex Wanalyzer-double-fclose
6514 @opindex Wno-analyzer-double-fclose
6515 This warning requires @option{-fanalyzer}, which enables it; use
6516 @option{-Wno-analyzer-double-fclose} to disable it.
6518 This diagnostic warns for paths through the code in which a @code{FILE *}
6519 can have @code{fclose} called on it more than once.
6521 @item -Wno-analyzer-double-free
6522 @opindex Wanalyzer-double-free
6523 @opindex Wno-analyzer-double-free
6524 This warning requires @option{-fanalyzer}, which enables it; use
6525 @option{-Wno-analyzer-double-free} to disable it.
6527 This diagnostic warns for paths through the code in which a pointer
6528 can have @code{free} called on it more than once.
6530 @item -Wno-analyzer-exposure-through-output-file
6531 @opindex Wanalyzer-exposure-through-output-file
6532 @opindex Wno-analyzer-exposure-through-output-file
6533 This warning requires @option{-fanalyzer}, which enables it; use
6534 @option{-Wno-analyzer-exposure-through-output-file}
6535 to disable it.
6537 This diagnostic warns for paths through the code in which a
6538 security-sensitive value is written to an output file
6539 (such as writing a password to a log file).
6541 @item -Wno-analyzer-file-leak
6542 @opindex Wanalyzer-file-leak
6543 @opindex Wno-analyzer-file-leak
6544 This warning requires @option{-fanalyzer}, which enables it; use
6545 @option{-Wno-analyzer-file-leak}
6546 to disable it.
6548 This diagnostic warns for paths through the code in which a
6549 @code{<stdio.h>} @code{FILE *} stream object is leaked.
6551 @item -Wno-analyzer-free-of-non-heap
6552 @opindex Wanalyzer-free-of-non-heap
6553 @opindex Wno-analyzer-free-of-non-heap
6554 This warning requires @option{-fanalyzer}, which enables it; use
6555 @option{-Wno-analyzer-free-of-non-heap}
6556 to disable it.
6558 This diagnostic warns for paths through the code in which @code{free}
6559 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
6561 @item -Wno-analyzer-malloc-leak
6562 @opindex Wanalyzer-malloc-leak
6563 @opindex Wno-analyzer-malloc-leak
6564 This warning requires @option{-fanalyzer}, which enables it; use
6565 @option{-Wno-analyzer-malloc-leak}
6566 to disable it.
6568 This diagnostic warns for paths through the code in which a
6569 pointer allocated via @code{malloc} is leaked.
6571 @item -Wno-analyzer-possible-null-argument
6572 @opindex Wanalyzer-possible-null-argument
6573 @opindex Wno-analyzer-possible-null-argument
6574 This warning requires @option{-fanalyzer}, which enables it; use
6575 @option{-Wno-analyzer-possible-null-argument} to disable it.
6577 This diagnostic warns for paths through the code in which a
6578 possibly-NULL value is passed to a function argument marked
6579 with @code{__attribute__((nonnull))} as requiring a non-NULL
6580 value.
6582 @item -Wno-analyzer-possible-null-dereference
6583 @opindex Wanalyzer-possible-null-dereference
6584 @opindex Wno-analyzer-possible-null-dereference
6585 This warning requires @option{-fanalyzer}, which enables it; use
6586 @option{-Wno-analyzer-possible-null-dereference} to disable it.
6588 This diagnostic warns for paths through the code in which a
6589 possibly-NULL value is dereferenced.
6591 @item -Wno-analyzer-null-argument
6592 @opindex Wanalyzer-null-argument
6593 @opindex Wno-analyzer-null-argument
6594 This warning requires @option{-fanalyzer}, which enables it; use
6595 @option{-Wno-analyzer-null-argument} to disable it.
6597 This diagnostic warns for paths through the code in which a
6598 value known to be NULL is passed to a function argument marked
6599 with @code{__attribute__((nonnull))} as requiring a non-NULL
6600 value.
6602 @item -Wno-analyzer-null-dereference
6603 @opindex Wanalyzer-null-dereference
6604 @opindex Wno-analyzer-null-dereference
6605 This warning requires @option{-fanalyzer}, which enables it; use
6606 @option{-Wno-analyzer-null-dereference} to disable it.
6608 This diagnostic warns for paths through the code in which a
6609 value known to be NULL is dereferenced.
6611 @item -Wno-analyzer-stale-setjmp-buffer
6612 @opindex Wanalyzer-stale-setjmp-buffer
6613 @opindex Wno-analyzer-stale-setjmp-buffer
6614 This warning requires @option{-fanalyzer}, which enables it; use
6615 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
6617 This diagnostic warns for paths through the code in which
6618 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
6619 to a @code{setjmp} call in a function that has returned.
6621 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
6622 location, it records the stack frame.  The stack frame becomes invalid
6623 when the function containing the @code{setjmp} call returns.  Attempting
6624 to rewind to it via @code{longjmp} would reference a stack frame that
6625 no longer exists, and likely lead to a crash (or worse).
6627 @item -Wno-analyzer-tainted-array-index
6628 @opindex Wanalyzer-tainted-array-index
6629 @opindex Wno-analyzer-tainted-array-index
6630 This warning requires @option{-fanalyzer}, which enables it; use
6631 @option{-Wno-analyzer-tainted-array-index} to disable it.
6633 This diagnostic warns for paths through the code in which a value
6634 that could be under an attacker's control is used as the index
6635 of an array access without being sanitized.
6637 @item -Wno-analyzer-unsafe-call-within-signal-handler
6638 @opindex Wanalyzer-unsafe-call-within-signal-handler
6639 @opindex Wno-analyzer-unsafe-call-within-signal-handler
6640 This warning requires @option{-fanalyzer}, which enables it; use
6641 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
6643 This diagnostic warns for paths through the code in which a
6644 function known to be async-signal-unsafe (such as @code{fprintf}) is
6645 called from a signal handler.
6647 @item -Wno-analyzer-use-after-free
6648 @opindex Wanalyzer-use-after-free
6649 @opindex Wno-analyzer-use-after-free
6650 This warning requires @option{-fanalyzer}, which enables it; use
6651 @option{-Wno-analyzer-use-after-free} to disable it.
6653 This diagnostic warns for paths through the code in which a
6654 pointer is used after @code{free} is called on it.
6656 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
6657 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
6658 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
6659 This warning requires @option{-fanalyzer}, which enables it; use
6660 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
6661 to disable it.
6663 This diagnostic warns for paths through the code in which a pointer
6664 is dereferenced that points to a variable in a stale stack frame.
6666 @item -Wno-analyzer-use-of-uninitialized-value
6667 @opindex Wanalyzer-use-of-uninitialized-value
6668 @opindex Wno-analyzer-use-of-uninitialized-value
6669 This warning requires @option{-fanalyzer}, which enables it; use
6670 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
6672 This diagnostic warns for paths through the code in which an uninitialized
6673 value is used.
6675 @item -Warith-conversion
6676 @opindex Warith-conversion
6677 @opindex Wno-arith-conversion
6678 Do warn about implicit conversions from arithmetic operations even
6679 when conversion of the operands to the same type cannot change their
6680 values.  This affects warnings from @option{-Wconversion},
6681 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
6683 @smallexample
6684 @group
6685 void f (char c, int i)
6687   c = c + i; // warns with @option{-Wconversion}
6688   c = c + 1; // only warns with @option{-Warith-conversion}
6690 @end group
6691 @end smallexample
6693 @item -Warray-bounds
6694 @itemx -Warray-bounds=@var{n}
6695 @opindex Wno-array-bounds
6696 @opindex Warray-bounds
6697 This option is only active when @option{-ftree-vrp} is active
6698 (default for @option{-O2} and above). It warns about subscripts to arrays
6699 that are always out of bounds. This warning is enabled by @option{-Wall}.
6701 @table @gcctabopt
6702 @item -Warray-bounds=1
6703 This is the warning level of @option{-Warray-bounds} and is enabled
6704 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6706 @item -Warray-bounds=2
6707 This warning level also warns about out of bounds access for
6708 arrays at the end of a struct and for arrays accessed through
6709 pointers. This warning level may give a larger number of
6710 false positives and is deactivated by default.
6711 @end table
6713 @item -Wattribute-alias=@var{n}
6714 @itemx -Wno-attribute-alias
6715 @opindex Wattribute-alias
6716 @opindex Wno-attribute-alias
6717 Warn about declarations using the @code{alias} and similar attributes whose
6718 target is incompatible with the type of the alias.
6719 @xref{Function Attributes,,Declaring Attributes of Functions}.
6721 @table @gcctabopt
6722 @item -Wattribute-alias=1
6723 The default warning level of the @option{-Wattribute-alias} option diagnoses
6724 incompatibilities between the type of the alias declaration and that of its
6725 target.  Such incompatibilities are typically indicative of bugs.
6727 @item -Wattribute-alias=2
6729 At this level @option{-Wattribute-alias} also diagnoses cases where
6730 the attributes of the alias declaration are more restrictive than the
6731 attributes applied to its target.  These mismatches can potentially
6732 result in incorrect code generation.  In other cases they may be
6733 benign and could be resolved simply by adding the missing attribute to
6734 the target.  For comparison, see the @option{-Wmissing-attributes}
6735 option, which controls diagnostics when the alias declaration is less
6736 restrictive than the target, rather than more restrictive.
6738 Attributes considered include @code{alloc_align}, @code{alloc_size},
6739 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6740 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6741 @code{returns_nonnull}, and @code{returns_twice}.
6742 @end table
6744 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6745 This is the default.  You can disable these warnings with either
6746 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6748 @item -Wbool-compare
6749 @opindex Wno-bool-compare
6750 @opindex Wbool-compare
6751 Warn about boolean expression compared with an integer value different from
6752 @code{true}/@code{false}.  For instance, the following comparison is
6753 always false:
6754 @smallexample
6755 int n = 5;
6756 @dots{}
6757 if ((n > 1) == 2) @{ @dots{} @}
6758 @end smallexample
6759 This warning is enabled by @option{-Wall}.
6761 @item -Wbool-operation
6762 @opindex Wno-bool-operation
6763 @opindex Wbool-operation
6764 Warn about suspicious operations on expressions of a boolean type.  For
6765 instance, bitwise negation of a boolean is very likely a bug in the program.
6766 For C, this warning also warns about incrementing or decrementing a boolean,
6767 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
6768 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6770 This warning is enabled by @option{-Wall}.
6772 @item -Wduplicated-branches
6773 @opindex Wno-duplicated-branches
6774 @opindex Wduplicated-branches
6775 Warn when an if-else has identical branches.  This warning detects cases like
6776 @smallexample
6777 if (p != NULL)
6778   return 0;
6779 else
6780   return 0;
6781 @end smallexample
6782 It doesn't warn when both branches contain just a null statement.  This warning
6783 also warn for conditional operators:
6784 @smallexample
6785   int i = x ? *p : *p;
6786 @end smallexample
6788 @item -Wduplicated-cond
6789 @opindex Wno-duplicated-cond
6790 @opindex Wduplicated-cond
6791 Warn about duplicated conditions in an if-else-if chain.  For instance,
6792 warn for the following code:
6793 @smallexample
6794 if (p->q != NULL) @{ @dots{} @}
6795 else if (p->q != NULL) @{ @dots{} @}
6796 @end smallexample
6798 @item -Wframe-address
6799 @opindex Wno-frame-address
6800 @opindex Wframe-address
6801 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6802 is called with an argument greater than 0.  Such calls may return indeterminate
6803 values or crash the program.  The warning is included in @option{-Wall}.
6805 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6806 @opindex Wno-discarded-qualifiers
6807 @opindex Wdiscarded-qualifiers
6808 Do not warn if type qualifiers on pointers are being discarded.
6809 Typically, the compiler warns if a @code{const char *} variable is
6810 passed to a function that takes a @code{char *} parameter.  This option
6811 can be used to suppress such a warning.
6813 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6814 @opindex Wno-discarded-array-qualifiers
6815 @opindex Wdiscarded-array-qualifiers
6816 Do not warn if type qualifiers on arrays which are pointer targets
6817 are being discarded.  Typically, the compiler warns if a
6818 @code{const int (*)[]} variable is passed to a function that
6819 takes a @code{int (*)[]} parameter.  This option can be used to
6820 suppress such a warning.
6822 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6823 @opindex Wno-incompatible-pointer-types
6824 @opindex Wincompatible-pointer-types
6825 Do not warn when there is a conversion between pointers that have incompatible
6826 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
6827 which warns for pointer argument passing or assignment with different
6828 signedness.
6830 @item -Wno-int-conversion @r{(C and Objective-C only)}
6831 @opindex Wno-int-conversion
6832 @opindex Wint-conversion
6833 Do not warn about incompatible integer to pointer and pointer to integer
6834 conversions.  This warning is about implicit conversions; for explicit
6835 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6836 @option{-Wno-pointer-to-int-cast} may be used.
6838 @item -Wzero-length-bounds
6839 @opindex Wzero-length-bounds
6840 @opindex Wzero-length-bounds
6841 Warn about accesses to elements of zero-length array members that might
6842 overlap other members of the same object.  Declaring interior zero-length
6843 arrays is discouraged because accesses to them are undefined.  See
6844 @xref{Zero Length}.
6846 For example, the first two stores in function @code{bad} are diagnosed
6847 because the array elements overlap the subsequent members @code{b} and
6848 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
6849 because it is beyond the bounds of the enclosing object.
6851 @smallexample
6852 struct X @{ int a[0]; int b, c; @};
6853 struct X x;
6855 void bad (void)
6857   x.a[0] = 0;   // -Wzero-length-bounds
6858   x.a[1] = 1;   // -Wzero-length-bounds
6859   x.a[2] = 2;   // -Warray-bounds
6861 @end smallexample
6863 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6865 @item -Wno-div-by-zero
6866 @opindex Wno-div-by-zero
6867 @opindex Wdiv-by-zero
6868 Do not warn about compile-time integer division by zero.  Floating-point
6869 division by zero is not warned about, as it can be a legitimate way of
6870 obtaining infinities and NaNs.
6872 @item -Wsystem-headers
6873 @opindex Wsystem-headers
6874 @opindex Wno-system-headers
6875 @cindex warnings from system headers
6876 @cindex system headers, warnings from
6877 Print warning messages for constructs found in system header files.
6878 Warnings from system headers are normally suppressed, on the assumption
6879 that they usually do not indicate real problems and would only make the
6880 compiler output harder to read.  Using this command-line option tells
6881 GCC to emit warnings from system headers as if they occurred in user
6882 code.  However, note that using @option{-Wall} in conjunction with this
6883 option does @emph{not} warn about unknown pragmas in system
6884 headers---for that, @option{-Wunknown-pragmas} must also be used.
6886 @item -Wtautological-compare
6887 @opindex Wtautological-compare
6888 @opindex Wno-tautological-compare
6889 Warn if a self-comparison always evaluates to true or false.  This
6890 warning detects various mistakes such as:
6891 @smallexample
6892 int i = 1;
6893 @dots{}
6894 if (i > i) @{ @dots{} @}
6895 @end smallexample
6897 This warning also warns about bitwise comparisons that always evaluate
6898 to true or false, for instance:
6899 @smallexample
6900 if ((a & 16) == 10) @{ @dots{} @}
6901 @end smallexample
6902 will always be false.
6904 This warning is enabled by @option{-Wall}.
6906 @item -Wtrampolines
6907 @opindex Wtrampolines
6908 @opindex Wno-trampolines
6909 Warn about trampolines generated for pointers to nested functions.
6910 A trampoline is a small piece of data or code that is created at run
6911 time on the stack when the address of a nested function is taken, and is
6912 used to call the nested function indirectly.  For some targets, it is
6913 made up of data only and thus requires no special treatment.  But, for
6914 most targets, it is made up of code and thus requires the stack to be
6915 made executable in order for the program to work properly.
6917 @item -Wfloat-equal
6918 @opindex Wfloat-equal
6919 @opindex Wno-float-equal
6920 Warn if floating-point values are used in equality comparisons.
6922 The idea behind this is that sometimes it is convenient (for the
6923 programmer) to consider floating-point values as approximations to
6924 infinitely precise real numbers.  If you are doing this, then you need
6925 to compute (by analyzing the code, or in some other way) the maximum or
6926 likely maximum error that the computation introduces, and allow for it
6927 when performing comparisons (and when producing output, but that's a
6928 different problem).  In particular, instead of testing for equality, you
6929 should check to see whether the two values have ranges that overlap; and
6930 this is done with the relational operators, so equality comparisons are
6931 probably mistaken.
6933 @item -Wtraditional @r{(C and Objective-C only)}
6934 @opindex Wtraditional
6935 @opindex Wno-traditional
6936 Warn about certain constructs that behave differently in traditional and
6937 ISO C@.  Also warn about ISO C constructs that have no traditional C
6938 equivalent, and/or problematic constructs that should be avoided.
6940 @itemize @bullet
6941 @item
6942 Macro parameters that appear within string literals in the macro body.
6943 In traditional C macro replacement takes place within string literals,
6944 but in ISO C it does not.
6946 @item
6947 In traditional C, some preprocessor directives did not exist.
6948 Traditional preprocessors only considered a line to be a directive
6949 if the @samp{#} appeared in column 1 on the line.  Therefore
6950 @option{-Wtraditional} warns about directives that traditional C
6951 understands but ignores because the @samp{#} does not appear as the
6952 first character on the line.  It also suggests you hide directives like
6953 @code{#pragma} not understood by traditional C by indenting them.  Some
6954 traditional implementations do not recognize @code{#elif}, so this option
6955 suggests avoiding it altogether.
6957 @item
6958 A function-like macro that appears without arguments.
6960 @item
6961 The unary plus operator.
6963 @item
6964 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6965 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
6966 constants.)  Note, these suffixes appear in macros defined in the system
6967 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6968 Use of these macros in user code might normally lead to spurious
6969 warnings, however GCC's integrated preprocessor has enough context to
6970 avoid warning in these cases.
6972 @item
6973 A function declared external in one block and then used after the end of
6974 the block.
6976 @item
6977 A @code{switch} statement has an operand of type @code{long}.
6979 @item
6980 A non-@code{static} function declaration follows a @code{static} one.
6981 This construct is not accepted by some traditional C compilers.
6983 @item
6984 The ISO type of an integer constant has a different width or
6985 signedness from its traditional type.  This warning is only issued if
6986 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
6987 typically represent bit patterns, are not warned about.
6989 @item
6990 Usage of ISO string concatenation is detected.
6992 @item
6993 Initialization of automatic aggregates.
6995 @item
6996 Identifier conflicts with labels.  Traditional C lacks a separate
6997 namespace for labels.
6999 @item
7000 Initialization of unions.  If the initializer is zero, the warning is
7001 omitted.  This is done under the assumption that the zero initializer in
7002 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7003 initializer warnings and relies on default initialization to zero in the
7004 traditional C case.
7006 @item
7007 Conversions by prototypes between fixed/floating-point values and vice
7008 versa.  The absence of these prototypes when compiling with traditional
7009 C causes serious problems.  This is a subset of the possible
7010 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7012 @item
7013 Use of ISO C style function definitions.  This warning intentionally is
7014 @emph{not} issued for prototype declarations or variadic functions
7015 because these ISO C features appear in your code when using
7016 libiberty's traditional C compatibility macros, @code{PARAMS} and
7017 @code{VPARAMS}.  This warning is also bypassed for nested functions
7018 because that feature is already a GCC extension and thus not relevant to
7019 traditional C compatibility.
7020 @end itemize
7022 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7023 @opindex Wtraditional-conversion
7024 @opindex Wno-traditional-conversion
7025 Warn if a prototype causes a type conversion that is different from what
7026 would happen to the same argument in the absence of a prototype.  This
7027 includes conversions of fixed point to floating and vice versa, and
7028 conversions changing the width or signedness of a fixed-point argument
7029 except when the same as the default promotion.
7031 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7032 @opindex Wdeclaration-after-statement
7033 @opindex Wno-declaration-after-statement
7034 Warn when a declaration is found after a statement in a block.  This
7035 construct, known from C++, was introduced with ISO C99 and is by default
7036 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Declarations}.
7038 @item -Wshadow
7039 @opindex Wshadow
7040 @opindex Wno-shadow
7041 Warn whenever a local variable or type declaration shadows another
7042 variable, parameter, type, class member (in C++), or instance variable
7043 (in Objective-C) or whenever a built-in function is shadowed.  Note
7044 that in C++, the compiler warns if a local variable shadows an
7045 explicit typedef, but not if it shadows a struct/class/enum.
7046 If this warning is enabled, it includes also all instances of
7047 local shadowing.  This means that @option{-Wno-shadow=local}
7048 and @option{-Wno-shadow=compatible-local} are ignored when
7049 @option{-Wshadow} is used.
7050 Same as @option{-Wshadow=global}.
7052 @item -Wno-shadow-ivar @r{(Objective-C only)}
7053 @opindex Wno-shadow-ivar
7054 @opindex Wshadow-ivar
7055 Do not warn whenever a local variable shadows an instance variable in an
7056 Objective-C method.
7058 @item -Wshadow=global
7059 @opindex Wshadow=global
7060 Warn for any shadowing.
7061 Same as @option{-Wshadow}.
7063 @item -Wshadow=local
7064 @opindex Wshadow=local
7065 Warn when a local variable shadows another local variable or parameter.
7067 @item -Wshadow=compatible-local
7068 @opindex Wshadow=compatible-local
7069 Warn when a local variable shadows another local variable or parameter
7070 whose type is compatible with that of the shadowing variable.  In C++,
7071 type compatibility here means the type of the shadowing variable can be
7072 converted to that of the shadowed variable.  The creation of this flag
7073 (in addition to @option{-Wshadow=local}) is based on the idea that when
7074 a local variable shadows another one of incompatible type, it is most
7075 likely intentional, not a bug or typo, as shown in the following example:
7077 @smallexample
7078 @group
7079 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7081   for (int i = 0; i < N; ++i)
7082   @{
7083     ...
7084   @}
7085   ...
7087 @end group
7088 @end smallexample
7090 Since the two variable @code{i} in the example above have incompatible types,
7091 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7092 Because their types are incompatible, if a programmer accidentally uses one
7093 in place of the other, type checking is expected to catch that and emit an
7094 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
7095 possibly reduce the number of warnings triggered by intentional shadowing.
7096 Note that this also means that shadowing @code{const char *i} by
7097 @code{char *i} does not emit a warning.
7099 This warning is also enabled by @option{-Wshadow=local}.
7101 @item -Wlarger-than=@var{byte-size}
7102 @opindex Wlarger-than=
7103 @opindex Wlarger-than-@var{byte-size}
7104 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7105 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7106 Warnings controlled by the option can be disabled either by specifying
7107 @var{byte-size} of @samp{SIZE_MAX} or more or by
7108 @option{-Wno-larger-than}.
7110 @item -Wno-larger-than
7111 @opindex Wno-larger-than
7112 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
7113 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7115 @item -Wframe-larger-than=@var{byte-size}
7116 @opindex Wframe-larger-than=
7117 @opindex Wno-frame-larger-than
7118 Warn if the size of a function frame exceeds @var{byte-size}.
7119 The computation done to determine the stack frame size is approximate
7120 and not conservative.
7121 The actual requirements may be somewhat greater than @var{byte-size}
7122 even if you do not get a warning.  In addition, any space allocated
7123 via @code{alloca}, variable-length arrays, or related constructs
7124 is not included by the compiler when determining
7125 whether or not to issue a warning.
7126 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7127 Warnings controlled by the option can be disabled either by specifying
7128 @var{byte-size} of @samp{SIZE_MAX} or more or by
7129 @option{-Wno-frame-larger-than}.
7131 @item -Wno-frame-larger-than
7132 @opindex Wno-frame-larger-than
7133 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
7134 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7136 @item -Wno-free-nonheap-object
7137 @opindex Wno-free-nonheap-object
7138 @opindex Wfree-nonheap-object
7139 Do not warn when attempting to free an object that was not allocated
7140 on the heap.
7142 @item -Wstack-usage=@var{byte-size}
7143 @opindex Wstack-usage
7144 @opindex Wno-stack-usage
7145 Warn if the stack usage of a function might exceed @var{byte-size}.
7146 The computation done to determine the stack usage is conservative.
7147 Any space allocated via @code{alloca}, variable-length arrays, or related
7148 constructs is included by the compiler when determining whether or not to
7149 issue a warning.
7151 The message is in keeping with the output of @option{-fstack-usage}.
7153 @itemize
7154 @item
7155 If the stack usage is fully static but exceeds the specified amount, it's:
7157 @smallexample
7158   warning: stack usage is 1120 bytes
7159 @end smallexample
7160 @item
7161 If the stack usage is (partly) dynamic but bounded, it's:
7163 @smallexample
7164   warning: stack usage might be 1648 bytes
7165 @end smallexample
7166 @item
7167 If the stack usage is (partly) dynamic and not bounded, it's:
7169 @smallexample
7170   warning: stack usage might be unbounded
7171 @end smallexample
7172 @end itemize
7174 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7175 Warnings controlled by the option can be disabled either by specifying
7176 @var{byte-size} of @samp{SIZE_MAX} or more or by
7177 @option{-Wno-stack-usage}.
7179 @item -Wno-stack-usage
7180 @opindex Wno-stack-usage
7181 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
7182 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7184 @item -Wunsafe-loop-optimizations
7185 @opindex Wunsafe-loop-optimizations
7186 @opindex Wno-unsafe-loop-optimizations
7187 Warn if the loop cannot be optimized because the compiler cannot
7188 assume anything on the bounds of the loop indices.  With
7189 @option{-funsafe-loop-optimizations} warn if the compiler makes
7190 such assumptions.
7192 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7193 @opindex Wno-pedantic-ms-format
7194 @opindex Wpedantic-ms-format
7195 When used in combination with @option{-Wformat}
7196 and @option{-pedantic} without GNU extensions, this option
7197 disables the warnings about non-ISO @code{printf} / @code{scanf} format
7198 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7199 which depend on the MS runtime.
7201 @item -Waligned-new
7202 @opindex Waligned-new
7203 @opindex Wno-aligned-new
7204 Warn about a new-expression of a type that requires greater alignment
7205 than the @code{alignof(std::max_align_t)} but uses an allocation
7206 function without an explicit alignment parameter. This option is
7207 enabled by @option{-Wall}.
7209 Normally this only warns about global allocation functions, but
7210 @option{-Waligned-new=all} also warns about class member allocation
7211 functions.
7213 @item -Wplacement-new
7214 @itemx -Wplacement-new=@var{n}
7215 @opindex Wplacement-new
7216 @opindex Wno-placement-new
7217 Warn about placement new expressions with undefined behavior, such as
7218 constructing an object in a buffer that is smaller than the type of
7219 the object.  For example, the placement new expression below is diagnosed
7220 because it attempts to construct an array of 64 integers in a buffer only
7221 64 bytes large.
7222 @smallexample
7223 char buf [64];
7224 new (buf) int[64];
7225 @end smallexample
7226 This warning is enabled by default.
7228 @table @gcctabopt
7229 @item -Wplacement-new=1
7230 This is the default warning level of @option{-Wplacement-new}.  At this
7231 level the warning is not issued for some strictly undefined constructs that
7232 GCC allows as extensions for compatibility with legacy code.  For example,
7233 the following @code{new} expression is not diagnosed at this level even
7234 though it has undefined behavior according to the C++ standard because
7235 it writes past the end of the one-element array.
7236 @smallexample
7237 struct S @{ int n, a[1]; @};
7238 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
7239 new (s->a)int [32]();
7240 @end smallexample
7242 @item -Wplacement-new=2
7243 At this level, in addition to diagnosing all the same constructs as at level
7244 1, a diagnostic is also issued for placement new expressions that construct
7245 an object in the last member of structure whose type is an array of a single
7246 element and whose size is less than the size of the object being constructed.
7247 While the previous example would be diagnosed, the following construct makes
7248 use of the flexible member array extension to avoid the warning at level 2.
7249 @smallexample
7250 struct S @{ int n, a[]; @};
7251 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
7252 new (s->a)int [32]();
7253 @end smallexample
7255 @end table
7257 @item -Wpointer-arith
7258 @opindex Wpointer-arith
7259 @opindex Wno-pointer-arith
7260 Warn about anything that depends on the ``size of'' a function type or
7261 of @code{void}.  GNU C assigns these types a size of 1, for
7262 convenience in calculations with @code{void *} pointers and pointers
7263 to functions.  In C++, warn also when an arithmetic operation involves
7264 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
7266 @item -Wpointer-compare
7267 @opindex Wpointer-compare
7268 @opindex Wno-pointer-compare
7269 Warn if a pointer is compared with a zero character constant.  This usually
7270 means that the pointer was meant to be dereferenced.  For example:
7272 @smallexample
7273 const char *p = foo ();
7274 if (p == '\0')
7275   return 42;
7276 @end smallexample
7278 Note that the code above is invalid in C++11.
7280 This warning is enabled by default.
7282 @item -Wtype-limits
7283 @opindex Wtype-limits
7284 @opindex Wno-type-limits
7285 Warn if a comparison is always true or always false due to the limited
7286 range of the data type, but do not warn for constant expressions.  For
7287 example, warn if an unsigned variable is compared against zero with
7288 @code{<} or @code{>=}.  This warning is also enabled by
7289 @option{-Wextra}.
7291 @item -Wabsolute-value @r{(C and Objective-C only)}
7292 @opindex Wabsolute-value
7293 @opindex Wno-absolute-value
7294 Warn for calls to standard functions that compute the absolute value
7295 of an argument when a more appropriate standard function is available.
7296 For example, calling @code{abs(3.14)} triggers the warning because the
7297 appropriate function to call to compute the absolute value of a double
7298 argument is @code{fabs}.  The option also triggers warnings when the
7299 argument in a call to such a function has an unsigned type.  This
7300 warning can be suppressed with an explicit type cast and it is also
7301 enabled by @option{-Wextra}.
7303 @include cppwarnopts.texi
7305 @item -Wbad-function-cast @r{(C and Objective-C only)}
7306 @opindex Wbad-function-cast
7307 @opindex Wno-bad-function-cast
7308 Warn when a function call is cast to a non-matching type.
7309 For example, warn if a call to a function returning an integer type 
7310 is cast to a pointer type.
7312 @item -Wc90-c99-compat @r{(C and Objective-C only)}
7313 @opindex Wc90-c99-compat
7314 @opindex Wno-c90-c99-compat
7315 Warn about features not present in ISO C90, but present in ISO C99.
7316 For instance, warn about use of variable length arrays, @code{long long}
7317 type, @code{bool} type, compound literals, designated initializers, and so
7318 on.  This option is independent of the standards mode.  Warnings are disabled
7319 in the expression that follows @code{__extension__}.
7321 @item -Wc99-c11-compat @r{(C and Objective-C only)}
7322 @opindex Wc99-c11-compat
7323 @opindex Wno-c99-c11-compat
7324 Warn about features not present in ISO C99, but present in ISO C11.
7325 For instance, warn about use of anonymous structures and unions,
7326 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7327 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7328 and so on.  This option is independent of the standards mode.  Warnings are
7329 disabled in the expression that follows @code{__extension__}.
7331 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
7332 @opindex Wc11-c2x-compat
7333 @opindex Wno-c11-c2x-compat
7334 Warn about features not present in ISO C11, but present in ISO C2X.
7335 For instance, warn about omitting the string in @code{_Static_assert},
7336 use of @samp{[[]]} syntax for attributes, use of decimal
7337 floating-point types, and so on.  This option is independent of the
7338 standards mode.  Warnings are disabled in the expression that follows
7339 @code{__extension__}.
7341 @item -Wc++-compat @r{(C and Objective-C only)}
7342 @opindex Wc++-compat
7343 @opindex Wno-c++-compat
7344 Warn about ISO C constructs that are outside of the common subset of
7345 ISO C and ISO C++, e.g.@: request for implicit conversion from
7346 @code{void *} to a pointer to non-@code{void} type.
7348 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7349 @opindex Wc++11-compat
7350 @opindex Wno-c++11-compat
7351 Warn about C++ constructs whose meaning differs between ISO C++ 1998
7352 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7353 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
7354 enabled by @option{-Wall}.
7356 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7357 @opindex Wc++14-compat
7358 @opindex Wno-c++14-compat
7359 Warn about C++ constructs whose meaning differs between ISO C++ 2011
7360 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
7362 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7363 @opindex Wc++17-compat
7364 @opindex Wno-c++17-compat
7365 Warn about C++ constructs whose meaning differs between ISO C++ 2014
7366 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
7368 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7369 @opindex Wc++20-compat
7370 @opindex Wno-c++20-compat
7371 Warn about C++ constructs whose meaning differs between ISO C++ 2017
7372 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
7374 @item -Wcast-qual
7375 @opindex Wcast-qual
7376 @opindex Wno-cast-qual
7377 Warn whenever a pointer is cast so as to remove a type qualifier from
7378 the target type.  For example, warn if a @code{const char *} is cast
7379 to an ordinary @code{char *}.
7381 Also warn when making a cast that introduces a type qualifier in an
7382 unsafe way.  For example, casting @code{char **} to @code{const char **}
7383 is unsafe, as in this example:
7385 @smallexample
7386   /* p is char ** value.  */
7387   const char **q = (const char **) p;
7388   /* Assignment of readonly string to const char * is OK.  */
7389   *q = "string";
7390   /* Now char** pointer points to read-only memory.  */
7391   **p = 'b';
7392 @end smallexample
7394 @item -Wcast-align
7395 @opindex Wcast-align
7396 @opindex Wno-cast-align
7397 Warn whenever a pointer is cast such that the required alignment of the
7398 target is increased.  For example, warn if a @code{char *} is cast to
7399 an @code{int *} on machines where integers can only be accessed at
7400 two- or four-byte boundaries.
7402 @item -Wcast-align=strict
7403 @opindex Wcast-align=strict
7404 Warn whenever a pointer is cast such that the required alignment of the
7405 target is increased.  For example, warn if a @code{char *} is cast to
7406 an @code{int *} regardless of the target machine.
7408 @item -Wcast-function-type
7409 @opindex Wcast-function-type
7410 @opindex Wno-cast-function-type
7411 Warn when a function pointer is cast to an incompatible function pointer.
7412 In a cast involving function types with a variable argument list only
7413 the types of initial arguments that are provided are considered.
7414 Any parameter of pointer-type matches any other pointer-type.  Any benign
7415 differences in integral types are ignored, like @code{int} vs.@: @code{long}
7416 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
7417 type @code{void (*) (void)} is special and matches everything, which can
7418 be used to suppress this warning.
7419 In a cast involving pointer to member types this warning warns whenever
7420 the type cast is changing the pointer to member type.
7421 This warning is enabled by @option{-Wextra}.
7423 @item -Wwrite-strings
7424 @opindex Wwrite-strings
7425 @opindex Wno-write-strings
7426 When compiling C, give string constants the type @code{const
7427 char[@var{length}]} so that copying the address of one into a
7428 non-@code{const} @code{char *} pointer produces a warning.  These
7429 warnings help you find at compile time code that can try to write
7430 into a string constant, but only if you have been very careful about
7431 using @code{const} in declarations and prototypes.  Otherwise, it is
7432 just a nuisance. This is why we did not make @option{-Wall} request
7433 these warnings.
7435 When compiling C++, warn about the deprecated conversion from string
7436 literals to @code{char *}.  This warning is enabled by default for C++
7437 programs.
7439 @item -Wcatch-value
7440 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
7441 @opindex Wcatch-value
7442 @opindex Wno-catch-value
7443 Warn about catch handlers that do not catch via reference.
7444 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
7445 warn about polymorphic class types that are caught by value.
7446 With @option{-Wcatch-value=2} warn about all class types that are caught
7447 by value. With @option{-Wcatch-value=3} warn about all types that are
7448 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
7450 @item -Wclobbered
7451 @opindex Wclobbered
7452 @opindex Wno-clobbered
7453 Warn for variables that might be changed by @code{longjmp} or
7454 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
7456 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
7457 @opindex Wconditionally-supported
7458 @opindex Wno-conditionally-supported
7459 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
7461 @item -Wconversion
7462 @opindex Wconversion
7463 @opindex Wno-conversion
7464 Warn for implicit conversions that may alter a value. This includes
7465 conversions between real and integer, like @code{abs (x)} when
7466 @code{x} is @code{double}; conversions between signed and unsigned,
7467 like @code{unsigned ui = -1}; and conversions to smaller types, like
7468 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7469 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7470 changed by the conversion like in @code{abs (2.0)}.  Warnings about
7471 conversions between signed and unsigned integers can be disabled by
7472 using @option{-Wno-sign-conversion}.
7474 For C++, also warn for confusing overload resolution for user-defined
7475 conversions; and conversions that never use a type conversion
7476 operator: conversions to @code{void}, the same type, a base class or a
7477 reference to them. Warnings about conversions between signed and
7478 unsigned integers are disabled by default in C++ unless
7479 @option{-Wsign-conversion} is explicitly enabled.
7481 Warnings about conversion from arithmetic on a small type back to that
7482 type are only given with @option{-Warith-conversion}.
7484 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
7485 @opindex Wconversion-null
7486 @opindex Wno-conversion-null
7487 Do not warn for conversions between @code{NULL} and non-pointer
7488 types. @option{-Wconversion-null} is enabled by default.
7490 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
7491 @opindex Wzero-as-null-pointer-constant
7492 @opindex Wno-zero-as-null-pointer-constant
7493 Warn when a literal @samp{0} is used as null pointer constant.  This can
7494 be useful to facilitate the conversion to @code{nullptr} in C++11.
7496 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
7497 @opindex Wsubobject-linkage
7498 @opindex Wno-subobject-linkage
7499 Warn if a class type has a base or a field whose type uses the anonymous
7500 namespace or depends on a type with no linkage.  If a type A depends on
7501 a type B with no or internal linkage, defining it in multiple
7502 translation units would be an ODR violation because the meaning of B
7503 is different in each translation unit.  If A only appears in a single
7504 translation unit, the best way to silence the warning is to give it
7505 internal linkage by putting it in an anonymous namespace as well.  The
7506 compiler doesn't give this warning for types defined in the main .C
7507 file, as those are unlikely to have multiple definitions.
7508 @option{-Wsubobject-linkage} is enabled by default.
7510 @item -Wdangling-else
7511 @opindex Wdangling-else
7512 @opindex Wno-dangling-else
7513 Warn about constructions where there may be confusion to which
7514 @code{if} statement an @code{else} branch belongs.  Here is an example of
7515 such a case:
7517 @smallexample
7518 @group
7520   if (a)
7521     if (b)
7522       foo ();
7523   else
7524     bar ();
7526 @end group
7527 @end smallexample
7529 In C/C++, every @code{else} branch belongs to the innermost possible
7530 @code{if} statement, which in this example is @code{if (b)}.  This is
7531 often not what the programmer expected, as illustrated in the above
7532 example by indentation the programmer chose.  When there is the
7533 potential for this confusion, GCC issues a warning when this flag
7534 is specified.  To eliminate the warning, add explicit braces around
7535 the innermost @code{if} statement so there is no way the @code{else}
7536 can belong to the enclosing @code{if}.  The resulting code
7537 looks like this:
7539 @smallexample
7540 @group
7542   if (a)
7543     @{
7544       if (b)
7545         foo ();
7546       else
7547         bar ();
7548     @}
7550 @end group
7551 @end smallexample
7553 This warning is enabled by @option{-Wparentheses}.
7555 @item -Wdate-time
7556 @opindex Wdate-time
7557 @opindex Wno-date-time
7558 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7559 are encountered as they might prevent bit-wise-identical reproducible
7560 compilations.
7562 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7563 @opindex Wdelete-incomplete
7564 @opindex Wno-delete-incomplete
7565 Warn when deleting a pointer to incomplete type, which may cause
7566 undefined behavior at runtime.  This warning is enabled by default.
7568 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7569 @opindex Wuseless-cast
7570 @opindex Wno-useless-cast
7571 Warn when an expression is casted to its own type.
7573 @item -Wempty-body
7574 @opindex Wempty-body
7575 @opindex Wno-empty-body
7576 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7577 while} statement.  This warning is also enabled by @option{-Wextra}.
7579 @item -Wenum-compare
7580 @opindex Wenum-compare
7581 @opindex Wno-enum-compare
7582 Warn about a comparison between values of different enumerated types.
7583 In C++ enumerated type mismatches in conditional expressions are also
7584 diagnosed and the warning is enabled by default.  In C this warning is 
7585 enabled by @option{-Wall}.
7587 @item -Wenum-conversion @r{(C, Objective-C only)}
7588 @opindex Wenum-conversion
7589 @opindex Wno-enum-conversion
7590 Warn when a value of enumerated type is implicitly converted to a 
7591 different enumerated type.  This warning is enabled by @option{-Wextra}.
7593 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7594 @opindex Wextra-semi
7595 @opindex Wno-extra-semi
7596 Warn about redundant semicolon after in-class function definition.
7598 @item -Wjump-misses-init @r{(C, Objective-C only)}
7599 @opindex Wjump-misses-init
7600 @opindex Wno-jump-misses-init
7601 Warn if a @code{goto} statement or a @code{switch} statement jumps
7602 forward across the initialization of a variable, or jumps backward to a
7603 label after the variable has been initialized.  This only warns about
7604 variables that are initialized when they are declared.  This warning is
7605 only supported for C and Objective-C; in C++ this sort of branch is an
7606 error in any case.
7608 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
7609 can be disabled with the @option{-Wno-jump-misses-init} option.
7611 @item -Wsign-compare
7612 @opindex Wsign-compare
7613 @opindex Wno-sign-compare
7614 @cindex warning for comparison of signed and unsigned values
7615 @cindex comparison of signed and unsigned values, warning
7616 @cindex signed and unsigned values, comparison warning
7617 Warn when a comparison between signed and unsigned values could produce
7618 an incorrect result when the signed value is converted to unsigned.
7619 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
7620 also enabled by @option{-Wextra}.
7622 @item -Wsign-conversion
7623 @opindex Wsign-conversion
7624 @opindex Wno-sign-conversion
7625 Warn for implicit conversions that may change the sign of an integer
7626 value, like assigning a signed integer expression to an unsigned
7627 integer variable. An explicit cast silences the warning. In C, this
7628 option is enabled also by @option{-Wconversion}.
7630 @item -Wfloat-conversion
7631 @opindex Wfloat-conversion
7632 @opindex Wno-float-conversion
7633 Warn for implicit conversions that reduce the precision of a real value.
7634 This includes conversions from real to integer, and from higher precision
7635 real to lower precision real values.  This option is also enabled by
7636 @option{-Wconversion}.
7638 @item -Wno-scalar-storage-order
7639 @opindex Wno-scalar-storage-order
7640 @opindex Wscalar-storage-order
7641 Do not warn on suspicious constructs involving reverse scalar storage order.
7643 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7644 @opindex Wsized-deallocation
7645 @opindex Wno-sized-deallocation
7646 Warn about a definition of an unsized deallocation function
7647 @smallexample
7648 void operator delete (void *) noexcept;
7649 void operator delete[] (void *) noexcept;
7650 @end smallexample
7651 without a definition of the corresponding sized deallocation function
7652 @smallexample
7653 void operator delete (void *, std::size_t) noexcept;
7654 void operator delete[] (void *, std::size_t) noexcept;
7655 @end smallexample
7656 or vice versa.  Enabled by @option{-Wextra} along with
7657 @option{-fsized-deallocation}.
7659 @item -Wsizeof-pointer-div
7660 @opindex Wsizeof-pointer-div
7661 @opindex Wno-sizeof-pointer-div
7662 Warn for suspicious divisions of two sizeof expressions that divide
7663 the pointer size by the element size, which is the usual way to compute
7664 the array size but won't work out correctly with pointers.  This warning
7665 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7666 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
7668 @item -Wsizeof-pointer-memaccess
7669 @opindex Wsizeof-pointer-memaccess
7670 @opindex Wno-sizeof-pointer-memaccess
7671 Warn for suspicious length parameters to certain string and memory built-in
7672 functions if the argument uses @code{sizeof}.  This warning triggers for
7673 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7674 an array, but a pointer, and suggests a possible fix, or about
7675 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
7676 also warns about calls to bounded string copy functions like @code{strncat}
7677 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7678 the source array.  For example, in the following function the call to
7679 @code{strncat} specifies the size of the source string as the bound.  That
7680 is almost certainly a mistake and so the call is diagnosed.
7681 @smallexample
7682 void make_file (const char *name)
7684   char path[PATH_MAX];
7685   strncpy (path, name, sizeof path - 1);
7686   strncat (path, ".text", sizeof ".text");
7687   @dots{}
7689 @end smallexample
7691 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7693 @item -Wsizeof-array-argument
7694 @opindex Wsizeof-array-argument
7695 @opindex Wno-sizeof-array-argument
7696 Warn when the @code{sizeof} operator is applied to a parameter that is
7697 declared as an array in a function definition.  This warning is enabled by
7698 default for C and C++ programs.
7700 @item -Wmemset-elt-size
7701 @opindex Wmemset-elt-size
7702 @opindex Wno-memset-elt-size
7703 Warn for suspicious calls to the @code{memset} built-in function, if the
7704 first argument references an array, and the third argument is a number
7705 equal to the number of elements, but not equal to the size of the array
7706 in memory.  This indicates that the user has omitted a multiplication by
7707 the element size.  This warning is enabled by @option{-Wall}.
7709 @item -Wmemset-transposed-args
7710 @opindex Wmemset-transposed-args
7711 @opindex Wno-memset-transposed-args
7712 Warn for suspicious calls to the @code{memset} built-in function where
7713 the second argument is not zero and the third argument is zero.  For
7714 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7715 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
7716 is only emitted if the third argument is a literal zero.  Otherwise, if
7717 it is an expression that is folded to zero, or a cast of zero to some
7718 type, it is far less likely that the arguments have been mistakenly
7719 transposed and no warning is emitted.  This warning is enabled
7720 by @option{-Wall}.
7722 @item -Waddress
7723 @opindex Waddress
7724 @opindex Wno-address
7725 Warn about suspicious uses of memory addresses. These include using
7726 the address of a function in a conditional expression, such as
7727 @code{void func(void); if (func)}, and comparisons against the memory
7728 address of a string literal, such as @code{if (x == "abc")}.  Such
7729 uses typically indicate a programmer error: the address of a function
7730 always evaluates to true, so their use in a conditional usually
7731 indicate that the programmer forgot the parentheses in a function
7732 call; and comparisons against string literals result in unspecified
7733 behavior and are not portable in C, so they usually indicate that the
7734 programmer intended to use @code{strcmp}.  This warning is enabled by
7735 @option{-Wall}.
7737 @item -Waddress-of-packed-member
7738 @opindex Waddress-of-packed-member
7739 @opindex Wno-address-of-packed-member
7740 Warn when the address of packed member of struct or union is taken,
7741 which usually results in an unaligned pointer value.  This is
7742 enabled by default.
7744 @item -Wlogical-op
7745 @opindex Wlogical-op
7746 @opindex Wno-logical-op
7747 Warn about suspicious uses of logical operators in expressions.
7748 This includes using logical operators in contexts where a
7749 bit-wise operator is likely to be expected.  Also warns when
7750 the operands of a logical operator are the same:
7751 @smallexample
7752 extern int a;
7753 if (a < 0 && a < 0) @{ @dots{} @}
7754 @end smallexample
7756 @item -Wlogical-not-parentheses
7757 @opindex Wlogical-not-parentheses
7758 @opindex Wno-logical-not-parentheses
7759 Warn about logical not used on the left hand side operand of a comparison.
7760 This option does not warn if the right operand is considered to be a boolean
7761 expression.  Its purpose is to detect suspicious code like the following:
7762 @smallexample
7763 int a;
7764 @dots{}
7765 if (!a > 1) @{ @dots{} @}
7766 @end smallexample
7768 It is possible to suppress the warning by wrapping the LHS into
7769 parentheses:
7770 @smallexample
7771 if ((!a) > 1) @{ @dots{} @}
7772 @end smallexample
7774 This warning is enabled by @option{-Wall}.
7776 @item -Waggregate-return
7777 @opindex Waggregate-return
7778 @opindex Wno-aggregate-return
7779 Warn if any functions that return structures or unions are defined or
7780 called.  (In languages where you can return an array, this also elicits
7781 a warning.)
7783 @item -Wno-aggressive-loop-optimizations
7784 @opindex Wno-aggressive-loop-optimizations
7785 @opindex Waggressive-loop-optimizations
7786 Warn if in a loop with constant number of iterations the compiler detects
7787 undefined behavior in some statement during one or more of the iterations.
7789 @item -Wno-attributes
7790 @opindex Wno-attributes
7791 @opindex Wattributes
7792 Do not warn if an unexpected @code{__attribute__} is used, such as
7793 unrecognized attributes, function attributes applied to variables,
7794 etc.  This does not stop errors for incorrect use of supported
7795 attributes.
7797 @item -Wno-builtin-declaration-mismatch
7798 @opindex Wno-builtin-declaration-mismatch
7799 @opindex Wbuiltin-declaration-mismatch
7800 Warn if a built-in function is declared with an incompatible signature
7801 or as a non-function, or when a built-in function declared with a type
7802 that does not include a prototype is called with arguments whose promoted
7803 types do not match those expected by the function.  When @option{-Wextra}
7804 is specified, also warn when a built-in function that takes arguments is
7805 declared without a prototype.  The @option{-Wno-builtin-declaration-mismatch}
7806 warning is enabled by default.  To avoid the warning include the appropriate
7807 header to bring the prototypes of built-in functions into scope.
7809 For example, the call to @code{memset} below is diagnosed by the warning
7810 because the function expects a value of type @code{size_t} as its argument
7811 but the type of @code{32} is @code{int}.  With @option{-Wextra},
7812 the declaration of the function is diagnosed as well.
7813 @smallexample
7814 extern void* memset ();
7815 void f (void *d)
7817   memset (d, '\0', 32);
7819 @end smallexample
7821 @item -Wno-builtin-macro-redefined
7822 @opindex Wno-builtin-macro-redefined
7823 @opindex Wbuiltin-macro-redefined
7824 Do not warn if certain built-in macros are redefined.  This suppresses
7825 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7826 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7828 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7829 @opindex Wstrict-prototypes
7830 @opindex Wno-strict-prototypes
7831 Warn if a function is declared or defined without specifying the
7832 argument types.  (An old-style function definition is permitted without
7833 a warning if preceded by a declaration that specifies the argument
7834 types.)
7836 @item -Wold-style-declaration @r{(C and Objective-C only)}
7837 @opindex Wold-style-declaration
7838 @opindex Wno-old-style-declaration
7839 Warn for obsolescent usages, according to the C Standard, in a
7840 declaration. For example, warn if storage-class specifiers like
7841 @code{static} are not the first things in a declaration.  This warning
7842 is also enabled by @option{-Wextra}.
7844 @item -Wold-style-definition @r{(C and Objective-C only)}
7845 @opindex Wold-style-definition
7846 @opindex Wno-old-style-definition
7847 Warn if an old-style function definition is used.  A warning is given
7848 even if there is a previous prototype.  A definition using @samp{()}
7849 is not considered an old-style definition in C2X mode, because it is
7850 equivalent to @samp{(void)} in that case, but is considered an
7851 old-style definition for older standards.
7853 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7854 @opindex Wmissing-parameter-type
7855 @opindex Wno-missing-parameter-type
7856 A function parameter is declared without a type specifier in K&R-style
7857 functions:
7859 @smallexample
7860 void foo(bar) @{ @}
7861 @end smallexample
7863 This warning is also enabled by @option{-Wextra}.
7865 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7866 @opindex Wmissing-prototypes
7867 @opindex Wno-missing-prototypes
7868 Warn if a global function is defined without a previous prototype
7869 declaration.  This warning is issued even if the definition itself
7870 provides a prototype.  Use this option to detect global functions
7871 that do not have a matching prototype declaration in a header file.
7872 This option is not valid for C++ because all function declarations
7873 provide prototypes and a non-matching declaration declares an
7874 overload rather than conflict with an earlier declaration.
7875 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7877 @item -Wmissing-declarations
7878 @opindex Wmissing-declarations
7879 @opindex Wno-missing-declarations
7880 Warn if a global function is defined without a previous declaration.
7881 Do so even if the definition itself provides a prototype.
7882 Use this option to detect global functions that are not declared in
7883 header files.  In C, no warnings are issued for functions with previous
7884 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7885 missing prototypes.  In C++, no warnings are issued for function templates,
7886 or for inline functions, or for functions in anonymous namespaces.
7888 @item -Wmissing-field-initializers
7889 @opindex Wmissing-field-initializers
7890 @opindex Wno-missing-field-initializers
7891 @opindex W
7892 @opindex Wextra
7893 @opindex Wno-extra
7894 Warn if a structure's initializer has some fields missing.  For
7895 example, the following code causes such a warning, because
7896 @code{x.h} is implicitly zero:
7898 @smallexample
7899 struct s @{ int f, g, h; @};
7900 struct s x = @{ 3, 4 @};
7901 @end smallexample
7903 This option does not warn about designated initializers, so the following
7904 modification does not trigger a warning:
7906 @smallexample
7907 struct s @{ int f, g, h; @};
7908 struct s x = @{ .f = 3, .g = 4 @};
7909 @end smallexample
7911 In C this option does not warn about the universal zero initializer
7912 @samp{@{ 0 @}}:
7914 @smallexample
7915 struct s @{ int f, g, h; @};
7916 struct s x = @{ 0 @};
7917 @end smallexample
7919 Likewise, in C++ this option does not warn about the empty @{ @}
7920 initializer, for example:
7922 @smallexample
7923 struct s @{ int f, g, h; @};
7924 s x = @{ @};
7925 @end smallexample
7927 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
7928 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7930 @item -Wno-multichar
7931 @opindex Wno-multichar
7932 @opindex Wmultichar
7933 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7934 Usually they indicate a typo in the user's code, as they have
7935 implementation-defined values, and should not be used in portable code.
7937 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7938 @opindex Wnormalized=
7939 @opindex Wnormalized
7940 @opindex Wno-normalized
7941 @cindex NFC
7942 @cindex NFKC
7943 @cindex character set, input normalization
7944 In ISO C and ISO C++, two identifiers are different if they are
7945 different sequences of characters.  However, sometimes when characters
7946 outside the basic ASCII character set are used, you can have two
7947 different character sequences that look the same.  To avoid confusion,
7948 the ISO 10646 standard sets out some @dfn{normalization rules} which
7949 when applied ensure that two sequences that look the same are turned into
7950 the same sequence.  GCC can warn you if you are using identifiers that
7951 have not been normalized; this option controls that warning.
7953 There are four levels of warning supported by GCC@.  The default is
7954 @option{-Wnormalized=nfc}, which warns about any identifier that is
7955 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
7956 recommended form for most uses.  It is equivalent to
7957 @option{-Wnormalized}.
7959 Unfortunately, there are some characters allowed in identifiers by
7960 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
7961 identifiers.  That is, there's no way to use these symbols in portable
7962 ISO C or C++ and have all your identifiers in NFC@.
7963 @option{-Wnormalized=id} suppresses the warning for these characters.
7964 It is hoped that future versions of the standards involved will correct
7965 this, which is why this option is not the default.
7967 You can switch the warning off for all characters by writing
7968 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
7969 only do this if you are using some other normalization scheme (like
7970 ``D''), because otherwise you can easily create bugs that are
7971 literally impossible to see.
7973 Some characters in ISO 10646 have distinct meanings but look identical
7974 in some fonts or display methodologies, especially once formatting has
7975 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7976 LETTER N'', displays just like a regular @code{n} that has been
7977 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
7978 normalization scheme to convert all these into a standard form as
7979 well, and GCC warns if your code is not in NFKC if you use
7980 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
7981 about every identifier that contains the letter O because it might be
7982 confused with the digit 0, and so is not the default, but may be
7983 useful as a local coding convention if the programming environment 
7984 cannot be fixed to display these characters distinctly.
7986 @item -Wno-attribute-warning
7987 @opindex Wno-attribute-warning
7988 @opindex Wattribute-warning
7989 Do not warn about usage of functions (@pxref{Function Attributes})
7990 declared with @code{warning} attribute.  By default, this warning is
7991 enabled.  @option{-Wno-attribute-warning} can be used to disable the
7992 warning or @option{-Wno-error=attribute-warning} can be used to
7993 disable the error when compiled with @option{-Werror} flag.
7995 @item -Wno-deprecated
7996 @opindex Wno-deprecated
7997 @opindex Wdeprecated
7998 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
8000 @item -Wno-deprecated-declarations
8001 @opindex Wno-deprecated-declarations
8002 @opindex Wdeprecated-declarations
8003 Do not warn about uses of functions (@pxref{Function Attributes}),
8004 variables (@pxref{Variable Attributes}), and types (@pxref{Type
8005 Attributes}) marked as deprecated by using the @code{deprecated}
8006 attribute.
8008 @item -Wno-overflow
8009 @opindex Wno-overflow
8010 @opindex Woverflow
8011 Do not warn about compile-time overflow in constant expressions.
8013 @item -Wno-odr
8014 @opindex Wno-odr
8015 @opindex Wodr
8016 Warn about One Definition Rule violations during link-time optimization.
8017 Enabled by default.
8019 @item -Wopenmp-simd
8020 @opindex Wopenmp-simd
8021 @opindex Wno-openmp-simd
8022 Warn if the vectorizer cost model overrides the OpenMP
8023 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
8024 option can be used to relax the cost model.
8026 @item -Woverride-init @r{(C and Objective-C only)}
8027 @opindex Woverride-init
8028 @opindex Wno-override-init
8029 @opindex W
8030 @opindex Wextra
8031 @opindex Wno-extra
8032 Warn if an initialized field without side effects is overridden when
8033 using designated initializers (@pxref{Designated Inits, , Designated
8034 Initializers}).
8036 This warning is included in @option{-Wextra}.  To get other
8037 @option{-Wextra} warnings without this one, use @option{-Wextra
8038 -Wno-override-init}.
8040 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
8041 @opindex Woverride-init-side-effects
8042 @opindex Wno-override-init-side-effects
8043 Warn if an initialized field with side effects is overridden when
8044 using designated initializers (@pxref{Designated Inits, , Designated
8045 Initializers}).  This warning is enabled by default.
8047 @item -Wpacked
8048 @opindex Wpacked
8049 @opindex Wno-packed
8050 Warn if a structure is given the packed attribute, but the packed
8051 attribute has no effect on the layout or size of the structure.
8052 Such structures may be mis-aligned for little benefit.  For
8053 instance, in this code, the variable @code{f.x} in @code{struct bar}
8054 is misaligned even though @code{struct bar} does not itself
8055 have the packed attribute:
8057 @smallexample
8058 @group
8059 struct foo @{
8060   int x;
8061   char a, b, c, d;
8062 @} __attribute__((packed));
8063 struct bar @{
8064   char z;
8065   struct foo f;
8067 @end group
8068 @end smallexample
8070 @item -Wpacked-bitfield-compat
8071 @opindex Wpacked-bitfield-compat
8072 @opindex Wno-packed-bitfield-compat
8073 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
8074 on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
8075 the change can lead to differences in the structure layout.  GCC
8076 informs you when the offset of such a field has changed in GCC 4.4.
8077 For example there is no longer a 4-bit padding between field @code{a}
8078 and @code{b} in this structure:
8080 @smallexample
8081 struct foo
8083   char a:4;
8084   char b:8;
8085 @} __attribute__ ((packed));
8086 @end smallexample
8088 This warning is enabled by default.  Use
8089 @option{-Wno-packed-bitfield-compat} to disable this warning.
8091 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
8092 @opindex Wpacked-not-aligned
8093 @opindex Wno-packed-not-aligned
8094 Warn if a structure field with explicitly specified alignment in a
8095 packed struct or union is misaligned.  For example, a warning will
8096 be issued on @code{struct S}, like, @code{warning: alignment 1 of
8097 'struct S' is less than 8}, in this code:
8099 @smallexample
8100 @group
8101 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
8102 struct __attribute__ ((packed)) S @{
8103   struct S8 s8;
8105 @end group
8106 @end smallexample
8108 This warning is enabled by @option{-Wall}.
8110 @item -Wpadded
8111 @opindex Wpadded
8112 @opindex Wno-padded
8113 Warn if padding is included in a structure, either to align an element
8114 of the structure or to align the whole structure.  Sometimes when this
8115 happens it is possible to rearrange the fields of the structure to
8116 reduce the padding and so make the structure smaller.
8118 @item -Wredundant-decls
8119 @opindex Wredundant-decls
8120 @opindex Wno-redundant-decls
8121 Warn if anything is declared more than once in the same scope, even in
8122 cases where multiple declaration is valid and changes nothing.
8124 @item -Wno-restrict
8125 @opindex Wrestrict
8126 @opindex Wno-restrict
8127 Warn when an object referenced by a @code{restrict}-qualified parameter
8128 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8129 argument, or when copies between such objects overlap.  For example,
8130 the call to the @code{strcpy} function below attempts to truncate the string
8131 by replacing its initial characters with the last four.  However, because
8132 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8133 the call is diagnosed.
8135 @smallexample
8136 void foo (void)
8138   char a[] = "abcd1234";
8139   strcpy (a, a + 4);
8140   @dots{}
8142 @end smallexample
8143 The @option{-Wrestrict} option detects some instances of simple overlap
8144 even without optimization but works best at @option{-O2} and above.  It
8145 is included in @option{-Wall}.
8147 @item -Wnested-externs @r{(C and Objective-C only)}
8148 @opindex Wnested-externs
8149 @opindex Wno-nested-externs
8150 Warn if an @code{extern} declaration is encountered within a function.
8152 @item -Wno-inherited-variadic-ctor
8153 @opindex Winherited-variadic-ctor
8154 @opindex Wno-inherited-variadic-ctor
8155 Suppress warnings about use of C++11 inheriting constructors when the
8156 base class inherited from has a C variadic constructor; the warning is
8157 on by default because the ellipsis is not inherited.
8159 @item -Winline
8160 @opindex Winline
8161 @opindex Wno-inline
8162 Warn if a function that is declared as inline cannot be inlined.
8163 Even with this option, the compiler does not warn about failures to
8164 inline functions declared in system headers.
8166 The compiler uses a variety of heuristics to determine whether or not
8167 to inline a function.  For example, the compiler takes into account
8168 the size of the function being inlined and the amount of inlining
8169 that has already been done in the current function.  Therefore,
8170 seemingly insignificant changes in the source program can cause the
8171 warnings produced by @option{-Winline} to appear or disappear.
8173 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
8174 @opindex Wno-invalid-offsetof
8175 @opindex Winvalid-offsetof
8176 Suppress warnings from applying the @code{offsetof} macro to a non-POD
8177 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
8178 to a non-standard-layout type is undefined.  In existing C++ implementations,
8179 however, @code{offsetof} typically gives meaningful results.
8180 This flag is for users who are aware that they are
8181 writing nonportable code and who have deliberately chosen to ignore the
8182 warning about it.
8184 The restrictions on @code{offsetof} may be relaxed in a future version
8185 of the C++ standard.
8187 @item -Wint-in-bool-context
8188 @opindex Wint-in-bool-context
8189 @opindex Wno-int-in-bool-context
8190 Warn for suspicious use of integer values where boolean values are expected,
8191 such as conditional expressions (?:) using non-boolean integer constants in
8192 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
8193 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
8194 for all kinds of multiplications regardless of the data type.
8195 This warning is enabled by @option{-Wall}.
8197 @item -Wno-int-to-pointer-cast
8198 @opindex Wno-int-to-pointer-cast
8199 @opindex Wint-to-pointer-cast
8200 Suppress warnings from casts to pointer type of an integer of a
8201 different size. In C++, casting to a pointer type of smaller size is
8202 an error. @option{Wint-to-pointer-cast} is enabled by default.
8205 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8206 @opindex Wno-pointer-to-int-cast
8207 @opindex Wpointer-to-int-cast
8208 Suppress warnings from casts from a pointer to an integer type of a
8209 different size.
8211 @item -Winvalid-pch
8212 @opindex Winvalid-pch
8213 @opindex Wno-invalid-pch
8214 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8215 the search path but cannot be used.
8217 @item -Wlong-long
8218 @opindex Wlong-long
8219 @opindex Wno-long-long
8220 Warn if @code{long long} type is used.  This is enabled by either
8221 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8222 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
8224 @item -Wvariadic-macros
8225 @opindex Wvariadic-macros
8226 @opindex Wno-variadic-macros
8227 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8228 alternate syntax is used in ISO C99 mode.  This is enabled by either
8229 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
8230 messages, use @option{-Wno-variadic-macros}.
8232 @item -Wvarargs
8233 @opindex Wvarargs
8234 @opindex Wno-varargs
8235 Warn upon questionable usage of the macros used to handle variable
8236 arguments like @code{va_start}.  This is default.  To inhibit the
8237 warning messages, use @option{-Wno-varargs}.
8239 @item -Wvector-operation-performance
8240 @opindex Wvector-operation-performance
8241 @opindex Wno-vector-operation-performance
8242 Warn if vector operation is not implemented via SIMD capabilities of the
8243 architecture.  Mainly useful for the performance tuning.
8244 Vector operation can be implemented @code{piecewise}, which means that the
8245 scalar operation is performed on every vector element; 
8246 @code{in parallel}, which means that the vector operation is implemented
8247 using scalars of wider type, which normally is more performance efficient;
8248 and @code{as a single scalar}, which means that vector fits into a
8249 scalar type.
8251 @item -Wno-virtual-move-assign
8252 @opindex Wvirtual-move-assign
8253 @opindex Wno-virtual-move-assign
8254 Suppress warnings about inheriting from a virtual base with a
8255 non-trivial C++11 move assignment operator.  This is dangerous because
8256 if the virtual base is reachable along more than one path, it is
8257 moved multiple times, which can mean both objects end up in the
8258 moved-from state.  If the move assignment operator is written to avoid
8259 moving from a moved-from object, this warning can be disabled.
8261 @item -Wvla
8262 @opindex Wvla
8263 @opindex Wno-vla
8264 Warn if a variable-length array is used in the code.
8265 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8266 the variable-length array.
8268 @item -Wvla-larger-than=@var{byte-size}
8269 @opindex Wvla-larger-than=
8270 @opindex Wno-vla-larger-than
8271 If this option is used, the compiler will warn for declarations of
8272 variable-length arrays whose size is either unbounded, or bounded
8273 by an argument that allows the array size to exceed @var{byte-size}
8274 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8275 works, but with variable-length arrays.
8277 Note that GCC may optimize small variable-length arrays of a known
8278 value into plain arrays, so this warning may not get triggered for
8279 such arrays.
8281 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8282 is typically only effective when @option{-ftree-vrp} is active (default
8283 for @option{-O2} and above).
8285 See also @option{-Walloca-larger-than=@var{byte-size}}.
8287 @item -Wno-vla-larger-than
8288 @opindex Wno-vla-larger-than
8289 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
8290 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8292 @item -Wvolatile-register-var
8293 @opindex Wvolatile-register-var
8294 @opindex Wno-volatile-register-var
8295 Warn if a register variable is declared volatile.  The volatile
8296 modifier does not inhibit all optimizations that may eliminate reads
8297 and/or writes to register variables.  This warning is enabled by
8298 @option{-Wall}.
8300 @item -Wdisabled-optimization
8301 @opindex Wdisabled-optimization
8302 @opindex Wno-disabled-optimization
8303 Warn if a requested optimization pass is disabled.  This warning does
8304 not generally indicate that there is anything wrong with your code; it
8305 merely indicates that GCC's optimizers are unable to handle the code
8306 effectively.  Often, the problem is that your code is too big or too
8307 complex; GCC refuses to optimize programs when the optimization
8308 itself is likely to take inordinate amounts of time.
8310 @item -Wpointer-sign @r{(C and Objective-C only)}
8311 @opindex Wpointer-sign
8312 @opindex Wno-pointer-sign
8313 Warn for pointer argument passing or assignment with different signedness.
8314 This option is only supported for C and Objective-C@.  It is implied by
8315 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8316 @option{-Wno-pointer-sign}.
8318 @item -Wstack-protector
8319 @opindex Wstack-protector
8320 @opindex Wno-stack-protector
8321 This option is only active when @option{-fstack-protector} is active.  It
8322 warns about functions that are not protected against stack smashing.
8324 @item -Woverlength-strings
8325 @opindex Woverlength-strings
8326 @opindex Wno-overlength-strings
8327 Warn about string constants that are longer than the ``minimum
8328 maximum'' length specified in the C standard.  Modern compilers
8329 generally allow string constants that are much longer than the
8330 standard's minimum limit, but very portable programs should avoid
8331 using longer strings.
8333 The limit applies @emph{after} string constant concatenation, and does
8334 not count the trailing NUL@.  In C90, the limit was 509 characters; in
8335 C99, it was raised to 4095.  C++98 does not specify a normative
8336 minimum maximum, so we do not diagnose overlength strings in C++@.
8338 This option is implied by @option{-Wpedantic}, and can be disabled with
8339 @option{-Wno-overlength-strings}.
8341 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8342 @opindex Wunsuffixed-float-constants
8343 @opindex Wno-unsuffixed-float-constants
8345 Issue a warning for any floating constant that does not have
8346 a suffix.  When used together with @option{-Wsystem-headers} it
8347 warns about such constants in system header files.  This can be useful
8348 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8349 from the decimal floating-point extension to C99.
8351 @item -Wno-designated-init @r{(C and Objective-C only)}
8352 Suppress warnings when a positional initializer is used to initialize
8353 a structure that has been marked with the @code{designated_init}
8354 attribute.
8356 @item -Whsa
8357 Issue a warning when HSAIL cannot be emitted for the compiled function or
8358 OpenMP construct.
8360 @end table
8362 @node Static Analyzer Options
8363 @section Options That Control Static Analysis
8365 @table @gcctabopt
8366 @item -fanalyzer
8367 @opindex analyzer
8368 @opindex fanalyzer
8369 @opindex fno-analyzer
8370 This option enables an static analysis of program flow which looks
8371 for ``interesting'' interprocedural paths through the
8372 code, and issues warnings for problems found on them.
8374 This analysis is much more expensive than other GCC warnings.
8376 Enabling this option effectively enables the following warnings:
8378 @gccoptlist{ @gol
8379 -Wanalyzer-double-fclose @gol
8380 -Wanalyzer-double-free @gol
8381 -Wanalyzer-exposure-through-output-file @gol
8382 -Wanalyzer-file-leak @gol
8383 -Wanalyzer-free-of-non-heap @gol
8384 -Wanalyzer-malloc-leak @gol
8385 -Wanalyzer-possible-null-argument @gol
8386 -Wanalyzer-possible-null-dereference @gol
8387 -Wanalyzer-null-argument @gol
8388 -Wanalyzer-null-dereference @gol
8389 -Wanalyzer-tainted-array-index @gol
8390 -Wanalyzer-unsafe-call-within-signal-handler @gol
8391 -Wanalyzer-use-after-free @gol
8392 -Wanalyzer-use-of-uninitialized-value @gol
8393 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8396 This option is only available if GCC was configured with analyzer
8397 support enabled.
8399 @item -Wanalyzer-too-complex
8400 @opindex Wanalyzer-too-complex
8401 @opindex Wno-analyzer-too-complex
8402 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8403 to attempt to explore the control flow and data flow in the program,
8404 but these can be defeated by sufficiently complicated code.
8406 By default, the analysis will silently stop if the code is too
8407 complicated for the analyzer to fully explore and it reaches an internal
8408 limit.
8410 The @option{-Wanalyzer-too-complex} option will warn if this occurs.
8412 @end table
8414 Pertinent parameters for controlling the exploration are:
8415 @option{--param analyzer-bb-explosion-factor=@var{value}},
8416 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
8417 @option{--param analyzer-max-recursion-depth=@var{value}}, and
8418 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8420 The following options control the analyzer.
8422 @table @gcctabopt
8424 @item -fanalyzer-call-summaries
8425 @opindex fanalyzer-call-summaries
8426 @opindex fno-analyzer-call-summaries
8427 Simplify interprocedural analysis by computing the effect of certain calls,
8428 rather than exploring all paths through the function from callsite to each
8429 possible return.
8431 If enabled, call summaries are only used for functions with more than one
8432 call site, and that are sufficiently complicated (as per
8433 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8435 @item -fanalyzer-checker=@var{name}
8436 @opindex fanalyzer-checker
8437 Restrict the analyzer to run just the named checker.
8439 @item -fanalyzer-fine-grained
8440 @opindex fanalyzer-fine-grained
8441 @opindex fno-analyzer-fine-grained
8442 This option is intended for analyzer developers.
8444 Internally the analyzer builds an ``exploded graph'' that combines
8445 control flow graphs with data flow information.
8447 By default, an edge in this graph can contain the effects of a run
8448 of multiple statements within a basic block.  With
8449 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
8451 @item -fno-analyzer-state-merge
8452 @opindex fanalyzer-state-merge
8453 @opindex fno-analyzer-state-merge
8454 This option is intended for analyzer developers.
8456 By default the analyzer will attempt to simplify analysis by merging
8457 sufficiently similar states at each program point as it builds its
8458 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
8459 merging can be suppressed, for debugging state-handling issues.
8461 @item -fno-analyzer-state-purge
8462 @opindex fanalyzer-state-purge
8463 @opindex fno-analyzer-state-purge
8464 This option is intended for analyzer developers.
8466 By default the analyzer will attempt to simplify analysis by purging
8467 aspects of state at a program point that appear to no longer be relevant
8468 e.g. the values of locals that aren't accessed later in the function
8469 and which aren't relevant to leak analysis.
8471 With @option{-fno-analyzer-state-purge} this purging of state can
8472 be suppressed, for debugging state-handling issues.
8474 @item -fanalyzer-transitivity
8475 @opindex fanalyzer-transitivity
8476 @opindex fno-analyzer-transitivity
8477 This option enables transitivity of constraints within the analyzer.
8479 @item -fanalyzer-verbose-edges
8480 This option is intended for analyzer developers.  It enables more
8481 verbose, lower-level detail in the descriptions of control flow
8482 within diagnostic paths.
8484 @item -fanalyzer-verbose-state-changes
8485 This option is intended for analyzer developers.  It enables more
8486 verbose, lower-level detail in the descriptions of events relating
8487 to state machines within diagnostic paths.
8489 @item -fanalyzer-verbosity=@var{level}
8490 This option controls the complexity of the control flow paths that are
8491 emitted for analyzer diagnostics.
8493 The @var{level} can be one of:
8495 @table @samp
8496 @item 0
8497 At this level, interprocedural call and return events are displayed,
8498 along with the most pertinent state-change events relating to
8499 a diagnostic.  For example, for a double-@code{free} diagnostic,
8500 both calls to @code{free} will be shown.
8502 @item 1
8503 As per the previous level, but also show events for the entry
8504 to each function.
8506 @item 2
8507 As per the previous level, but also show  events relating to
8508 control flow (e.g. ``true path taken'' at a conditional).
8510 This level is the default.
8512 @item 3
8513 This level is intended for analyzer developers; it adds various
8514 other events intended for debugging the analyzer.
8516 @end table
8518 @item -fdump-analyzer
8519 @opindex fdump-analyzer
8520 Dump internal details about what the analyzer is doing to
8521 @file{@var{file}.analyzer.txt}.
8522 This option is overridden by @option{-fdump-analyzer-stderr}.
8524 @item -fdump-analyzer-stderr
8525 @opindex fdump-analyzer-stderr
8526 Dump internal details about what the analyzer is doing to stderr.
8527 This option overrides @option{-fdump-analyzer}.
8529 @item -fdump-analyzer-callgraph
8530 @opindex fdump-analyzer-callgraph
8531 Dump a representation of the call graph suitable for viewing with
8532 GraphViz to @file{@var{file}.callgraph.dot}.
8534 @item -fdump-analyzer-exploded-graph
8535 @opindex fdump-analyzer-exploded-graph
8536 Dump a representation of the ``exploded graph'' suitable for viewing with
8537 GraphViz to @file{@var{file}.eg.dot}.
8538 Nodes are color-coded based on state-machine states to emphasize
8539 state changes.
8541 @item -fdump-analyzer-exploded-nodes
8542 @opindex dump-analyzer-exploded-nodes
8543 Emit diagnostics showing where nodes in the ``exploded graph'' are
8544 in relation to the program source.
8546 @item -fdump-analyzer-exploded-nodes-2
8547 @opindex dump-analyzer-exploded-nodes-2
8548 Dump a textual representation of the ``exploded graph'' to
8549 @file{@var{file}.eg.txt}.
8551 @item -fdump-analyzer-exploded-nodes-3
8552 @opindex dump-analyzer-exploded-nodes-3
8553 Dump a textual representation of the ``exploded graph'' to
8554 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8555 This is typically a large number of dump files.
8557 @item -fdump-analyzer-state-purge
8558 @opindex fdump-analyzer-state-purge
8559 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8560 ``supergraph'' suitable for viewing with GraphViz, but annotate the
8561 graph with information on what state will be purged at each node.
8562 The graph is written to @file{@var{file}.state-purge.dot}.
8564 @item -fdump-analyzer-supergraph
8565 @opindex fdump-analyzer-supergraph
8566 Dump a representation of the ``supergraph'' suitable for viewing with
8567 GraphViz to @file{@var{file}.supergraph.dot}.  This shows all of the
8568 control flow graphs in the program, with interprocedural edges for
8569 calls and returns.
8571 @end table
8573 @node Debugging Options
8574 @section Options for Debugging Your Program
8575 @cindex options, debugging
8576 @cindex debugging information options
8578 To tell GCC to emit extra information for use by a debugger, in almost 
8579 all cases you need only to add @option{-g} to your other options.
8581 GCC allows you to use @option{-g} with
8582 @option{-O}.  The shortcuts taken by optimized code may occasionally
8583 be surprising: some variables you declared may not exist
8584 at all; flow of control may briefly move where you did not expect it;
8585 some statements may not be executed because they compute constant
8586 results or their values are already at hand; some statements may
8587 execute in different places because they have been moved out of loops.
8588 Nevertheless it is possible to debug optimized output.  This makes
8589 it reasonable to use the optimizer for programs that might have bugs.
8591 If you are not using some other optimization option, consider
8592 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
8593 With no @option{-O} option at all, some compiler passes that collect
8594 information useful for debugging do not run at all, so that
8595 @option{-Og} may result in a better debugging experience.
8597 @table @gcctabopt
8598 @item -g
8599 @opindex g
8600 Produce debugging information in the operating system's native format
8601 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
8602 information.
8604 On most systems that use stabs format, @option{-g} enables use of extra
8605 debugging information that only GDB can use; this extra information
8606 makes debugging work better in GDB but probably makes other debuggers
8607 crash or
8608 refuse to read the program.  If you want to control for certain whether
8609 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8610 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8612 @item -ggdb
8613 @opindex ggdb
8614 Produce debugging information for use by GDB@.  This means to use the
8615 most expressive format available (DWARF, stabs, or the native format
8616 if neither of those are supported), including GDB extensions if at all
8617 possible.
8619 @item -gdwarf
8620 @itemx -gdwarf-@var{version}
8621 @opindex gdwarf
8622 Produce debugging information in DWARF format (if that is supported).
8623 The value of @var{version} may be either 2, 3, 4 or 5; the default version
8624 for most targets is 4.  DWARF Version 5 is only experimental.
8626 Note that with DWARF Version 2, some ports require and always
8627 use some non-conflicting DWARF 3 extensions in the unwind tables.
8629 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8630 for maximum benefit.
8632 GCC no longer supports DWARF Version 1, which is substantially
8633 different than Version 2 and later.  For historical reasons, some
8634 other DWARF-related options such as
8635 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8636 in their names, but apply to all currently-supported versions of DWARF.
8638 @item -gstabs
8639 @opindex gstabs
8640 Produce debugging information in stabs format (if that is supported),
8641 without GDB extensions.  This is the format used by DBX on most BSD
8642 systems.  On MIPS, Alpha and System V Release 4 systems this option
8643 produces stabs debugging output that is not understood by DBX@.
8644 On System V Release 4 systems this option requires the GNU assembler.
8646 @item -gstabs+
8647 @opindex gstabs+
8648 Produce debugging information in stabs format (if that is supported),
8649 using GNU extensions understood only by the GNU debugger (GDB)@.  The
8650 use of these extensions is likely to make other debuggers crash or
8651 refuse to read the program.
8653 @item -gxcoff
8654 @opindex gxcoff
8655 Produce debugging information in XCOFF format (if that is supported).
8656 This is the format used by the DBX debugger on IBM RS/6000 systems.
8658 @item -gxcoff+
8659 @opindex gxcoff+
8660 Produce debugging information in XCOFF format (if that is supported),
8661 using GNU extensions understood only by the GNU debugger (GDB)@.  The
8662 use of these extensions is likely to make other debuggers crash or
8663 refuse to read the program, and may cause assemblers other than the GNU
8664 assembler (GAS) to fail with an error.
8666 @item -gvms
8667 @opindex gvms
8668 Produce debugging information in Alpha/VMS debug format (if that is
8669 supported).  This is the format used by DEBUG on Alpha/VMS systems.
8671 @item -g@var{level}
8672 @itemx -ggdb@var{level}
8673 @itemx -gstabs@var{level}
8674 @itemx -gxcoff@var{level}
8675 @itemx -gvms@var{level}
8676 Request debugging information and also use @var{level} to specify how
8677 much information.  The default level is 2.
8679 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
8680 @option{-g}.
8682 Level 1 produces minimal information, enough for making backtraces in
8683 parts of the program that you don't plan to debug.  This includes
8684 descriptions of functions and external variables, and line number
8685 tables, but no information about local variables.
8687 Level 3 includes extra information, such as all the macro definitions
8688 present in the program.  Some debuggers support macro expansion when
8689 you use @option{-g3}.
8691 If you use multiple @option{-g} options, with or without level numbers,
8692 the last such option is the one that is effective.
8694 @option{-gdwarf} does not accept a concatenated debug level, to avoid
8695 confusion with @option{-gdwarf-@var{level}}.
8696 Instead use an additional @option{-g@var{level}} option to change the
8697 debug level for DWARF.
8699 @item -fno-eliminate-unused-debug-symbols
8700 @opindex feliminate-unused-debug-symbols
8701 @opindex fno-eliminate-unused-debug-symbols
8702 By default, no debug information is produced for symbols that are not actually
8703 used. Use this option if you want debug information for all symbols.
8705 @item -femit-class-debug-always
8706 @opindex femit-class-debug-always
8707 Instead of emitting debugging information for a C++ class in only one
8708 object file, emit it in all object files using the class.  This option
8709 should be used only with debuggers that are unable to handle the way GCC
8710 normally emits debugging information for classes because using this
8711 option increases the size of debugging information by as much as a
8712 factor of two.
8714 @item -fno-merge-debug-strings
8715 @opindex fmerge-debug-strings
8716 @opindex fno-merge-debug-strings
8717 Direct the linker to not merge together strings in the debugging
8718 information that are identical in different object files.  Merging is
8719 not supported by all assemblers or linkers.  Merging decreases the size
8720 of the debug information in the output file at the cost of increasing
8721 link processing time.  Merging is enabled by default.
8723 @item -fdebug-prefix-map=@var{old}=@var{new}
8724 @opindex fdebug-prefix-map
8725 When compiling files residing in directory @file{@var{old}}, record
8726 debugging information describing them as if the files resided in
8727 directory @file{@var{new}} instead.  This can be used to replace a
8728 build-time path with an install-time path in the debug info.  It can
8729 also be used to change an absolute path to a relative path by using
8730 @file{.} for @var{new}.  This can give more reproducible builds, which
8731 are location independent, but may require an extra command to tell GDB
8732 where to find the source files. See also @option{-ffile-prefix-map}.
8734 @item -fvar-tracking
8735 @opindex fvar-tracking
8736 Run variable tracking pass.  It computes where variables are stored at each
8737 position in code.  Better debugging information is then generated
8738 (if the debugging information format supports this information).
8740 It is enabled by default when compiling with optimization (@option{-Os},
8741 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8742 the debug info format supports it.
8744 @item -fvar-tracking-assignments
8745 @opindex fvar-tracking-assignments
8746 @opindex fno-var-tracking-assignments
8747 Annotate assignments to user variables early in the compilation and
8748 attempt to carry the annotations over throughout the compilation all the
8749 way to the end, in an attempt to improve debug information while
8750 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
8752 It can be enabled even if var-tracking is disabled, in which case
8753 annotations are created and maintained, but discarded at the end.
8754 By default, this flag is enabled together with @option{-fvar-tracking},
8755 except when selective scheduling is enabled.
8757 @item -gsplit-dwarf
8758 @opindex gsplit-dwarf
8759 Separate as much DWARF debugging information as possible into a
8760 separate output file with the extension @file{.dwo}.  This option allows
8761 the build system to avoid linking files with debug information.  To
8762 be useful, this option requires a debugger capable of reading @file{.dwo}
8763 files.
8765 @item -gdescribe-dies
8766 @opindex gdescribe-dies
8767 Add description attributes to some DWARF DIEs that have no name attribute,
8768 such as artificial variables, external references and call site
8769 parameter DIEs.
8771 @item -gpubnames
8772 @opindex gpubnames
8773 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8775 @item -ggnu-pubnames
8776 @opindex ggnu-pubnames
8777 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8778 suitable for conversion into a GDB@ index.  This option is only useful
8779 with a linker that can produce GDB@ index version 7.
8781 @item -fdebug-types-section
8782 @opindex fdebug-types-section
8783 @opindex fno-debug-types-section
8784 When using DWARF Version 4 or higher, type DIEs can be put into
8785 their own @code{.debug_types} section instead of making them part of the
8786 @code{.debug_info} section.  It is more efficient to put them in a separate
8787 comdat section since the linker can then remove duplicates.
8788 But not all DWARF consumers support @code{.debug_types} sections yet
8789 and on some objects @code{.debug_types} produces larger instead of smaller
8790 debugging information.
8792 @item -grecord-gcc-switches
8793 @itemx -gno-record-gcc-switches
8794 @opindex grecord-gcc-switches
8795 @opindex gno-record-gcc-switches
8796 This switch causes the command-line options used to invoke the
8797 compiler that may affect code generation to be appended to the
8798 DW_AT_producer attribute in DWARF debugging information.  The options
8799 are concatenated with spaces separating them from each other and from
8800 the compiler version.  
8801 It is enabled by default.
8802 See also @option{-frecord-gcc-switches} for another
8803 way of storing compiler options into the object file.  
8805 @item -gstrict-dwarf
8806 @opindex gstrict-dwarf
8807 Disallow using extensions of later DWARF standard version than selected
8808 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
8809 DWARF extensions from later standard versions is allowed.
8811 @item -gno-strict-dwarf
8812 @opindex gno-strict-dwarf
8813 Allow using extensions of later DWARF standard version than selected with
8814 @option{-gdwarf-@var{version}}.
8816 @item -gas-loc-support
8817 @opindex gas-loc-support
8818 Inform the compiler that the assembler supports @code{.loc} directives.
8819 It may then use them for the assembler to generate DWARF2+ line number
8820 tables.
8822 This is generally desirable, because assembler-generated line-number
8823 tables are a lot more compact than those the compiler can generate
8824 itself.
8826 This option will be enabled by default if, at GCC configure time, the
8827 assembler was found to support such directives.
8829 @item -gno-as-loc-support
8830 @opindex gno-as-loc-support
8831 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8832 line number tables are to be generated.
8834 @item -gas-locview-support
8835 @opindex gas-locview-support
8836 Inform the compiler that the assembler supports @code{view} assignment
8837 and reset assertion checking in @code{.loc} directives.
8839 This option will be enabled by default if, at GCC configure time, the
8840 assembler was found to support them.
8842 @item -gno-as-locview-support
8843 Force GCC to assign view numbers internally, if
8844 @option{-gvariable-location-views} are explicitly requested.
8846 @item -gcolumn-info
8847 @itemx -gno-column-info
8848 @opindex gcolumn-info
8849 @opindex gno-column-info
8850 Emit location column information into DWARF debugging information, rather
8851 than just file and line.
8852 This option is enabled by default.
8854 @item -gstatement-frontiers
8855 @itemx -gno-statement-frontiers
8856 @opindex gstatement-frontiers
8857 @opindex gno-statement-frontiers
8858 This option causes GCC to create markers in the internal representation
8859 at the beginning of statements, and to keep them roughly in place
8860 throughout compilation, using them to guide the output of @code{is_stmt}
8861 markers in the line number table.  This is enabled by default when
8862 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8863 @dots{}), and outputting DWARF 2 debug information at the normal level.
8865 @item -gvariable-location-views
8866 @itemx -gvariable-location-views=incompat5
8867 @itemx -gno-variable-location-views
8868 @opindex gvariable-location-views
8869 @opindex gvariable-location-views=incompat5
8870 @opindex gno-variable-location-views
8871 Augment variable location lists with progressive view numbers implied
8872 from the line number table.  This enables debug information consumers to
8873 inspect state at certain points of the program, even if no instructions
8874 associated with the corresponding source locations are present at that
8875 point.  If the assembler lacks support for view numbers in line number
8876 tables, this will cause the compiler to emit the line number table,
8877 which generally makes them somewhat less compact.  The augmented line
8878 number tables and location lists are fully backward-compatible, so they
8879 can be consumed by debug information consumers that are not aware of
8880 these augmentations, but they won't derive any benefit from them either.
8882 This is enabled by default when outputting DWARF 2 debug information at
8883 the normal level, as long as there is assembler support,
8884 @option{-fvar-tracking-assignments} is enabled and
8885 @option{-gstrict-dwarf} is not.  When assembler support is not
8886 available, this may still be enabled, but it will force GCC to output
8887 internal line number tables, and if
8888 @option{-ginternal-reset-location-views} is not enabled, that will most
8889 certainly lead to silently mismatching location views.
8891 There is a proposed representation for view numbers that is not backward
8892 compatible with the location list format introduced in DWARF 5, that can
8893 be enabled with @option{-gvariable-location-views=incompat5}.  This
8894 option may be removed in the future, is only provided as a reference
8895 implementation of the proposed representation.  Debug information
8896 consumers are not expected to support this extended format, and they
8897 would be rendered unable to decode location lists using it.
8899 @item -ginternal-reset-location-views
8900 @itemx -gno-internal-reset-location-views
8901 @opindex ginternal-reset-location-views
8902 @opindex gno-internal-reset-location-views
8903 Attempt to determine location views that can be omitted from location
8904 view lists.  This requires the compiler to have very accurate insn
8905 length estimates, which isn't always the case, and it may cause
8906 incorrect view lists to be generated silently when using an assembler
8907 that does not support location view lists.  The GNU assembler will flag
8908 any such error as a @code{view number mismatch}.  This is only enabled
8909 on ports that define a reliable estimation function.
8911 @item -ginline-points
8912 @itemx -gno-inline-points
8913 @opindex ginline-points
8914 @opindex gno-inline-points
8915 Generate extended debug information for inlined functions.  Location
8916 view tracking markers are inserted at inlined entry points, so that
8917 address and view numbers can be computed and output in debug
8918 information.  This can be enabled independently of location views, in
8919 which case the view numbers won't be output, but it can only be enabled
8920 along with statement frontiers, and it is only enabled by default if
8921 location views are enabled.
8923 @item -gz@r{[}=@var{type}@r{]}
8924 @opindex gz
8925 Produce compressed debug sections in DWARF format, if that is supported.
8926 If @var{type} is not given, the default type depends on the capabilities
8927 of the assembler and linker used.  @var{type} may be one of
8928 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8929 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8930 compression in traditional GNU format).  If the linker doesn't support
8931 writing compressed debug sections, the option is rejected.  Otherwise,
8932 if the assembler does not support them, @option{-gz} is silently ignored
8933 when producing object files.
8935 @item -femit-struct-debug-baseonly
8936 @opindex femit-struct-debug-baseonly
8937 Emit debug information for struct-like types
8938 only when the base name of the compilation source file
8939 matches the base name of file in which the struct is defined.
8941 This option substantially reduces the size of debugging information,
8942 but at significant potential loss in type information to the debugger.
8943 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8944 See @option{-femit-struct-debug-detailed} for more detailed control.
8946 This option works only with DWARF debug output.
8948 @item -femit-struct-debug-reduced
8949 @opindex femit-struct-debug-reduced
8950 Emit debug information for struct-like types
8951 only when the base name of the compilation source file
8952 matches the base name of file in which the type is defined,
8953 unless the struct is a template or defined in a system header.
8955 This option significantly reduces the size of debugging information,
8956 with some potential loss in type information to the debugger.
8957 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8958 See @option{-femit-struct-debug-detailed} for more detailed control.
8960 This option works only with DWARF debug output.
8962 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8963 @opindex femit-struct-debug-detailed
8964 Specify the struct-like types
8965 for which the compiler generates debug information.
8966 The intent is to reduce duplicate struct debug information
8967 between different object files within the same program.
8969 This option is a detailed version of
8970 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8971 which serves for most needs.
8973 A specification has the syntax@*
8974 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8976 The optional first word limits the specification to
8977 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8978 A struct type is used directly when it is the type of a variable, member.
8979 Indirect uses arise through pointers to structs.
8980 That is, when use of an incomplete struct is valid, the use is indirect.
8981 An example is
8982 @samp{struct one direct; struct two * indirect;}.
8984 The optional second word limits the specification to
8985 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8986 Generic structs are a bit complicated to explain.
8987 For C++, these are non-explicit specializations of template classes,
8988 or non-template classes within the above.
8989 Other programming languages have generics,
8990 but @option{-femit-struct-debug-detailed} does not yet implement them.
8992 The third word specifies the source files for those
8993 structs for which the compiler should emit debug information.
8994 The values @samp{none} and @samp{any} have the normal meaning.
8995 The value @samp{base} means that
8996 the base of name of the file in which the type declaration appears
8997 must match the base of the name of the main compilation file.
8998 In practice, this means that when compiling @file{foo.c}, debug information
8999 is generated for types declared in that file and @file{foo.h},
9000 but not other header files.
9001 The value @samp{sys} means those types satisfying @samp{base}
9002 or declared in system or compiler headers.
9004 You may need to experiment to determine the best settings for your application.
9006 The default is @option{-femit-struct-debug-detailed=all}.
9008 This option works only with DWARF debug output.
9010 @item -fno-dwarf2-cfi-asm
9011 @opindex fdwarf2-cfi-asm
9012 @opindex fno-dwarf2-cfi-asm
9013 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9014 instead of using GAS @code{.cfi_*} directives.
9016 @item -fno-eliminate-unused-debug-types
9017 @opindex feliminate-unused-debug-types
9018 @opindex fno-eliminate-unused-debug-types
9019 Normally, when producing DWARF output, GCC avoids producing debug symbol 
9020 output for types that are nowhere used in the source file being compiled.
9021 Sometimes it is useful to have GCC emit debugging
9022 information for all types declared in a compilation
9023 unit, regardless of whether or not they are actually used
9024 in that compilation unit, for example 
9025 if, in the debugger, you want to cast a value to a type that is
9026 not actually used in your program (but is declared).  More often,
9027 however, this results in a significant amount of wasted space.
9028 @end table
9030 @node Optimize Options
9031 @section Options That Control Optimization
9032 @cindex optimize options
9033 @cindex options, optimization
9035 These options control various sorts of optimizations.
9037 Without any optimization option, the compiler's goal is to reduce the
9038 cost of compilation and to make debugging produce the expected
9039 results.  Statements are independent: if you stop the program with a
9040 breakpoint between statements, you can then assign a new value to any
9041 variable or change the program counter to any other statement in the
9042 function and get exactly the results you expect from the source
9043 code.
9045 Turning on optimization flags makes the compiler attempt to improve
9046 the performance and/or code size at the expense of compilation time
9047 and possibly the ability to debug the program.
9049 The compiler performs optimization based on the knowledge it has of the
9050 program.  Compiling multiple files at once to a single output file mode allows
9051 the compiler to use information gained from all of the files when compiling
9052 each of them.
9054 Not all optimizations are controlled directly by a flag.  Only
9055 optimizations that have a flag are listed in this section.
9057 Most optimizations are completely disabled at @option{-O0} or if an
9058 @option{-O} level is not set on the command line, even if individual
9059 optimization flags are specified.  Similarly, @option{-Og} suppresses
9060 many optimization passes.
9062 Depending on the target and how GCC was configured, a slightly different
9063 set of optimizations may be enabled at each @option{-O} level than
9064 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
9065 to find out the exact set of optimizations that are enabled at each level.
9066 @xref{Overall Options}, for examples.
9068 @table @gcctabopt
9069 @item -O
9070 @itemx -O1
9071 @opindex O
9072 @opindex O1
9073 Optimize.  Optimizing compilation takes somewhat more time, and a lot
9074 more memory for a large function.
9076 With @option{-O}, the compiler tries to reduce code size and execution
9077 time, without performing any optimizations that take a great deal of
9078 compilation time.
9080 @c Note that in addition to the default_options_table list in opts.c,
9081 @c several optimization flags default to true but control optimization
9082 @c passes that are explicitly disabled at -O0.
9084 @option{-O} turns on the following optimization flags:
9086 @c Please keep the following list alphabetized.
9087 @gccoptlist{-fauto-inc-dec @gol
9088 -fbranch-count-reg @gol
9089 -fcombine-stack-adjustments @gol
9090 -fcompare-elim @gol
9091 -fcprop-registers @gol
9092 -fdce @gol
9093 -fdefer-pop @gol
9094 -fdelayed-branch @gol
9095 -fdse @gol
9096 -fforward-propagate @gol
9097 -fguess-branch-probability @gol
9098 -fif-conversion @gol
9099 -fif-conversion2 @gol
9100 -finline-functions-called-once @gol
9101 -fipa-profile @gol
9102 -fipa-pure-const @gol
9103 -fipa-reference @gol
9104 -fipa-reference-addressable @gol
9105 -fmerge-constants @gol
9106 -fmove-loop-invariants @gol
9107 -fomit-frame-pointer @gol
9108 -freorder-blocks @gol
9109 -fshrink-wrap @gol
9110 -fshrink-wrap-separate @gol
9111 -fsplit-wide-types @gol
9112 -fssa-backprop @gol
9113 -fssa-phiopt @gol
9114 -ftree-bit-ccp @gol
9115 -ftree-ccp @gol
9116 -ftree-ch @gol
9117 -ftree-coalesce-vars @gol
9118 -ftree-copy-prop @gol
9119 -ftree-dce @gol
9120 -ftree-dominator-opts @gol
9121 -ftree-dse @gol
9122 -ftree-forwprop @gol
9123 -ftree-fre @gol
9124 -ftree-phiprop @gol
9125 -ftree-pta @gol
9126 -ftree-scev-cprop @gol
9127 -ftree-sink @gol
9128 -ftree-slsr @gol
9129 -ftree-sra @gol
9130 -ftree-ter @gol
9131 -funit-at-a-time}
9133 @item -O2
9134 @opindex O2
9135 Optimize even more.  GCC performs nearly all supported optimizations
9136 that do not involve a space-speed tradeoff.
9137 As compared to @option{-O}, this option increases both compilation time
9138 and the performance of the generated code.
9140 @option{-O2} turns on all optimization flags specified by @option{-O}.  It
9141 also turns on the following optimization flags:
9143 @c Please keep the following list alphabetized!
9144 @gccoptlist{-falign-functions  -falign-jumps @gol
9145 -falign-labels  -falign-loops @gol
9146 -fcaller-saves @gol
9147 -fcode-hoisting @gol
9148 -fcrossjumping @gol
9149 -fcse-follow-jumps  -fcse-skip-blocks @gol
9150 -fdelete-null-pointer-checks @gol
9151 -fdevirtualize  -fdevirtualize-speculatively @gol
9152 -fexpensive-optimizations @gol
9153 -ffinite-loops @gol
9154 -fgcse  -fgcse-lm  @gol
9155 -fhoist-adjacent-loads @gol
9156 -finline-functions @gol
9157 -finline-small-functions @gol
9158 -findirect-inlining @gol
9159 -fipa-bit-cp  -fipa-cp  -fipa-icf @gol
9160 -fipa-ra  -fipa-sra  -fipa-vrp @gol
9161 -fisolate-erroneous-paths-dereference @gol
9162 -flra-remat @gol
9163 -foptimize-sibling-calls @gol
9164 -foptimize-strlen @gol
9165 -fpartial-inlining @gol
9166 -fpeephole2 @gol
9167 -freorder-blocks-algorithm=stc @gol
9168 -freorder-blocks-and-partition  -freorder-functions @gol
9169 -frerun-cse-after-loop  @gol
9170 -fschedule-insns  -fschedule-insns2 @gol
9171 -fsched-interblock  -fsched-spec @gol
9172 -fstore-merging @gol
9173 -fstrict-aliasing @gol
9174 -fthread-jumps @gol
9175 -ftree-builtin-call-dce @gol
9176 -ftree-pre @gol
9177 -ftree-switch-conversion  -ftree-tail-merge @gol
9178 -ftree-vrp}
9180 Please note the warning under @option{-fgcse} about
9181 invoking @option{-O2} on programs that use computed gotos.
9183 @item -O3
9184 @opindex O3
9185 Optimize yet more.  @option{-O3} turns on all optimizations specified
9186 by @option{-O2} and also turns on the following optimization flags:
9188 @c Please keep the following list alphabetized!
9189 @gccoptlist{-fgcse-after-reload @gol
9190 -fipa-cp-clone
9191 -floop-interchange @gol
9192 -floop-unroll-and-jam @gol
9193 -fpeel-loops @gol
9194 -fpredictive-commoning @gol
9195 -fsplit-paths @gol
9196 -ftree-loop-distribute-patterns @gol
9197 -ftree-loop-distribution @gol
9198 -ftree-loop-vectorize @gol
9199 -ftree-partial-pre @gol
9200 -ftree-slp-vectorize @gol
9201 -funswitch-loops @gol
9202 -fvect-cost-model @gol
9203 -fversion-loops-for-strides}
9205 @item -O0
9206 @opindex O0
9207 Reduce compilation time and make debugging produce the expected
9208 results.  This is the default.
9210 @item -Os
9211 @opindex Os
9212 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
9213 except those that often increase code size:
9215 @gccoptlist{-falign-functions  -falign-jumps @gol
9216 -falign-labels  -falign-loops @gol
9217 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
9219 It also enables @option{-finline-functions}, causes the compiler to tune for
9220 code size rather than execution speed, and performs further optimizations
9221 designed to reduce code size.
9223 @item -Ofast
9224 @opindex Ofast
9225 Disregard strict standards compliance.  @option{-Ofast} enables all
9226 @option{-O3} optimizations.  It also enables optimizations that are not
9227 valid for all standard-compliant programs.
9228 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9229 and the Fortran-specific @option{-fstack-arrays}, unless
9230 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9232 @item -Og
9233 @opindex Og
9234 Optimize debugging experience.  @option{-Og} should be the optimization
9235 level of choice for the standard edit-compile-debug cycle, offering
9236 a reasonable level of optimization while maintaining fast compilation
9237 and a good debugging experience.  It is a better choice than @option{-O0}
9238 for producing debuggable code because some compiler passes
9239 that collect debug information are disabled at @option{-O0}.
9241 Like @option{-O0}, @option{-Og} completely disables a number of 
9242 optimization passes so that individual options controlling them have
9243 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
9244 optimization flags except for those that may interfere with debugging:
9246 @gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
9247 -fdse  -fif-conversion  -fif-conversion2  @gol
9248 -finline-functions-called-once @gol
9249 -fmove-loop-invariants  -fssa-phiopt @gol
9250 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
9252 @end table
9254 If you use multiple @option{-O} options, with or without level numbers,
9255 the last such option is the one that is effective.
9257 Options of the form @option{-f@var{flag}} specify machine-independent
9258 flags.  Most flags have both positive and negative forms; the negative
9259 form of @option{-ffoo} is @option{-fno-foo}.  In the table
9260 below, only one of the forms is listed---the one you typically 
9261 use.  You can figure out the other form by either removing @samp{no-}
9262 or adding it.
9264 The following options control specific optimizations.  They are either
9265 activated by @option{-O} options or are related to ones that are.  You
9266 can use the following flags in the rare cases when ``fine-tuning'' of
9267 optimizations to be performed is desired.
9269 @table @gcctabopt
9270 @item -fno-defer-pop
9271 @opindex fno-defer-pop
9272 @opindex fdefer-pop
9273 For machines that must pop arguments after a function call, always pop 
9274 the arguments as soon as each function returns.  
9275 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9276 this allows the compiler to let arguments accumulate on the stack for several
9277 function calls and pop them all at once.
9279 @item -fforward-propagate
9280 @opindex fforward-propagate
9281 Perform a forward propagation pass on RTL@.  The pass tries to combine two
9282 instructions and checks if the result can be simplified.  If loop unrolling
9283 is active, two passes are performed and the second is scheduled after
9284 loop unrolling.
9286 This option is enabled by default at optimization levels @option{-O},
9287 @option{-O2}, @option{-O3}, @option{-Os}.
9289 @item -ffp-contract=@var{style}
9290 @opindex ffp-contract
9291 @option{-ffp-contract=off} disables floating-point expression contraction.
9292 @option{-ffp-contract=fast} enables floating-point expression contraction
9293 such as forming of fused multiply-add operations if the target has
9294 native support for them.
9295 @option{-ffp-contract=on} enables floating-point expression contraction
9296 if allowed by the language standard.  This is currently not implemented
9297 and treated equal to @option{-ffp-contract=off}.
9299 The default is @option{-ffp-contract=fast}.
9301 @item -fomit-frame-pointer
9302 @opindex fomit-frame-pointer
9303 Omit the frame pointer in functions that don't need one.  This avoids the
9304 instructions to save, set up and restore the frame pointer; on many targets
9305 it also makes an extra register available.
9307 On some targets this flag has no effect because the standard calling sequence
9308 always uses a frame pointer, so it cannot be omitted.
9310 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9311 is used in all functions.  Several targets always omit the frame pointer in
9312 leaf functions.
9314 Enabled by default at @option{-O} and higher.
9316 @item -foptimize-sibling-calls
9317 @opindex foptimize-sibling-calls
9318 Optimize sibling and tail recursive calls.
9320 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9322 @item -foptimize-strlen
9323 @opindex foptimize-strlen
9324 Optimize various standard C string functions (e.g.@: @code{strlen},
9325 @code{strchr} or @code{strcpy}) and
9326 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9328 Enabled at levels @option{-O2}, @option{-O3}.
9330 @item -fno-inline
9331 @opindex fno-inline
9332 @opindex finline
9333 Do not expand any functions inline apart from those marked with
9334 the @code{always_inline} attribute.  This is the default when not
9335 optimizing.
9337 Single functions can be exempted from inlining by marking them
9338 with the @code{noinline} attribute.
9340 @item -finline-small-functions
9341 @opindex finline-small-functions
9342 Integrate functions into their callers when their body is smaller than expected
9343 function call code (so overall size of program gets smaller).  The compiler
9344 heuristically decides which functions are simple enough to be worth integrating
9345 in this way.  This inlining applies to all functions, even those not declared
9346 inline.
9348 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9350 @item -findirect-inlining
9351 @opindex findirect-inlining
9352 Inline also indirect calls that are discovered to be known at compile
9353 time thanks to previous inlining.  This option has any effect only
9354 when inlining itself is turned on by the @option{-finline-functions}
9355 or @option{-finline-small-functions} options.
9357 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9359 @item -finline-functions
9360 @opindex finline-functions
9361 Consider all functions for inlining, even if they are not declared inline.
9362 The compiler heuristically decides which functions are worth integrating
9363 in this way.
9365 If all calls to a given function are integrated, and the function is
9366 declared @code{static}, then the function is normally not output as
9367 assembler code in its own right.
9369 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
9370 by @option{-fprofile-use} and @option{-fauto-profile}.
9372 @item -finline-functions-called-once
9373 @opindex finline-functions-called-once
9374 Consider all @code{static} functions called once for inlining into their
9375 caller even if they are not marked @code{inline}.  If a call to a given
9376 function is integrated, then the function is not output as assembler code
9377 in its own right.
9379 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9380 but not @option{-Og}.
9382 @item -fearly-inlining
9383 @opindex fearly-inlining
9384 Inline functions marked by @code{always_inline} and functions whose body seems
9385 smaller than the function call overhead early before doing
9386 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
9387 makes profiling significantly cheaper and usually inlining faster on programs
9388 having large chains of nested wrapper functions.
9390 Enabled by default.
9392 @item -fipa-sra
9393 @opindex fipa-sra
9394 Perform interprocedural scalar replacement of aggregates, removal of
9395 unused parameters and replacement of parameters passed by reference
9396 by parameters passed by value.
9398 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9400 @item -finline-limit=@var{n}
9401 @opindex finline-limit
9402 By default, GCC limits the size of functions that can be inlined.  This flag
9403 allows coarse control of this limit.  @var{n} is the size of functions that
9404 can be inlined in number of pseudo instructions.
9406 Inlining is actually controlled by a number of parameters, which may be
9407 specified individually by using @option{--param @var{name}=@var{value}}.
9408 The @option{-finline-limit=@var{n}} option sets some of these parameters
9409 as follows:
9411 @table @gcctabopt
9412 @item max-inline-insns-single
9413 is set to @var{n}/2.
9414 @item max-inline-insns-auto
9415 is set to @var{n}/2.
9416 @end table
9418 See below for a documentation of the individual
9419 parameters controlling inlining and for the defaults of these parameters.
9421 @emph{Note:} there may be no value to @option{-finline-limit} that results
9422 in default behavior.
9424 @emph{Note:} pseudo instruction represents, in this particular context, an
9425 abstract measurement of function's size.  In no way does it represent a count
9426 of assembly instructions and as such its exact meaning might change from one
9427 release to an another.
9429 @item -fno-keep-inline-dllexport
9430 @opindex fno-keep-inline-dllexport
9431 @opindex fkeep-inline-dllexport
9432 This is a more fine-grained version of @option{-fkeep-inline-functions},
9433 which applies only to functions that are declared using the @code{dllexport}
9434 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
9435 Functions}.
9437 @item -fkeep-inline-functions
9438 @opindex fkeep-inline-functions
9439 In C, emit @code{static} functions that are declared @code{inline}
9440 into the object file, even if the function has been inlined into all
9441 of its callers.  This switch does not affect functions using the
9442 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
9443 inline functions into the object file.
9445 @item -fkeep-static-functions
9446 @opindex fkeep-static-functions
9447 Emit @code{static} functions into the object file, even if the function
9448 is never used.
9450 @item -fkeep-static-consts
9451 @opindex fkeep-static-consts
9452 Emit variables declared @code{static const} when optimization isn't turned
9453 on, even if the variables aren't referenced.
9455 GCC enables this option by default.  If you want to force the compiler to
9456 check if a variable is referenced, regardless of whether or not
9457 optimization is turned on, use the @option{-fno-keep-static-consts} option.
9459 @item -fmerge-constants
9460 @opindex fmerge-constants
9461 Attempt to merge identical constants (string constants and floating-point
9462 constants) across compilation units.
9464 This option is the default for optimized compilation if the assembler and
9465 linker support it.  Use @option{-fno-merge-constants} to inhibit this
9466 behavior.
9468 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9470 @item -fmerge-all-constants
9471 @opindex fmerge-all-constants
9472 Attempt to merge identical constants and identical variables.
9474 This option implies @option{-fmerge-constants}.  In addition to
9475 @option{-fmerge-constants} this considers e.g.@: even constant initialized
9476 arrays or initialized constant variables with integral or floating-point
9477 types.  Languages like C or C++ require each variable, including multiple
9478 instances of the same variable in recursive calls, to have distinct locations,
9479 so using this option results in non-conforming
9480 behavior.
9482 @item -fmodulo-sched
9483 @opindex fmodulo-sched
9484 Perform swing modulo scheduling immediately before the first scheduling
9485 pass.  This pass looks at innermost loops and reorders their
9486 instructions by overlapping different iterations.
9488 @item -fmodulo-sched-allow-regmoves
9489 @opindex fmodulo-sched-allow-regmoves
9490 Perform more aggressive SMS-based modulo scheduling with register moves
9491 allowed.  By setting this flag certain anti-dependences edges are
9492 deleted, which triggers the generation of reg-moves based on the
9493 life-range analysis.  This option is effective only with
9494 @option{-fmodulo-sched} enabled.
9496 @item -fno-branch-count-reg
9497 @opindex fno-branch-count-reg
9498 @opindex fbranch-count-reg
9499 Disable the optimization pass that scans for opportunities to use 
9500 ``decrement and branch'' instructions on a count register instead of
9501 instruction sequences that decrement a register, compare it against zero, and
9502 then branch based upon the result.  This option is only meaningful on
9503 architectures that support such instructions, which include x86, PowerPC,
9504 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
9505 doesn't remove the decrement and branch instructions from the generated
9506 instruction stream introduced by other optimization passes.
9508 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9509 except for @option{-Og}.
9511 @item -fno-function-cse
9512 @opindex fno-function-cse
9513 @opindex ffunction-cse
9514 Do not put function addresses in registers; make each instruction that
9515 calls a constant function contain the function's address explicitly.
9517 This option results in less efficient code, but some strange hacks
9518 that alter the assembler output may be confused by the optimizations
9519 performed when this option is not used.
9521 The default is @option{-ffunction-cse}
9523 @item -fno-zero-initialized-in-bss
9524 @opindex fno-zero-initialized-in-bss
9525 @opindex fzero-initialized-in-bss
9526 If the target supports a BSS section, GCC by default puts variables that
9527 are initialized to zero into BSS@.  This can save space in the resulting
9528 code.
9530 This option turns off this behavior because some programs explicitly
9531 rely on variables going to the data section---e.g., so that the
9532 resulting executable can find the beginning of that section and/or make
9533 assumptions based on that.
9535 The default is @option{-fzero-initialized-in-bss}.
9537 @item -fthread-jumps
9538 @opindex fthread-jumps
9539 Perform optimizations that check to see if a jump branches to a
9540 location where another comparison subsumed by the first is found.  If
9541 so, the first branch is redirected to either the destination of the
9542 second branch or a point immediately following it, depending on whether
9543 the condition is known to be true or false.
9545 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9547 @item -fsplit-wide-types
9548 @opindex fsplit-wide-types
9549 When using a type that occupies multiple registers, such as @code{long
9550 long} on a 32-bit system, split the registers apart and allocate them
9551 independently.  This normally generates better code for those types,
9552 but may make debugging more difficult.
9554 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9555 @option{-Os}.
9557 @item -fsplit-wide-types-early
9558 @opindex fsplit-wide-types-early
9559 Fully split wide types early, instead of very late.
9560 This option has no effect unless @option{-fsplit-wide-types} is turned on.
9562 This is the default on some targets.
9564 @item -fcse-follow-jumps
9565 @opindex fcse-follow-jumps
9566 In common subexpression elimination (CSE), scan through jump instructions
9567 when the target of the jump is not reached by any other path.  For
9568 example, when CSE encounters an @code{if} statement with an
9569 @code{else} clause, CSE follows the jump when the condition
9570 tested is false.
9572 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9574 @item -fcse-skip-blocks
9575 @opindex fcse-skip-blocks
9576 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9577 follow jumps that conditionally skip over blocks.  When CSE
9578 encounters a simple @code{if} statement with no else clause,
9579 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
9580 body of the @code{if}.
9582 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9584 @item -frerun-cse-after-loop
9585 @opindex frerun-cse-after-loop
9586 Re-run common subexpression elimination after loop optimizations are
9587 performed.
9589 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9591 @item -fgcse
9592 @opindex fgcse
9593 Perform a global common subexpression elimination pass.
9594 This pass also performs global constant and copy propagation.
9596 @emph{Note:} When compiling a program using computed gotos, a GCC
9597 extension, you may get better run-time performance if you disable
9598 the global common subexpression elimination pass by adding
9599 @option{-fno-gcse} to the command line.
9601 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9603 @item -fgcse-lm
9604 @opindex fgcse-lm
9605 When @option{-fgcse-lm} is enabled, global common subexpression elimination
9606 attempts to move loads that are only killed by stores into themselves.  This
9607 allows a loop containing a load/store sequence to be changed to a load outside
9608 the loop, and a copy/store within the loop.
9610 Enabled by default when @option{-fgcse} is enabled.
9612 @item -fgcse-sm
9613 @opindex fgcse-sm
9614 When @option{-fgcse-sm} is enabled, a store motion pass is run after
9615 global common subexpression elimination.  This pass attempts to move
9616 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
9617 loops containing a load/store sequence can be changed to a load before
9618 the loop and a store after the loop.
9620 Not enabled at any optimization level.
9622 @item -fgcse-las
9623 @opindex fgcse-las
9624 When @option{-fgcse-las} is enabled, the global common subexpression
9625 elimination pass eliminates redundant loads that come after stores to the
9626 same memory location (both partial and full redundancies).
9628 Not enabled at any optimization level.
9630 @item -fgcse-after-reload
9631 @opindex fgcse-after-reload
9632 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9633 pass is performed after reload.  The purpose of this pass is to clean up
9634 redundant spilling.
9636 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9638 @item -faggressive-loop-optimizations
9639 @opindex faggressive-loop-optimizations
9640 This option tells the loop optimizer to use language constraints to
9641 derive bounds for the number of iterations of a loop.  This assumes that
9642 loop code does not invoke undefined behavior by for example causing signed
9643 integer overflows or out-of-bound array accesses.  The bounds for the
9644 number of iterations of a loop are used to guide loop unrolling and peeling
9645 and loop exit test optimizations.
9646 This option is enabled by default.
9648 @item -funconstrained-commons
9649 @opindex funconstrained-commons
9650 This option tells the compiler that variables declared in common blocks
9651 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
9652 prevents certain optimizations that depend on knowing the array bounds.
9654 @item -fcrossjumping
9655 @opindex fcrossjumping
9656 Perform cross-jumping transformation.
9657 This transformation unifies equivalent code and saves code size.  The
9658 resulting code may or may not perform better than without cross-jumping.
9660 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9662 @item -fauto-inc-dec
9663 @opindex fauto-inc-dec
9664 Combine increments or decrements of addresses with memory accesses.
9665 This pass is always skipped on architectures that do not have
9666 instructions to support this.  Enabled by default at @option{-O} and
9667 higher on architectures that support this.
9669 @item -fdce
9670 @opindex fdce
9671 Perform dead code elimination (DCE) on RTL@.
9672 Enabled by default at @option{-O} and higher.
9674 @item -fdse
9675 @opindex fdse
9676 Perform dead store elimination (DSE) on RTL@.
9677 Enabled by default at @option{-O} and higher.
9679 @item -fif-conversion
9680 @opindex fif-conversion
9681 Attempt to transform conditional jumps into branch-less equivalents.  This
9682 includes use of conditional moves, min, max, set flags and abs instructions, and
9683 some tricks doable by standard arithmetics.  The use of conditional execution
9684 on chips where it is available is controlled by @option{-fif-conversion2}.
9686 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9687 not with @option{-Og}.
9689 @item -fif-conversion2
9690 @opindex fif-conversion2
9691 Use conditional execution (where available) to transform conditional jumps into
9692 branch-less equivalents.
9694 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9695 not with @option{-Og}.
9697 @item -fdeclone-ctor-dtor
9698 @opindex fdeclone-ctor-dtor
9699 The C++ ABI requires multiple entry points for constructors and
9700 destructors: one for a base subobject, one for a complete object, and
9701 one for a virtual destructor that calls operator delete afterwards.
9702 For a hierarchy with virtual bases, the base and complete variants are
9703 clones, which means two copies of the function.  With this option, the
9704 base and complete variants are changed to be thunks that call a common
9705 implementation.
9707 Enabled by @option{-Os}.
9709 @item -fdelete-null-pointer-checks
9710 @opindex fdelete-null-pointer-checks
9711 Assume that programs cannot safely dereference null pointers, and that
9712 no code or data element resides at address zero.
9713 This option enables simple constant
9714 folding optimizations at all optimization levels.  In addition, other
9715 optimization passes in GCC use this flag to control global dataflow
9716 analyses that eliminate useless checks for null pointers; these assume
9717 that a memory access to address zero always results in a trap, so
9718 that if a pointer is checked after it has already been dereferenced,
9719 it cannot be null.
9721 Note however that in some environments this assumption is not true.
9722 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9723 for programs that depend on that behavior.
9725 This option is enabled by default on most targets.  On Nios II ELF, it
9726 defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
9728 Passes that use the dataflow information
9729 are enabled independently at different optimization levels.
9731 @item -fdevirtualize
9732 @opindex fdevirtualize
9733 Attempt to convert calls to virtual functions to direct calls.  This
9734 is done both within a procedure and interprocedurally as part of
9735 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9736 propagation (@option{-fipa-cp}).
9737 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9739 @item -fdevirtualize-speculatively
9740 @opindex fdevirtualize-speculatively
9741 Attempt to convert calls to virtual functions to speculative direct calls.
9742 Based on the analysis of the type inheritance graph, determine for a given call
9743 the set of likely targets. If the set is small, preferably of size 1, change
9744 the call into a conditional deciding between direct and indirect calls.  The
9745 speculative calls enable more optimizations, such as inlining.  When they seem
9746 useless after further optimization, they are converted back into original form.
9748 @item -fdevirtualize-at-ltrans
9749 @opindex fdevirtualize-at-ltrans
9750 Stream extra information needed for aggressive devirtualization when running
9751 the link-time optimizer in local transformation mode.  
9752 This option enables more devirtualization but
9753 significantly increases the size of streamed data. For this reason it is
9754 disabled by default.
9756 @item -fexpensive-optimizations
9757 @opindex fexpensive-optimizations
9758 Perform a number of minor optimizations that are relatively expensive.
9760 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9762 @item -free
9763 @opindex free
9764 Attempt to remove redundant extension instructions.  This is especially
9765 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9766 registers after writing to their lower 32-bit half.
9768 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9769 @option{-O3}, @option{-Os}.
9771 @item -fno-lifetime-dse
9772 @opindex fno-lifetime-dse
9773 @opindex flifetime-dse
9774 In C++ the value of an object is only affected by changes within its
9775 lifetime: when the constructor begins, the object has an indeterminate
9776 value, and any changes during the lifetime of the object are dead when
9777 the object is destroyed.  Normally dead store elimination will take
9778 advantage of this; if your code relies on the value of the object
9779 storage persisting beyond the lifetime of the object, you can use this
9780 flag to disable this optimization.  To preserve stores before the
9781 constructor starts (e.g.@: because your operator new clears the object
9782 storage) but still treat the object as dead after the destructor, you
9783 can use @option{-flifetime-dse=1}.  The default behavior can be
9784 explicitly selected with @option{-flifetime-dse=2}.
9785 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9787 @item -flive-range-shrinkage
9788 @opindex flive-range-shrinkage
9789 Attempt to decrease register pressure through register live range
9790 shrinkage.  This is helpful for fast processors with small or moderate
9791 size register sets.
9793 @item -fira-algorithm=@var{algorithm}
9794 @opindex fira-algorithm
9795 Use the specified coloring algorithm for the integrated register
9796 allocator.  The @var{algorithm} argument can be @samp{priority}, which
9797 specifies Chow's priority coloring, or @samp{CB}, which specifies
9798 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
9799 for all architectures, but for those targets that do support it, it is
9800 the default because it generates better code.
9802 @item -fira-region=@var{region}
9803 @opindex fira-region
9804 Use specified regions for the integrated register allocator.  The
9805 @var{region} argument should be one of the following:
9807 @table @samp
9809 @item all
9810 Use all loops as register allocation regions.
9811 This can give the best results for machines with a small and/or
9812 irregular register set.
9814 @item mixed
9815 Use all loops except for loops with small register pressure 
9816 as the regions.  This value usually gives
9817 the best results in most cases and for most architectures,
9818 and is enabled by default when compiling with optimization for speed
9819 (@option{-O}, @option{-O2}, @dots{}).
9821 @item one
9822 Use all functions as a single region.  
9823 This typically results in the smallest code size, and is enabled by default for
9824 @option{-Os} or @option{-O0}.
9826 @end table
9828 @item -fira-hoist-pressure
9829 @opindex fira-hoist-pressure
9830 Use IRA to evaluate register pressure in the code hoisting pass for
9831 decisions to hoist expressions.  This option usually results in smaller
9832 code, but it can slow the compiler down.
9834 This option is enabled at level @option{-Os} for all targets.
9836 @item -fira-loop-pressure
9837 @opindex fira-loop-pressure
9838 Use IRA to evaluate register pressure in loops for decisions to move
9839 loop invariants.  This option usually results in generation
9840 of faster and smaller code on machines with large register files (>= 32
9841 registers), but it can slow the compiler down.
9843 This option is enabled at level @option{-O3} for some targets.
9845 @item -fno-ira-share-save-slots
9846 @opindex fno-ira-share-save-slots
9847 @opindex fira-share-save-slots
9848 Disable sharing of stack slots used for saving call-used hard
9849 registers living through a call.  Each hard register gets a
9850 separate stack slot, and as a result function stack frames are
9851 larger.
9853 @item -fno-ira-share-spill-slots
9854 @opindex fno-ira-share-spill-slots
9855 @opindex fira-share-spill-slots
9856 Disable sharing of stack slots allocated for pseudo-registers.  Each
9857 pseudo-register that does not get a hard register gets a separate
9858 stack slot, and as a result function stack frames are larger.
9860 @item -flra-remat
9861 @opindex flra-remat
9862 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
9863 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9864 values if it is profitable.
9866 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9868 @item -fdelayed-branch
9869 @opindex fdelayed-branch
9870 If supported for the target machine, attempt to reorder instructions
9871 to exploit instruction slots available after delayed branch
9872 instructions.
9874 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9875 but not at @option{-Og}.
9877 @item -fschedule-insns
9878 @opindex fschedule-insns
9879 If supported for the target machine, attempt to reorder instructions to
9880 eliminate execution stalls due to required data being unavailable.  This
9881 helps machines that have slow floating point or memory load instructions
9882 by allowing other instructions to be issued until the result of the load
9883 or floating-point instruction is required.
9885 Enabled at levels @option{-O2}, @option{-O3}.
9887 @item -fschedule-insns2
9888 @opindex fschedule-insns2
9889 Similar to @option{-fschedule-insns}, but requests an additional pass of
9890 instruction scheduling after register allocation has been done.  This is
9891 especially useful on machines with a relatively small number of
9892 registers and where memory load instructions take more than one cycle.
9894 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9896 @item -fno-sched-interblock
9897 @opindex fno-sched-interblock
9898 @opindex fsched-interblock
9899 Disable instruction scheduling across basic blocks, which
9900 is normally enabled when scheduling before register allocation, i.e.@:
9901 with @option{-fschedule-insns} or at @option{-O2} or higher.
9903 @item -fno-sched-spec
9904 @opindex fno-sched-spec
9905 @opindex fsched-spec
9906 Disable speculative motion of non-load instructions, which
9907 is normally enabled when scheduling before register allocation, i.e.@:
9908 with @option{-fschedule-insns} or at @option{-O2} or higher.
9910 @item -fsched-pressure
9911 @opindex fsched-pressure
9912 Enable register pressure sensitive insn scheduling before register
9913 allocation.  This only makes sense when scheduling before register
9914 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9915 @option{-O2} or higher.  Usage of this option can improve the
9916 generated code and decrease its size by preventing register pressure
9917 increase above the number of available hard registers and subsequent
9918 spills in register allocation.
9920 @item -fsched-spec-load
9921 @opindex fsched-spec-load
9922 Allow speculative motion of some load instructions.  This only makes
9923 sense when scheduling before register allocation, i.e.@: with
9924 @option{-fschedule-insns} or at @option{-O2} or higher.
9926 @item -fsched-spec-load-dangerous
9927 @opindex fsched-spec-load-dangerous
9928 Allow speculative motion of more load instructions.  This only makes
9929 sense when scheduling before register allocation, i.e.@: with
9930 @option{-fschedule-insns} or at @option{-O2} or higher.
9932 @item -fsched-stalled-insns
9933 @itemx -fsched-stalled-insns=@var{n}
9934 @opindex fsched-stalled-insns
9935 Define how many insns (if any) can be moved prematurely from the queue
9936 of stalled insns into the ready list during the second scheduling pass.
9937 @option{-fno-sched-stalled-insns} means that no insns are moved
9938 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9939 on how many queued insns can be moved prematurely.
9940 @option{-fsched-stalled-insns} without a value is equivalent to
9941 @option{-fsched-stalled-insns=1}.
9943 @item -fsched-stalled-insns-dep
9944 @itemx -fsched-stalled-insns-dep=@var{n}
9945 @opindex fsched-stalled-insns-dep
9946 Define how many insn groups (cycles) are examined for a dependency
9947 on a stalled insn that is a candidate for premature removal from the queue
9948 of stalled insns.  This has an effect only during the second scheduling pass,
9949 and only if @option{-fsched-stalled-insns} is used.
9950 @option{-fno-sched-stalled-insns-dep} is equivalent to
9951 @option{-fsched-stalled-insns-dep=0}.
9952 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9953 @option{-fsched-stalled-insns-dep=1}.
9955 @item -fsched2-use-superblocks
9956 @opindex fsched2-use-superblocks
9957 When scheduling after register allocation, use superblock scheduling.
9958 This allows motion across basic block boundaries,
9959 resulting in faster schedules.  This option is experimental, as not all machine
9960 descriptions used by GCC model the CPU closely enough to avoid unreliable
9961 results from the algorithm.
9963 This only makes sense when scheduling after register allocation, i.e.@: with
9964 @option{-fschedule-insns2} or at @option{-O2} or higher.
9966 @item -fsched-group-heuristic
9967 @opindex fsched-group-heuristic
9968 Enable the group heuristic in the scheduler.  This heuristic favors
9969 the instruction that belongs to a schedule group.  This is enabled
9970 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9971 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9973 @item -fsched-critical-path-heuristic
9974 @opindex fsched-critical-path-heuristic
9975 Enable the critical-path heuristic in the scheduler.  This heuristic favors
9976 instructions on the critical path.  This is enabled by default when
9977 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9978 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9980 @item -fsched-spec-insn-heuristic
9981 @opindex fsched-spec-insn-heuristic
9982 Enable the speculative instruction heuristic in the scheduler.  This
9983 heuristic favors speculative instructions with greater dependency weakness.
9984 This is enabled by default when scheduling is enabled, i.e.@:
9985 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9986 or at @option{-O2} or higher.
9988 @item -fsched-rank-heuristic
9989 @opindex fsched-rank-heuristic
9990 Enable the rank heuristic in the scheduler.  This heuristic favors
9991 the instruction belonging to a basic block with greater size or frequency.
9992 This is enabled by default when scheduling is enabled, i.e.@:
9993 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9994 at @option{-O2} or higher.
9996 @item -fsched-last-insn-heuristic
9997 @opindex fsched-last-insn-heuristic
9998 Enable the last-instruction heuristic in the scheduler.  This heuristic
9999 favors the instruction that is less dependent on the last instruction
10000 scheduled.  This is enabled by default when scheduling is enabled,
10001 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10002 at @option{-O2} or higher.
10004 @item -fsched-dep-count-heuristic
10005 @opindex fsched-dep-count-heuristic
10006 Enable the dependent-count heuristic in the scheduler.  This heuristic
10007 favors the instruction that has more instructions depending on it.
10008 This is enabled by default when scheduling is enabled, i.e.@:
10009 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10010 at @option{-O2} or higher.
10012 @item -freschedule-modulo-scheduled-loops
10013 @opindex freschedule-modulo-scheduled-loops
10014 Modulo scheduling is performed before traditional scheduling.  If a loop
10015 is modulo scheduled, later scheduling passes may change its schedule.  
10016 Use this option to control that behavior.
10018 @item -fselective-scheduling
10019 @opindex fselective-scheduling
10020 Schedule instructions using selective scheduling algorithm.  Selective
10021 scheduling runs instead of the first scheduler pass.
10023 @item -fselective-scheduling2
10024 @opindex fselective-scheduling2
10025 Schedule instructions using selective scheduling algorithm.  Selective
10026 scheduling runs instead of the second scheduler pass.
10028 @item -fsel-sched-pipelining
10029 @opindex fsel-sched-pipelining
10030 Enable software pipelining of innermost loops during selective scheduling.
10031 This option has no effect unless one of @option{-fselective-scheduling} or
10032 @option{-fselective-scheduling2} is turned on.
10034 @item -fsel-sched-pipelining-outer-loops
10035 @opindex fsel-sched-pipelining-outer-loops
10036 When pipelining loops during selective scheduling, also pipeline outer loops.
10037 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10039 @item -fsemantic-interposition
10040 @opindex fsemantic-interposition
10041 Some object formats, like ELF, allow interposing of symbols by the 
10042 dynamic linker.
10043 This means that for symbols exported from the DSO, the compiler cannot perform
10044 interprocedural propagation, inlining and other optimizations in anticipation
10045 that the function or variable in question may change. While this feature is
10046 useful, for example, to rewrite memory allocation functions by a debugging
10047 implementation, it is expensive in the terms of code quality.
10048 With @option{-fno-semantic-interposition} the compiler assumes that 
10049 if interposition happens for functions the overwriting function will have 
10050 precisely the same semantics (and side effects). 
10051 Similarly if interposition happens
10052 for variables, the constructor of the variable will be the same. The flag
10053 has no effect for functions explicitly declared inline 
10054 (where it is never allowed for interposition to change semantics) 
10055 and for symbols explicitly declared weak.
10057 @item -fshrink-wrap
10058 @opindex fshrink-wrap
10059 Emit function prologues only before parts of the function that need it,
10060 rather than at the top of the function.  This flag is enabled by default at
10061 @option{-O} and higher.
10063 @item -fshrink-wrap-separate
10064 @opindex fshrink-wrap-separate
10065 Shrink-wrap separate parts of the prologue and epilogue separately, so that
10066 those parts are only executed when needed.
10067 This option is on by default, but has no effect unless @option{-fshrink-wrap}
10068 is also turned on and the target supports this.
10070 @item -fcaller-saves
10071 @opindex fcaller-saves
10072 Enable allocation of values to registers that are clobbered by
10073 function calls, by emitting extra instructions to save and restore the
10074 registers around such calls.  Such allocation is done only when it
10075 seems to result in better code.
10077 This option is always enabled by default on certain machines, usually
10078 those which have no call-preserved registers to use instead.
10080 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10082 @item -fcombine-stack-adjustments
10083 @opindex fcombine-stack-adjustments
10084 Tracks stack adjustments (pushes and pops) and stack memory references
10085 and then tries to find ways to combine them.
10087 Enabled by default at @option{-O1} and higher.
10089 @item -fipa-ra
10090 @opindex fipa-ra
10091 Use caller save registers for allocation if those registers are not used by
10092 any called function.  In that case it is not necessary to save and restore
10093 them around calls.  This is only possible if called functions are part of
10094 same compilation unit as current function and they are compiled before it.
10096 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10097 is disabled if generated code will be instrumented for profiling
10098 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10099 exactly (this happens on targets that do not expose prologues
10100 and epilogues in RTL).
10102 @item -fconserve-stack
10103 @opindex fconserve-stack
10104 Attempt to minimize stack usage.  The compiler attempts to use less
10105 stack space, even if that makes the program slower.  This option
10106 implies setting the @option{large-stack-frame} parameter to 100
10107 and the @option{large-stack-frame-growth} parameter to 400.
10109 @item -ftree-reassoc
10110 @opindex ftree-reassoc
10111 Perform reassociation on trees.  This flag is enabled by default
10112 at @option{-O} and higher.
10114 @item -fcode-hoisting
10115 @opindex fcode-hoisting
10116 Perform code hoisting.  Code hoisting tries to move the
10117 evaluation of expressions executed on all paths to the function exit
10118 as early as possible.  This is especially useful as a code size
10119 optimization, but it often helps for code speed as well.
10120 This flag is enabled by default at @option{-O2} and higher.
10122 @item -ftree-pre
10123 @opindex ftree-pre
10124 Perform partial redundancy elimination (PRE) on trees.  This flag is
10125 enabled by default at @option{-O2} and @option{-O3}.
10127 @item -ftree-partial-pre
10128 @opindex ftree-partial-pre
10129 Make partial redundancy elimination (PRE) more aggressive.  This flag is
10130 enabled by default at @option{-O3}.
10132 @item -ftree-forwprop
10133 @opindex ftree-forwprop
10134 Perform forward propagation on trees.  This flag is enabled by default
10135 at @option{-O} and higher.
10137 @item -ftree-fre
10138 @opindex ftree-fre
10139 Perform full redundancy elimination (FRE) on trees.  The difference
10140 between FRE and PRE is that FRE only considers expressions
10141 that are computed on all paths leading to the redundant computation.
10142 This analysis is faster than PRE, though it exposes fewer redundancies.
10143 This flag is enabled by default at @option{-O} and higher.
10145 @item -ftree-phiprop
10146 @opindex ftree-phiprop
10147 Perform hoisting of loads from conditional pointers on trees.  This
10148 pass is enabled by default at @option{-O} and higher.
10150 @item -fhoist-adjacent-loads
10151 @opindex fhoist-adjacent-loads
10152 Speculatively hoist loads from both branches of an if-then-else if the
10153 loads are from adjacent locations in the same structure and the target
10154 architecture has a conditional move instruction.  This flag is enabled
10155 by default at @option{-O2} and higher.
10157 @item -ftree-copy-prop
10158 @opindex ftree-copy-prop
10159 Perform copy propagation on trees.  This pass eliminates unnecessary
10160 copy operations.  This flag is enabled by default at @option{-O} and
10161 higher.
10163 @item -fipa-pure-const
10164 @opindex fipa-pure-const
10165 Discover which functions are pure or constant.
10166 Enabled by default at @option{-O} and higher.
10168 @item -fipa-reference
10169 @opindex fipa-reference
10170 Discover which static variables do not escape the
10171 compilation unit.
10172 Enabled by default at @option{-O} and higher.
10174 @item -fipa-reference-addressable
10175 @opindex fipa-reference-addressable
10176 Discover read-only, write-only and non-addressable static variables.
10177 Enabled by default at @option{-O} and higher.
10179 @item -fipa-stack-alignment
10180 @opindex fipa-stack-alignment
10181 Reduce stack alignment on call sites if possible.
10182 Enabled by default.
10184 @item -fipa-pta
10185 @opindex fipa-pta
10186 Perform interprocedural pointer analysis and interprocedural modification
10187 and reference analysis.  This option can cause excessive memory and
10188 compile-time usage on large compilation units.  It is not enabled by
10189 default at any optimization level.
10191 @item -fipa-profile
10192 @opindex fipa-profile
10193 Perform interprocedural profile propagation.  The functions called only from
10194 cold functions are marked as cold. Also functions executed once (such as
10195 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10196 functions and loop less parts of functions executed once are then optimized for
10197 size.
10198 Enabled by default at @option{-O} and higher.
10200 @item -fipa-cp
10201 @opindex fipa-cp
10202 Perform interprocedural constant propagation.
10203 This optimization analyzes the program to determine when values passed
10204 to functions are constants and then optimizes accordingly.
10205 This optimization can substantially increase performance
10206 if the application has constants passed to functions.
10207 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10208 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10210 @item -fipa-cp-clone
10211 @opindex fipa-cp-clone
10212 Perform function cloning to make interprocedural constant propagation stronger.
10213 When enabled, interprocedural constant propagation performs function cloning
10214 when externally visible function can be called with constant arguments.
10215 Because this optimization can create multiple copies of functions,
10216 it may significantly increase code size
10217 (see @option{--param ipcp-unit-growth=@var{value}}).
10218 This flag is enabled by default at @option{-O3}.
10219 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10221 @item -fipa-bit-cp
10222 @opindex fipa-bit-cp
10223 When enabled, perform interprocedural bitwise constant
10224 propagation. This flag is enabled by default at @option{-O2} and
10225 by @option{-fprofile-use} and @option{-fauto-profile}.
10226 It requires that @option{-fipa-cp} is enabled.  
10228 @item -fipa-vrp
10229 @opindex fipa-vrp
10230 When enabled, perform interprocedural propagation of value
10231 ranges. This flag is enabled by default at @option{-O2}. It requires
10232 that @option{-fipa-cp} is enabled.
10234 @item -fipa-icf
10235 @opindex fipa-icf
10236 Perform Identical Code Folding for functions and read-only variables.
10237 The optimization reduces code size and may disturb unwind stacks by replacing
10238 a function by equivalent one with a different name. The optimization works
10239 more effectively with link-time optimization enabled.
10241 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10242 works on different levels and thus the optimizations are not same - there are
10243 equivalences that are found only by GCC and equivalences found only by Gold.
10245 This flag is enabled by default at @option{-O2} and @option{-Os}.
10247 @item -flive-patching=@var{level}
10248 @opindex flive-patching
10249 Control GCC's optimizations to produce output suitable for live-patching.
10251 If the compiler's optimization uses a function's body or information extracted
10252 from its body to optimize/change another function, the latter is called an
10253 impacted function of the former.  If a function is patched, its impacted
10254 functions should be patched too.
10256 The impacted functions are determined by the compiler's interprocedural
10257 optimizations.  For example, a caller is impacted when inlining a function
10258 into its caller,
10259 cloning a function and changing its caller to call this new clone,
10260 or extracting a function's pureness/constness information to optimize
10261 its direct or indirect callers, etc.
10263 Usually, the more IPA optimizations enabled, the larger the number of
10264 impacted functions for each function.  In order to control the number of
10265 impacted functions and more easily compute the list of impacted function,
10266 IPA optimizations can be partially enabled at two different levels.
10268 The @var{level} argument should be one of the following:
10270 @table @samp
10272 @item inline-clone
10274 Only enable inlining and cloning optimizations, which includes inlining,
10275 cloning, interprocedural scalar replacement of aggregates and partial inlining.
10276 As a result, when patching a function, all its callers and its clones'
10277 callers are impacted, therefore need to be patched as well.
10279 @option{-flive-patching=inline-clone} disables the following optimization flags:
10280 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
10281 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
10282 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
10283 -fipa-stack-alignment}
10285 @item inline-only-static
10287 Only enable inlining of static functions.
10288 As a result, when patching a static function, all its callers are impacted
10289 and so need to be patched as well.
10291 In addition to all the flags that @option{-flive-patching=inline-clone}
10292 disables,
10293 @option{-flive-patching=inline-only-static} disables the following additional
10294 optimization flags:
10295 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
10297 @end table
10299 When @option{-flive-patching} is specified without any value, the default value
10300 is @var{inline-clone}.
10302 This flag is disabled by default.
10304 Note that @option{-flive-patching} is not supported with link-time optimization
10305 (@option{-flto}).
10307 @item -fisolate-erroneous-paths-dereference
10308 @opindex fisolate-erroneous-paths-dereference
10309 Detect paths that trigger erroneous or undefined behavior due to
10310 dereferencing a null pointer.  Isolate those paths from the main control
10311 flow and turn the statement with erroneous or undefined behavior into a trap.
10312 This flag is enabled by default at @option{-O2} and higher and depends on
10313 @option{-fdelete-null-pointer-checks} also being enabled.
10315 @item -fisolate-erroneous-paths-attribute
10316 @opindex fisolate-erroneous-paths-attribute
10317 Detect paths that trigger erroneous or undefined behavior due to a null value
10318 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10319 attribute.  Isolate those paths from the main control flow and turn the
10320 statement with erroneous or undefined behavior into a trap.  This is not
10321 currently enabled, but may be enabled by @option{-O2} in the future.
10323 @item -ftree-sink
10324 @opindex ftree-sink
10325 Perform forward store motion on trees.  This flag is
10326 enabled by default at @option{-O} and higher.
10328 @item -ftree-bit-ccp
10329 @opindex ftree-bit-ccp
10330 Perform sparse conditional bit constant propagation on trees and propagate
10331 pointer alignment information.
10332 This pass only operates on local scalar variables and is enabled by default
10333 at @option{-O1} and higher, except for @option{-Og}.
10334 It requires that @option{-ftree-ccp} is enabled.
10336 @item -ftree-ccp
10337 @opindex ftree-ccp
10338 Perform sparse conditional constant propagation (CCP) on trees.  This
10339 pass only operates on local scalar variables and is enabled by default
10340 at @option{-O} and higher.
10342 @item -fssa-backprop
10343 @opindex fssa-backprop
10344 Propagate information about uses of a value up the definition chain
10345 in order to simplify the definitions.  For example, this pass strips
10346 sign operations if the sign of a value never matters.  The flag is
10347 enabled by default at @option{-O} and higher.
10349 @item -fssa-phiopt
10350 @opindex fssa-phiopt
10351 Perform pattern matching on SSA PHI nodes to optimize conditional
10352 code.  This pass is enabled by default at @option{-O1} and higher,
10353 except for @option{-Og}.
10355 @item -ftree-switch-conversion
10356 @opindex ftree-switch-conversion
10357 Perform conversion of simple initializations in a switch to
10358 initializations from a scalar array.  This flag is enabled by default
10359 at @option{-O2} and higher.
10361 @item -ftree-tail-merge
10362 @opindex ftree-tail-merge
10363 Look for identical code sequences.  When found, replace one with a jump to the
10364 other.  This optimization is known as tail merging or cross jumping.  This flag
10365 is enabled by default at @option{-O2} and higher.  The compilation time
10366 in this pass can
10367 be limited using @option{max-tail-merge-comparisons} parameter and
10368 @option{max-tail-merge-iterations} parameter.
10370 @item -ftree-dce
10371 @opindex ftree-dce
10372 Perform dead code elimination (DCE) on trees.  This flag is enabled by
10373 default at @option{-O} and higher.
10375 @item -ftree-builtin-call-dce
10376 @opindex ftree-builtin-call-dce
10377 Perform conditional dead code elimination (DCE) for calls to built-in functions
10378 that may set @code{errno} but are otherwise free of side effects.  This flag is
10379 enabled by default at @option{-O2} and higher if @option{-Os} is not also
10380 specified.
10382 @item -ffinite-loops
10383 @opindex ffinite-loops
10384 @opindex fno-finite-loops
10385 Assume that a loop with an exit will eventually take the exit and not loop
10386 indefinitely.  This allows the compiler to remove loops that otherwise have
10387 no side-effects, not considering eventual endless looping as such.
10389 This option is enabled by default at @option{-O2}.
10391 @item -ftree-dominator-opts
10392 @opindex ftree-dominator-opts
10393 Perform a variety of simple scalar cleanups (constant/copy
10394 propagation, redundancy elimination, range propagation and expression
10395 simplification) based on a dominator tree traversal.  This also
10396 performs jump threading (to reduce jumps to jumps). This flag is
10397 enabled by default at @option{-O} and higher.
10399 @item -ftree-dse
10400 @opindex ftree-dse
10401 Perform dead store elimination (DSE) on trees.  A dead store is a store into
10402 a memory location that is later overwritten by another store without
10403 any intervening loads.  In this case the earlier store can be deleted.  This
10404 flag is enabled by default at @option{-O} and higher.
10406 @item -ftree-ch
10407 @opindex ftree-ch
10408 Perform loop header copying on trees.  This is beneficial since it increases
10409 effectiveness of code motion optimizations.  It also saves one jump.  This flag
10410 is enabled by default at @option{-O} and higher.  It is not enabled
10411 for @option{-Os}, since it usually increases code size.
10413 @item -ftree-loop-optimize
10414 @opindex ftree-loop-optimize
10415 Perform loop optimizations on trees.  This flag is enabled by default
10416 at @option{-O} and higher.
10418 @item -ftree-loop-linear
10419 @itemx -floop-strip-mine
10420 @itemx -floop-block
10421 @opindex ftree-loop-linear
10422 @opindex floop-strip-mine
10423 @opindex floop-block
10424 Perform loop nest optimizations.  Same as
10425 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
10426 to be configured with @option{--with-isl} to enable the Graphite loop
10427 transformation infrastructure.
10429 @item -fgraphite-identity
10430 @opindex fgraphite-identity
10431 Enable the identity transformation for graphite.  For every SCoP we generate
10432 the polyhedral representation and transform it back to gimple.  Using
10433 @option{-fgraphite-identity} we can check the costs or benefits of the
10434 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
10435 are also performed by the code generator isl, like index splitting and
10436 dead code elimination in loops.
10438 @item -floop-nest-optimize
10439 @opindex floop-nest-optimize
10440 Enable the isl based loop nest optimizer.  This is a generic loop nest
10441 optimizer based on the Pluto optimization algorithms.  It calculates a loop
10442 structure optimized for data-locality and parallelism.  This option
10443 is experimental.
10445 @item -floop-parallelize-all
10446 @opindex floop-parallelize-all
10447 Use the Graphite data dependence analysis to identify loops that can
10448 be parallelized.  Parallelize all the loops that can be analyzed to
10449 not contain loop carried dependences without checking that it is
10450 profitable to parallelize the loops.
10452 @item -ftree-coalesce-vars
10453 @opindex ftree-coalesce-vars
10454 While transforming the program out of the SSA representation, attempt to
10455 reduce copying by coalescing versions of different user-defined
10456 variables, instead of just compiler temporaries.  This may severely
10457 limit the ability to debug an optimized program compiled with
10458 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
10459 prevents SSA coalescing of user variables.  This option is enabled by
10460 default if optimization is enabled, and it does very little otherwise.
10462 @item -ftree-loop-if-convert
10463 @opindex ftree-loop-if-convert
10464 Attempt to transform conditional jumps in the innermost loops to
10465 branch-less equivalents.  The intent is to remove control-flow from
10466 the innermost loops in order to improve the ability of the
10467 vectorization pass to handle these loops.  This is enabled by default
10468 if vectorization is enabled.
10470 @item -ftree-loop-distribution
10471 @opindex ftree-loop-distribution
10472 Perform loop distribution.  This flag can improve cache performance on
10473 big loop bodies and allow further loop optimizations, like
10474 parallelization or vectorization, to take place.  For example, the loop
10475 @smallexample
10476 DO I = 1, N
10477   A(I) = B(I) + C
10478   D(I) = E(I) * F
10479 ENDDO
10480 @end smallexample
10481 is transformed to
10482 @smallexample
10483 DO I = 1, N
10484    A(I) = B(I) + C
10485 ENDDO
10486 DO I = 1, N
10487    D(I) = E(I) * F
10488 ENDDO
10489 @end smallexample
10490 This flag is enabled by default at @option{-O3}.
10491 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10493 @item -ftree-loop-distribute-patterns
10494 @opindex ftree-loop-distribute-patterns
10495 Perform loop distribution of patterns that can be code generated with
10496 calls to a library.  This flag is enabled by default at @option{-O2} and
10497 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10499 This pass distributes the initialization loops and generates a call to
10500 memset zero.  For example, the loop
10501 @smallexample
10502 DO I = 1, N
10503   A(I) = 0
10504   B(I) = A(I) + I
10505 ENDDO
10506 @end smallexample
10507 is transformed to
10508 @smallexample
10509 DO I = 1, N
10510    A(I) = 0
10511 ENDDO
10512 DO I = 1, N
10513    B(I) = A(I) + I
10514 ENDDO
10515 @end smallexample
10516 and the initialization loop is transformed into a call to memset zero.
10517 This flag is enabled by default at @option{-O3}.
10518 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10520 @item -floop-interchange
10521 @opindex floop-interchange
10522 Perform loop interchange outside of graphite.  This flag can improve cache
10523 performance on loop nest and allow further loop optimizations, like
10524 vectorization, to take place.  For example, the loop
10525 @smallexample
10526 for (int i = 0; i < N; i++)
10527   for (int j = 0; j < N; j++)
10528     for (int k = 0; k < N; k++)
10529       c[i][j] = c[i][j] + a[i][k]*b[k][j];
10530 @end smallexample
10531 is transformed to
10532 @smallexample
10533 for (int i = 0; i < N; i++)
10534   for (int k = 0; k < N; k++)
10535     for (int j = 0; j < N; j++)
10536       c[i][j] = c[i][j] + a[i][k]*b[k][j];
10537 @end smallexample
10538 This flag is enabled by default at @option{-O3}.
10539 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10541 @item -floop-unroll-and-jam
10542 @opindex floop-unroll-and-jam
10543 Apply unroll and jam transformations on feasible loops.  In a loop
10544 nest this unrolls the outer loop by some factor and fuses the resulting
10545 multiple inner loops.  This flag is enabled by default at @option{-O3}.
10546 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10548 @item -ftree-loop-im
10549 @opindex ftree-loop-im
10550 Perform loop invariant motion on trees.  This pass moves only invariants that
10551 are hard to handle at RTL level (function calls, operations that expand to
10552 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
10553 operands of conditions that are invariant out of the loop, so that we can use
10554 just trivial invariantness analysis in loop unswitching.  The pass also includes
10555 store motion.
10557 @item -ftree-loop-ivcanon
10558 @opindex ftree-loop-ivcanon
10559 Create a canonical counter for number of iterations in loops for which
10560 determining number of iterations requires complicated analysis.  Later
10561 optimizations then may determine the number easily.  Useful especially
10562 in connection with unrolling.
10564 @item -ftree-scev-cprop
10565 @opindex ftree-scev-cprop
10566 Perform final value replacement.  If a variable is modified in a loop
10567 in such a way that its value when exiting the loop can be determined using
10568 only its initial value and the number of loop iterations, replace uses of
10569 the final value by such a computation, provided it is sufficiently cheap.
10570 This reduces data dependencies and may allow further simplifications.
10571 Enabled by default at @option{-O} and higher.
10573 @item -fivopts
10574 @opindex fivopts
10575 Perform induction variable optimizations (strength reduction, induction
10576 variable merging and induction variable elimination) on trees.
10578 @item -ftree-parallelize-loops=n
10579 @opindex ftree-parallelize-loops
10580 Parallelize loops, i.e., split their iteration space to run in n threads.
10581 This is only possible for loops whose iterations are independent
10582 and can be arbitrarily reordered.  The optimization is only
10583 profitable on multiprocessor machines, for loops that are CPU-intensive,
10584 rather than constrained e.g.@: by memory bandwidth.  This option
10585 implies @option{-pthread}, and thus is only supported on targets
10586 that have support for @option{-pthread}.
10588 @item -ftree-pta
10589 @opindex ftree-pta
10590 Perform function-local points-to analysis on trees.  This flag is
10591 enabled by default at @option{-O1} and higher, except for @option{-Og}.
10593 @item -ftree-sra
10594 @opindex ftree-sra
10595 Perform scalar replacement of aggregates.  This pass replaces structure
10596 references with scalars to prevent committing structures to memory too
10597 early.  This flag is enabled by default at @option{-O1} and higher,
10598 except for @option{-Og}.
10600 @item -fstore-merging
10601 @opindex fstore-merging
10602 Perform merging of narrow stores to consecutive memory addresses.  This pass
10603 merges contiguous stores of immediate values narrower than a word into fewer
10604 wider stores to reduce the number of instructions.  This is enabled by default
10605 at @option{-O2} and higher as well as @option{-Os}.
10607 @item -ftree-ter
10608 @opindex ftree-ter
10609 Perform temporary expression replacement during the SSA->normal phase.  Single
10610 use/single def temporaries are replaced at their use location with their
10611 defining expression.  This results in non-GIMPLE code, but gives the expanders
10612 much more complex trees to work on resulting in better RTL generation.  This is
10613 enabled by default at @option{-O} and higher.
10615 @item -ftree-slsr
10616 @opindex ftree-slsr
10617 Perform straight-line strength reduction on trees.  This recognizes related
10618 expressions involving multiplications and replaces them by less expensive
10619 calculations when possible.  This is enabled by default at @option{-O} and
10620 higher.
10622 @item -ftree-vectorize
10623 @opindex ftree-vectorize
10624 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10625 and @option{-ftree-slp-vectorize} if not explicitly specified.
10627 @item -ftree-loop-vectorize
10628 @opindex ftree-loop-vectorize
10629 Perform loop vectorization on trees. This flag is enabled by default at
10630 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10631 and @option{-fauto-profile}.
10633 @item -ftree-slp-vectorize
10634 @opindex ftree-slp-vectorize
10635 Perform basic block vectorization on trees. This flag is enabled by default at
10636 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10637 and @option{-fauto-profile}.
10639 @item -fvect-cost-model=@var{model}
10640 @opindex fvect-cost-model
10641 Alter the cost model used for vectorization.  The @var{model} argument
10642 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10643 With the @samp{unlimited} model the vectorized code-path is assumed
10644 to be profitable while with the @samp{dynamic} model a runtime check
10645 guards the vectorized code-path to enable it only for iteration
10646 counts that will likely execute faster than when executing the original
10647 scalar loop.  The @samp{cheap} model disables vectorization of
10648 loops where doing so would be cost prohibitive for example due to
10649 required runtime checks for data dependence or alignment but otherwise
10650 is equal to the @samp{dynamic} model.
10651 The default cost model depends on other optimization flags and is
10652 either @samp{dynamic} or @samp{cheap}.
10654 @item -fsimd-cost-model=@var{model}
10655 @opindex fsimd-cost-model
10656 Alter the cost model used for vectorization of loops marked with the OpenMP
10657 simd directive.  The @var{model} argument should be one of
10658 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
10659 have the same meaning as described in @option{-fvect-cost-model} and by
10660 default a cost model defined with @option{-fvect-cost-model} is used.
10662 @item -ftree-vrp
10663 @opindex ftree-vrp
10664 Perform Value Range Propagation on trees.  This is similar to the
10665 constant propagation pass, but instead of values, ranges of values are
10666 propagated.  This allows the optimizers to remove unnecessary range
10667 checks like array bound checks and null pointer checks.  This is
10668 enabled by default at @option{-O2} and higher.  Null pointer check
10669 elimination is only done if @option{-fdelete-null-pointer-checks} is
10670 enabled.
10672 @item -fsplit-paths
10673 @opindex fsplit-paths
10674 Split paths leading to loop backedges.  This can improve dead code
10675 elimination and common subexpression elimination.  This is enabled by
10676 default at @option{-O3} and above.
10678 @item -fsplit-ivs-in-unroller
10679 @opindex fsplit-ivs-in-unroller
10680 Enables expression of values of induction variables in later iterations
10681 of the unrolled loop using the value in the first iteration.  This breaks
10682 long dependency chains, thus improving efficiency of the scheduling passes.
10684 A combination of @option{-fweb} and CSE is often sufficient to obtain the
10685 same effect.  However, that is not reliable in cases where the loop body
10686 is more complicated than a single basic block.  It also does not work at all
10687 on some architectures due to restrictions in the CSE pass.
10689 This optimization is enabled by default.
10691 @item -fvariable-expansion-in-unroller
10692 @opindex fvariable-expansion-in-unroller
10693 With this option, the compiler creates multiple copies of some
10694 local variables when unrolling a loop, which can result in superior code.
10696 This optimization is enabled by default for PowerPC targets, but disabled
10697 by default otherwise.
10699 @item -fpartial-inlining
10700 @opindex fpartial-inlining
10701 Inline parts of functions.  This option has any effect only
10702 when inlining itself is turned on by the @option{-finline-functions}
10703 or @option{-finline-small-functions} options.
10705 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10707 @item -fpredictive-commoning
10708 @opindex fpredictive-commoning
10709 Perform predictive commoning optimization, i.e., reusing computations
10710 (especially memory loads and stores) performed in previous
10711 iterations of loops.
10713 This option is enabled at level @option{-O3}.
10714 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10716 @item -fprefetch-loop-arrays
10717 @opindex fprefetch-loop-arrays
10718 If supported by the target machine, generate instructions to prefetch
10719 memory to improve the performance of loops that access large arrays.
10721 This option may generate better or worse code; results are highly
10722 dependent on the structure of loops within the source code.
10724 Disabled at level @option{-Os}.
10726 @item -fno-printf-return-value
10727 @opindex fno-printf-return-value
10728 @opindex fprintf-return-value
10729 Do not substitute constants for known return value of formatted output
10730 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10731 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
10732 transformation allows GCC to optimize or even eliminate branches based
10733 on the known return value of these functions called with arguments that
10734 are either constant, or whose values are known to be in a range that
10735 makes determining the exact return value possible.  For example, when
10736 @option{-fprintf-return-value} is in effect, both the branch and the
10737 body of the @code{if} statement (but not the call to @code{snprint})
10738 can be optimized away when @code{i} is a 32-bit or smaller integer
10739 because the return value is guaranteed to be at most 8.
10741 @smallexample
10742 char buf[9];
10743 if (snprintf (buf, "%08x", i) >= sizeof buf)
10744   @dots{}
10745 @end smallexample
10747 The @option{-fprintf-return-value} option relies on other optimizations
10748 and yields best results with @option{-O2} and above.  It works in tandem
10749 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10750 options.  The @option{-fprintf-return-value} option is enabled by default.
10752 @item -fno-peephole
10753 @itemx -fno-peephole2
10754 @opindex fno-peephole
10755 @opindex fpeephole
10756 @opindex fno-peephole2
10757 @opindex fpeephole2
10758 Disable any machine-specific peephole optimizations.  The difference
10759 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10760 are implemented in the compiler; some targets use one, some use the
10761 other, a few use both.
10763 @option{-fpeephole} is enabled by default.
10764 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10766 @item -fno-guess-branch-probability
10767 @opindex fno-guess-branch-probability
10768 @opindex fguess-branch-probability
10769 Do not guess branch probabilities using heuristics.
10771 GCC uses heuristics to guess branch probabilities if they are
10772 not provided by profiling feedback (@option{-fprofile-arcs}).  These
10773 heuristics are based on the control flow graph.  If some branch probabilities
10774 are specified by @code{__builtin_expect}, then the heuristics are
10775 used to guess branch probabilities for the rest of the control flow graph,
10776 taking the @code{__builtin_expect} info into account.  The interactions
10777 between the heuristics and @code{__builtin_expect} can be complex, and in
10778 some cases, it may be useful to disable the heuristics so that the effects
10779 of @code{__builtin_expect} are easier to understand.
10781 It is also possible to specify expected probability of the expression
10782 with @code{__builtin_expect_with_probability} built-in function.
10784 The default is @option{-fguess-branch-probability} at levels
10785 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10787 @item -freorder-blocks
10788 @opindex freorder-blocks
10789 Reorder basic blocks in the compiled function in order to reduce number of
10790 taken branches and improve code locality.
10792 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10794 @item -freorder-blocks-algorithm=@var{algorithm}
10795 @opindex freorder-blocks-algorithm
10796 Use the specified algorithm for basic block reordering.  The
10797 @var{algorithm} argument can be @samp{simple}, which does not increase
10798 code size (except sometimes due to secondary effects like alignment),
10799 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10800 put all often executed code together, minimizing the number of branches
10801 executed by making extra copies of code.
10803 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10804 @samp{stc} at levels @option{-O2}, @option{-O3}.
10806 @item -freorder-blocks-and-partition
10807 @opindex freorder-blocks-and-partition
10808 In addition to reordering basic blocks in the compiled function, in order
10809 to reduce number of taken branches, partitions hot and cold basic blocks
10810 into separate sections of the assembly and @file{.o} files, to improve
10811 paging and cache locality performance.
10813 This optimization is automatically turned off in the presence of
10814 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10815 section attribute and on any architecture that does not support named
10816 sections.  When @option{-fsplit-stack} is used this option is not
10817 enabled by default (to avoid linker errors), but may be enabled
10818 explicitly (if using a working linker).
10820 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10822 @item -freorder-functions
10823 @opindex freorder-functions
10824 Reorder functions in the object file in order to
10825 improve code locality.  This is implemented by using special
10826 subsections @code{.text.hot} for most frequently executed functions and
10827 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
10828 the linker so object file format must support named sections and linker must
10829 place them in a reasonable way.
10831 This option isn't effective unless you either provide profile feedback
10832 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
10833 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10835 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10837 @item -fstrict-aliasing
10838 @opindex fstrict-aliasing
10839 Allow the compiler to assume the strictest aliasing rules applicable to
10840 the language being compiled.  For C (and C++), this activates
10841 optimizations based on the type of expressions.  In particular, an
10842 object of one type is assumed never to reside at the same address as an
10843 object of a different type, unless the types are almost the same.  For
10844 example, an @code{unsigned int} can alias an @code{int}, but not a
10845 @code{void*} or a @code{double}.  A character type may alias any other
10846 type.
10848 @anchor{Type-punning}Pay special attention to code like this:
10849 @smallexample
10850 union a_union @{
10851   int i;
10852   double d;
10855 int f() @{
10856   union a_union t;
10857   t.d = 3.0;
10858   return t.i;
10860 @end smallexample
10861 The practice of reading from a different union member than the one most
10862 recently written to (called ``type-punning'') is common.  Even with
10863 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10864 is accessed through the union type.  So, the code above works as
10865 expected.  @xref{Structures unions enumerations and bit-fields
10866 implementation}.  However, this code might not:
10867 @smallexample
10868 int f() @{
10869   union a_union t;
10870   int* ip;
10871   t.d = 3.0;
10872   ip = &t.i;
10873   return *ip;
10875 @end smallexample
10877 Similarly, access by taking the address, casting the resulting pointer
10878 and dereferencing the result has undefined behavior, even if the cast
10879 uses a union type, e.g.:
10880 @smallexample
10881 int f() @{
10882   double d = 3.0;
10883   return ((union a_union *) &d)->i;
10885 @end smallexample
10887 The @option{-fstrict-aliasing} option is enabled at levels
10888 @option{-O2}, @option{-O3}, @option{-Os}.
10890 @item -falign-functions
10891 @itemx -falign-functions=@var{n}
10892 @itemx -falign-functions=@var{n}:@var{m}
10893 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10894 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10895 @opindex falign-functions
10896 Align the start of functions to the next power-of-two greater than
10897 @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at least
10898 the first @var{m} bytes of the function can be fetched by the CPU
10899 without crossing an @var{n}-byte alignment boundary.
10901 If @var{m} is not specified, it defaults to @var{n}.
10903 Examples: @option{-falign-functions=32} aligns functions to the next
10904 32-byte boundary, @option{-falign-functions=24} aligns to the next
10905 32-byte boundary only if this can be done by skipping 23 bytes or less,
10906 @option{-falign-functions=32:7} aligns to the next
10907 32-byte boundary only if this can be done by skipping 6 bytes or less.
10909 The second pair of @var{n2}:@var{m2} values allows you to specify
10910 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10911 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10912 otherwise aligns to the next 32-byte boundary if this can be done
10913 by skipping 2 bytes or less.
10914 If @var{m2} is not specified, it defaults to @var{n2}.
10916 Some assemblers only support this flag when @var{n} is a power of two;
10917 in that case, it is rounded up.
10919 @option{-fno-align-functions} and @option{-falign-functions=1} are
10920 equivalent and mean that functions are not aligned.
10922 If @var{n} is not specified or is zero, use a machine-dependent default.
10923 The maximum allowed @var{n} option value is 65536.
10925 Enabled at levels @option{-O2}, @option{-O3}.
10927 @item -flimit-function-alignment
10928 If this option is enabled, the compiler tries to avoid unnecessarily
10929 overaligning functions. It attempts to instruct the assembler to align
10930 by the amount specified by @option{-falign-functions}, but not to
10931 skip more bytes than the size of the function.
10933 @item -falign-labels
10934 @itemx -falign-labels=@var{n}
10935 @itemx -falign-labels=@var{n}:@var{m}
10936 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10937 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10938 @opindex falign-labels
10939 Align all branch targets to a power-of-two boundary.
10941 Parameters of this option are analogous to the @option{-falign-functions} option.
10942 @option{-fno-align-labels} and @option{-falign-labels=1} are
10943 equivalent and mean that labels are not aligned.
10945 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10946 are greater than this value, then their values are used instead.
10948 If @var{n} is not specified or is zero, use a machine-dependent default
10949 which is very likely to be @samp{1}, meaning no alignment.
10950 The maximum allowed @var{n} option value is 65536.
10952 Enabled at levels @option{-O2}, @option{-O3}.
10954 @item -falign-loops
10955 @itemx -falign-loops=@var{n}
10956 @itemx -falign-loops=@var{n}:@var{m}
10957 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10958 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10959 @opindex falign-loops
10960 Align loops to a power-of-two boundary.  If the loops are executed
10961 many times, this makes up for any execution of the dummy padding
10962 instructions.
10964 Parameters of this option are analogous to the @option{-falign-functions} option.
10965 @option{-fno-align-loops} and @option{-falign-loops=1} are
10966 equivalent and mean that loops are not aligned.
10967 The maximum allowed @var{n} option value is 65536.
10969 If @var{n} is not specified or is zero, use a machine-dependent default.
10971 Enabled at levels @option{-O2}, @option{-O3}.
10973 @item -falign-jumps
10974 @itemx -falign-jumps=@var{n}
10975 @itemx -falign-jumps=@var{n}:@var{m}
10976 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10977 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10978 @opindex falign-jumps
10979 Align branch targets to a power-of-two boundary, for branch targets
10980 where the targets can only be reached by jumping.  In this case,
10981 no dummy operations need be executed.
10983 Parameters of this option are analogous to the @option{-falign-functions} option.
10984 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10985 equivalent and mean that loops are not aligned.
10987 If @var{n} is not specified or is zero, use a machine-dependent default.
10988 The maximum allowed @var{n} option value is 65536.
10990 Enabled at levels @option{-O2}, @option{-O3}.
10992 @item -fno-allocation-dce
10993 @opindex fno-allocation-dce
10994 Do not remove unused C++ allocations in dead code elimination.
10996 @item -fallow-store-data-races
10997 @opindex fallow-store-data-races
10998 Allow the compiler to introduce new data races on stores.
11000 Enabled at level @option{-Ofast}.
11002 @item -funit-at-a-time
11003 @opindex funit-at-a-time
11004 This option is left for compatibility reasons. @option{-funit-at-a-time}
11005 has no effect, while @option{-fno-unit-at-a-time} implies
11006 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11008 Enabled by default.
11010 @item -fno-toplevel-reorder
11011 @opindex fno-toplevel-reorder
11012 @opindex ftoplevel-reorder
11013 Do not reorder top-level functions, variables, and @code{asm}
11014 statements.  Output them in the same order that they appear in the
11015 input file.  When this option is used, unreferenced static variables
11016 are not removed.  This option is intended to support existing code
11017 that relies on a particular ordering.  For new code, it is better to
11018 use attributes when possible.
11020 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11021 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11022 Additionally @option{-fno-toplevel-reorder} implies
11023 @option{-fno-section-anchors}.
11025 @item -fweb
11026 @opindex fweb
11027 Constructs webs as commonly used for register allocation purposes and assign
11028 each web individual pseudo register.  This allows the register allocation pass
11029 to operate on pseudos directly, but also strengthens several other optimization
11030 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
11031 however, make debugging impossible, since variables no longer stay in a
11032 ``home register''.
11034 Enabled by default with @option{-funroll-loops}.
11036 @item -fwhole-program
11037 @opindex fwhole-program
11038 Assume that the current compilation unit represents the whole program being
11039 compiled.  All public functions and variables with the exception of @code{main}
11040 and those merged by attribute @code{externally_visible} become static functions
11041 and in effect are optimized more aggressively by interprocedural optimizers.
11043 This option should not be used in combination with @option{-flto}.
11044 Instead relying on a linker plugin should provide safer and more precise
11045 information.
11047 @item -flto[=@var{n}]
11048 @opindex flto
11049 This option runs the standard link-time optimizer.  When invoked
11050 with source code, it generates GIMPLE (one of GCC's internal
11051 representations) and writes it to special ELF sections in the object
11052 file.  When the object files are linked together, all the function
11053 bodies are read from these ELF sections and instantiated as if they
11054 had been part of the same translation unit.
11056 To use the link-time optimizer, @option{-flto} and optimization
11057 options should be specified at compile time and during the final link.
11058 It is recommended that you compile all the files participating in the
11059 same link with the same options and also specify those options at
11060 link time.  
11061 For example:
11063 @smallexample
11064 gcc -c -O2 -flto foo.c
11065 gcc -c -O2 -flto bar.c
11066 gcc -o myprog -flto -O2 foo.o bar.o
11067 @end smallexample
11069 The first two invocations to GCC save a bytecode representation
11070 of GIMPLE into special ELF sections inside @file{foo.o} and
11071 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
11072 @file{foo.o} and @file{bar.o}, merges the two files into a single
11073 internal image, and compiles the result as usual.  Since both
11074 @file{foo.o} and @file{bar.o} are merged into a single image, this
11075 causes all the interprocedural analyses and optimizations in GCC to
11076 work across the two files as if they were a single one.  This means,
11077 for example, that the inliner is able to inline functions in
11078 @file{bar.o} into functions in @file{foo.o} and vice-versa.
11080 Another (simpler) way to enable link-time optimization is:
11082 @smallexample
11083 gcc -o myprog -flto -O2 foo.c bar.c
11084 @end smallexample
11086 The above generates bytecode for @file{foo.c} and @file{bar.c},
11087 merges them together into a single GIMPLE representation and optimizes
11088 them as usual to produce @file{myprog}.
11090 The important thing to keep in mind is that to enable link-time
11091 optimizations you need to use the GCC driver to perform the link step.
11092 GCC automatically performs link-time optimization if any of the
11093 objects involved were compiled with the @option{-flto} command-line option.  
11094 You can always override
11095 the automatic decision to do link-time optimization
11096 by passing @option{-fno-lto} to the link command.
11098 To make whole program optimization effective, it is necessary to make
11099 certain whole program assumptions.  The compiler needs to know
11100 what functions and variables can be accessed by libraries and runtime
11101 outside of the link-time optimized unit.  When supported by the linker,
11102 the linker plugin (see @option{-fuse-linker-plugin}) passes information
11103 to the compiler about used and externally visible symbols.  When
11104 the linker plugin is not available, @option{-fwhole-program} should be
11105 used to allow the compiler to make these assumptions, which leads
11106 to more aggressive optimization decisions.
11108 When a file is compiled with @option{-flto} without
11109 @option{-fuse-linker-plugin}, the generated object file is larger than
11110 a regular object file because it contains GIMPLE bytecodes and the usual
11111 final code (see @option{-ffat-lto-objects}.  This means that
11112 object files with LTO information can be linked as normal object
11113 files; if @option{-fno-lto} is passed to the linker, no
11114 interprocedural optimizations are applied.  Note that when
11115 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
11116 but you cannot perform a regular, non-LTO link on them.
11118 When producing the final binary, GCC only
11119 applies link-time optimizations to those files that contain bytecode.
11120 Therefore, you can mix and match object files and libraries with
11121 GIMPLE bytecodes and final object code.  GCC automatically selects
11122 which files to optimize in LTO mode and which files to link without
11123 further processing.
11125 Generally, options specified at link time override those
11126 specified at compile time, although in some cases GCC attempts to infer
11127 link-time options from the settings used to compile the input files.
11129 If you do not specify an optimization level option @option{-O} at
11130 link time, then GCC uses the highest optimization level 
11131 used when compiling the object files.  Note that it is generally 
11132 ineffective to specify an optimization level option only at link time and 
11133 not at compile time, for two reasons.  First, compiling without 
11134 optimization suppresses compiler passes that gather information 
11135 needed for effective optimization at link time.  Second, some early
11136 optimization passes can be performed only at compile time and 
11137 not at link time.
11139 There are some code generation flags preserved by GCC when
11140 generating bytecodes, as they need to be used during the final link.
11141 Currently, the following options and their settings are taken from
11142 the first object file that explicitly specifies them: 
11143 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11144 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11145 and all the @option{-m} target flags.
11147 Certain ABI-changing flags are required to match in all compilation units,
11148 and trying to override this at link time with a conflicting value
11149 is ignored.  This includes options such as @option{-freg-struct-return}
11150 and @option{-fpcc-struct-return}. 
11152 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11153 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11154 are passed through to the link stage and merged conservatively for
11155 conflicting translation units.  Specifically
11156 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11157 precedence; and for example @option{-ffp-contract=off} takes precedence
11158 over @option{-ffp-contract=fast}.  You can override them at link time.
11160 To enable debug info generation you need to supply @option{-g} at
11161 compile time.  If any of the input files at link time were built
11162 with debug info generation enabled the link will enable debug info
11163 generation as well.  Any elaborate debug info settings
11164 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11165 at the linker command line and mixing different settings in different
11166 translation units is discouraged.
11168 If LTO encounters objects with C linkage declared with incompatible
11169 types in separate translation units to be linked together (undefined
11170 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11171 issued.  The behavior is still undefined at run time.  Similar
11172 diagnostics may be raised for other languages.
11174 Another feature of LTO is that it is possible to apply interprocedural
11175 optimizations on files written in different languages:
11177 @smallexample
11178 gcc -c -flto foo.c
11179 g++ -c -flto bar.cc
11180 gfortran -c -flto baz.f90
11181 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11182 @end smallexample
11184 Notice that the final link is done with @command{g++} to get the C++
11185 runtime libraries and @option{-lgfortran} is added to get the Fortran
11186 runtime libraries.  In general, when mixing languages in LTO mode, you
11187 should use the same link command options as when mixing languages in a
11188 regular (non-LTO) compilation.
11190 If object files containing GIMPLE bytecode are stored in a library archive, say
11191 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11192 are using a linker with plugin support.  To create static libraries suitable
11193 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11194 and @command{ranlib}; 
11195 to show the symbols of object files with GIMPLE bytecode, use
11196 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
11197 and @command{nm} have been compiled with plugin support.  At link time, use the
11198 flag @option{-fuse-linker-plugin} to ensure that the library participates in
11199 the LTO optimization process:
11201 @smallexample
11202 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11203 @end smallexample
11205 With the linker plugin enabled, the linker extracts the needed
11206 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11207 to make them part of the aggregated GIMPLE image to be optimized.
11209 If you are not using a linker with plugin support and/or do not
11210 enable the linker plugin, then the objects inside @file{libfoo.a}
11211 are extracted and linked as usual, but they do not participate
11212 in the LTO optimization process.  In order to make a static library suitable
11213 for both LTO optimization and usual linkage, compile its object files with
11214 @option{-flto} @option{-ffat-lto-objects}.
11216 Link-time optimizations do not require the presence of the whole program to
11217 operate.  If the program does not require any symbols to be exported, it is
11218 possible to combine @option{-flto} and @option{-fwhole-program} to allow
11219 the interprocedural optimizers to use more aggressive assumptions which may
11220 lead to improved optimization opportunities.
11221 Use of @option{-fwhole-program} is not needed when linker plugin is
11222 active (see @option{-fuse-linker-plugin}).
11224 The current implementation of LTO makes no
11225 attempt to generate bytecode that is portable between different
11226 types of hosts.  The bytecode files are versioned and there is a
11227 strict version check, so bytecode files generated in one version of
11228 GCC do not work with an older or newer version of GCC.
11230 Link-time optimization does not work well with generation of debugging
11231 information on systems other than those using a combination of ELF and
11232 DWARF.
11234 If you specify the optional @var{n}, the optimization and code
11235 generation done at link time is executed in parallel using @var{n}
11236 parallel jobs by utilizing an installed @command{make} program.  The
11237 environment variable @env{MAKE} may be used to override the program
11238 used.
11240 You can also specify @option{-flto=jobserver} to use GNU make's
11241 job server mode to determine the number of parallel jobs. This
11242 is useful when the Makefile calling GCC is already executing in parallel.
11243 You must prepend a @samp{+} to the command recipe in the parent Makefile
11244 for this to work.  This option likely only works if @env{MAKE} is
11245 GNU make.  Even without the option value, GCC tries to automatically
11246 detect a running GNU make's job server.
11248 Use @option{-flto=auto} to use GNU make's job server, if available,
11249 or otherwise fall back to autodetection of the number of CPU threads
11250 present in your system.
11252 @item -flto-partition=@var{alg}
11253 @opindex flto-partition
11254 Specify the partitioning algorithm used by the link-time optimizer.
11255 The value is either @samp{1to1} to specify a partitioning mirroring
11256 the original source files or @samp{balanced} to specify partitioning
11257 into equally sized chunks (whenever possible) or @samp{max} to create
11258 new partition for every symbol where possible.  Specifying @samp{none}
11259 as an algorithm disables partitioning and streaming completely. 
11260 The default value is @samp{balanced}. While @samp{1to1} can be used
11261 as an workaround for various code ordering issues, the @samp{max}
11262 partitioning is intended for internal testing only.
11263 The value @samp{one} specifies that exactly one partition should be
11264 used while the value @samp{none} bypasses partitioning and executes
11265 the link-time optimization step directly from the WPA phase.
11267 @item -flto-compression-level=@var{n}
11268 @opindex flto-compression-level
11269 This option specifies the level of compression used for intermediate
11270 language written to LTO object files, and is only meaningful in
11271 conjunction with LTO mode (@option{-flto}).  Valid
11272 values are 0 (no compression) to 9 (maximum compression).  Values
11273 outside this range are clamped to either 0 or 9.  If the option is not
11274 given, a default balanced compression setting is used.
11276 @item -fuse-linker-plugin
11277 @opindex fuse-linker-plugin
11278 Enables the use of a linker plugin during link-time optimization.  This
11279 option relies on plugin support in the linker, which is available in gold
11280 or in GNU ld 2.21 or newer.
11282 This option enables the extraction of object files with GIMPLE bytecode out
11283 of library archives. This improves the quality of optimization by exposing
11284 more code to the link-time optimizer.  This information specifies what
11285 symbols can be accessed externally (by non-LTO object or during dynamic
11286 linking).  Resulting code quality improvements on binaries (and shared
11287 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11288 See @option{-flto} for a description of the effect of this flag and how to
11289 use it.
11291 This option is enabled by default when LTO support in GCC is enabled
11292 and GCC was configured for use with
11293 a linker supporting plugins (GNU ld 2.21 or newer or gold).
11295 @item -ffat-lto-objects
11296 @opindex ffat-lto-objects
11297 Fat LTO objects are object files that contain both the intermediate language
11298 and the object code. This makes them usable for both LTO linking and normal
11299 linking. This option is effective only when compiling with @option{-flto}
11300 and is ignored at link time.
11302 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11303 requires the complete toolchain to be aware of LTO. It requires a linker with
11304 linker plugin support for basic functionality.  Additionally,
11305 @command{nm}, @command{ar} and @command{ranlib}
11306 need to support linker plugins to allow a full-featured build environment
11307 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
11308 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11309 to these tools. With non fat LTO makefiles need to be modified to use them.
11311 Note that modern binutils provide plugin auto-load mechanism.
11312 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11313 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11314 @command{gcc-ranlib}).
11316 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11317 support.
11319 @item -fcompare-elim
11320 @opindex fcompare-elim
11321 After register allocation and post-register allocation instruction splitting,
11322 identify arithmetic instructions that compute processor flags similar to a
11323 comparison operation based on that arithmetic.  If possible, eliminate the
11324 explicit comparison operation.
11326 This pass only applies to certain targets that cannot explicitly represent
11327 the comparison operation before register allocation is complete.
11329 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11331 @item -fcprop-registers
11332 @opindex fcprop-registers
11333 After register allocation and post-register allocation instruction splitting,
11334 perform a copy-propagation pass to try to reduce scheduling dependencies
11335 and occasionally eliminate the copy.
11337 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11339 @item -fprofile-correction
11340 @opindex fprofile-correction
11341 Profiles collected using an instrumented binary for multi-threaded programs may
11342 be inconsistent due to missed counter updates. When this option is specified,
11343 GCC uses heuristics to correct or smooth out such inconsistencies. By
11344 default, GCC emits an error message when an inconsistent profile is detected.
11346 This option is enabled by @option{-fauto-profile}.
11348 @item -fprofile-partial-training
11349 @opindex fprofile-use
11350 With @code{-fprofile-use} all portions of programs not executed during train
11351 run are optimized agressively for size rather than speed.  In some cases it is
11352 not practical to train all possible hot paths in the program. (For
11353 example, program may contain functions specific for a given hardware and
11354 trianing may not cover all hardware configurations program is run on.)  With
11355 @code{-fprofile-partial-training} profile feedback will be ignored for all
11356 functions not executed during the train run leading them to be optimized as if
11357 they were compiled without profile feedback. This leads to better performance
11358 when train run is not representative but also leads to significantly bigger
11359 code.
11361 @item -fprofile-use
11362 @itemx -fprofile-use=@var{path}
11363 @opindex fprofile-use
11364 Enable profile feedback-directed optimizations, 
11365 and the following optimizations, many of which
11366 are generally profitable only with profile feedback available:
11368 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11369 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11370 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11371 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11372 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11373 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11374 -fprofile-reorder-functions}
11376 Before you can use this option, you must first generate profiling information.
11377 @xref{Instrumentation Options}, for information about the
11378 @option{-fprofile-generate} option.
11380 By default, GCC emits an error message if the feedback profiles do not
11381 match the source code.  This error can be turned into a warning by using
11382 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
11383 optimized code.  Additionally, by default, GCC also emits a warning message if
11384 the feedback profiles do not exist (see @option{-Wmissing-profile}).
11386 If @var{path} is specified, GCC looks at the @var{path} to find
11387 the profile feedback data files. See @option{-fprofile-dir}.
11389 @item -fauto-profile
11390 @itemx -fauto-profile=@var{path}
11391 @opindex fauto-profile
11392 Enable sampling-based feedback-directed optimizations, 
11393 and the following optimizations,
11394 many of which are generally profitable only with profile feedback available:
11396 @gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11397 -funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11398 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11399 -fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11400 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11401 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11402 -fprofile-correction}
11404 @var{path} is the name of a file containing AutoFDO profile information.
11405 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11407 Producing an AutoFDO profile data file requires running your program
11408 with the @command{perf} utility on a supported GNU/Linux target system.
11409 For more information, see @uref{https://perf.wiki.kernel.org/}.
11411 E.g.
11412 @smallexample
11413 perf record -e br_inst_retired:near_taken -b -o perf.data \
11414     -- your_program
11415 @end smallexample
11417 Then use the @command{create_gcov} tool to convert the raw profile data
11418 to a format that can be used by GCC.@  You must also supply the 
11419 unstripped binary for your program to this tool.  
11420 See @uref{https://github.com/google/autofdo}.
11422 E.g.
11423 @smallexample
11424 create_gcov --binary=your_program.unstripped --profile=perf.data \
11425     --gcov=profile.afdo
11426 @end smallexample
11427 @end table
11429 The following options control compiler behavior regarding floating-point 
11430 arithmetic.  These options trade off between speed and
11431 correctness.  All must be specifically enabled.
11433 @table @gcctabopt
11434 @item -ffloat-store
11435 @opindex ffloat-store
11436 Do not store floating-point variables in registers, and inhibit other
11437 options that might change whether a floating-point value is taken from a
11438 register or memory.
11440 @cindex floating-point precision
11441 This option prevents undesirable excess precision on machines such as
11442 the 68000 where the floating registers (of the 68881) keep more
11443 precision than a @code{double} is supposed to have.  Similarly for the
11444 x86 architecture.  For most programs, the excess precision does only
11445 good, but a few programs rely on the precise definition of IEEE floating
11446 point.  Use @option{-ffloat-store} for such programs, after modifying
11447 them to store all pertinent intermediate computations into variables.
11449 @item -fexcess-precision=@var{style}
11450 @opindex fexcess-precision
11451 This option allows further control over excess precision on machines
11452 where floating-point operations occur in a format with more precision or
11453 range than the IEEE standard and interchange floating-point types.  By
11454 default, @option{-fexcess-precision=fast} is in effect; this means that
11455 operations may be carried out in a wider precision than the types specified
11456 in the source if that would result in faster code, and it is unpredictable
11457 when rounding to the types specified in the source code takes place.
11458 When compiling C, if @option{-fexcess-precision=standard} is specified then
11459 excess precision follows the rules specified in ISO C99; in particular,
11460 both casts and assignments cause values to be rounded to their
11461 semantic types (whereas @option{-ffloat-store} only affects
11462 assignments).  This option is enabled by default for C if a strict
11463 conformance option such as @option{-std=c99} is used.
11464 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11465 regardless of whether a strict conformance option is used.
11467 @opindex mfpmath
11468 @option{-fexcess-precision=standard} is not implemented for languages
11469 other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
11470 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11471 semantics apply without excess precision, and in the latter, rounding
11472 is unpredictable.
11474 @item -ffast-math
11475 @opindex ffast-math
11476 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11477 @option{-ffinite-math-only}, @option{-fno-rounding-math},
11478 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11479 @option{-fexcess-precision=fast}.
11481 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11483 This option is not turned on by any @option{-O} option besides
11484 @option{-Ofast} since it can result in incorrect output for programs
11485 that depend on an exact implementation of IEEE or ISO rules/specifications
11486 for math functions. It may, however, yield faster code for programs
11487 that do not require the guarantees of these specifications.
11489 @item -fno-math-errno
11490 @opindex fno-math-errno
11491 @opindex fmath-errno
11492 Do not set @code{errno} after calling math functions that are executed
11493 with a single instruction, e.g., @code{sqrt}.  A program that relies on
11494 IEEE exceptions for math error handling may want to use this flag
11495 for speed while maintaining IEEE arithmetic compatibility.
11497 This option is not turned on by any @option{-O} option since
11498 it can result in incorrect output for programs that depend on
11499 an exact implementation of IEEE or ISO rules/specifications for
11500 math functions. It may, however, yield faster code for programs
11501 that do not require the guarantees of these specifications.
11503 The default is @option{-fmath-errno}.
11505 On Darwin systems, the math library never sets @code{errno}.  There is
11506 therefore no reason for the compiler to consider the possibility that
11507 it might, and @option{-fno-math-errno} is the default.
11509 @item -funsafe-math-optimizations
11510 @opindex funsafe-math-optimizations
11512 Allow optimizations for floating-point arithmetic that (a) assume
11513 that arguments and results are valid and (b) may violate IEEE or
11514 ANSI standards.  When used at link time, it may include libraries
11515 or startup files that change the default FPU control word or other
11516 similar optimizations.
11518 This option is not turned on by any @option{-O} option since
11519 it can result in incorrect output for programs that depend on
11520 an exact implementation of IEEE or ISO rules/specifications for
11521 math functions. It may, however, yield faster code for programs
11522 that do not require the guarantees of these specifications.
11523 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11524 @option{-fassociative-math} and @option{-freciprocal-math}.
11526 The default is @option{-fno-unsafe-math-optimizations}.
11528 @item -fassociative-math
11529 @opindex fassociative-math
11531 Allow re-association of operands in series of floating-point operations.
11532 This violates the ISO C and C++ language standard by possibly changing
11533 computation result.  NOTE: re-ordering may change the sign of zero as
11534 well as ignore NaNs and inhibit or create underflow or overflow (and
11535 thus cannot be used on code that relies on rounding behavior like
11536 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
11537 and thus may not be used when ordered comparisons are required.
11538 This option requires that both @option{-fno-signed-zeros} and
11539 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
11540 much sense with @option{-frounding-math}. For Fortran the option
11541 is automatically enabled when both @option{-fno-signed-zeros} and
11542 @option{-fno-trapping-math} are in effect.
11544 The default is @option{-fno-associative-math}.
11546 @item -freciprocal-math
11547 @opindex freciprocal-math
11549 Allow the reciprocal of a value to be used instead of dividing by
11550 the value if this enables optimizations.  For example @code{x / y}
11551 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11552 is subject to common subexpression elimination.  Note that this loses
11553 precision and increases the number of flops operating on the value.
11555 The default is @option{-fno-reciprocal-math}.
11557 @item -ffinite-math-only
11558 @opindex ffinite-math-only
11559 Allow optimizations for floating-point arithmetic that assume
11560 that arguments and results are not NaNs or +-Infs.
11562 This option is not turned on by any @option{-O} option since
11563 it can result in incorrect output for programs that depend on
11564 an exact implementation of IEEE or ISO rules/specifications for
11565 math functions. It may, however, yield faster code for programs
11566 that do not require the guarantees of these specifications.
11568 The default is @option{-fno-finite-math-only}.
11570 @item -fno-signed-zeros
11571 @opindex fno-signed-zeros
11572 @opindex fsigned-zeros
11573 Allow optimizations for floating-point arithmetic that ignore the
11574 signedness of zero.  IEEE arithmetic specifies the behavior of
11575 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11576 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11577 This option implies that the sign of a zero result isn't significant.
11579 The default is @option{-fsigned-zeros}.
11581 @item -fno-trapping-math
11582 @opindex fno-trapping-math
11583 @opindex ftrapping-math
11584 Compile code assuming that floating-point operations cannot generate
11585 user-visible traps.  These traps include division by zero, overflow,
11586 underflow, inexact result and invalid operation.  This option requires
11587 that @option{-fno-signaling-nans} be in effect.  Setting this option may
11588 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11590 This option should never be turned on by any @option{-O} option since
11591 it can result in incorrect output for programs that depend on
11592 an exact implementation of IEEE or ISO rules/specifications for
11593 math functions.
11595 The default is @option{-ftrapping-math}.
11597 @item -frounding-math
11598 @opindex frounding-math
11599 Disable transformations and optimizations that assume default floating-point
11600 rounding behavior.  This is round-to-zero for all floating point
11601 to integer conversions, and round-to-nearest for all other arithmetic
11602 truncations.  This option should be specified for programs that change
11603 the FP rounding mode dynamically, or that may be executed with a
11604 non-default rounding mode.  This option disables constant folding of
11605 floating-point expressions at compile time (which may be affected by
11606 rounding mode) and arithmetic transformations that are unsafe in the
11607 presence of sign-dependent rounding modes.
11609 The default is @option{-fno-rounding-math}.
11611 This option is experimental and does not currently guarantee to
11612 disable all GCC optimizations that are affected by rounding mode.
11613 Future versions of GCC may provide finer control of this setting
11614 using C99's @code{FENV_ACCESS} pragma.  This command-line option
11615 will be used to specify the default state for @code{FENV_ACCESS}.
11617 @item -fsignaling-nans
11618 @opindex fsignaling-nans
11619 Compile code assuming that IEEE signaling NaNs may generate user-visible
11620 traps during floating-point operations.  Setting this option disables
11621 optimizations that may change the number of exceptions visible with
11622 signaling NaNs.  This option implies @option{-ftrapping-math}.
11624 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11625 be defined.
11627 The default is @option{-fno-signaling-nans}.
11629 This option is experimental and does not currently guarantee to
11630 disable all GCC optimizations that affect signaling NaN behavior.
11632 @item -fno-fp-int-builtin-inexact
11633 @opindex fno-fp-int-builtin-inexact
11634 @opindex ffp-int-builtin-inexact
11635 Do not allow the built-in functions @code{ceil}, @code{floor},
11636 @code{round} and @code{trunc}, and their @code{float} and @code{long
11637 double} variants, to generate code that raises the ``inexact''
11638 floating-point exception for noninteger arguments.  ISO C99 and C11
11639 allow these functions to raise the ``inexact'' exception, but ISO/IEC
11640 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
11641 ISO C2X, does not allow these functions to do so.
11643 The default is @option{-ffp-int-builtin-inexact}, allowing the
11644 exception to be raised, unless C2X or a later C standard is selected.
11645 This option does nothing unless @option{-ftrapping-math} is in effect.
11647 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
11648 generate a call to a library function then the ``inexact'' exception
11649 may be raised if the library implementation does not follow TS 18661.
11651 @item -fsingle-precision-constant
11652 @opindex fsingle-precision-constant
11653 Treat floating-point constants as single precision instead of
11654 implicitly converting them to double-precision constants.
11656 @item -fcx-limited-range
11657 @opindex fcx-limited-range
11658 When enabled, this option states that a range reduction step is not
11659 needed when performing complex division.  Also, there is no checking
11660 whether the result of a complex multiplication or division is @code{NaN
11661 + I*NaN}, with an attempt to rescue the situation in that case.  The
11662 default is @option{-fno-cx-limited-range}, but is enabled by
11663 @option{-ffast-math}.
11665 This option controls the default setting of the ISO C99
11666 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
11667 all languages.
11669 @item -fcx-fortran-rules
11670 @opindex fcx-fortran-rules
11671 Complex multiplication and division follow Fortran rules.  Range
11672 reduction is done as part of complex division, but there is no checking
11673 whether the result of a complex multiplication or division is @code{NaN
11674 + I*NaN}, with an attempt to rescue the situation in that case.
11676 The default is @option{-fno-cx-fortran-rules}.
11678 @end table
11680 The following options control optimizations that may improve
11681 performance, but are not enabled by any @option{-O} options.  This
11682 section includes experimental options that may produce broken code.
11684 @table @gcctabopt
11685 @item -fbranch-probabilities
11686 @opindex fbranch-probabilities
11687 After running a program compiled with @option{-fprofile-arcs}
11688 (@pxref{Instrumentation Options}),
11689 you can compile it a second time using
11690 @option{-fbranch-probabilities}, to improve optimizations based on
11691 the number of times each branch was taken.  When a program
11692 compiled with @option{-fprofile-arcs} exits, it saves arc execution
11693 counts to a file called @file{@var{sourcename}.gcda} for each source
11694 file.  The information in this data file is very dependent on the
11695 structure of the generated code, so you must use the same source code
11696 and the same optimization options for both compilations.
11698 With @option{-fbranch-probabilities}, GCC puts a
11699 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
11700 These can be used to improve optimization.  Currently, they are only
11701 used in one place: in @file{reorg.c}, instead of guessing which path a
11702 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
11703 exactly determine which path is taken more often.
11705 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11707 @item -fprofile-values
11708 @opindex fprofile-values
11709 If combined with @option{-fprofile-arcs}, it adds code so that some
11710 data about values of expressions in the program is gathered.
11712 With @option{-fbranch-probabilities}, it reads back the data gathered
11713 from profiling values of expressions for usage in optimizations.
11715 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
11716 @option{-fauto-profile}.
11718 @item -fprofile-reorder-functions
11719 @opindex fprofile-reorder-functions
11720 Function reordering based on profile instrumentation collects
11721 first time of execution of a function and orders these functions
11722 in ascending order.
11724 Enabled with @option{-fprofile-use}.
11726 @item -fvpt
11727 @opindex fvpt
11728 If combined with @option{-fprofile-arcs}, this option instructs the compiler
11729 to add code to gather information about values of expressions.
11731 With @option{-fbranch-probabilities}, it reads back the data gathered
11732 and actually performs the optimizations based on them.
11733 Currently the optimizations include specialization of division operations
11734 using the knowledge about the value of the denominator.
11736 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
11738 @item -frename-registers
11739 @opindex frename-registers
11740 Attempt to avoid false dependencies in scheduled code by making use
11741 of registers left over after register allocation.  This optimization
11742 most benefits processors with lots of registers.  Depending on the
11743 debug information format adopted by the target, however, it can
11744 make debugging impossible, since variables no longer stay in
11745 a ``home register''.
11747 Enabled by default with @option{-funroll-loops}.
11749 @item -fschedule-fusion
11750 @opindex fschedule-fusion
11751 Performs a target dependent pass over the instruction stream to schedule
11752 instructions of same type together because target machine can execute them
11753 more efficiently if they are adjacent to each other in the instruction flow.
11755 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11757 @item -ftracer
11758 @opindex ftracer
11759 Perform tail duplication to enlarge superblock size.  This transformation
11760 simplifies the control flow of the function allowing other optimizations to do
11761 a better job.
11763 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11765 @item -funroll-loops
11766 @opindex funroll-loops
11767 Unroll loops whose number of iterations can be determined at compile time or
11768 upon entry to the loop.  @option{-funroll-loops} implies
11769 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11770 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11771 a small constant number of iterations).  This option makes code larger, and may
11772 or may not make it run faster.
11774 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11776 @item -funroll-all-loops
11777 @opindex funroll-all-loops
11778 Unroll all loops, even if their number of iterations is uncertain when
11779 the loop is entered.  This usually makes programs run more slowly.
11780 @option{-funroll-all-loops} implies the same options as
11781 @option{-funroll-loops}.
11783 @item -fpeel-loops
11784 @opindex fpeel-loops
11785 Peels loops for which there is enough information that they do not
11786 roll much (from profile feedback or static analysis).  It also turns on
11787 complete loop peeling (i.e.@: complete removal of loops with small constant
11788 number of iterations).
11790 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11792 @item -fmove-loop-invariants
11793 @opindex fmove-loop-invariants
11794 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
11795 at level @option{-O1} and higher, except for @option{-Og}.
11797 @item -fsplit-loops
11798 @opindex fsplit-loops
11799 Split a loop into two if it contains a condition that's always true
11800 for one side of the iteration space and false for the other.
11802 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11804 @item -funswitch-loops
11805 @opindex funswitch-loops
11806 Move branches with loop invariant conditions out of the loop, with duplicates
11807 of the loop on both branches (modified according to result of the condition).
11809 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11811 @item -fversion-loops-for-strides
11812 @opindex fversion-loops-for-strides
11813 If a loop iterates over an array with a variable stride, create another
11814 version of the loop that assumes the stride is always one.  For example:
11816 @smallexample
11817 for (int i = 0; i < n; ++i)
11818   x[i * stride] = @dots{};
11819 @end smallexample
11821 becomes:
11823 @smallexample
11824 if (stride == 1)
11825   for (int i = 0; i < n; ++i)
11826     x[i] = @dots{};
11827 else
11828   for (int i = 0; i < n; ++i)
11829     x[i * stride] = @dots{};
11830 @end smallexample
11832 This is particularly useful for assumed-shape arrays in Fortran where
11833 (for example) it allows better vectorization assuming contiguous accesses.
11834 This flag is enabled by default at @option{-O3}.
11835 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11837 @item -ffunction-sections
11838 @itemx -fdata-sections
11839 @opindex ffunction-sections
11840 @opindex fdata-sections
11841 Place each function or data item into its own section in the output
11842 file if the target supports arbitrary sections.  The name of the
11843 function or the name of the data item determines the section's name
11844 in the output file.
11846 Use these options on systems where the linker can perform optimizations to
11847 improve locality of reference in the instruction space.  Most systems using the
11848 ELF object format have linkers with such optimizations.  On AIX, the linker
11849 rearranges sections (CSECTs) based on the call graph.  The performance impact
11850 varies.
11852 Together with a linker garbage collection (linker @option{--gc-sections}
11853 option) these options may lead to smaller statically-linked executables (after
11854 stripping).
11856 On ELF/DWARF systems these options do not degenerate the quality of the debug
11857 information.  There could be issues with other object files/debug info formats.
11859 Only use these options when there are significant benefits from doing so.  When
11860 you specify these options, the assembler and linker create larger object and
11861 executable files and are also slower.  These options affect code generation.
11862 They prevent optimizations by the compiler and assembler using relative
11863 locations inside a translation unit since the locations are unknown until
11864 link time.  An example of such an optimization is relaxing calls to short call
11865 instructions.
11867 @item -fstdarg-opt
11868 @opindex fstdarg-opt
11869 Optimize the prologue of variadic argument functions with respect to usage of
11870 those arguments.
11872 @item -fsection-anchors
11873 @opindex fsection-anchors
11874 Try to reduce the number of symbolic address calculations by using
11875 shared ``anchor'' symbols to address nearby objects.  This transformation
11876 can help to reduce the number of GOT entries and GOT accesses on some
11877 targets.
11879 For example, the implementation of the following function @code{foo}:
11881 @smallexample
11882 static int a, b, c;
11883 int foo (void) @{ return a + b + c; @}
11884 @end smallexample
11886 @noindent
11887 usually calculates the addresses of all three variables, but if you
11888 compile it with @option{-fsection-anchors}, it accesses the variables
11889 from a common anchor point instead.  The effect is similar to the
11890 following pseudocode (which isn't valid C):
11892 @smallexample
11893 int foo (void)
11895   register int *xr = &x;
11896   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11898 @end smallexample
11900 Not all targets support this option.
11902 @item --param @var{name}=@var{value}
11903 @opindex param
11904 In some places, GCC uses various constants to control the amount of
11905 optimization that is done.  For example, GCC does not inline functions
11906 that contain more than a certain number of instructions.  You can
11907 control some of these constants on the command line using the
11908 @option{--param} option.
11910 The names of specific parameters, and the meaning of the values, are
11911 tied to the internals of the compiler, and are subject to change
11912 without notice in future releases.
11914 In order to get minimal, maximal and default value of a parameter,
11915 one can use @option{--help=param -Q} options.
11917 In each case, the @var{value} is an integer.  The following choices
11918 of @var{name} are recognized for all targets:
11920 @table @gcctabopt
11921 @item predictable-branch-outcome
11922 When branch is predicted to be taken with probability lower than this threshold
11923 (in percent), then it is considered well predictable.
11925 @item max-rtl-if-conversion-insns
11926 RTL if-conversion tries to remove conditional branches around a block and
11927 replace them with conditionally executed instructions.  This parameter
11928 gives the maximum number of instructions in a block which should be
11929 considered for if-conversion.  The compiler will
11930 also use other heuristics to decide whether if-conversion is likely to be
11931 profitable.
11933 @item max-rtl-if-conversion-predictable-cost
11934 @itemx max-rtl-if-conversion-unpredictable-cost
11935 RTL if-conversion will try to remove conditional branches around a block
11936 and replace them with conditionally executed instructions.  These parameters
11937 give the maximum permissible cost for the sequence that would be generated
11938 by if-conversion depending on whether the branch is statically determined
11939 to be predictable or not.  The units for this parameter are the same as
11940 those for the GCC internal seq_cost metric.  The compiler will try to
11941 provide a reasonable default for this parameter using the BRANCH_COST
11942 target macro.
11944 @item max-crossjump-edges
11945 The maximum number of incoming edges to consider for cross-jumping.
11946 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11947 the number of edges incoming to each block.  Increasing values mean
11948 more aggressive optimization, making the compilation time increase with
11949 probably small improvement in executable size.
11951 @item min-crossjump-insns
11952 The minimum number of instructions that must be matched at the end
11953 of two blocks before cross-jumping is performed on them.  This
11954 value is ignored in the case where all instructions in the block being
11955 cross-jumped from are matched.
11957 @item max-grow-copy-bb-insns
11958 The maximum code size expansion factor when copying basic blocks
11959 instead of jumping.  The expansion is relative to a jump instruction.
11961 @item max-goto-duplication-insns
11962 The maximum number of instructions to duplicate to a block that jumps
11963 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
11964 passes, GCC factors computed gotos early in the compilation process,
11965 and unfactors them as late as possible.  Only computed jumps at the
11966 end of a basic blocks with no more than max-goto-duplication-insns are
11967 unfactored.
11969 @item max-delay-slot-insn-search
11970 The maximum number of instructions to consider when looking for an
11971 instruction to fill a delay slot.  If more than this arbitrary number of
11972 instructions are searched, the time savings from filling the delay slot
11973 are minimal, so stop searching.  Increasing values mean more
11974 aggressive optimization, making the compilation time increase with probably
11975 small improvement in execution time.
11977 @item max-delay-slot-live-search
11978 When trying to fill delay slots, the maximum number of instructions to
11979 consider when searching for a block with valid live register
11980 information.  Increasing this arbitrarily chosen value means more
11981 aggressive optimization, increasing the compilation time.  This parameter
11982 should be removed when the delay slot code is rewritten to maintain the
11983 control-flow graph.
11985 @item max-gcse-memory
11986 The approximate maximum amount of memory that can be allocated in
11987 order to perform the global common subexpression elimination
11988 optimization.  If more memory than specified is required, the
11989 optimization is not done.
11991 @item max-gcse-insertion-ratio
11992 If the ratio of expression insertions to deletions is larger than this value
11993 for any expression, then RTL PRE inserts or removes the expression and thus
11994 leaves partially redundant computations in the instruction stream.
11996 @item max-pending-list-length
11997 The maximum number of pending dependencies scheduling allows
11998 before flushing the current state and starting over.  Large functions
11999 with few branches or calls can create excessively large lists which
12000 needlessly consume memory and resources.
12002 @item max-modulo-backtrack-attempts
12003 The maximum number of backtrack attempts the scheduler should make
12004 when modulo scheduling a loop.  Larger values can exponentially increase
12005 compilation time.
12007 @item max-inline-insns-single
12008 Several parameters control the tree inliner used in GCC@.  This number sets the
12009 maximum number of instructions (counted in GCC's internal representation) in a
12010 single function that the tree inliner considers for inlining.  This only
12011 affects functions declared inline and methods implemented in a class
12012 declaration (C++). 
12015 @item max-inline-insns-auto
12016 When you use @option{-finline-functions} (included in @option{-O3}),
12017 a lot of functions that would otherwise not be considered for inlining
12018 by the compiler are investigated.  To those functions, a different
12019 (more restrictive) limit compared to functions declared inline can
12020 be applied (@option{--param max-inline-insns-auto}).
12022 @item max-inline-insns-small
12023 This is bound applied to calls which are considered relevant with
12024 @option{-finline-small-functions}.
12026 @item max-inline-insns-size
12027 This is bound applied to calls which are optimized for size. Small growth
12028 may be desirable to anticipate optimization oppurtunities exposed by inlining.
12030 @item uninlined-function-insns
12031 Number of instructions accounted by inliner for function overhead such as
12032 function prologue and epilogue.
12034 @item uninlined-function-time
12035 Extra time accounted by inliner for function overhead such as time needed to
12036 execute function prologue and epilogue
12038 @item inline-heuristics-hint-percent
12039 The scale (in percents) applied to @option{inline-insns-single},
12040 @option{inline-insns-single-O2}, @option{inline-insns-auto}
12041 when inline heuristics hints that inlining is
12042 very profitable (will enable later optimizations).
12044 @item uninlined-thunk-insns
12045 @item uninlined-thunk-time
12046 Same as @option{--param uninlined-function-insns} and
12047 @option{--param uninlined-function-time} but applied to function thunks
12049 @item inline-min-speedup
12050 When estimated performance improvement of caller + callee runtime exceeds this
12051 threshold (in percent), the function can be inlined regardless of the limit on
12052 @option{--param max-inline-insns-single} and @option{--param
12053 max-inline-insns-auto}.
12055 @item large-function-insns
12056 The limit specifying really large functions.  For functions larger than this
12057 limit after inlining, inlining is constrained by
12058 @option{--param large-function-growth}.  This parameter is useful primarily
12059 to avoid extreme compilation time caused by non-linear algorithms used by the
12060 back end.
12062 @item large-function-growth
12063 Specifies maximal growth of large function caused by inlining in percents.
12064 For example, parameter value 100 limits large function growth to 2.0 times
12065 the original size.
12067 @item large-unit-insns
12068 The limit specifying large translation unit.  Growth caused by inlining of
12069 units larger than this limit is limited by @option{--param inline-unit-growth}.
12070 For small units this might be too tight.
12071 For example, consider a unit consisting of function A
12072 that is inline and B that just calls A three times.  If B is small relative to
12073 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
12074 large units consisting of small inlineable functions, however, the overall unit
12075 growth limit is needed to avoid exponential explosion of code size.  Thus for
12076 smaller units, the size is increased to @option{--param large-unit-insns}
12077 before applying @option{--param inline-unit-growth}.
12079 @item inline-unit-growth
12080 Specifies maximal overall growth of the compilation unit caused by inlining.
12081 For example, parameter value 20 limits unit growth to 1.2 times the original
12082 size. Cold functions (either marked cold via an attribute or by profile
12083 feedback) are not accounted into the unit size.
12085 @item ipcp-unit-growth
12086 Specifies maximal overall growth of the compilation unit caused by
12087 interprocedural constant propagation.  For example, parameter value 10 limits
12088 unit growth to 1.1 times the original size.
12090 @item large-stack-frame
12091 The limit specifying large stack frames.  While inlining the algorithm is trying
12092 to not grow past this limit too much.
12094 @item large-stack-frame-growth
12095 Specifies maximal growth of large stack frames caused by inlining in percents.
12096 For example, parameter value 1000 limits large stack frame growth to 11 times
12097 the original size.
12099 @item max-inline-insns-recursive
12100 @itemx max-inline-insns-recursive-auto
12101 Specifies the maximum number of instructions an out-of-line copy of a
12102 self-recursive inline
12103 function can grow into by performing recursive inlining.
12105 @option{--param max-inline-insns-recursive} applies to functions
12106 declared inline.
12107 For functions not declared inline, recursive inlining
12108 happens only when @option{-finline-functions} (included in @option{-O3}) is
12109 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12111 @item max-inline-recursive-depth
12112 @itemx max-inline-recursive-depth-auto
12113 Specifies the maximum recursion depth used for recursive inlining.
12115 @option{--param max-inline-recursive-depth} applies to functions
12116 declared inline.  For functions not declared inline, recursive inlining
12117 happens only when @option{-finline-functions} (included in @option{-O3}) is
12118 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12120 @item min-inline-recursive-probability
12121 Recursive inlining is profitable only for function having deep recursion
12122 in average and can hurt for function having little recursion depth by
12123 increasing the prologue size or complexity of function body to other
12124 optimizers.
12126 When profile feedback is available (see @option{-fprofile-generate}) the actual
12127 recursion depth can be guessed from the probability that function recurses
12128 via a given call expression.  This parameter limits inlining only to call
12129 expressions whose probability exceeds the given threshold (in percents).
12131 @item early-inlining-insns
12132 Specify growth that the early inliner can make.  In effect it increases
12133 the amount of inlining for code having a large abstraction penalty.
12135 @item max-early-inliner-iterations
12136 Limit of iterations of the early inliner.  This basically bounds
12137 the number of nested indirect calls the early inliner can resolve.
12138 Deeper chains are still handled by late inlining.
12140 @item comdat-sharing-probability
12141 Probability (in percent) that C++ inline function with comdat visibility
12142 are shared across multiple compilation units.
12144 @item profile-func-internal-id
12145 A parameter to control whether to use function internal id in profile
12146 database lookup. If the value is 0, the compiler uses an id that
12147 is based on function assembler name and filename, which makes old profile
12148 data more tolerant to source changes such as function reordering etc.
12150 @item min-vect-loop-bound
12151 The minimum number of iterations under which loops are not vectorized
12152 when @option{-ftree-vectorize} is used.  The number of iterations after
12153 vectorization needs to be greater than the value specified by this option
12154 to allow vectorization.
12156 @item gcse-cost-distance-ratio
12157 Scaling factor in calculation of maximum distance an expression
12158 can be moved by GCSE optimizations.  This is currently supported only in the
12159 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
12160 is with simple expressions, i.e., the expressions that have cost
12161 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
12162 hoisting of simple expressions.
12164 @item gcse-unrestricted-cost
12165 Cost, roughly measured as the cost of a single typical machine
12166 instruction, at which GCSE optimizations do not constrain
12167 the distance an expression can travel.  This is currently
12168 supported only in the code hoisting pass.  The lesser the cost,
12169 the more aggressive code hoisting is.  Specifying 0 
12170 allows all expressions to travel unrestricted distances.
12172 @item max-hoist-depth
12173 The depth of search in the dominator tree for expressions to hoist.
12174 This is used to avoid quadratic behavior in hoisting algorithm.
12175 The value of 0 does not limit on the search, but may slow down compilation
12176 of huge functions.
12178 @item max-tail-merge-comparisons
12179 The maximum amount of similar bbs to compare a bb with.  This is used to
12180 avoid quadratic behavior in tree tail merging.
12182 @item max-tail-merge-iterations
12183 The maximum amount of iterations of the pass over the function.  This is used to
12184 limit compilation time in tree tail merging.
12186 @item store-merging-allow-unaligned
12187 Allow the store merging pass to introduce unaligned stores if it is legal to
12188 do so.
12190 @item max-stores-to-merge
12191 The maximum number of stores to attempt to merge into wider stores in the store
12192 merging pass.
12194 @item max-unrolled-insns
12195 The maximum number of instructions that a loop may have to be unrolled.
12196 If a loop is unrolled, this parameter also determines how many times
12197 the loop code is unrolled.
12199 @item max-average-unrolled-insns
12200 The maximum number of instructions biased by probabilities of their execution
12201 that a loop may have to be unrolled.  If a loop is unrolled,
12202 this parameter also determines how many times the loop code is unrolled.
12204 @item max-unroll-times
12205 The maximum number of unrollings of a single loop.
12207 @item max-peeled-insns
12208 The maximum number of instructions that a loop may have to be peeled.
12209 If a loop is peeled, this parameter also determines how many times
12210 the loop code is peeled.
12212 @item max-peel-times
12213 The maximum number of peelings of a single loop.
12215 @item max-peel-branches
12216 The maximum number of branches on the hot path through the peeled sequence.
12218 @item max-completely-peeled-insns
12219 The maximum number of insns of a completely peeled loop.
12221 @item max-completely-peel-times
12222 The maximum number of iterations of a loop to be suitable for complete peeling.
12224 @item max-completely-peel-loop-nest-depth
12225 The maximum depth of a loop nest suitable for complete peeling.
12227 @item max-unswitch-insns
12228 The maximum number of insns of an unswitched loop.
12230 @item max-unswitch-level
12231 The maximum number of branches unswitched in a single loop.
12233 @item lim-expensive
12234 The minimum cost of an expensive expression in the loop invariant motion.
12236 @item min-loop-cond-split-prob
12237 When FDO profile information is available, @option{min-loop-cond-split-prob}
12238 specifies minimum threshold for probability of semi-invariant condition
12239 statement to trigger loop split.
12241 @item iv-consider-all-candidates-bound
12242 Bound on number of candidates for induction variables, below which
12243 all candidates are considered for each use in induction variable
12244 optimizations.  If there are more candidates than this,
12245 only the most relevant ones are considered to avoid quadratic time complexity.
12247 @item iv-max-considered-uses
12248 The induction variable optimizations give up on loops that contain more
12249 induction variable uses.
12251 @item iv-always-prune-cand-set-bound
12252 If the number of candidates in the set is smaller than this value,
12253 always try to remove unnecessary ivs from the set
12254 when adding a new one.
12256 @item avg-loop-niter
12257 Average number of iterations of a loop.
12259 @item dse-max-object-size
12260 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12261 Larger values may result in larger compilation times.
12263 @item dse-max-alias-queries-per-store
12264 Maximum number of queries into the alias oracle per store.
12265 Larger values result in larger compilation times and may result in more
12266 removed dead stores.
12268 @item scev-max-expr-size
12269 Bound on size of expressions used in the scalar evolutions analyzer.
12270 Large expressions slow the analyzer.
12272 @item scev-max-expr-complexity
12273 Bound on the complexity of the expressions in the scalar evolutions analyzer.
12274 Complex expressions slow the analyzer.
12276 @item max-tree-if-conversion-phi-args
12277 Maximum number of arguments in a PHI supported by TREE if conversion
12278 unless the loop is marked with simd pragma.
12280 @item vect-max-version-for-alignment-checks
12281 The maximum number of run-time checks that can be performed when
12282 doing loop versioning for alignment in the vectorizer.
12284 @item vect-max-version-for-alias-checks
12285 The maximum number of run-time checks that can be performed when
12286 doing loop versioning for alias in the vectorizer.
12288 @item vect-max-peeling-for-alignment
12289 The maximum number of loop peels to enhance access alignment
12290 for vectorizer. Value -1 means no limit.
12292 @item max-iterations-to-track
12293 The maximum number of iterations of a loop the brute-force algorithm
12294 for analysis of the number of iterations of the loop tries to evaluate.
12296 @item hot-bb-count-fraction
12297 The denominator n of fraction 1/n of the maximal execution count of a
12298 basic block in the entire program that a basic block needs to at least
12299 have in order to be considered hot.  The default is 10000, which means
12300 that a basic block is considered hot if its execution count is greater
12301 than 1/10000 of the maximal execution count.  0 means that it is never
12302 considered hot.  Used in non-LTO mode.
12304 @item hot-bb-count-ws-permille
12305 The number of most executed permilles, ranging from 0 to 1000, of the
12306 profiled execution of the entire program to which the execution count
12307 of a basic block must be part of in order to be considered hot.  The
12308 default is 990, which means that a basic block is considered hot if
12309 its execution count contributes to the upper 990 permilles, or 99.0%,
12310 of the profiled execution of the entire program.  0 means that it is
12311 never considered hot.  Used in LTO mode.
12313 @item hot-bb-frequency-fraction
12314 The denominator n of fraction 1/n of the execution frequency of the
12315 entry block of a function that a basic block of this function needs
12316 to at least have in order to be considered hot.  The default is 1000,
12317 which means that a basic block is considered hot in a function if it
12318 is executed more frequently than 1/1000 of the frequency of the entry
12319 block of the function.  0 means that it is never considered hot.
12321 @item unlikely-bb-count-fraction
12322 The denominator n of fraction 1/n of the number of profiled runs of
12323 the entire program below which the execution count of a basic block
12324 must be in order for the basic block to be considered unlikely executed.
12325 The default is 20, which means that a basic block is considered unlikely
12326 executed if it is executed in fewer than 1/20, or 5%, of the runs of
12327 the program.  0 means that it is always considered unlikely executed.
12329 @item max-predicted-iterations
12330 The maximum number of loop iterations we predict statically.  This is useful
12331 in cases where a function contains a single loop with known bound and
12332 another loop with unknown bound.
12333 The known number of iterations is predicted correctly, while
12334 the unknown number of iterations average to roughly 10.  This means that the
12335 loop without bounds appears artificially cold relative to the other one.
12337 @item builtin-expect-probability
12338 Control the probability of the expression having the specified value. This
12339 parameter takes a percentage (i.e.@: 0 ... 100) as input.
12341 @item builtin-string-cmp-inline-length
12342 The maximum length of a constant string for a builtin string cmp call 
12343 eligible for inlining.
12345 @item align-threshold
12347 Select fraction of the maximal frequency of executions of a basic block in
12348 a function to align the basic block.
12350 @item align-loop-iterations
12352 A loop expected to iterate at least the selected number of iterations is
12353 aligned.
12355 @item tracer-dynamic-coverage
12356 @itemx tracer-dynamic-coverage-feedback
12358 This value is used to limit superblock formation once the given percentage of
12359 executed instructions is covered.  This limits unnecessary code size
12360 expansion.
12362 The @option{tracer-dynamic-coverage-feedback} parameter
12363 is used only when profile
12364 feedback is available.  The real profiles (as opposed to statically estimated
12365 ones) are much less balanced allowing the threshold to be larger value.
12367 @item tracer-max-code-growth
12368 Stop tail duplication once code growth has reached given percentage.  This is
12369 a rather artificial limit, as most of the duplicates are eliminated later in
12370 cross jumping, so it may be set to much higher values than is the desired code
12371 growth.
12373 @item tracer-min-branch-ratio
12375 Stop reverse growth when the reverse probability of best edge is less than this
12376 threshold (in percent).
12378 @item tracer-min-branch-probability
12379 @itemx tracer-min-branch-probability-feedback
12381 Stop forward growth if the best edge has probability lower than this
12382 threshold.
12384 Similarly to @option{tracer-dynamic-coverage} two parameters are
12385 provided.  @option{tracer-min-branch-probability-feedback} is used for
12386 compilation with profile feedback and @option{tracer-min-branch-probability}
12387 compilation without.  The value for compilation with profile feedback
12388 needs to be more conservative (higher) in order to make tracer
12389 effective.
12391 @item stack-clash-protection-guard-size
12392 Specify the size of the operating system provided stack guard as
12393 2 raised to @var{num} bytes.  Higher values may reduce the
12394 number of explicit probes, but a value larger than the operating system
12395 provided guard will leave code vulnerable to stack clash style attacks.
12397 @item stack-clash-protection-probe-interval
12398 Stack clash protection involves probing stack space as it is allocated.  This
12399 param controls the maximum distance between probes into the stack as 2 raised
12400 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
12401 larger than the operating system provided guard will leave code vulnerable to
12402 stack clash style attacks.
12404 @item max-cse-path-length
12406 The maximum number of basic blocks on path that CSE considers.
12408 @item max-cse-insns
12409 The maximum number of instructions CSE processes before flushing.
12411 @item ggc-min-expand
12413 GCC uses a garbage collector to manage its own memory allocation.  This
12414 parameter specifies the minimum percentage by which the garbage
12415 collector's heap should be allowed to expand between collections.
12416 Tuning this may improve compilation speed; it has no effect on code
12417 generation.
12419 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12420 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
12421 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
12422 GCC is not able to calculate RAM on a particular platform, the lower
12423 bound of 30% is used.  Setting this parameter and
12424 @option{ggc-min-heapsize} to zero causes a full collection to occur at
12425 every opportunity.  This is extremely slow, but can be useful for
12426 debugging.
12428 @item ggc-min-heapsize
12430 Minimum size of the garbage collector's heap before it begins bothering
12431 to collect garbage.  The first collection occurs after the heap expands
12432 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
12433 tuning this may improve compilation speed, and has no effect on code
12434 generation.
12436 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12437 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12438 with a lower bound of 4096 (four megabytes) and an upper bound of
12439 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
12440 particular platform, the lower bound is used.  Setting this parameter
12441 very large effectively disables garbage collection.  Setting this
12442 parameter and @option{ggc-min-expand} to zero causes a full collection
12443 to occur at every opportunity.
12445 @item max-reload-search-insns
12446 The maximum number of instruction reload should look backward for equivalent
12447 register.  Increasing values mean more aggressive optimization, making the
12448 compilation time increase with probably slightly better performance.
12450 @item max-cselib-memory-locations
12451 The maximum number of memory locations cselib should take into account.
12452 Increasing values mean more aggressive optimization, making the compilation time
12453 increase with probably slightly better performance.
12455 @item max-sched-ready-insns
12456 The maximum number of instructions ready to be issued the scheduler should
12457 consider at any given time during the first scheduling pass.  Increasing
12458 values mean more thorough searches, making the compilation time increase
12459 with probably little benefit.
12461 @item max-sched-region-blocks
12462 The maximum number of blocks in a region to be considered for
12463 interblock scheduling.
12465 @item max-pipeline-region-blocks
12466 The maximum number of blocks in a region to be considered for
12467 pipelining in the selective scheduler.
12469 @item max-sched-region-insns
12470 The maximum number of insns in a region to be considered for
12471 interblock scheduling.
12473 @item max-pipeline-region-insns
12474 The maximum number of insns in a region to be considered for
12475 pipelining in the selective scheduler.
12477 @item min-spec-prob
12478 The minimum probability (in percents) of reaching a source block
12479 for interblock speculative scheduling.
12481 @item max-sched-extend-regions-iters
12482 The maximum number of iterations through CFG to extend regions.
12483 A value of 0 disables region extensions.
12485 @item max-sched-insn-conflict-delay
12486 The maximum conflict delay for an insn to be considered for speculative motion.
12488 @item sched-spec-prob-cutoff
12489 The minimal probability of speculation success (in percents), so that
12490 speculative insns are scheduled.
12492 @item sched-state-edge-prob-cutoff
12493 The minimum probability an edge must have for the scheduler to save its
12494 state across it.
12496 @item sched-mem-true-dep-cost
12497 Minimal distance (in CPU cycles) between store and load targeting same
12498 memory locations.
12500 @item selsched-max-lookahead
12501 The maximum size of the lookahead window of selective scheduling.  It is a
12502 depth of search for available instructions.
12504 @item selsched-max-sched-times
12505 The maximum number of times that an instruction is scheduled during
12506 selective scheduling.  This is the limit on the number of iterations
12507 through which the instruction may be pipelined.
12509 @item selsched-insns-to-rename
12510 The maximum number of best instructions in the ready list that are considered
12511 for renaming in the selective scheduler.
12513 @item sms-min-sc
12514 The minimum value of stage count that swing modulo scheduler
12515 generates.
12517 @item max-last-value-rtl
12518 The maximum size measured as number of RTLs that can be recorded in an expression
12519 in combiner for a pseudo register as last known value of that register.
12521 @item max-combine-insns
12522 The maximum number of instructions the RTL combiner tries to combine.
12524 @item integer-share-limit
12525 Small integer constants can use a shared data structure, reducing the
12526 compiler's memory usage and increasing its speed.  This sets the maximum
12527 value of a shared integer constant.
12529 @item ssp-buffer-size
12530 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12531 protection when @option{-fstack-protection} is used.
12533 @item min-size-for-stack-sharing
12534 The minimum size of variables taking part in stack slot sharing when not
12535 optimizing.
12537 @item max-jump-thread-duplication-stmts
12538 Maximum number of statements allowed in a block that needs to be
12539 duplicated when threading jumps.
12541 @item max-fields-for-field-sensitive
12542 Maximum number of fields in a structure treated in
12543 a field sensitive manner during pointer analysis.
12545 @item prefetch-latency
12546 Estimate on average number of instructions that are executed before
12547 prefetch finishes.  The distance prefetched ahead is proportional
12548 to this constant.  Increasing this number may also lead to less
12549 streams being prefetched (see @option{simultaneous-prefetches}).
12551 @item simultaneous-prefetches
12552 Maximum number of prefetches that can run at the same time.
12554 @item l1-cache-line-size
12555 The size of cache line in L1 data cache, in bytes.
12557 @item l1-cache-size
12558 The size of L1 data cache, in kilobytes.
12560 @item l2-cache-size
12561 The size of L2 data cache, in kilobytes.
12563 @item prefetch-dynamic-strides
12564 Whether the loop array prefetch pass should issue software prefetch hints
12565 for strides that are non-constant.  In some cases this may be
12566 beneficial, though the fact the stride is non-constant may make it
12567 hard to predict when there is clear benefit to issuing these hints.
12569 Set to 1 if the prefetch hints should be issued for non-constant
12570 strides.  Set to 0 if prefetch hints should be issued only for strides that
12571 are known to be constant and below @option{prefetch-minimum-stride}.
12573 @item prefetch-minimum-stride
12574 Minimum constant stride, in bytes, to start using prefetch hints for.  If
12575 the stride is less than this threshold, prefetch hints will not be issued.
12577 This setting is useful for processors that have hardware prefetchers, in
12578 which case there may be conflicts between the hardware prefetchers and
12579 the software prefetchers.  If the hardware prefetchers have a maximum
12580 stride they can handle, it should be used here to improve the use of
12581 software prefetchers.
12583 A value of -1 means we don't have a threshold and therefore
12584 prefetch hints can be issued for any constant stride.
12586 This setting is only useful for strides that are known and constant.
12588 @item loop-interchange-max-num-stmts
12589 The maximum number of stmts in a loop to be interchanged.
12591 @item loop-interchange-stride-ratio
12592 The minimum ratio between stride of two loops for interchange to be profitable.
12594 @item min-insn-to-prefetch-ratio
12595 The minimum ratio between the number of instructions and the
12596 number of prefetches to enable prefetching in a loop.
12598 @item prefetch-min-insn-to-mem-ratio
12599 The minimum ratio between the number of instructions and the
12600 number of memory references to enable prefetching in a loop.
12602 @item use-canonical-types
12603 Whether the compiler should use the ``canonical'' type system.
12604 Should always be 1, which uses a more efficient internal
12605 mechanism for comparing types in C++ and Objective-C++.  However, if
12606 bugs in the canonical type system are causing compilation failures,
12607 set this value to 0 to disable canonical types.
12609 @item switch-conversion-max-branch-ratio
12610 Switch initialization conversion refuses to create arrays that are
12611 bigger than @option{switch-conversion-max-branch-ratio} times the number of
12612 branches in the switch.
12614 @item max-partial-antic-length
12615 Maximum length of the partial antic set computed during the tree
12616 partial redundancy elimination optimization (@option{-ftree-pre}) when
12617 optimizing at @option{-O3} and above.  For some sorts of source code
12618 the enhanced partial redundancy elimination optimization can run away,
12619 consuming all of the memory available on the host machine.  This
12620 parameter sets a limit on the length of the sets that are computed,
12621 which prevents the runaway behavior.  Setting a value of 0 for
12622 this parameter allows an unlimited set length.
12624 @item rpo-vn-max-loop-depth
12625 Maximum loop depth that is value-numbered optimistically.
12626 When the limit hits the innermost
12627 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
12628 loop nest are value-numbered optimistically and the remaining ones not.
12630 @item sccvn-max-alias-queries-per-access
12631 Maximum number of alias-oracle queries we perform when looking for
12632 redundancies for loads and stores.  If this limit is hit the search
12633 is aborted and the load or store is not considered redundant.  The
12634 number of queries is algorithmically limited to the number of
12635 stores on all paths from the load to the function entry.
12637 @item ira-max-loops-num
12638 IRA uses regional register allocation by default.  If a function
12639 contains more loops than the number given by this parameter, only at most
12640 the given number of the most frequently-executed loops form regions
12641 for regional register allocation.
12643 @item ira-max-conflict-table-size 
12644 Although IRA uses a sophisticated algorithm to compress the conflict
12645 table, the table can still require excessive amounts of memory for
12646 huge functions.  If the conflict table for a function could be more
12647 than the size in MB given by this parameter, the register allocator
12648 instead uses a faster, simpler, and lower-quality
12649 algorithm that does not require building a pseudo-register conflict table.  
12651 @item ira-loop-reserved-regs
12652 IRA can be used to evaluate more accurate register pressure in loops
12653 for decisions to move loop invariants (see @option{-O3}).  The number
12654 of available registers reserved for some other purposes is given
12655 by this parameter.  Default of the parameter
12656 is the best found from numerous experiments.
12658 @item lra-inheritance-ebb-probability-cutoff
12659 LRA tries to reuse values reloaded in registers in subsequent insns.
12660 This optimization is called inheritance.  EBB is used as a region to
12661 do this optimization.  The parameter defines a minimal fall-through
12662 edge probability in percentage used to add BB to inheritance EBB in
12663 LRA.  The default value was chosen
12664 from numerous runs of SPEC2000 on x86-64.
12666 @item loop-invariant-max-bbs-in-loop
12667 Loop invariant motion can be very expensive, both in compilation time and
12668 in amount of needed compile-time memory, with very large loops.  Loops
12669 with more basic blocks than this parameter won't have loop invariant
12670 motion optimization performed on them.
12672 @item loop-max-datarefs-for-datadeps
12673 Building data dependencies is expensive for very large loops.  This
12674 parameter limits the number of data references in loops that are
12675 considered for data dependence analysis.  These large loops are no
12676 handled by the optimizations using loop data dependencies.
12678 @item max-vartrack-size
12679 Sets a maximum number of hash table slots to use during variable
12680 tracking dataflow analysis of any function.  If this limit is exceeded
12681 with variable tracking at assignments enabled, analysis for that
12682 function is retried without it, after removing all debug insns from
12683 the function.  If the limit is exceeded even without debug insns, var
12684 tracking analysis is completely disabled for the function.  Setting
12685 the parameter to zero makes it unlimited.
12687 @item max-vartrack-expr-depth
12688 Sets a maximum number of recursion levels when attempting to map
12689 variable names or debug temporaries to value expressions.  This trades
12690 compilation time for more complete debug information.  If this is set too
12691 low, value expressions that are available and could be represented in
12692 debug information may end up not being used; setting this higher may
12693 enable the compiler to find more complex debug expressions, but compile
12694 time and memory use may grow.
12696 @item max-debug-marker-count
12697 Sets a threshold on the number of debug markers (e.g.@: begin stmt
12698 markers) to avoid complexity explosion at inlining or expanding to RTL.
12699 If a function has more such gimple stmts than the set limit, such stmts
12700 will be dropped from the inlined copy of a function, and from its RTL
12701 expansion.
12703 @item min-nondebug-insn-uid
12704 Use uids starting at this parameter for nondebug insns.  The range below
12705 the parameter is reserved exclusively for debug insns created by
12706 @option{-fvar-tracking-assignments}, but debug insns may get
12707 (non-overlapping) uids above it if the reserved range is exhausted.
12709 @item ipa-sra-ptr-growth-factor
12710 IPA-SRA replaces a pointer to an aggregate with one or more new
12711 parameters only when their cumulative size is less or equal to
12712 @option{ipa-sra-ptr-growth-factor} times the size of the original
12713 pointer parameter.
12715 @item ipa-sra-max-replacements
12716 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
12717 consequence, it is also the maximum number of replacements of a formal
12718 parameter.
12720 @item sra-max-scalarization-size-Ospeed
12721 @itemx sra-max-scalarization-size-Osize
12722 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12723 replace scalar parts of aggregates with uses of independent scalar
12724 variables.  These parameters control the maximum size, in storage units,
12725 of aggregate which is considered for replacement when compiling for
12726 speed
12727 (@option{sra-max-scalarization-size-Ospeed}) or size
12728 (@option{sra-max-scalarization-size-Osize}) respectively.
12730 @item tm-max-aggregate-size
12731 When making copies of thread-local variables in a transaction, this
12732 parameter specifies the size in bytes after which variables are
12733 saved with the logging functions as opposed to save/restore code
12734 sequence pairs.  This option only applies when using
12735 @option{-fgnu-tm}.
12737 @item graphite-max-nb-scop-params
12738 To avoid exponential effects in the Graphite loop transforms, the
12739 number of parameters in a Static Control Part (SCoP) is bounded.
12740 A value of zero can be used to lift
12741 the bound.  A variable whose value is unknown at compilation time and
12742 defined outside a SCoP is a parameter of the SCoP.
12744 @item loop-block-tile-size
12745 Loop blocking or strip mining transforms, enabled with
12746 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12747 loop in the loop nest by a given number of iterations.  The strip
12748 length can be changed using the @option{loop-block-tile-size}
12749 parameter.
12751 @item ipa-cp-value-list-size
12752 IPA-CP attempts to track all possible values and types passed to a function's
12753 parameter in order to propagate them and perform devirtualization.
12754 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12755 stores per one formal parameter of a function.
12757 @item ipa-cp-eval-threshold
12758 IPA-CP calculates its own score of cloning profitability heuristics
12759 and performs those cloning opportunities with scores that exceed
12760 @option{ipa-cp-eval-threshold}.
12762 @item ipa-cp-max-recursive-depth
12763 Maximum depth of recursive cloning for self-recursive function.
12765 @item ipa-cp-min-recursive-probability
12766 Recursive cloning only when the probability of call being executed exceeds
12767 the parameter.
12769 @item ipa-cp-recursion-penalty
12770 Percentage penalty the recursive functions will receive when they
12771 are evaluated for cloning.
12773 @item ipa-cp-single-call-penalty
12774 Percentage penalty functions containing a single call to another
12775 function will receive when they are evaluated for cloning.
12777 @item ipa-max-agg-items
12778 IPA-CP is also capable to propagate a number of scalar values passed
12779 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12780 number of such values per one parameter.
12782 @item ipa-cp-loop-hint-bonus
12783 When IPA-CP determines that a cloning candidate would make the number
12784 of iterations of a loop known, it adds a bonus of
12785 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12786 the candidate.
12788 @item ipa-max-aa-steps
12789 During its analysis of function bodies, IPA-CP employs alias analysis
12790 in order to track values pointed to by function parameters.  In order
12791 not spend too much time analyzing huge functions, it gives up and
12792 consider all memory clobbered after examining
12793 @option{ipa-max-aa-steps} statements modifying memory.
12795 @item ipa-max-switch-predicate-bounds
12796 Maximal number of boundary endpoints of case ranges of switch statement.
12797 For switch exceeding this limit, IPA-CP will not construct cloning cost
12798 predicate, which is used to estimate cloning benefit, for default case
12799 of the switch statement.
12801 @item ipa-max-param-expr-ops
12802 IPA-CP will analyze conditional statement that references some function
12803 parameter to estimate benefit for cloning upon certain constant value.
12804 But if number of operations in a parameter expression exceeds
12805 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12806 one, and is not handled by IPA analysis.
12808 @item lto-partitions
12809 Specify desired number of partitions produced during WHOPR compilation.
12810 The number of partitions should exceed the number of CPUs used for compilation.
12812 @item lto-min-partition
12813 Size of minimal partition for WHOPR (in estimated instructions).
12814 This prevents expenses of splitting very small programs into too many
12815 partitions.
12817 @item lto-max-partition
12818 Size of max partition for WHOPR (in estimated instructions).
12819 to provide an upper bound for individual size of partition.
12820 Meant to be used only with balanced partitioning.
12822 @item lto-max-streaming-parallelism
12823 Maximal number of parallel processes used for LTO streaming.
12825 @item cxx-max-namespaces-for-diagnostic-help
12826 The maximum number of namespaces to consult for suggestions when C++
12827 name lookup fails for an identifier.
12829 @item sink-frequency-threshold
12830 The maximum relative execution frequency (in percents) of the target block
12831 relative to a statement's original block to allow statement sinking of a
12832 statement.  Larger numbers result in more aggressive statement sinking.
12833 A small positive adjustment is applied for
12834 statements with memory operands as those are even more profitable so sink.
12836 @item max-stores-to-sink
12837 The maximum number of conditional store pairs that can be sunk.  Set to 0
12838 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12839 (@option{-ftree-loop-if-convert}) is disabled.
12841 @item case-values-threshold
12842 The smallest number of different values for which it is best to use a
12843 jump-table instead of a tree of conditional branches.  If the value is
12844 0, use the default for the machine.
12846 @item jump-table-max-growth-ratio-for-size
12847 The maximum code size growth ratio when expanding
12848 into a jump table (in percent).  The parameter is used when
12849 optimizing for size.
12851 @item jump-table-max-growth-ratio-for-speed
12852 The maximum code size growth ratio when expanding
12853 into a jump table (in percent).  The parameter is used when
12854 optimizing for speed.
12856 @item tree-reassoc-width
12857 Set the maximum number of instructions executed in parallel in
12858 reassociated tree. This parameter overrides target dependent
12859 heuristics used by default if has non zero value.
12861 @item sched-pressure-algorithm
12862 Choose between the two available implementations of
12863 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
12864 and is the more likely to prevent instructions from being reordered.
12865 Algorithm 2 was designed to be a compromise between the relatively
12866 conservative approach taken by algorithm 1 and the rather aggressive
12867 approach taken by the default scheduler.  It relies more heavily on
12868 having a regular register file and accurate register pressure classes.
12869 See @file{haifa-sched.c} in the GCC sources for more details.
12871 The default choice depends on the target.
12873 @item max-slsr-cand-scan
12874 Set the maximum number of existing candidates that are considered when
12875 seeking a basis for a new straight-line strength reduction candidate.
12877 @item asan-globals
12878 Enable buffer overflow detection for global objects.  This kind
12879 of protection is enabled by default if you are using
12880 @option{-fsanitize=address} option.
12881 To disable global objects protection use @option{--param asan-globals=0}.
12883 @item asan-stack
12884 Enable buffer overflow detection for stack objects.  This kind of
12885 protection is enabled by default when using @option{-fsanitize=address}.
12886 To disable stack protection use @option{--param asan-stack=0} option.
12888 @item asan-instrument-reads
12889 Enable buffer overflow detection for memory reads.  This kind of
12890 protection is enabled by default when using @option{-fsanitize=address}.
12891 To disable memory reads protection use
12892 @option{--param asan-instrument-reads=0}.
12894 @item asan-instrument-writes
12895 Enable buffer overflow detection for memory writes.  This kind of
12896 protection is enabled by default when using @option{-fsanitize=address}.
12897 To disable memory writes protection use
12898 @option{--param asan-instrument-writes=0} option.
12900 @item asan-memintrin
12901 Enable detection for built-in functions.  This kind of protection
12902 is enabled by default when using @option{-fsanitize=address}.
12903 To disable built-in functions protection use
12904 @option{--param asan-memintrin=0}.
12906 @item asan-use-after-return
12907 Enable detection of use-after-return.  This kind of protection
12908 is enabled by default when using the @option{-fsanitize=address} option.
12909 To disable it use @option{--param asan-use-after-return=0}.
12911 Note: By default the check is disabled at run time.  To enable it,
12912 add @code{detect_stack_use_after_return=1} to the environment variable
12913 @env{ASAN_OPTIONS}.
12915 @item asan-instrumentation-with-call-threshold
12916 If number of memory accesses in function being instrumented
12917 is greater or equal to this number, use callbacks instead of inline checks.
12918 E.g. to disable inline code use
12919 @option{--param asan-instrumentation-with-call-threshold=0}.
12921 @item use-after-scope-direct-emission-threshold
12922 If the size of a local variable in bytes is smaller or equal to this
12923 number, directly poison (or unpoison) shadow memory instead of using
12924 run-time callbacks.
12926 @item max-fsm-thread-path-insns
12927 Maximum number of instructions to copy when duplicating blocks on a
12928 finite state automaton jump thread path.
12930 @item max-fsm-thread-length
12931 Maximum number of basic blocks on a finite state automaton jump thread
12932 path.
12934 @item max-fsm-thread-paths
12935 Maximum number of new jump thread paths to create for a finite state
12936 automaton.
12938 @item parloops-chunk-size
12939 Chunk size of omp schedule for loops parallelized by parloops.
12941 @item parloops-schedule
12942 Schedule type of omp schedule for loops parallelized by parloops (static,
12943 dynamic, guided, auto, runtime).
12945 @item parloops-min-per-thread
12946 The minimum number of iterations per thread of an innermost parallelized
12947 loop for which the parallelized variant is preferred over the single threaded
12948 one.  Note that for a parallelized loop nest the
12949 minimum number of iterations of the outermost loop per thread is two.
12951 @item max-ssa-name-query-depth
12952 Maximum depth of recursion when querying properties of SSA names in things
12953 like fold routines.  One level of recursion corresponds to following a
12954 use-def chain.
12956 @item hsa-gen-debug-stores
12957 Enable emission of special debug stores within HSA kernels which are
12958 then read and reported by libgomp plugin.  Generation of these stores
12959 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12960 enable it.
12962 @item max-speculative-devirt-maydefs
12963 The maximum number of may-defs we analyze when looking for a must-def
12964 specifying the dynamic type of an object that invokes a virtual call
12965 we may be able to devirtualize speculatively.
12967 @item max-vrp-switch-assertions
12968 The maximum number of assertions to add along the default edge of a switch
12969 statement during VRP.
12971 @item unroll-jam-min-percent
12972 The minimum percentage of memory references that must be optimized
12973 away for the unroll-and-jam transformation to be considered profitable.
12975 @item unroll-jam-max-unroll
12976 The maximum number of times the outer loop should be unrolled by
12977 the unroll-and-jam transformation.
12979 @item max-rtl-if-conversion-unpredictable-cost
12980 Maximum permissible cost for the sequence that would be generated
12981 by the RTL if-conversion pass for a branch that is considered unpredictable.
12983 @item max-variable-expansions-in-unroller
12984 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12985 of times that an individual variable will be expanded during loop unrolling.
12987 @item tracer-min-branch-probability-feedback
12988 Stop forward growth if the probability of best edge is less than
12989 this threshold (in percent). Used when profile feedback is available.
12991 @item partial-inlining-entry-probability
12992 Maximum probability of the entry BB of split region
12993 (in percent relative to entry BB of the function)
12994 to make partial inlining happen.
12996 @item max-tracked-strlens
12997 Maximum number of strings for which strlen optimization pass will
12998 track string lengths.
13000 @item gcse-after-reload-partial-fraction
13001 The threshold ratio for performing partial redundancy
13002 elimination after reload.
13004 @item gcse-after-reload-critical-fraction
13005 The threshold ratio of critical edges execution count that
13006 permit performing redundancy elimination after reload.
13008 @item max-loop-header-insns
13009 The maximum number of insns in loop header duplicated
13010 by the copy loop headers pass.
13012 @item vect-epilogues-nomask
13013 Enable loop epilogue vectorization using smaller vector size.
13015 @item slp-max-insns-in-bb
13016 Maximum number of instructions in basic block to be
13017 considered for SLP vectorization.
13019 @item avoid-fma-max-bits
13020 Maximum number of bits for which we avoid creating FMAs.
13022 @item sms-loop-average-count-threshold
13023 A threshold on the average loop count considered by the swing modulo scheduler.
13025 @item sms-dfa-history
13026 The number of cycles the swing modulo scheduler considers when checking
13027 conflicts using DFA.
13029 @item max-inline-insns-recursive-auto
13030 The maximum number of instructions non-inline function
13031 can grow to via recursive inlining.
13033 @item graphite-allow-codegen-errors
13034 Whether codegen errors should be ICEs when @option{-fchecking}.
13036 @item sms-max-ii-factor
13037 A factor for tuning the upper bound that swing modulo scheduler
13038 uses for scheduling a loop.
13040 @item lra-max-considered-reload-pseudos
13041 The max number of reload pseudos which are considered during
13042 spilling a non-reload pseudo.
13044 @item max-pow-sqrt-depth
13045 Maximum depth of sqrt chains to use when synthesizing exponentiation
13046 by a real constant.
13048 @item max-dse-active-local-stores
13049 Maximum number of active local stores in RTL dead store elimination.
13051 @item asan-instrument-allocas
13052 Enable asan allocas/VLAs protection.
13054 @item max-iterations-computation-cost
13055 Bound on the cost of an expression to compute the number of iterations.
13057 @item max-isl-operations
13058 Maximum number of isl operations, 0 means unlimited.
13060 @item graphite-max-arrays-per-scop
13061 Maximum number of arrays per scop.
13063 @item max-vartrack-reverse-op-size
13064 Max. size of loc list for which reverse ops should be added.
13066 @item tracer-dynamic-coverage-feedback
13067 The percentage of function, weighted by execution frequency,
13068 that must be covered by trace formation.
13069 Used when profile feedback is available.
13071 @item max-inline-recursive-depth-auto
13072 The maximum depth of recursive inlining for non-inline functions.
13074 @item fsm-scale-path-stmts
13075 Scale factor to apply to the number of statements in a threading path
13076 when comparing to the number of (scaled) blocks.
13078 @item fsm-maximum-phi-arguments
13079 Maximum number of arguments a PHI may have before the FSM threader
13080 will not try to thread through its block.
13082 @item uninit-control-dep-attempts
13083 Maximum number of nested calls to search for control dependencies
13084 during uninitialized variable analysis.
13086 @item max-once-peeled-insns
13087 The maximum number of insns of a peeled loop that rolls only once.
13089 @item sra-max-scalarization-size-Osize
13090 Maximum size, in storage units, of an aggregate
13091 which should be considered for scalarization when compiling for size.
13093 @item fsm-scale-path-blocks
13094 Scale factor to apply to the number of blocks in a threading path
13095 when comparing to the number of (scaled) statements.
13097 @item sched-autopref-queue-depth
13098 Hardware autoprefetcher scheduler model control flag.
13099 Number of lookahead cycles the model looks into; at '
13100 ' only enable instruction sorting heuristic.
13102 @item loop-versioning-max-inner-insns
13103 The maximum number of instructions that an inner loop can have
13104 before the loop versioning pass considers it too big to copy.
13106 @item loop-versioning-max-outer-insns
13107 The maximum number of instructions that an outer loop can have
13108 before the loop versioning pass considers it too big to copy,
13109 discounting any instructions in inner loops that directly benefit
13110 from versioning.
13112 @item ssa-name-def-chain-limit
13113 The maximum number of SSA_NAME assignments to follow in determining
13114 a property of a variable such as its value.  This limits the number
13115 of iterations or recursive calls GCC performs when optimizing certain
13116 statements or when determining their validity prior to issuing
13117 diagnostics.
13119 @end table
13121 The following choices of @var{name} are available on AArch64 targets:
13123 @table @gcctabopt
13124 @item aarch64-sve-compare-costs
13125 When vectorizing for SVE, consider using ``unpacked'' vectors for
13126 smaller elements and use the cost model to pick the cheapest approach.
13127 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13129 Using unpacked vectors includes storing smaller elements in larger
13130 containers and accessing elements with extending loads and truncating
13131 stores.
13132 @end table
13134 @end table
13136 @node Instrumentation Options
13137 @section Program Instrumentation Options
13138 @cindex instrumentation options
13139 @cindex program instrumentation options
13140 @cindex run-time error checking options
13141 @cindex profiling options
13142 @cindex options, program instrumentation
13143 @cindex options, run-time error checking
13144 @cindex options, profiling
13146 GCC supports a number of command-line options that control adding
13147 run-time instrumentation to the code it normally generates.  
13148 For example, one purpose of instrumentation is collect profiling
13149 statistics for use in finding program hot spots, code coverage
13150 analysis, or profile-guided optimizations.
13151 Another class of program instrumentation is adding run-time checking 
13152 to detect programming errors like invalid pointer
13153 dereferences or out-of-bounds array accesses, as well as deliberately
13154 hostile attacks such as stack smashing or C++ vtable hijacking.
13155 There is also a general hook which can be used to implement other
13156 forms of tracing or function-level instrumentation for debug or
13157 program analysis purposes.
13159 @table @gcctabopt
13160 @cindex @command{prof}
13161 @cindex @command{gprof}
13162 @item -p
13163 @itemx -pg
13164 @opindex p
13165 @opindex pg
13166 Generate extra code to write profile information suitable for the
13167 analysis program @command{prof} (for @option{-p}) or @command{gprof}
13168 (for @option{-pg}).  You must use this option when compiling
13169 the source files you want data about, and you must also use it when
13170 linking.
13172 You can use the function attribute @code{no_instrument_function} to
13173 suppress profiling of individual functions when compiling with these options.
13174 @xref{Common Function Attributes}.
13176 @item -fprofile-arcs
13177 @opindex fprofile-arcs
13178 Add code so that program flow @dfn{arcs} are instrumented.  During
13179 execution the program records how many times each branch and call is
13180 executed and how many times it is taken or returns.  On targets that support
13181 constructors with priority support, profiling properly handles constructors,
13182 destructors and C++ constructors (and destructors) of classes which are used
13183 as a type of a global variable.
13185 When the compiled
13186 program exits it saves this data to a file called
13187 @file{@var{auxname}.gcda} for each source file.  The data may be used for
13188 profile-directed optimizations (@option{-fbranch-probabilities}), or for
13189 test coverage analysis (@option{-ftest-coverage}).  Each object file's
13190 @var{auxname} is generated from the name of the output file, if
13191 explicitly specified and it is not the final executable, otherwise it is
13192 the basename of the source file.  In both cases any suffix is removed
13193 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13194 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13195 @xref{Cross-profiling}.
13197 @cindex @command{gcov}
13198 @item --coverage
13199 @opindex coverage
13201 This option is used to compile and link code instrumented for coverage
13202 analysis.  The option is a synonym for @option{-fprofile-arcs}
13203 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13204 linking).  See the documentation for those options for more details.
13206 @itemize
13208 @item
13209 Compile the source files with @option{-fprofile-arcs} plus optimization
13210 and code generation options.  For test coverage analysis, use the
13211 additional @option{-ftest-coverage} option.  You do not need to profile
13212 every source file in a program.
13214 @item
13215 Compile the source files additionally with @option{-fprofile-abs-path}
13216 to create absolute path names in the @file{.gcno} files.  This allows
13217 @command{gcov} to find the correct sources in projects where compilations
13218 occur with different working directories.
13220 @item
13221 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13222 (the latter implies the former).
13224 @item
13225 Run the program on a representative workload to generate the arc profile
13226 information.  This may be repeated any number of times.  You can run
13227 concurrent instances of your program, and provided that the file system
13228 supports locking, the data files will be correctly updated.  Unless
13229 a strict ISO C dialect option is in effect, @code{fork} calls are
13230 detected and correctly handled without double counting.
13232 @item
13233 For profile-directed optimizations, compile the source files again with
13234 the same optimization and code generation options plus
13235 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13236 Control Optimization}).
13238 @item
13239 For test coverage analysis, use @command{gcov} to produce human readable
13240 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
13241 @command{gcov} documentation for further information.
13243 @end itemize
13245 With @option{-fprofile-arcs}, for each function of your program GCC
13246 creates a program flow graph, then finds a spanning tree for the graph.
13247 Only arcs that are not on the spanning tree have to be instrumented: the
13248 compiler adds code to count the number of times that these arcs are
13249 executed.  When an arc is the only exit or only entrance to a block, the
13250 instrumentation code can be added to the block; otherwise, a new basic
13251 block must be created to hold the instrumentation code.
13253 @need 2000
13254 @item -ftest-coverage
13255 @opindex ftest-coverage
13256 Produce a notes file that the @command{gcov} code-coverage utility
13257 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13258 show program coverage.  Each source file's note file is called
13259 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
13260 above for a description of @var{auxname} and instructions on how to
13261 generate test coverage data.  Coverage data matches the source files
13262 more closely if you do not optimize.
13264 @item -fprofile-abs-path
13265 @opindex fprofile-abs-path
13266 Automatically convert relative source file names to absolute path names
13267 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
13268 sources in projects where compilations occur with different working
13269 directories.
13271 @item -fprofile-dir=@var{path}
13272 @opindex fprofile-dir
13274 Set the directory to search for the profile data files in to @var{path}.
13275 This option affects only the profile data generated by
13276 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13277 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13278 and its related options.  Both absolute and relative paths can be used.
13279 By default, GCC uses the current directory as @var{path}, thus the
13280 profile data file appears in the same directory as the object file.
13281 In order to prevent the file name clashing, if the object file name is
13282 not an absolute path, we mangle the absolute path of the
13283 @file{@var{sourcename}.gcda} file and use it as the file name of a
13284 @file{.gcda} file.  See similar option @option{-fprofile-note}.
13286 When an executable is run in a massive parallel environment, it is recommended
13287 to save profile to different folders.  That can be done with variables
13288 in @var{path} that are exported during run-time:
13290 @table @gcctabopt
13292 @item %p
13293 process ID.
13295 @item %q@{VAR@}
13296 value of environment variable @var{VAR}
13298 @end table
13300 @item -fprofile-generate
13301 @itemx -fprofile-generate=@var{path}
13302 @opindex fprofile-generate
13304 Enable options usually used for instrumenting application to produce
13305 profile useful for later recompilation with profile feedback based
13306 optimization.  You must use @option{-fprofile-generate} both when
13307 compiling and when linking your program.
13309 The following options are enabled:
13310 @option{-fprofile-arcs}, @option{-fprofile-values},
13311 @option{-finline-functions}, and @option{-fipa-bit-cp}.
13313 If @var{path} is specified, GCC looks at the @var{path} to find
13314 the profile feedback data files. See @option{-fprofile-dir}.
13316 To optimize the program based on the collected profile information, use
13317 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
13319 @item -fprofile-note=@var{path}
13320 @opindex fprofile-note
13322 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13323 location.  If you combine the option with multiple source files,
13324 the @file{.gcno} file will be overwritten.
13326 @item -fprofile-update=@var{method}
13327 @opindex fprofile-update
13329 Alter the update method for an application instrumented for profile
13330 feedback based optimization.  The @var{method} argument should be one of
13331 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13332 The first one is useful for single-threaded applications,
13333 while the second one prevents profile corruption by emitting thread-safe code.
13335 @strong{Warning:} When an application does not properly join all threads
13336 (or creates an detached thread), a profile file can be still corrupted.
13338 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13339 when supported by a target, or to @samp{single} otherwise.  The GCC driver
13340 automatically selects @samp{prefer-atomic} when @option{-pthread}
13341 is present in the command line.
13343 @item -fprofile-filter-files=@var{regex}
13344 @opindex fprofile-filter-files
13346 Instrument only functions from files where names match
13347 any regular expression (separated by a semi-colon).
13349 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13350 only @file{main.c} and all C files starting with 'module'.
13352 @item -fprofile-exclude-files=@var{regex}
13353 @opindex fprofile-exclude-files
13355 Instrument only functions from files where names do not match
13356 all the regular expressions (separated by a semi-colon).
13358 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13359 of all files that are located in @file{/usr/} folder.
13361 @item -fsanitize=address
13362 @opindex fsanitize=address
13363 Enable AddressSanitizer, a fast memory error detector.
13364 Memory access instructions are instrumented to detect
13365 out-of-bounds and use-after-free bugs.
13366 The option enables @option{-fsanitize-address-use-after-scope}.
13367 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13368 more details.  The run-time behavior can be influenced using the
13369 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
13370 the available options are shown at startup of the instrumented program.  See
13371 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13372 for a list of supported options.
13373 The option cannot be combined with @option{-fsanitize=thread}.
13375 @item -fsanitize=kernel-address
13376 @opindex fsanitize=kernel-address
13377 Enable AddressSanitizer for Linux kernel.
13378 See @uref{https://github.com/google/kasan/wiki} for more details.
13380 @item -fsanitize=pointer-compare
13381 @opindex fsanitize=pointer-compare
13382 Instrument comparison operation (<, <=, >, >=) with pointer operands.
13383 The option must be combined with either @option{-fsanitize=kernel-address} or
13384 @option{-fsanitize=address}
13385 The option cannot be combined with @option{-fsanitize=thread}.
13386 Note: By default the check is disabled at run time.  To enable it,
13387 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13388 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13389 invalid operation only when both pointers are non-null.
13391 @item -fsanitize=pointer-subtract
13392 @opindex fsanitize=pointer-subtract
13393 Instrument subtraction with pointer operands.
13394 The option must be combined with either @option{-fsanitize=kernel-address} or
13395 @option{-fsanitize=address}
13396 The option cannot be combined with @option{-fsanitize=thread}.
13397 Note: By default the check is disabled at run time.  To enable it,
13398 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13399 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13400 invalid operation only when both pointers are non-null.
13402 @item -fsanitize=thread
13403 @opindex fsanitize=thread
13404 Enable ThreadSanitizer, a fast data race detector.
13405 Memory access instructions are instrumented to detect
13406 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13407 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13408 environment variable; see
13409 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13410 supported options.
13411 The option cannot be combined with @option{-fsanitize=address},
13412 @option{-fsanitize=leak}.
13414 Note that sanitized atomic builtins cannot throw exceptions when
13415 operating on invalid memory addresses with non-call exceptions
13416 (@option{-fnon-call-exceptions}).
13418 @item -fsanitize=leak
13419 @opindex fsanitize=leak
13420 Enable LeakSanitizer, a memory leak detector.
13421 This option only matters for linking of executables and
13422 the executable is linked against a library that overrides @code{malloc}
13423 and other allocator functions.  See
13424 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13425 details.  The run-time behavior can be influenced using the
13426 @env{LSAN_OPTIONS} environment variable.
13427 The option cannot be combined with @option{-fsanitize=thread}.
13429 @item -fsanitize=undefined
13430 @opindex fsanitize=undefined
13431 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13432 Various computations are instrumented to detect undefined behavior
13433 at runtime.  Current suboptions are:
13435 @table @gcctabopt
13437 @item -fsanitize=shift
13438 @opindex fsanitize=shift
13439 This option enables checking that the result of a shift operation is
13440 not undefined.  Note that what exactly is considered undefined differs
13441 slightly between C and C++, as well as between ISO C90 and C99, etc.
13442 This option has two suboptions, @option{-fsanitize=shift-base} and
13443 @option{-fsanitize=shift-exponent}.
13445 @item -fsanitize=shift-exponent
13446 @opindex fsanitize=shift-exponent
13447 This option enables checking that the second argument of a shift operation
13448 is not negative and is smaller than the precision of the promoted first
13449 argument.
13451 @item -fsanitize=shift-base
13452 @opindex fsanitize=shift-base
13453 If the second argument of a shift operation is within range, check that the
13454 result of a shift operation is not undefined.  Note that what exactly is
13455 considered undefined differs slightly between C and C++, as well as between
13456 ISO C90 and C99, etc.
13458 @item -fsanitize=integer-divide-by-zero
13459 @opindex fsanitize=integer-divide-by-zero
13460 Detect integer division by zero as well as @code{INT_MIN / -1} division.
13462 @item -fsanitize=unreachable
13463 @opindex fsanitize=unreachable
13464 With this option, the compiler turns the @code{__builtin_unreachable}
13465 call into a diagnostics message call instead.  When reaching the
13466 @code{__builtin_unreachable} call, the behavior is undefined.
13468 @item -fsanitize=vla-bound
13469 @opindex fsanitize=vla-bound
13470 This option instructs the compiler to check that the size of a variable
13471 length array is positive.
13473 @item -fsanitize=null
13474 @opindex fsanitize=null
13475 This option enables pointer checking.  Particularly, the application
13476 built with this option turned on will issue an error message when it
13477 tries to dereference a NULL pointer, or if a reference (possibly an
13478 rvalue reference) is bound to a NULL pointer, or if a method is invoked
13479 on an object pointed by a NULL pointer.
13481 @item -fsanitize=return
13482 @opindex fsanitize=return
13483 This option enables return statement checking.  Programs
13484 built with this option turned on will issue an error message
13485 when the end of a non-void function is reached without actually
13486 returning a value.  This option works in C++ only.
13488 @item -fsanitize=signed-integer-overflow
13489 @opindex fsanitize=signed-integer-overflow
13490 This option enables signed integer overflow checking.  We check that
13491 the result of @code{+}, @code{*}, and both unary and binary @code{-}
13492 does not overflow in the signed arithmetics.  Note, integer promotion
13493 rules must be taken into account.  That is, the following is not an
13494 overflow:
13495 @smallexample
13496 signed char a = SCHAR_MAX;
13497 a++;
13498 @end smallexample
13500 @item -fsanitize=bounds
13501 @opindex fsanitize=bounds
13502 This option enables instrumentation of array bounds.  Various out of bounds
13503 accesses are detected.  Flexible array members, flexible array member-like
13504 arrays, and initializers of variables with static storage are not instrumented.
13506 @item -fsanitize=bounds-strict
13507 @opindex fsanitize=bounds-strict
13508 This option enables strict instrumentation of array bounds.  Most out of bounds
13509 accesses are detected, including flexible array members and flexible array
13510 member-like arrays.  Initializers of variables with static storage are not
13511 instrumented.
13513 @item -fsanitize=alignment
13514 @opindex fsanitize=alignment
13516 This option enables checking of alignment of pointers when they are
13517 dereferenced, or when a reference is bound to insufficiently aligned target,
13518 or when a method or constructor is invoked on insufficiently aligned object.
13520 @item -fsanitize=object-size
13521 @opindex fsanitize=object-size
13522 This option enables instrumentation of memory references using the
13523 @code{__builtin_object_size} function.  Various out of bounds pointer
13524 accesses are detected.
13526 @item -fsanitize=float-divide-by-zero
13527 @opindex fsanitize=float-divide-by-zero
13528 Detect floating-point division by zero.  Unlike other similar options,
13529 @option{-fsanitize=float-divide-by-zero} is not enabled by
13530 @option{-fsanitize=undefined}, since floating-point division by zero can
13531 be a legitimate way of obtaining infinities and NaNs.
13533 @item -fsanitize=float-cast-overflow
13534 @opindex fsanitize=float-cast-overflow
13535 This option enables floating-point type to integer conversion checking.
13536 We check that the result of the conversion does not overflow.
13537 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13538 not enabled by @option{-fsanitize=undefined}.
13539 This option does not work well with @code{FE_INVALID} exceptions enabled.
13541 @item -fsanitize=nonnull-attribute
13542 @opindex fsanitize=nonnull-attribute
13544 This option enables instrumentation of calls, checking whether null values
13545 are not passed to arguments marked as requiring a non-null value by the
13546 @code{nonnull} function attribute.
13548 @item -fsanitize=returns-nonnull-attribute
13549 @opindex fsanitize=returns-nonnull-attribute
13551 This option enables instrumentation of return statements in functions
13552 marked with @code{returns_nonnull} function attribute, to detect returning
13553 of null values from such functions.
13555 @item -fsanitize=bool
13556 @opindex fsanitize=bool
13558 This option enables instrumentation of loads from bool.  If a value other
13559 than 0/1 is loaded, a run-time error is issued.
13561 @item -fsanitize=enum
13562 @opindex fsanitize=enum
13564 This option enables instrumentation of loads from an enum type.  If
13565 a value outside the range of values for the enum type is loaded,
13566 a run-time error is issued.
13568 @item -fsanitize=vptr
13569 @opindex fsanitize=vptr
13571 This option enables instrumentation of C++ member function calls, member
13572 accesses and some conversions between pointers to base and derived classes,
13573 to verify the referenced object has the correct dynamic type.
13575 @item -fsanitize=pointer-overflow
13576 @opindex fsanitize=pointer-overflow
13578 This option enables instrumentation of pointer arithmetics.  If the pointer
13579 arithmetics overflows, a run-time error is issued.
13581 @item -fsanitize=builtin
13582 @opindex fsanitize=builtin
13584 This option enables instrumentation of arguments to selected builtin
13585 functions.  If an invalid value is passed to such arguments, a run-time
13586 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
13587 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
13588 by this option.
13590 @end table
13592 While @option{-ftrapv} causes traps for signed overflows to be emitted,
13593 @option{-fsanitize=undefined} gives a diagnostic message.
13594 This currently works only for the C family of languages.
13596 @item -fno-sanitize=all
13597 @opindex fno-sanitize=all
13599 This option disables all previously enabled sanitizers.
13600 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
13601 together.
13603 @item -fasan-shadow-offset=@var{number}
13604 @opindex fasan-shadow-offset
13605 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
13606 It is useful for experimenting with different shadow memory layouts in
13607 Kernel AddressSanitizer.
13609 @item -fsanitize-sections=@var{s1},@var{s2},...
13610 @opindex fsanitize-sections
13611 Sanitize global variables in selected user-defined sections.  @var{si} may
13612 contain wildcards.
13614 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
13615 @opindex fsanitize-recover
13616 @opindex fno-sanitize-recover
13617 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
13618 mentioned in comma-separated list of @var{opts}.  Enabling this option
13619 for a sanitizer component causes it to attempt to continue
13620 running the program as if no error happened.  This means multiple
13621 runtime errors can be reported in a single program run, and the exit
13622 code of the program may indicate success even when errors
13623 have been reported.  The @option{-fno-sanitize-recover=} option
13624 can be used to alter
13625 this behavior: only the first detected error is reported
13626 and program then exits with a non-zero exit code.
13628 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
13629 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
13630 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
13631 @option{-fsanitize=bounds-strict},
13632 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
13633 For these sanitizers error recovery is turned on by default,
13634 except @option{-fsanitize=address}, for which this feature is experimental.
13635 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
13636 accepted, the former enables recovery for all sanitizers that support it,
13637 the latter disables recovery for all sanitizers that support it.
13639 Even if a recovery mode is turned on the compiler side, it needs to be also
13640 enabled on the runtime library side, otherwise the failures are still fatal.
13641 The runtime library defaults to @code{halt_on_error=0} for
13642 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
13643 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
13644 setting the @code{halt_on_error} flag in the corresponding environment variable.
13646 Syntax without an explicit @var{opts} parameter is deprecated.  It is
13647 equivalent to specifying an @var{opts} list of:
13649 @smallexample
13650 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13651 @end smallexample
13653 @item -fsanitize-address-use-after-scope
13654 @opindex fsanitize-address-use-after-scope
13655 Enable sanitization of local variables to detect use-after-scope bugs.
13656 The option sets @option{-fstack-reuse} to @samp{none}.
13658 @item -fsanitize-undefined-trap-on-error
13659 @opindex fsanitize-undefined-trap-on-error
13660 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
13661 report undefined behavior using @code{__builtin_trap} rather than
13662 a @code{libubsan} library routine.  The advantage of this is that the
13663 @code{libubsan} library is not needed and is not linked in, so this
13664 is usable even in freestanding environments.
13666 @item -fsanitize-coverage=trace-pc
13667 @opindex fsanitize-coverage=trace-pc
13668 Enable coverage-guided fuzzing code instrumentation.
13669 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
13671 @item -fsanitize-coverage=trace-cmp
13672 @opindex fsanitize-coverage=trace-cmp
13673 Enable dataflow guided fuzzing code instrumentation.
13674 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
13675 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
13676 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
13677 variable or @code{__sanitizer_cov_trace_const_cmp1},
13678 @code{__sanitizer_cov_trace_const_cmp2},
13679 @code{__sanitizer_cov_trace_const_cmp4} or
13680 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
13681 operand constant, @code{__sanitizer_cov_trace_cmpf} or
13682 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
13683 @code{__sanitizer_cov_trace_switch} for switch statements.
13685 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
13686 @opindex fcf-protection
13687 Enable code instrumentation of control-flow transfers to increase
13688 program security by checking that target addresses of control-flow
13689 transfer instructions (such as indirect function call, function return,
13690 indirect jump) are valid.  This prevents diverting the flow of control
13691 to an unexpected target.  This is intended to protect against such
13692 threats as Return-oriented Programming (ROP), and similarly
13693 call/jmp-oriented programming (COP/JOP).
13695 The value @code{branch} tells the compiler to implement checking of
13696 validity of control-flow transfer at the point of indirect branch
13697 instructions, i.e.@: call/jmp instructions.  The value @code{return}
13698 implements checking of validity at the point of returning from a
13699 function.  The value @code{full} is an alias for specifying both
13700 @code{branch} and @code{return}. The value @code{none} turns off
13701 instrumentation.
13703 The macro @code{__CET__} is defined when @option{-fcf-protection} is
13704 used.  The first bit of @code{__CET__} is set to 1 for the value
13705 @code{branch} and the second bit of @code{__CET__} is set to 1 for
13706 the @code{return}.
13708 You can also use the @code{nocf_check} attribute to identify
13709 which functions and calls should be skipped from instrumentation
13710 (@pxref{Function Attributes}).
13712 Currently the x86 GNU/Linux target provides an implementation based
13713 on Intel Control-flow Enforcement Technology (CET).
13715 @item -fstack-protector
13716 @opindex fstack-protector
13717 Emit extra code to check for buffer overflows, such as stack smashing
13718 attacks.  This is done by adding a guard variable to functions with
13719 vulnerable objects.  This includes functions that call @code{alloca}, and
13720 functions with buffers larger than or equal to 8 bytes.  The guards are
13721 initialized when a function is entered and then checked when the function
13722 exits.  If a guard check fails, an error message is printed and the program
13723 exits.  Only variables that are actually allocated on the stack are
13724 considered, optimized away variables or variables allocated in registers
13725 don't count.
13727 @item -fstack-protector-all
13728 @opindex fstack-protector-all
13729 Like @option{-fstack-protector} except that all functions are protected.
13731 @item -fstack-protector-strong
13732 @opindex fstack-protector-strong
13733 Like @option{-fstack-protector} but includes additional functions to
13734 be protected --- those that have local array definitions, or have
13735 references to local frame addresses.  Only variables that are actually
13736 allocated on the stack are considered, optimized away variables or variables
13737 allocated in registers don't count.
13739 @item -fstack-protector-explicit
13740 @opindex fstack-protector-explicit
13741 Like @option{-fstack-protector} but only protects those functions which
13742 have the @code{stack_protect} attribute.
13744 @item -fstack-check
13745 @opindex fstack-check
13746 Generate code to verify that you do not go beyond the boundary of the
13747 stack.  You should specify this flag if you are running in an
13748 environment with multiple threads, but you only rarely need to specify it in
13749 a single-threaded environment since stack overflow is automatically
13750 detected on nearly all systems if there is only one stack.
13752 Note that this switch does not actually cause checking to be done; the
13753 operating system or the language runtime must do that.  The switch causes
13754 generation of code to ensure that they see the stack being extended.
13756 You can additionally specify a string parameter: @samp{no} means no
13757 checking, @samp{generic} means force the use of old-style checking,
13758 @samp{specific} means use the best checking method and is equivalent
13759 to bare @option{-fstack-check}.
13761 Old-style checking is a generic mechanism that requires no specific
13762 target support in the compiler but comes with the following drawbacks:
13764 @enumerate
13765 @item
13766 Modified allocation strategy for large objects: they are always
13767 allocated dynamically if their size exceeds a fixed threshold.  Note this
13768 may change the semantics of some code.
13770 @item
13771 Fixed limit on the size of the static frame of functions: when it is
13772 topped by a particular function, stack checking is not reliable and
13773 a warning is issued by the compiler.
13775 @item
13776 Inefficiency: because of both the modified allocation strategy and the
13777 generic implementation, code performance is hampered.
13778 @end enumerate
13780 Note that old-style stack checking is also the fallback method for
13781 @samp{specific} if no target support has been added in the compiler.
13783 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13784 and stack overflows.  @samp{specific} is an excellent choice when compiling
13785 Ada code.  It is not generally sufficient to protect against stack-clash
13786 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
13788 @item -fstack-clash-protection
13789 @opindex fstack-clash-protection
13790 Generate code to prevent stack clash style attacks.  When this option is
13791 enabled, the compiler will only allocate one page of stack space at a time
13792 and each page is accessed immediately after allocation.  Thus, it prevents
13793 allocations from jumping over any stack guard page provided by the
13794 operating system.
13796 Most targets do not fully support stack clash protection.  However, on
13797 those targets @option{-fstack-clash-protection} will protect dynamic stack
13798 allocations.  @option{-fstack-clash-protection} may also provide limited
13799 protection for static stack allocations if the target supports
13800 @option{-fstack-check=specific}.
13802 @item -fstack-limit-register=@var{reg}
13803 @itemx -fstack-limit-symbol=@var{sym}
13804 @itemx -fno-stack-limit
13805 @opindex fstack-limit-register
13806 @opindex fstack-limit-symbol
13807 @opindex fno-stack-limit
13808 Generate code to ensure that the stack does not grow beyond a certain value,
13809 either the value of a register or the address of a symbol.  If a larger
13810 stack is required, a signal is raised at run time.  For most targets,
13811 the signal is raised before the stack overruns the boundary, so
13812 it is possible to catch the signal without taking special precautions.
13814 For instance, if the stack starts at absolute address @samp{0x80000000}
13815 and grows downwards, you can use the flags
13816 @option{-fstack-limit-symbol=__stack_limit} and
13817 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13818 of 128KB@.  Note that this may only work with the GNU linker.
13820 You can locally override stack limit checking by using the
13821 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13823 @item -fsplit-stack
13824 @opindex fsplit-stack
13825 Generate code to automatically split the stack before it overflows.
13826 The resulting program has a discontiguous stack which can only
13827 overflow if the program is unable to allocate any more memory.  This
13828 is most useful when running threaded programs, as it is no longer
13829 necessary to calculate a good stack size to use for each thread.  This
13830 is currently only implemented for the x86 targets running
13831 GNU/Linux.
13833 When code compiled with @option{-fsplit-stack} calls code compiled
13834 without @option{-fsplit-stack}, there may not be much stack space
13835 available for the latter code to run.  If compiling all code,
13836 including library code, with @option{-fsplit-stack} is not an option,
13837 then the linker can fix up these calls so that the code compiled
13838 without @option{-fsplit-stack} always has a large stack.  Support for
13839 this is implemented in the gold linker in GNU binutils release 2.21
13840 and later.
13842 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13843 @opindex fvtable-verify
13844 This option is only available when compiling C++ code.
13845 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13846 feature that verifies at run time, for every virtual call, that
13847 the vtable pointer through which the call is made is valid for the type of
13848 the object, and has not been corrupted or overwritten.  If an invalid vtable
13849 pointer is detected at run time, an error is reported and execution of the
13850 program is immediately halted.
13852 This option causes run-time data structures to be built at program startup,
13853 which are used for verifying the vtable pointers.  
13854 The options @samp{std} and @samp{preinit}
13855 control the timing of when these data structures are built.  In both cases the
13856 data structures are built before execution reaches @code{main}.  Using
13857 @option{-fvtable-verify=std} causes the data structures to be built after
13858 shared libraries have been loaded and initialized.
13859 @option{-fvtable-verify=preinit} causes them to be built before shared
13860 libraries have been loaded and initialized.
13862 If this option appears multiple times in the command line with different
13863 values specified, @samp{none} takes highest priority over both @samp{std} and
13864 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13866 @item -fvtv-debug
13867 @opindex fvtv-debug
13868 When used in conjunction with @option{-fvtable-verify=std} or 
13869 @option{-fvtable-verify=preinit}, causes debug versions of the 
13870 runtime functions for the vtable verification feature to be called.  
13871 This flag also causes the compiler to log information about which 
13872 vtable pointers it finds for each class.
13873 This information is written to a file named @file{vtv_set_ptr_data.log} 
13874 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
13875 if that is defined or the current working directory otherwise.
13877 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
13878 file, be sure to delete any existing one.
13880 @item -fvtv-counts
13881 @opindex fvtv-counts
13882 This is a debugging flag.  When used in conjunction with
13883 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13884 causes the compiler to keep track of the total number of virtual calls
13885 it encounters and the number of verifications it inserts.  It also
13886 counts the number of calls to certain run-time library functions
13887 that it inserts and logs this information for each compilation unit.
13888 The compiler writes this information to a file named
13889 @file{vtv_count_data.log} in the directory named by the environment
13890 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13891 directory otherwise.  It also counts the size of the vtable pointer sets
13892 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13893 in the same directory.
13895 Note:  This feature @emph{appends} data to the log files.  To get fresh log
13896 files, be sure to delete any existing ones.
13898 @item -finstrument-functions
13899 @opindex finstrument-functions
13900 Generate instrumentation calls for entry and exit to functions.  Just
13901 after function entry and just before function exit, the following
13902 profiling functions are called with the address of the current
13903 function and its call site.  (On some platforms,
13904 @code{__builtin_return_address} does not work beyond the current
13905 function, so the call site information may not be available to the
13906 profiling functions otherwise.)
13908 @smallexample
13909 void __cyg_profile_func_enter (void *this_fn,
13910                                void *call_site);
13911 void __cyg_profile_func_exit  (void *this_fn,
13912                                void *call_site);
13913 @end smallexample
13915 The first argument is the address of the start of the current function,
13916 which may be looked up exactly in the symbol table.
13918 This instrumentation is also done for functions expanded inline in other
13919 functions.  The profiling calls indicate where, conceptually, the
13920 inline function is entered and exited.  This means that addressable
13921 versions of such functions must be available.  If all your uses of a
13922 function are expanded inline, this may mean an additional expansion of
13923 code size.  If you use @code{extern inline} in your C code, an
13924 addressable version of such functions must be provided.  (This is
13925 normally the case anyway, but if you get lucky and the optimizer always
13926 expands the functions inline, you might have gotten away without
13927 providing static copies.)
13929 A function may be given the attribute @code{no_instrument_function}, in
13930 which case this instrumentation is not done.  This can be used, for
13931 example, for the profiling functions listed above, high-priority
13932 interrupt routines, and any functions from which the profiling functions
13933 cannot safely be called (perhaps signal handlers, if the profiling
13934 routines generate output or allocate memory).
13935 @xref{Common Function Attributes}.
13937 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13938 @opindex finstrument-functions-exclude-file-list
13940 Set the list of functions that are excluded from instrumentation (see
13941 the description of @option{-finstrument-functions}).  If the file that
13942 contains a function definition matches with one of @var{file}, then
13943 that function is not instrumented.  The match is done on substrings:
13944 if the @var{file} parameter is a substring of the file name, it is
13945 considered to be a match.
13947 For example:
13949 @smallexample
13950 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13951 @end smallexample
13953 @noindent
13954 excludes any inline function defined in files whose pathnames
13955 contain @file{/bits/stl} or @file{include/sys}.
13957 If, for some reason, you want to include letter @samp{,} in one of
13958 @var{sym}, write @samp{\,}. For example,
13959 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13960 (note the single quote surrounding the option).
13962 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13963 @opindex finstrument-functions-exclude-function-list
13965 This is similar to @option{-finstrument-functions-exclude-file-list},
13966 but this option sets the list of function names to be excluded from
13967 instrumentation.  The function name to be matched is its user-visible
13968 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13969 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
13970 match is done on substrings: if the @var{sym} parameter is a substring
13971 of the function name, it is considered to be a match.  For C99 and C++
13972 extended identifiers, the function name must be given in UTF-8, not
13973 using universal character names.
13975 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13976 @opindex fpatchable-function-entry
13977 Generate @var{N} NOPs right at the beginning
13978 of each function, with the function entry point before the @var{M}th NOP.
13979 If @var{M} is omitted, it defaults to @code{0} so the
13980 function entry points to the address just at the first NOP.
13981 The NOP instructions reserve extra space which can be used to patch in
13982 any desired instrumentation at run time, provided that the code segment
13983 is writable.  The amount of space is controllable indirectly via
13984 the number of NOPs; the NOP instruction used corresponds to the instruction
13985 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
13986 is target-specific and may also depend on the architecture variant and/or
13987 other compilation options.
13989 For run-time identification, the starting addresses of these areas,
13990 which correspond to their respective function entries minus @var{M},
13991 are additionally collected in the @code{__patchable_function_entries}
13992 section of the resulting binary.
13994 Note that the value of @code{__attribute__ ((patchable_function_entry
13995 (N,M)))} takes precedence over command-line option
13996 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
13997 the area size or to remove it completely on a single function.
13998 If @code{N=0}, no pad location is recorded.
14000 The NOP instructions are inserted at---and maybe before, depending on
14001 @var{M}---the function entry address, even before the prologue.
14003 @end table
14006 @node Preprocessor Options
14007 @section Options Controlling the Preprocessor
14008 @cindex preprocessor options
14009 @cindex options, preprocessor
14011 These options control the C preprocessor, which is run on each C source
14012 file before actual compilation.
14014 If you use the @option{-E} option, nothing is done except preprocessing.
14015 Some of these options make sense only together with @option{-E} because
14016 they cause the preprocessor output to be unsuitable for actual
14017 compilation.
14019 In addition to the options listed here, there are a number of options 
14020 to control search paths for include files documented in 
14021 @ref{Directory Options}.  
14022 Options to control preprocessor diagnostics are listed in 
14023 @ref{Warning Options}.
14025 @table @gcctabopt
14026 @include cppopts.texi
14028 @item -Wp,@var{option}
14029 @opindex Wp
14030 You can use @option{-Wp,@var{option}} to bypass the compiler driver
14031 and pass @var{option} directly through to the preprocessor.  If
14032 @var{option} contains commas, it is split into multiple options at the
14033 commas.  However, many options are modified, translated or interpreted
14034 by the compiler driver before being passed to the preprocessor, and
14035 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
14036 interface is undocumented and subject to change, so whenever possible
14037 you should avoid using @option{-Wp} and let the driver handle the
14038 options instead.
14040 @item -Xpreprocessor @var{option}
14041 @opindex Xpreprocessor
14042 Pass @var{option} as an option to the preprocessor.  You can use this to
14043 supply system-specific preprocessor options that GCC does not 
14044 recognize.
14046 If you want to pass an option that takes an argument, you must use
14047 @option{-Xpreprocessor} twice, once for the option and once for the argument.
14049 @item -no-integrated-cpp
14050 @opindex no-integrated-cpp
14051 Perform preprocessing as a separate pass before compilation.
14052 By default, GCC performs preprocessing as an integrated part of
14053 input tokenization and parsing.
14054 If this option is provided, the appropriate language front end
14055 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14056 and Objective-C, respectively) is instead invoked twice,
14057 once for preprocessing only and once for actual compilation
14058 of the preprocessed input.
14059 This option may be useful in conjunction with the @option{-B} or
14060 @option{-wrapper} options to specify an alternate preprocessor or
14061 perform additional processing of the program source between
14062 normal preprocessing and compilation.
14064 @end table
14066 @node Assembler Options
14067 @section Passing Options to the Assembler
14069 @c prevent bad page break with this line
14070 You can pass options to the assembler.
14072 @table @gcctabopt
14073 @item -Wa,@var{option}
14074 @opindex Wa
14075 Pass @var{option} as an option to the assembler.  If @var{option}
14076 contains commas, it is split into multiple options at the commas.
14078 @item -Xassembler @var{option}
14079 @opindex Xassembler
14080 Pass @var{option} as an option to the assembler.  You can use this to
14081 supply system-specific assembler options that GCC does not
14082 recognize.
14084 If you want to pass an option that takes an argument, you must use
14085 @option{-Xassembler} twice, once for the option and once for the argument.
14087 @end table
14089 @node Link Options
14090 @section Options for Linking
14091 @cindex link options
14092 @cindex options, linking
14094 These options come into play when the compiler links object files into
14095 an executable output file.  They are meaningless if the compiler is
14096 not doing a link step.
14098 @table @gcctabopt
14099 @cindex file names
14100 @item @var{object-file-name}
14101 A file name that does not end in a special recognized suffix is
14102 considered to name an object file or library.  (Object files are
14103 distinguished from libraries by the linker according to the file
14104 contents.)  If linking is done, these object files are used as input
14105 to the linker.
14107 @item -c
14108 @itemx -S
14109 @itemx -E
14110 @opindex c
14111 @opindex S
14112 @opindex E
14113 If any of these options is used, then the linker is not run, and
14114 object file names should not be used as arguments.  @xref{Overall
14115 Options}.
14117 @item -flinker-output=@var{type}
14118 @opindex flinker-output
14119 This option controls code generation of the link-time optimizer.  By
14120 default the linker output is automatically determined by the linker
14121 plugin.  For debugging the compiler and if incremental linking with a 
14122 non-LTO object file is desired, it may be useful to control the type
14123 manually.
14125 If @var{type} is @samp{exec}, code generation produces a static
14126 binary. In this case @option{-fpic} and @option{-fpie} are both
14127 disabled.
14129 If @var{type} is @samp{dyn}, code generation produces a shared
14130 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
14131 but not enabled automatically.  This allows to build shared libraries
14132 without position-independent code on architectures where this is
14133 possible, i.e.@: on x86.
14135 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14136 executable. This results in similar optimizations as @samp{exec}
14137 except that @option{-fpie} is not disabled if specified at compilation
14138 time.
14140 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14141 done.  The sections containing intermediate code for link-time optimization are
14142 merged, pre-optimized, and output to the resulting object file. In addition, if
14143 @option{-ffat-lto-objects} is specified, binary code is produced for future
14144 non-LTO linking. The object file produced by incremental linking is smaller
14145 than a static library produced from the same object files.  At link time the
14146 result of incremental linking also loads faster than a static
14147 library assuming that the majority of objects in the library are used.
14149 Finally @samp{nolto-rel} configures the compiler for incremental linking where
14150 code generation is forced, a final binary is produced, and the intermediate
14151 code for later link-time optimization is stripped. When multiple object files
14152 are linked together the resulting code is better optimized than with
14153 link-time optimizations disabled (for example, cross-module inlining 
14154 happens), but most of benefits of whole program optimizations are lost. 
14156 During the incremental link (by @option{-r}) the linker plugin defaults to
14157 @option{rel}. With current interfaces to GNU Binutils it is however not
14158 possible to incrementally link LTO objects and non-LTO objects into a single
14159 mixed object file.  If any of object files in incremental link cannot
14160 be used for link-time optimization, the linker plugin issues a warning and
14161 uses @samp{nolto-rel}. To maintain whole program optimization, it is
14162 recommended to link such objects into static library instead. Alternatively it
14163 is possible to use H.J. Lu's binutils with support for mixed objects.
14165 @item -fuse-ld=bfd
14166 @opindex fuse-ld=bfd
14167 Use the @command{bfd} linker instead of the default linker.
14169 @item -fuse-ld=gold
14170 @opindex fuse-ld=gold
14171 Use the @command{gold} linker instead of the default linker.
14173 @item -fuse-ld=lld
14174 @opindex fuse-ld=lld
14175 Use the LLVM @command{lld} linker instead of the default linker.
14177 @cindex Libraries
14178 @item -l@var{library}
14179 @itemx -l @var{library}
14180 @opindex l
14181 Search the library named @var{library} when linking.  (The second
14182 alternative with the library as a separate argument is only for
14183 POSIX compliance and is not recommended.)
14185 The @option{-l} option is passed directly to the linker by GCC.  Refer
14186 to your linker documentation for exact details.  The general
14187 description below applies to the GNU linker.  
14189 The linker searches a standard list of directories for the library.
14190 The directories searched include several standard system directories
14191 plus any that you specify with @option{-L}.
14193 Static libraries are archives of object files, and have file names
14194 like @file{lib@var{library}.a}.  Some targets also support shared
14195 libraries, which typically have names like @file{lib@var{library}.so}.
14196 If both static and shared libraries are found, the linker gives
14197 preference to linking with the shared library unless the
14198 @option{-static} option is used.
14200 It makes a difference where in the command you write this option; the
14201 linker searches and processes libraries and object files in the order they
14202 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14203 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
14204 to functions in @samp{z}, those functions may not be loaded.
14206 @item -lobjc
14207 @opindex lobjc
14208 You need this special case of the @option{-l} option in order to
14209 link an Objective-C or Objective-C++ program.
14211 @item -nostartfiles
14212 @opindex nostartfiles
14213 Do not use the standard system startup files when linking.
14214 The standard system libraries are used normally, unless @option{-nostdlib},
14215 @option{-nolibc}, or @option{-nodefaultlibs} is used.
14217 @item -nodefaultlibs
14218 @opindex nodefaultlibs
14219 Do not use the standard system libraries when linking.
14220 Only the libraries you specify are passed to the linker, and options
14221 specifying linkage of the system libraries, such as @option{-static-libgcc}
14222 or @option{-shared-libgcc}, are ignored.  
14223 The standard startup files are used normally, unless @option{-nostartfiles}
14224 is used.  
14226 The compiler may generate calls to @code{memcmp},
14227 @code{memset}, @code{memcpy} and @code{memmove}.
14228 These entries are usually resolved by entries in
14229 libc.  These entry points should be supplied through some other
14230 mechanism when this option is specified.
14232 @item -nolibc
14233 @opindex nolibc
14234 Do not use the C library or system libraries tightly coupled with it when
14235 linking.  Still link with the startup files, @file{libgcc} or toolchain
14236 provided language support libraries such as @file{libgnat}, @file{libgfortran}
14237 or @file{libstdc++} unless options preventing their inclusion are used as
14238 well.  This typically removes @option{-lc} from the link command line, as well
14239 as system libraries that normally go with it and become meaningless when
14240 absence of a C library is assumed, for example @option{-lpthread} or
14241 @option{-lm} in some configurations.  This is intended for bare-board
14242 targets when there is indeed no C library available.
14244 @item -nostdlib
14245 @opindex nostdlib
14246 Do not use the standard system startup files or libraries when linking.
14247 No startup files and only the libraries you specify are passed to
14248 the linker, and options specifying linkage of the system libraries, such as
14249 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14251 The compiler may generate calls to @code{memcmp}, @code{memset},
14252 @code{memcpy} and @code{memmove}.
14253 These entries are usually resolved by entries in
14254 libc.  These entry points should be supplied through some other
14255 mechanism when this option is specified.
14257 @cindex @option{-lgcc}, use with @option{-nostdlib}
14258 @cindex @option{-nostdlib} and unresolved references
14259 @cindex unresolved references and @option{-nostdlib}
14260 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14261 @cindex @option{-nodefaultlibs} and unresolved references
14262 @cindex unresolved references and @option{-nodefaultlibs}
14263 One of the standard libraries bypassed by @option{-nostdlib} and
14264 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14265 which GCC uses to overcome shortcomings of particular machines, or special
14266 needs for some languages.
14267 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14268 Collection (GCC) Internals},
14269 for more discussion of @file{libgcc.a}.)
14270 In most cases, you need @file{libgcc.a} even when you want to avoid
14271 other standard libraries.  In other words, when you specify @option{-nostdlib}
14272 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14273 This ensures that you have no unresolved references to internal GCC
14274 library subroutines.
14275 (An example of such an internal subroutine is @code{__main}, used to ensure C++
14276 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14277 GNU Compiler Collection (GCC) Internals}.)
14279 @item -e @var{entry}
14280 @itemx --entry=@var{entry}
14281 @opindex e
14282 @opindex entry
14284 Specify that the program entry point is @var{entry}.  The argument is
14285 interpreted by the linker; the GNU linker accepts either a symbol name
14286 or an address.
14288 @item -pie
14289 @opindex pie
14290 Produce a dynamically linked position independent executable on targets
14291 that support it.  For predictable results, you must also specify the same
14292 set of options used for compilation (@option{-fpie}, @option{-fPIE},
14293 or model suboptions) when you specify this linker option.
14295 @item -no-pie
14296 @opindex no-pie
14297 Don't produce a dynamically linked position independent executable.
14299 @item -static-pie
14300 @opindex static-pie
14301 Produce a static position independent executable on targets that support
14302 it.  A static position independent executable is similar to a static
14303 executable, but can be loaded at any address without a dynamic linker.
14304 For predictable results, you must also specify the same set of options
14305 used for compilation (@option{-fpie}, @option{-fPIE}, or model
14306 suboptions) when you specify this linker option.
14308 @item -pthread
14309 @opindex pthread
14310 Link with the POSIX threads library.  This option is supported on 
14311 GNU/Linux targets, most other Unix derivatives, and also on 
14312 x86 Cygwin and MinGW targets.  On some targets this option also sets 
14313 flags for the preprocessor, so it should be used consistently for both
14314 compilation and linking.
14316 @item -r
14317 @opindex r
14318 Produce a relocatable object as output.  This is also known as partial
14319 linking.
14321 @item -rdynamic
14322 @opindex rdynamic
14323 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14324 that support it. This instructs the linker to add all symbols, not
14325 only used ones, to the dynamic symbol table. This option is needed
14326 for some uses of @code{dlopen} or to allow obtaining backtraces
14327 from within a program.
14329 @item -s
14330 @opindex s
14331 Remove all symbol table and relocation information from the executable.
14333 @item -static
14334 @opindex static
14335 On systems that support dynamic linking, this overrides @option{-pie}
14336 and prevents linking with the shared libraries.  On other systems, this
14337 option has no effect.
14339 @item -shared
14340 @opindex shared
14341 Produce a shared object which can then be linked with other objects to
14342 form an executable.  Not all systems support this option.  For predictable
14343 results, you must also specify the same set of options used for compilation
14344 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
14345 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14346 needs to build supplementary stub code for constructors to work.  On
14347 multi-libbed systems, @samp{gcc -shared} must select the correct support
14348 libraries to link against.  Failing to supply the correct flags may lead
14349 to subtle defects.  Supplying them in cases where they are not necessary
14350 is innocuous.}
14352 @item -shared-libgcc
14353 @itemx -static-libgcc
14354 @opindex shared-libgcc
14355 @opindex static-libgcc
14356 On systems that provide @file{libgcc} as a shared library, these options
14357 force the use of either the shared or static version, respectively.
14358 If no shared version of @file{libgcc} was built when the compiler was
14359 configured, these options have no effect.
14361 There are several situations in which an application should use the
14362 shared @file{libgcc} instead of the static version.  The most common
14363 of these is when the application wishes to throw and catch exceptions
14364 across different shared libraries.  In that case, each of the libraries
14365 as well as the application itself should use the shared @file{libgcc}.
14367 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14368 whenever you build a shared library or a main executable, because C++
14369 programs typically use exceptions, so this is the right thing to do.
14371 If, instead, you use the GCC driver to create shared libraries, you may
14372 find that they are not always linked with the shared @file{libgcc}.
14373 If GCC finds, at its configuration time, that you have a non-GNU linker
14374 or a GNU linker that does not support option @option{--eh-frame-hdr},
14375 it links the shared version of @file{libgcc} into shared libraries
14376 by default.  Otherwise, it takes advantage of the linker and optimizes
14377 away the linking with the shared version of @file{libgcc}, linking with
14378 the static version of libgcc by default.  This allows exceptions to
14379 propagate through such shared libraries, without incurring relocation
14380 costs at library load time.
14382 However, if a library or main executable is supposed to throw or catch
14383 exceptions, you must link it using the G++ driver, or using the option
14384 @option{-shared-libgcc}, such that it is linked with the shared
14385 @file{libgcc}.
14387 @item -static-libasan
14388 @opindex static-libasan
14389 When the @option{-fsanitize=address} option is used to link a program,
14390 the GCC driver automatically links against @option{libasan}.  If
14391 @file{libasan} is available as a shared library, and the @option{-static}
14392 option is not used, then this links against the shared version of
14393 @file{libasan}.  The @option{-static-libasan} option directs the GCC
14394 driver to link @file{libasan} statically, without necessarily linking
14395 other libraries statically.
14397 @item -static-libtsan
14398 @opindex static-libtsan
14399 When the @option{-fsanitize=thread} option is used to link a program,
14400 the GCC driver automatically links against @option{libtsan}.  If
14401 @file{libtsan} is available as a shared library, and the @option{-static}
14402 option is not used, then this links against the shared version of
14403 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
14404 driver to link @file{libtsan} statically, without necessarily linking
14405 other libraries statically.
14407 @item -static-liblsan
14408 @opindex static-liblsan
14409 When the @option{-fsanitize=leak} option is used to link a program,
14410 the GCC driver automatically links against @option{liblsan}.  If
14411 @file{liblsan} is available as a shared library, and the @option{-static}
14412 option is not used, then this links against the shared version of
14413 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
14414 driver to link @file{liblsan} statically, without necessarily linking
14415 other libraries statically.
14417 @item -static-libubsan
14418 @opindex static-libubsan
14419 When the @option{-fsanitize=undefined} option is used to link a program,
14420 the GCC driver automatically links against @option{libubsan}.  If
14421 @file{libubsan} is available as a shared library, and the @option{-static}
14422 option is not used, then this links against the shared version of
14423 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
14424 driver to link @file{libubsan} statically, without necessarily linking
14425 other libraries statically.
14427 @item -static-libstdc++
14428 @opindex static-libstdc++
14429 When the @command{g++} program is used to link a C++ program, it
14430 normally automatically links against @option{libstdc++}.  If
14431 @file{libstdc++} is available as a shared library, and the
14432 @option{-static} option is not used, then this links against the
14433 shared version of @file{libstdc++}.  That is normally fine.  However, it
14434 is sometimes useful to freeze the version of @file{libstdc++} used by
14435 the program without going all the way to a fully static link.  The
14436 @option{-static-libstdc++} option directs the @command{g++} driver to
14437 link @file{libstdc++} statically, without necessarily linking other
14438 libraries statically.
14440 @item -symbolic
14441 @opindex symbolic
14442 Bind references to global symbols when building a shared object.  Warn
14443 about any unresolved references (unless overridden by the link editor
14444 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
14445 this option.
14447 @item -T @var{script}
14448 @opindex T
14449 @cindex linker script
14450 Use @var{script} as the linker script.  This option is supported by most
14451 systems using the GNU linker.  On some targets, such as bare-board
14452 targets without an operating system, the @option{-T} option may be required
14453 when linking to avoid references to undefined symbols.
14455 @item -Xlinker @var{option}
14456 @opindex Xlinker
14457 Pass @var{option} as an option to the linker.  You can use this to
14458 supply system-specific linker options that GCC does not recognize.
14460 If you want to pass an option that takes a separate argument, you must use
14461 @option{-Xlinker} twice, once for the option and once for the argument.
14462 For example, to pass @option{-assert definitions}, you must write
14463 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
14464 @option{-Xlinker "-assert definitions"}, because this passes the entire
14465 string as a single argument, which is not what the linker expects.
14467 When using the GNU linker, it is usually more convenient to pass
14468 arguments to linker options using the @option{@var{option}=@var{value}}
14469 syntax than as separate arguments.  For example, you can specify
14470 @option{-Xlinker -Map=output.map} rather than
14471 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
14472 this syntax for command-line options.
14474 @item -Wl,@var{option}
14475 @opindex Wl
14476 Pass @var{option} as an option to the linker.  If @var{option} contains
14477 commas, it is split into multiple options at the commas.  You can use this
14478 syntax to pass an argument to the option.
14479 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14480 linker.  When using the GNU linker, you can also get the same effect with
14481 @option{-Wl,-Map=output.map}.
14483 @item -u @var{symbol}
14484 @opindex u
14485 Pretend the symbol @var{symbol} is undefined, to force linking of
14486 library modules to define it.  You can use @option{-u} multiple times with
14487 different symbols to force loading of additional library modules.
14489 @item -z @var{keyword}
14490 @opindex z
14491 @option{-z} is passed directly on to the linker along with the keyword
14492 @var{keyword}. See the section in the documentation of your linker for
14493 permitted values and their meanings.
14494 @end table
14496 @node Directory Options
14497 @section Options for Directory Search
14498 @cindex directory options
14499 @cindex options, directory search
14500 @cindex search path
14502 These options specify directories to search for header files, for
14503 libraries and for parts of the compiler:
14505 @table @gcctabopt
14506 @include cppdiropts.texi
14508 @item -iplugindir=@var{dir}
14509 @opindex iplugindir=
14510 Set the directory to search for plugins that are passed
14511 by @option{-fplugin=@var{name}} instead of
14512 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
14513 to be used by the user, but only passed by the driver.
14515 @item -L@var{dir}
14516 @opindex L
14517 Add directory @var{dir} to the list of directories to be searched
14518 for @option{-l}.
14520 @item -B@var{prefix}
14521 @opindex B
14522 This option specifies where to find the executables, libraries,
14523 include files, and data files of the compiler itself.
14525 The compiler driver program runs one or more of the subprograms
14526 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
14527 @var{prefix} as a prefix for each program it tries to run, both with and
14528 without @samp{@var{machine}/@var{version}/} for the corresponding target
14529 machine and compiler version.
14531 For each subprogram to be run, the compiler driver first tries the
14532 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
14533 is not specified, the driver tries two standard prefixes, 
14534 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
14535 those results in a file name that is found, the unmodified program
14536 name is searched for using the directories specified in your
14537 @env{PATH} environment variable.
14539 The compiler checks to see if the path provided by @option{-B}
14540 refers to a directory, and if necessary it adds a directory
14541 separator character at the end of the path.
14543 @option{-B} prefixes that effectively specify directory names also apply
14544 to libraries in the linker, because the compiler translates these
14545 options into @option{-L} options for the linker.  They also apply to
14546 include files in the preprocessor, because the compiler translates these
14547 options into @option{-isystem} options for the preprocessor.  In this case,
14548 the compiler appends @samp{include} to the prefix.
14550 The runtime support file @file{libgcc.a} can also be searched for using
14551 the @option{-B} prefix, if needed.  If it is not found there, the two
14552 standard prefixes above are tried, and that is all.  The file is left
14553 out of the link if it is not found by those means.
14555 Another way to specify a prefix much like the @option{-B} prefix is to use
14556 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
14557 Variables}.
14559 As a special kludge, if the path provided by @option{-B} is
14560 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
14561 9, then it is replaced by @file{[dir/]include}.  This is to help
14562 with boot-strapping the compiler.
14564 @item -no-canonical-prefixes
14565 @opindex no-canonical-prefixes
14566 Do not expand any symbolic links, resolve references to @samp{/../}
14567 or @samp{/./}, or make the path absolute when generating a relative
14568 prefix.
14570 @item --sysroot=@var{dir}
14571 @opindex sysroot
14572 Use @var{dir} as the logical root directory for headers and libraries.
14573 For example, if the compiler normally searches for headers in
14574 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
14575 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14577 If you use both this option and the @option{-isysroot} option, then
14578 the @option{--sysroot} option applies to libraries, but the
14579 @option{-isysroot} option applies to header files.
14581 The GNU linker (beginning with version 2.16) has the necessary support
14582 for this option.  If your linker does not support this option, the
14583 header file aspect of @option{--sysroot} still works, but the
14584 library aspect does not.
14586 @item --no-sysroot-suffix
14587 @opindex no-sysroot-suffix
14588 For some targets, a suffix is added to the root directory specified
14589 with @option{--sysroot}, depending on the other options used, so that
14590 headers may for example be found in
14591 @file{@var{dir}/@var{suffix}/usr/include} instead of
14592 @file{@var{dir}/usr/include}.  This option disables the addition of
14593 such a suffix.
14595 @end table
14597 @node Code Gen Options
14598 @section Options for Code Generation Conventions
14599 @cindex code generation conventions
14600 @cindex options, code generation
14601 @cindex run-time options
14603 These machine-independent options control the interface conventions
14604 used in code generation.
14606 Most of them have both positive and negative forms; the negative form
14607 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
14608 one of the forms is listed---the one that is not the default.  You
14609 can figure out the other form by either removing @samp{no-} or adding
14612 @table @gcctabopt
14613 @item -fstack-reuse=@var{reuse-level}
14614 @opindex fstack_reuse
14615 This option controls stack space reuse for user declared local/auto variables
14616 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
14617 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
14618 local variables and temporaries, @samp{named_vars} enables the reuse only for
14619 user defined local variables with names, and @samp{none} disables stack reuse
14620 completely. The default value is @samp{all}. The option is needed when the
14621 program extends the lifetime of a scoped local variable or a compiler generated
14622 temporary beyond the end point defined by the language.  When a lifetime of
14623 a variable ends, and if the variable lives in memory, the optimizing compiler
14624 has the freedom to reuse its stack space with other temporaries or scoped
14625 local variables whose live range does not overlap with it. Legacy code extending
14626 local lifetime is likely to break with the stack reuse optimization.
14628 For example,
14630 @smallexample
14631    int *p;
14632    @{
14633      int local1;
14635      p = &local1;
14636      local1 = 10;
14637      ....
14638    @}
14639    @{
14640       int local2;
14641       local2 = 20;
14642       ...
14643    @}
14645    if (*p == 10)  // out of scope use of local1
14646      @{
14648      @}
14649 @end smallexample
14651 Another example:
14652 @smallexample
14654    struct A
14655    @{
14656        A(int k) : i(k), j(k) @{ @}
14657        int i;
14658        int j;
14659    @};
14661    A *ap;
14663    void foo(const A& ar)
14664    @{
14665       ap = &ar;
14666    @}
14668    void bar()
14669    @{
14670       foo(A(10)); // temp object's lifetime ends when foo returns
14672       @{
14673         A a(20);
14674         ....
14675       @}
14676       ap->i+= 10;  // ap references out of scope temp whose space
14677                    // is reused with a. What is the value of ap->i?
14678    @}
14680 @end smallexample
14682 The lifetime of a compiler generated temporary is well defined by the C++
14683 standard. When a lifetime of a temporary ends, and if the temporary lives
14684 in memory, the optimizing compiler has the freedom to reuse its stack
14685 space with other temporaries or scoped local variables whose live range
14686 does not overlap with it. However some of the legacy code relies on
14687 the behavior of older compilers in which temporaries' stack space is
14688 not reused, the aggressive stack reuse can lead to runtime errors. This
14689 option is used to control the temporary stack reuse optimization.
14691 @item -ftrapv
14692 @opindex ftrapv
14693 This option generates traps for signed overflow on addition, subtraction,
14694 multiplication operations.
14695 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14696 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14697 @option{-fwrapv} being effective.  Note that only active options override, so
14698 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14699 results in @option{-ftrapv} being effective.
14701 @item -fwrapv
14702 @opindex fwrapv
14703 This option instructs the compiler to assume that signed arithmetic
14704 overflow of addition, subtraction and multiplication wraps around
14705 using twos-complement representation.  This flag enables some optimizations
14706 and disables others.
14707 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14708 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14709 @option{-fwrapv} being effective.  Note that only active options override, so
14710 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14711 results in @option{-ftrapv} being effective.
14713 @item -fwrapv-pointer
14714 @opindex fwrapv-pointer
14715 This option instructs the compiler to assume that pointer arithmetic
14716 overflow on addition and subtraction wraps around using twos-complement
14717 representation.  This flag disables some optimizations which assume
14718 pointer overflow is invalid.
14720 @item -fstrict-overflow
14721 @opindex fstrict-overflow
14722 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
14723 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
14725 @item -fexceptions
14726 @opindex fexceptions
14727 Enable exception handling.  Generates extra code needed to propagate
14728 exceptions.  For some targets, this implies GCC generates frame
14729 unwind information for all functions, which can produce significant data
14730 size overhead, although it does not affect execution.  If you do not
14731 specify this option, GCC enables it by default for languages like
14732 C++ that normally require exception handling, and disables it for
14733 languages like C that do not normally require it.  However, you may need
14734 to enable this option when compiling C code that needs to interoperate
14735 properly with exception handlers written in C++.  You may also wish to
14736 disable this option if you are compiling older C++ programs that don't
14737 use exception handling.
14739 @item -fnon-call-exceptions
14740 @opindex fnon-call-exceptions
14741 Generate code that allows trapping instructions to throw exceptions.
14742 Note that this requires platform-specific runtime support that does
14743 not exist everywhere.  Moreover, it only allows @emph{trapping}
14744 instructions to throw exceptions, i.e.@: memory references or floating-point
14745 instructions.  It does not allow exceptions to be thrown from
14746 arbitrary signal handlers such as @code{SIGALRM}.
14748 @item -fdelete-dead-exceptions
14749 @opindex fdelete-dead-exceptions
14750 Consider that instructions that may throw exceptions but don't otherwise
14751 contribute to the execution of the program can be optimized away.
14752 This option is enabled by default for the Ada front end, as permitted by
14753 the Ada language specification.
14754 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14756 @item -funwind-tables
14757 @opindex funwind-tables
14758 Similar to @option{-fexceptions}, except that it just generates any needed
14759 static data, but does not affect the generated code in any other way.
14760 You normally do not need to enable this option; instead, a language processor
14761 that needs this handling enables it on your behalf.
14763 @item -fasynchronous-unwind-tables
14764 @opindex fasynchronous-unwind-tables
14765 Generate unwind table in DWARF format, if supported by target machine.  The
14766 table is exact at each instruction boundary, so it can be used for stack
14767 unwinding from asynchronous events (such as debugger or garbage collector).
14769 @item -fno-gnu-unique
14770 @opindex fno-gnu-unique
14771 @opindex fgnu-unique
14772 On systems with recent GNU assembler and C library, the C++ compiler
14773 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14774 of template static data members and static local variables in inline
14775 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14776 is necessary to avoid problems with a library used by two different
14777 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14778 therefore disagreeing with the other one about the binding of the
14779 symbol.  But this causes @code{dlclose} to be ignored for affected
14780 DSOs; if your program relies on reinitialization of a DSO via
14781 @code{dlclose} and @code{dlopen}, you can use
14782 @option{-fno-gnu-unique}.
14784 @item -fpcc-struct-return
14785 @opindex fpcc-struct-return
14786 Return ``short'' @code{struct} and @code{union} values in memory like
14787 longer ones, rather than in registers.  This convention is less
14788 efficient, but it has the advantage of allowing intercallability between
14789 GCC-compiled files and files compiled with other compilers, particularly
14790 the Portable C Compiler (pcc).
14792 The precise convention for returning structures in memory depends
14793 on the target configuration macros.
14795 Short structures and unions are those whose size and alignment match
14796 that of some integer type.
14798 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14799 switch is not binary compatible with code compiled with the
14800 @option{-freg-struct-return} switch.
14801 Use it to conform to a non-default application binary interface.
14803 @item -freg-struct-return
14804 @opindex freg-struct-return
14805 Return @code{struct} and @code{union} values in registers when possible.
14806 This is more efficient for small structures than
14807 @option{-fpcc-struct-return}.
14809 If you specify neither @option{-fpcc-struct-return} nor
14810 @option{-freg-struct-return}, GCC defaults to whichever convention is
14811 standard for the target.  If there is no standard convention, GCC
14812 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14813 the principal compiler.  In those cases, we can choose the standard, and
14814 we chose the more efficient register return alternative.
14816 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14817 switch is not binary compatible with code compiled with the
14818 @option{-fpcc-struct-return} switch.
14819 Use it to conform to a non-default application binary interface.
14821 @item -fshort-enums
14822 @opindex fshort-enums
14823 Allocate to an @code{enum} type only as many bytes as it needs for the
14824 declared range of possible values.  Specifically, the @code{enum} type
14825 is equivalent to the smallest integer type that has enough room.
14827 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14828 code that is not binary compatible with code generated without that switch.
14829 Use it to conform to a non-default application binary interface.
14831 @item -fshort-wchar
14832 @opindex fshort-wchar
14833 Override the underlying type for @code{wchar_t} to be @code{short
14834 unsigned int} instead of the default for the target.  This option is
14835 useful for building programs to run under WINE@.
14837 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14838 code that is not binary compatible with code generated without that switch.
14839 Use it to conform to a non-default application binary interface.
14841 @item -fcommon
14842 @opindex fcommon
14843 @opindex fno-common
14844 @cindex tentative definitions
14845 In C code, this option controls the placement of global variables
14846 defined without an initializer, known as @dfn{tentative definitions}
14847 in the C standard.  Tentative definitions are distinct from declarations
14848 of a variable with the @code{extern} keyword, which do not allocate storage.
14850 The default is @option{-fno-common}, which specifies that the compiler places
14851 uninitialized global variables in the BSS section of the object file.
14852 This inhibits the merging of tentative definitions by the linker so you get a
14853 multiple-definition error if the same variable is accidentally defined in more
14854 than one compilation unit.
14856 The @option{-fcommon} places uninitialized global variables in a common block.
14857 This allows the linker to resolve all tentative definitions of the same variable
14858 in different compilation units to the same object, or to a non-tentative
14859 definition.  This behavior is inconsistent with C++, and on many targets implies
14860 a speed and code size penalty on global variable references.  It is mainly
14861 useful to enable legacy code to link without errors.
14863 @item -fno-ident
14864 @opindex fno-ident
14865 @opindex fident
14866 Ignore the @code{#ident} directive.
14868 @item -finhibit-size-directive
14869 @opindex finhibit-size-directive
14870 Don't output a @code{.size} assembler directive, or anything else that
14871 would cause trouble if the function is split in the middle, and the
14872 two halves are placed at locations far apart in memory.  This option is
14873 used when compiling @file{crtstuff.c}; you should not need to use it
14874 for anything else.
14876 @item -fverbose-asm
14877 @opindex fverbose-asm
14878 Put extra commentary information in the generated assembly code to
14879 make it more readable.  This option is generally only of use to those
14880 who actually need to read the generated assembly code (perhaps while
14881 debugging the compiler itself).
14883 @option{-fno-verbose-asm}, the default, causes the
14884 extra information to be omitted and is useful when comparing two assembler
14885 files.
14887 The added comments include:
14889 @itemize @bullet
14891 @item
14892 information on the compiler version and command-line options,
14894 @item
14895 the source code lines associated with the assembly instructions,
14896 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14898 @item
14899 hints on which high-level expressions correspond to
14900 the various assembly instruction operands.
14902 @end itemize
14904 For example, given this C source file:
14906 @smallexample
14907 int test (int n)
14909   int i;
14910   int total = 0;
14912   for (i = 0; i < n; i++)
14913     total += i * i;
14915   return total;
14917 @end smallexample
14919 compiling to (x86_64) assembly via @option{-S} and emitting the result
14920 direct to stdout via @option{-o} @option{-}
14922 @smallexample
14923 gcc -S test.c -fverbose-asm -Os -o -
14924 @end smallexample
14926 gives output similar to this:
14928 @smallexample
14929         .file   "test.c"
14930 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14931   [...snip...]
14932 # options passed:
14933   [...snip...]
14935         .text
14936         .globl  test
14937         .type   test, @@function
14938 test:
14939 .LFB0:
14940         .cfi_startproc
14941 # test.c:4:   int total = 0;
14942         xorl    %eax, %eax      # <retval>
14943 # test.c:6:   for (i = 0; i < n; i++)
14944         xorl    %edx, %edx      # i
14945 .L2:
14946 # test.c:6:   for (i = 0; i < n; i++)
14947         cmpl    %edi, %edx      # n, i
14948         jge     .L5     #,
14949 # test.c:7:     total += i * i;
14950         movl    %edx, %ecx      # i, tmp92
14951         imull   %edx, %ecx      # i, tmp92
14952 # test.c:6:   for (i = 0; i < n; i++)
14953         incl    %edx    # i
14954 # test.c:7:     total += i * i;
14955         addl    %ecx, %eax      # tmp92, <retval>
14956         jmp     .L2     #
14957 .L5:
14958 # test.c:10: @}
14959         ret
14960         .cfi_endproc
14961 .LFE0:
14962         .size   test, .-test
14963         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
14964         .section        .note.GNU-stack,"",@@progbits
14965 @end smallexample
14967 The comments are intended for humans rather than machines and hence the
14968 precise format of the comments is subject to change.
14970 @item -frecord-gcc-switches
14971 @opindex frecord-gcc-switches
14972 This switch causes the command line used to invoke the
14973 compiler to be recorded into the object file that is being created.
14974 This switch is only implemented on some targets and the exact format
14975 of the recording is target and binary file format dependent, but it
14976 usually takes the form of a section containing ASCII text.  This
14977 switch is related to the @option{-fverbose-asm} switch, but that
14978 switch only records information in the assembler output file as
14979 comments, so it never reaches the object file.
14980 See also @option{-grecord-gcc-switches} for another
14981 way of storing compiler options into the object file.
14983 @item -fpic
14984 @opindex fpic
14985 @cindex global offset table
14986 @cindex PIC
14987 Generate position-independent code (PIC) suitable for use in a shared
14988 library, if supported for the target machine.  Such code accesses all
14989 constant addresses through a global offset table (GOT)@.  The dynamic
14990 loader resolves the GOT entries when the program starts (the dynamic
14991 loader is not part of GCC; it is part of the operating system).  If
14992 the GOT size for the linked executable exceeds a machine-specific
14993 maximum size, you get an error message from the linker indicating that
14994 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14995 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14996 on the m68k and RS/6000.  The x86 has no such limit.)
14998 Position-independent code requires special support, and therefore works
14999 only on certain machines.  For the x86, GCC supports PIC for System V
15000 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
15001 position-independent.
15003 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15004 are defined to 1.
15006 @item -fPIC
15007 @opindex fPIC
15008 If supported for the target machine, emit position-independent code,
15009 suitable for dynamic linking and avoiding any limit on the size of the
15010 global offset table.  This option makes a difference on AArch64, m68k,
15011 PowerPC and SPARC@.
15013 Position-independent code requires special support, and therefore works
15014 only on certain machines.
15016 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15017 are defined to 2.
15019 @item -fpie
15020 @itemx -fPIE
15021 @opindex fpie
15022 @opindex fPIE
15023 These options are similar to @option{-fpic} and @option{-fPIC}, but the
15024 generated position-independent code can be only linked into executables.
15025 Usually these options are used to compile code that will be linked using
15026 the @option{-pie} GCC option.
15028 @option{-fpie} and @option{-fPIE} both define the macros
15029 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
15030 for @option{-fpie} and 2 for @option{-fPIE}.
15032 @item -fno-plt
15033 @opindex fno-plt
15034 @opindex fplt
15035 Do not use the PLT for external function calls in position-independent code.
15036 Instead, load the callee address at call sites from the GOT and branch to it.
15037 This leads to more efficient code by eliminating PLT stubs and exposing
15038 GOT loads to optimizations.  On architectures such as 32-bit x86 where
15039 PLT stubs expect the GOT pointer in a specific register, this gives more
15040 register allocation freedom to the compiler.
15041 Lazy binding requires use of the PLT; 
15042 with @option{-fno-plt} all external symbols are resolved at load time.
15044 Alternatively, the function attribute @code{noplt} can be used to avoid calls
15045 through the PLT for specific external functions.
15047 In position-dependent code, a few targets also convert calls to
15048 functions that are marked to not use the PLT to use the GOT instead.
15050 @item -fno-jump-tables
15051 @opindex fno-jump-tables
15052 @opindex fjump-tables
15053 Do not use jump tables for switch statements even where it would be
15054 more efficient than other code generation strategies.  This option is
15055 of use in conjunction with @option{-fpic} or @option{-fPIC} for
15056 building code that forms part of a dynamic linker and cannot
15057 reference the address of a jump table.  On some targets, jump tables
15058 do not require a GOT and this option is not needed.
15060 @item -ffixed-@var{reg}
15061 @opindex ffixed
15062 Treat the register named @var{reg} as a fixed register; generated code
15063 should never refer to it (except perhaps as a stack pointer, frame
15064 pointer or in some other fixed role).
15066 @var{reg} must be the name of a register.  The register names accepted
15067 are machine-specific and are defined in the @code{REGISTER_NAMES}
15068 macro in the machine description macro file.
15070 This flag does not have a negative form, because it specifies a
15071 three-way choice.
15073 @item -fcall-used-@var{reg}
15074 @opindex fcall-used
15075 Treat the register named @var{reg} as an allocable register that is
15076 clobbered by function calls.  It may be allocated for temporaries or
15077 variables that do not live across a call.  Functions compiled this way
15078 do not save and restore the register @var{reg}.
15080 It is an error to use this flag with the frame pointer or stack pointer.
15081 Use of this flag for other registers that have fixed pervasive roles in
15082 the machine's execution model produces disastrous results.
15084 This flag does not have a negative form, because it specifies a
15085 three-way choice.
15087 @item -fcall-saved-@var{reg}
15088 @opindex fcall-saved
15089 Treat the register named @var{reg} as an allocable register saved by
15090 functions.  It may be allocated even for temporaries or variables that
15091 live across a call.  Functions compiled this way save and restore
15092 the register @var{reg} if they use it.
15094 It is an error to use this flag with the frame pointer or stack pointer.
15095 Use of this flag for other registers that have fixed pervasive roles in
15096 the machine's execution model produces disastrous results.
15098 A different sort of disaster results from the use of this flag for
15099 a register in which function values may be returned.
15101 This flag does not have a negative form, because it specifies a
15102 three-way choice.
15104 @item -fpack-struct[=@var{n}]
15105 @opindex fpack-struct
15106 Without a value specified, pack all structure members together without
15107 holes.  When a value is specified (which must be a small power of two), pack
15108 structure members according to this value, representing the maximum
15109 alignment (that is, objects with default alignment requirements larger than
15110 this are output potentially unaligned at the next fitting location.
15112 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15113 code that is not binary compatible with code generated without that switch.
15114 Additionally, it makes the code suboptimal.
15115 Use it to conform to a non-default application binary interface.
15117 @item -fleading-underscore
15118 @opindex fleading-underscore
15119 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15120 change the way C symbols are represented in the object file.  One use
15121 is to help link with legacy assembly code.
15123 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15124 generate code that is not binary compatible with code generated without that
15125 switch.  Use it to conform to a non-default application binary interface.
15126 Not all targets provide complete support for this switch.
15128 @item -ftls-model=@var{model}
15129 @opindex ftls-model
15130 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15131 The @var{model} argument should be one of @samp{global-dynamic},
15132 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15133 Note that the choice is subject to optimization: the compiler may use
15134 a more efficient model for symbols not visible outside of the translation
15135 unit, or if @option{-fpic} is not given on the command line.
15137 The default without @option{-fpic} is @samp{initial-exec}; with
15138 @option{-fpic} the default is @samp{global-dynamic}.
15140 @item -ftrampolines
15141 @opindex ftrampolines
15142 For targets that normally need trampolines for nested functions, always
15143 generate them instead of using descriptors.  Otherwise, for targets that
15144 do not need them, like for example HP-PA or IA-64, do nothing.
15146 A trampoline is a small piece of code that is created at run time on the
15147 stack when the address of a nested function is taken, and is used to call
15148 the nested function indirectly.  Therefore, it requires the stack to be
15149 made executable in order for the program to work properly.
15151 @option{-fno-trampolines} is enabled by default on a language by language
15152 basis to let the compiler avoid generating them, if it computes that this
15153 is safe, and replace them with descriptors.  Descriptors are made up of data
15154 only, but the generated code must be prepared to deal with them.  As of this
15155 writing, @option{-fno-trampolines} is enabled by default only for Ada.
15157 Moreover, code compiled with @option{-ftrampolines} and code compiled with
15158 @option{-fno-trampolines} are not binary compatible if nested functions are
15159 present.  This option must therefore be used on a program-wide basis and be
15160 manipulated with extreme care.
15162 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15163 @opindex fvisibility
15164 Set the default ELF image symbol visibility to the specified option---all
15165 symbols are marked with this unless overridden within the code.
15166 Using this feature can very substantially improve linking and
15167 load times of shared object libraries, produce more optimized
15168 code, provide near-perfect API export and prevent symbol clashes.
15169 It is @strong{strongly} recommended that you use this in any shared objects
15170 you distribute.
15172 Despite the nomenclature, @samp{default} always means public; i.e.,
15173 available to be linked against from outside the shared object.
15174 @samp{protected} and @samp{internal} are pretty useless in real-world
15175 usage so the only other commonly used option is @samp{hidden}.
15176 The default if @option{-fvisibility} isn't specified is
15177 @samp{default}, i.e., make every symbol public.
15179 A good explanation of the benefits offered by ensuring ELF
15180 symbols have the correct visibility is given by ``How To Write
15181 Shared Libraries'' by Ulrich Drepper (which can be found at
15182 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15183 solution made possible by this option to marking things hidden when
15184 the default is public is to make the default hidden and mark things
15185 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15186 and @code{__attribute__ ((visibility("default")))} instead of
15187 @code{__declspec(dllexport)} you get almost identical semantics with
15188 identical syntax.  This is a great boon to those working with
15189 cross-platform projects.
15191 For those adding visibility support to existing code, you may find
15192 @code{#pragma GCC visibility} of use.  This works by you enclosing
15193 the declarations you wish to set visibility for with (for example)
15194 @code{#pragma GCC visibility push(hidden)} and
15195 @code{#pragma GCC visibility pop}.
15196 Bear in mind that symbol visibility should be viewed @strong{as
15197 part of the API interface contract} and thus all new code should
15198 always specify visibility when it is not the default; i.e., declarations
15199 only for use within the local DSO should @strong{always} be marked explicitly
15200 as hidden as so to avoid PLT indirection overheads---making this
15201 abundantly clear also aids readability and self-documentation of the code.
15202 Note that due to ISO C++ specification requirements, @code{operator new} and
15203 @code{operator delete} must always be of default visibility.
15205 Be aware that headers from outside your project, in particular system
15206 headers and headers from any other library you use, may not be
15207 expecting to be compiled with visibility other than the default.  You
15208 may need to explicitly say @code{#pragma GCC visibility push(default)}
15209 before including any such headers.
15211 @code{extern} declarations are not affected by @option{-fvisibility}, so
15212 a lot of code can be recompiled with @option{-fvisibility=hidden} with
15213 no modifications.  However, this means that calls to @code{extern}
15214 functions with no explicit visibility use the PLT, so it is more
15215 effective to use @code{__attribute ((visibility))} and/or
15216 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
15217 declarations should be treated as hidden.
15219 Note that @option{-fvisibility} does affect C++ vague linkage
15220 entities. This means that, for instance, an exception class that is
15221 be thrown between DSOs must be explicitly marked with default
15222 visibility so that the @samp{type_info} nodes are unified between
15223 the DSOs.
15225 An overview of these techniques, their benefits and how to use them
15226 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15228 @item -fstrict-volatile-bitfields
15229 @opindex fstrict-volatile-bitfields
15230 This option should be used if accesses to volatile bit-fields (or other
15231 structure fields, although the compiler usually honors those types
15232 anyway) should use a single access of the width of the
15233 field's type, aligned to a natural alignment if possible.  For
15234 example, targets with memory-mapped peripheral registers might require
15235 all such accesses to be 16 bits wide; with this flag you can
15236 declare all peripheral bit-fields as @code{unsigned short} (assuming short
15237 is 16 bits on these targets) to force GCC to use 16-bit accesses
15238 instead of, perhaps, a more efficient 32-bit access.
15240 If this option is disabled, the compiler uses the most efficient
15241 instruction.  In the previous example, that might be a 32-bit load
15242 instruction, even though that accesses bytes that do not contain
15243 any portion of the bit-field, or memory-mapped registers unrelated to
15244 the one being updated.
15246 In some cases, such as when the @code{packed} attribute is applied to a 
15247 structure field, it may not be possible to access the field with a single
15248 read or write that is correctly aligned for the target machine.  In this
15249 case GCC falls back to generating multiple accesses rather than code that 
15250 will fault or truncate the result at run time.
15252 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
15253 not allowed to touch non bit-field members.  It is therefore recommended
15254 to define all bits of the field's type as bit-field members.
15256 The default value of this option is determined by the application binary
15257 interface for the target processor.
15259 @item -fsync-libcalls
15260 @opindex fsync-libcalls
15261 This option controls whether any out-of-line instance of the @code{__sync}
15262 family of functions may be used to implement the C++11 @code{__atomic}
15263 family of functions.
15265 The default value of this option is enabled, thus the only useful form
15266 of the option is @option{-fno-sync-libcalls}.  This option is used in
15267 the implementation of the @file{libatomic} runtime library.
15269 @end table
15271 @node Developer Options
15272 @section GCC Developer Options
15273 @cindex developer options
15274 @cindex debugging GCC
15275 @cindex debug dump options
15276 @cindex dump options
15277 @cindex compilation statistics
15279 This section describes command-line options that are primarily of
15280 interest to GCC developers, including options to support compiler
15281 testing and investigation of compiler bugs and compile-time
15282 performance problems.  This includes options that produce debug dumps
15283 at various points in the compilation; that print statistics such as
15284 memory use and execution time; and that print information about GCC's
15285 configuration, such as where it searches for libraries.  You should
15286 rarely need to use any of these options for ordinary compilation and
15287 linking tasks.
15289 Many developer options that cause GCC to dump output to a file take an
15290 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15291 or @samp{-} to dump to standard output, and @samp{stderr} for standard
15292 error.
15294 If @samp{=@var{filename}} is omitted, a default dump file name is
15295 constructed by concatenating the base dump file name, a pass number,
15296 phase letter, and pass name.  The base dump file name is the name of
15297 output file produced by the compiler if explicitly specified and not
15298 an executable; otherwise it is the source file name.
15299 The pass number is determined by the order passes are registered with
15300 the compiler's pass manager. 
15301 This is generally the same as the order of execution, but passes
15302 registered by plugins, target-specific passes, or passes that are
15303 otherwise registered late are numbered higher than the pass named
15304 @samp{final}, even if they are executed earlier.  The phase letter is
15305 one of @samp{i} (inter-procedural analysis), @samp{l}
15306 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
15307 The files are created in the directory of the output file. 
15309 @table @gcctabopt
15311 @item -fcallgraph-info
15312 @itemx -fcallgraph-info=@var{MARKERS}
15313 @opindex fcallgraph-info
15314 Makes the compiler output callgraph information for the program, on a
15315 per-object-file basis.  The information is generated in the common VCG
15316 format.  It can be decorated with additional, per-node and/or per-edge
15317 information, if a list of comma-separated markers is additionally
15318 specified.  When the @code{su} marker is specified, the callgraph is
15319 decorated with stack usage information; it is equivalent to
15320 @option{-fstack-usage}.  When the @code{da} marker is specified, the
15321 callgraph is decorated with information about dynamically allocated
15322 objects.
15324 When compiling with @option{-flto}, no callgraph information is output
15325 along with the object file.  At LTO link time, @option{-fcallgraph-info}
15326 may generate multiple callgraph information files next to intermediate
15327 LTO output files.
15329 @item -d@var{letters}
15330 @itemx -fdump-rtl-@var{pass}
15331 @itemx -fdump-rtl-@var{pass}=@var{filename}
15332 @opindex d
15333 @opindex fdump-rtl-@var{pass}
15334 Says to make debugging dumps during compilation at times specified by
15335 @var{letters}.  This is used for debugging the RTL-based passes of the
15336 compiler.
15338 Some @option{-d@var{letters}} switches have different meaning when
15339 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
15340 for information about preprocessor-specific dump options.
15342 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15343 @option{-d} option @var{letters}.  Here are the possible
15344 letters for use in @var{pass} and @var{letters}, and their meanings:
15346 @table @gcctabopt
15348 @item -fdump-rtl-alignments
15349 @opindex fdump-rtl-alignments
15350 Dump after branch alignments have been computed.
15352 @item -fdump-rtl-asmcons
15353 @opindex fdump-rtl-asmcons
15354 Dump after fixing rtl statements that have unsatisfied in/out constraints.
15356 @item -fdump-rtl-auto_inc_dec
15357 @opindex fdump-rtl-auto_inc_dec
15358 Dump after auto-inc-dec discovery.  This pass is only run on
15359 architectures that have auto inc or auto dec instructions.
15361 @item -fdump-rtl-barriers
15362 @opindex fdump-rtl-barriers
15363 Dump after cleaning up the barrier instructions.
15365 @item -fdump-rtl-bbpart
15366 @opindex fdump-rtl-bbpart
15367 Dump after partitioning hot and cold basic blocks.
15369 @item -fdump-rtl-bbro
15370 @opindex fdump-rtl-bbro
15371 Dump after block reordering.
15373 @item -fdump-rtl-btl1
15374 @itemx -fdump-rtl-btl2
15375 @opindex fdump-rtl-btl2
15376 @opindex fdump-rtl-btl2
15377 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15378 after the two branch
15379 target load optimization passes.
15381 @item -fdump-rtl-bypass
15382 @opindex fdump-rtl-bypass
15383 Dump after jump bypassing and control flow optimizations.
15385 @item -fdump-rtl-combine
15386 @opindex fdump-rtl-combine
15387 Dump after the RTL instruction combination pass.
15389 @item -fdump-rtl-compgotos
15390 @opindex fdump-rtl-compgotos
15391 Dump after duplicating the computed gotos.
15393 @item -fdump-rtl-ce1
15394 @itemx -fdump-rtl-ce2
15395 @itemx -fdump-rtl-ce3
15396 @opindex fdump-rtl-ce1
15397 @opindex fdump-rtl-ce2
15398 @opindex fdump-rtl-ce3
15399 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15400 @option{-fdump-rtl-ce3} enable dumping after the three
15401 if conversion passes.
15403 @item -fdump-rtl-cprop_hardreg
15404 @opindex fdump-rtl-cprop_hardreg
15405 Dump after hard register copy propagation.
15407 @item -fdump-rtl-csa
15408 @opindex fdump-rtl-csa
15409 Dump after combining stack adjustments.
15411 @item -fdump-rtl-cse1
15412 @itemx -fdump-rtl-cse2
15413 @opindex fdump-rtl-cse1
15414 @opindex fdump-rtl-cse2
15415 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15416 the two common subexpression elimination passes.
15418 @item -fdump-rtl-dce
15419 @opindex fdump-rtl-dce
15420 Dump after the standalone dead code elimination passes.
15422 @item -fdump-rtl-dbr
15423 @opindex fdump-rtl-dbr
15424 Dump after delayed branch scheduling.
15426 @item -fdump-rtl-dce1
15427 @itemx -fdump-rtl-dce2
15428 @opindex fdump-rtl-dce1
15429 @opindex fdump-rtl-dce2
15430 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15431 the two dead store elimination passes.
15433 @item -fdump-rtl-eh
15434 @opindex fdump-rtl-eh
15435 Dump after finalization of EH handling code.
15437 @item -fdump-rtl-eh_ranges
15438 @opindex fdump-rtl-eh_ranges
15439 Dump after conversion of EH handling range regions.
15441 @item -fdump-rtl-expand
15442 @opindex fdump-rtl-expand
15443 Dump after RTL generation.
15445 @item -fdump-rtl-fwprop1
15446 @itemx -fdump-rtl-fwprop2
15447 @opindex fdump-rtl-fwprop1
15448 @opindex fdump-rtl-fwprop2
15449 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15450 dumping after the two forward propagation passes.
15452 @item -fdump-rtl-gcse1
15453 @itemx -fdump-rtl-gcse2
15454 @opindex fdump-rtl-gcse1
15455 @opindex fdump-rtl-gcse2
15456 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15457 after global common subexpression elimination.
15459 @item -fdump-rtl-init-regs
15460 @opindex fdump-rtl-init-regs
15461 Dump after the initialization of the registers.
15463 @item -fdump-rtl-initvals
15464 @opindex fdump-rtl-initvals
15465 Dump after the computation of the initial value sets.
15467 @item -fdump-rtl-into_cfglayout
15468 @opindex fdump-rtl-into_cfglayout
15469 Dump after converting to cfglayout mode.
15471 @item -fdump-rtl-ira
15472 @opindex fdump-rtl-ira
15473 Dump after iterated register allocation.
15475 @item -fdump-rtl-jump
15476 @opindex fdump-rtl-jump
15477 Dump after the second jump optimization.
15479 @item -fdump-rtl-loop2
15480 @opindex fdump-rtl-loop2
15481 @option{-fdump-rtl-loop2} enables dumping after the rtl
15482 loop optimization passes.
15484 @item -fdump-rtl-mach
15485 @opindex fdump-rtl-mach
15486 Dump after performing the machine dependent reorganization pass, if that
15487 pass exists.
15489 @item -fdump-rtl-mode_sw
15490 @opindex fdump-rtl-mode_sw
15491 Dump after removing redundant mode switches.
15493 @item -fdump-rtl-rnreg
15494 @opindex fdump-rtl-rnreg
15495 Dump after register renumbering.
15497 @item -fdump-rtl-outof_cfglayout
15498 @opindex fdump-rtl-outof_cfglayout
15499 Dump after converting from cfglayout mode.
15501 @item -fdump-rtl-peephole2
15502 @opindex fdump-rtl-peephole2
15503 Dump after the peephole pass.
15505 @item -fdump-rtl-postreload
15506 @opindex fdump-rtl-postreload
15507 Dump after post-reload optimizations.
15509 @item -fdump-rtl-pro_and_epilogue
15510 @opindex fdump-rtl-pro_and_epilogue
15511 Dump after generating the function prologues and epilogues.
15513 @item -fdump-rtl-sched1
15514 @itemx -fdump-rtl-sched2
15515 @opindex fdump-rtl-sched1
15516 @opindex fdump-rtl-sched2
15517 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15518 after the basic block scheduling passes.
15520 @item -fdump-rtl-ree
15521 @opindex fdump-rtl-ree
15522 Dump after sign/zero extension elimination.
15524 @item -fdump-rtl-seqabstr
15525 @opindex fdump-rtl-seqabstr
15526 Dump after common sequence discovery.
15528 @item -fdump-rtl-shorten
15529 @opindex fdump-rtl-shorten
15530 Dump after shortening branches.
15532 @item -fdump-rtl-sibling
15533 @opindex fdump-rtl-sibling
15534 Dump after sibling call optimizations.
15536 @item -fdump-rtl-split1
15537 @itemx -fdump-rtl-split2
15538 @itemx -fdump-rtl-split3
15539 @itemx -fdump-rtl-split4
15540 @itemx -fdump-rtl-split5
15541 @opindex fdump-rtl-split1
15542 @opindex fdump-rtl-split2
15543 @opindex fdump-rtl-split3
15544 @opindex fdump-rtl-split4
15545 @opindex fdump-rtl-split5
15546 These options enable dumping after five rounds of
15547 instruction splitting.
15549 @item -fdump-rtl-sms
15550 @opindex fdump-rtl-sms
15551 Dump after modulo scheduling.  This pass is only run on some
15552 architectures.
15554 @item -fdump-rtl-stack
15555 @opindex fdump-rtl-stack
15556 Dump after conversion from GCC's ``flat register file'' registers to the
15557 x87's stack-like registers.  This pass is only run on x86 variants.
15559 @item -fdump-rtl-subreg1
15560 @itemx -fdump-rtl-subreg2
15561 @opindex fdump-rtl-subreg1
15562 @opindex fdump-rtl-subreg2
15563 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
15564 the two subreg expansion passes.
15566 @item -fdump-rtl-unshare
15567 @opindex fdump-rtl-unshare
15568 Dump after all rtl has been unshared.
15570 @item -fdump-rtl-vartrack
15571 @opindex fdump-rtl-vartrack
15572 Dump after variable tracking.
15574 @item -fdump-rtl-vregs
15575 @opindex fdump-rtl-vregs
15576 Dump after converting virtual registers to hard registers.
15578 @item -fdump-rtl-web
15579 @opindex fdump-rtl-web
15580 Dump after live range splitting.
15582 @item -fdump-rtl-regclass
15583 @itemx -fdump-rtl-subregs_of_mode_init
15584 @itemx -fdump-rtl-subregs_of_mode_finish
15585 @itemx -fdump-rtl-dfinit
15586 @itemx -fdump-rtl-dfinish
15587 @opindex fdump-rtl-regclass
15588 @opindex fdump-rtl-subregs_of_mode_init
15589 @opindex fdump-rtl-subregs_of_mode_finish
15590 @opindex fdump-rtl-dfinit
15591 @opindex fdump-rtl-dfinish
15592 These dumps are defined but always produce empty files.
15594 @item -da
15595 @itemx -fdump-rtl-all
15596 @opindex da
15597 @opindex fdump-rtl-all
15598 Produce all the dumps listed above.
15600 @item -dA
15601 @opindex dA
15602 Annotate the assembler output with miscellaneous debugging information.
15604 @item -dD
15605 @opindex dD
15606 Dump all macro definitions, at the end of preprocessing, in addition to
15607 normal output.
15609 @item -dH
15610 @opindex dH
15611 Produce a core dump whenever an error occurs.
15613 @item -dp
15614 @opindex dp
15615 Annotate the assembler output with a comment indicating which
15616 pattern and alternative is used.  The length and cost of each instruction are
15617 also printed.
15619 @item -dP
15620 @opindex dP
15621 Dump the RTL in the assembler output as a comment before each instruction.
15622 Also turns on @option{-dp} annotation.
15624 @item -dx
15625 @opindex dx
15626 Just generate RTL for a function instead of compiling it.  Usually used
15627 with @option{-fdump-rtl-expand}.
15628 @end table
15630 @item -fdump-debug
15631 @opindex fdump-debug
15632 Dump debugging information generated during the debug
15633 generation phase.
15635 @item -fdump-earlydebug
15636 @opindex fdump-earlydebug
15637 Dump debugging information generated during the early debug
15638 generation phase.
15640 @item -fdump-noaddr
15641 @opindex fdump-noaddr
15642 When doing debugging dumps, suppress address output.  This makes it more
15643 feasible to use diff on debugging dumps for compiler invocations with
15644 different compiler binaries and/or different
15645 text / bss / data / heap / stack / dso start locations.
15647 @item -freport-bug
15648 @opindex freport-bug
15649 Collect and dump debug information into a temporary file if an
15650 internal compiler error (ICE) occurs.
15652 @item -fdump-unnumbered
15653 @opindex fdump-unnumbered
15654 When doing debugging dumps, suppress instruction numbers and address output.
15655 This makes it more feasible to use diff on debugging dumps for compiler
15656 invocations with different options, in particular with and without
15657 @option{-g}.
15659 @item -fdump-unnumbered-links
15660 @opindex fdump-unnumbered-links
15661 When doing debugging dumps (see @option{-d} option above), suppress
15662 instruction numbers for the links to the previous and next instructions
15663 in a sequence.
15665 @item -fdump-ipa-@var{switch}
15666 @itemx -fdump-ipa-@var{switch}-@var{options}
15667 @opindex fdump-ipa
15668 Control the dumping at various stages of inter-procedural analysis
15669 language tree to a file.  The file name is generated by appending a
15670 switch specific suffix to the source file name, and the file is created
15671 in the same directory as the output file.  The following dumps are
15672 possible:
15674 @table @samp
15675 @item all
15676 Enables all inter-procedural analysis dumps.
15678 @item cgraph
15679 Dumps information about call-graph optimization, unused function removal,
15680 and inlining decisions.
15682 @item inline
15683 Dump after function inlining.
15685 @end table
15687 Additionally, the options @option{-optimized}, @option{-missed},
15688 @option{-note}, and @option{-all} can be provided, with the same meaning
15689 as for @option{-fopt-info}, defaulting to @option{-optimized}.
15691 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
15692 information on callsites that were inlined, along with callsites
15693 that were not inlined.
15695 By default, the dump will contain messages about successful
15696 optimizations (equivalent to @option{-optimized}) together with
15697 low-level details about the analysis.
15699 @item -fdump-lang-all
15700 @itemx -fdump-lang-@var{switch}
15701 @itemx -fdump-lang-@var{switch}-@var{options}
15702 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
15703 @opindex fdump-lang-all
15704 @opindex fdump-lang
15705 Control the dumping of language-specific information.  The @var{options}
15706 and @var{filename} portions behave as described in the
15707 @option{-fdump-tree} option.  The following @var{switch} values are
15708 accepted:
15710 @table @samp
15711 @item all
15713 Enable all language-specific dumps.
15715 @item class
15716 Dump class hierarchy information.  Virtual table information is emitted
15717 unless '@option{slim}' is specified.  This option is applicable to C++ only.
15719 @item raw
15720 Dump the raw internal tree data.  This option is applicable to C++ only.
15722 @end table
15724 @item -fdump-passes
15725 @opindex fdump-passes
15726 Print on @file{stderr} the list of optimization passes that are turned
15727 on and off by the current command-line options.
15729 @item -fdump-statistics-@var{option}
15730 @opindex fdump-statistics
15731 Enable and control dumping of pass statistics in a separate file.  The
15732 file name is generated by appending a suffix ending in
15733 @samp{.statistics} to the source file name, and the file is created in
15734 the same directory as the output file.  If the @samp{-@var{option}}
15735 form is used, @samp{-stats} causes counters to be summed over the
15736 whole compilation unit while @samp{-details} dumps every event as
15737 the passes generate them.  The default with no option is to sum
15738 counters for each function compiled.
15740 @item -fdump-tree-all
15741 @itemx -fdump-tree-@var{switch}
15742 @itemx -fdump-tree-@var{switch}-@var{options}
15743 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15744 @opindex fdump-tree-all
15745 @opindex fdump-tree
15746 Control the dumping at various stages of processing the intermediate
15747 language tree to a file.  If the @samp{-@var{options}}
15748 form is used, @var{options} is a list of @samp{-} separated options
15749 which control the details of the dump.  Not all options are applicable
15750 to all dumps; those that are not meaningful are ignored.  The
15751 following options are available
15753 @table @samp
15754 @item address
15755 Print the address of each node.  Usually this is not meaningful as it
15756 changes according to the environment and source file.  Its primary use
15757 is for tying up a dump file with a debug environment.
15758 @item asmname
15759 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15760 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
15761 use working backward from mangled names in the assembly file.
15762 @item slim
15763 When dumping front-end intermediate representations, inhibit dumping
15764 of members of a scope or body of a function merely because that scope
15765 has been reached.  Only dump such items when they are directly reachable
15766 by some other path.
15768 When dumping pretty-printed trees, this option inhibits dumping the
15769 bodies of control structures.
15771 When dumping RTL, print the RTL in slim (condensed) form instead of
15772 the default LISP-like representation.
15773 @item raw
15774 Print a raw representation of the tree.  By default, trees are
15775 pretty-printed into a C-like representation.
15776 @item details
15777 Enable more detailed dumps (not honored by every dump option). Also
15778 include information from the optimization passes.
15779 @item stats
15780 Enable dumping various statistics about the pass (not honored by every dump
15781 option).
15782 @item blocks
15783 Enable showing basic block boundaries (disabled in raw dumps).
15784 @item graph
15785 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15786 dump a representation of the control flow graph suitable for viewing with
15787 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
15788 the file is pretty-printed as a subgraph, so that GraphViz can render them
15789 all in a single plot.
15791 This option currently only works for RTL dumps, and the RTL is always
15792 dumped in slim form.
15793 @item vops
15794 Enable showing virtual operands for every statement.
15795 @item lineno
15796 Enable showing line numbers for statements.
15797 @item uid
15798 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15799 @item verbose
15800 Enable showing the tree dump for each statement.
15801 @item eh
15802 Enable showing the EH region number holding each statement.
15803 @item scev
15804 Enable showing scalar evolution analysis details.
15805 @item optimized
15806 Enable showing optimization information (only available in certain
15807 passes).
15808 @item missed
15809 Enable showing missed optimization information (only available in certain
15810 passes).
15811 @item note
15812 Enable other detailed optimization information (only available in
15813 certain passes).
15814 @item all
15815 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15816 and @option{lineno}.
15817 @item optall
15818 Turn on all optimization options, i.e., @option{optimized},
15819 @option{missed}, and @option{note}.
15820 @end table
15822 To determine what tree dumps are available or find the dump for a pass
15823 of interest follow the steps below.
15825 @enumerate
15826 @item
15827 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15828 look for a code that corresponds to the pass you are interested in.
15829 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15830 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15831 The number at the end distinguishes distinct invocations of the same pass.
15832 @item
15833 To enable the creation of the dump file, append the pass code to
15834 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
15835 to enable the dump from the Early Value Range Propagation pass, invoke
15836 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
15837 specify the name of the dump file.  If you don't specify one, GCC
15838 creates as described below.
15839 @item
15840 Find the pass dump in a file whose name is composed of three components
15841 separated by a period: the name of the source file GCC was invoked to
15842 compile, a numeric suffix indicating the pass number followed by the
15843 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15844 and finally the pass code.  For example, the Early VRP pass dump might
15845 be in a file named @file{myfile.c.038t.evrp} in the current working
15846 directory.  Note that the numeric codes are not stable and may change
15847 from one version of GCC to another.
15848 @end enumerate
15850 @item -fopt-info
15851 @itemx -fopt-info-@var{options}
15852 @itemx -fopt-info-@var{options}=@var{filename}
15853 @opindex fopt-info
15854 Controls optimization dumps from various optimization passes. If the
15855 @samp{-@var{options}} form is used, @var{options} is a list of
15856 @samp{-} separated option keywords to select the dump details and
15857 optimizations.  
15859 The @var{options} can be divided into three groups:
15860 @enumerate
15861 @item
15862 options describing what kinds of messages should be emitted,
15863 @item
15864 options describing the verbosity of the dump, and
15865 @item
15866 options describing which optimizations should be included.
15867 @end enumerate
15868 The options from each group can be freely mixed as they are
15869 non-overlapping. However, in case of any conflicts,
15870 the later options override the earlier options on the command
15871 line. 
15873 The following options control which kinds of messages should be emitted:
15875 @table @samp
15876 @item optimized
15877 Print information when an optimization is successfully applied. It is
15878 up to a pass to decide which information is relevant. For example, the
15879 vectorizer passes print the source location of loops which are
15880 successfully vectorized.
15881 @item missed
15882 Print information about missed optimizations. Individual passes
15883 control which information to include in the output. 
15884 @item note
15885 Print verbose information about optimizations, such as certain
15886 transformations, more detailed messages about decisions etc.
15887 @item all
15888 Print detailed optimization information. This includes
15889 @samp{optimized}, @samp{missed}, and @samp{note}.
15890 @end table
15892 The following option controls the dump verbosity:
15894 @table @samp
15895 @item internals
15896 By default, only ``high-level'' messages are emitted. This option enables
15897 additional, more detailed, messages, which are likely to only be of interest
15898 to GCC developers.
15899 @end table
15901 One or more of the following option keywords can be used to describe a
15902 group of optimizations:
15904 @table @samp
15905 @item ipa
15906 Enable dumps from all interprocedural optimizations.
15907 @item loop
15908 Enable dumps from all loop optimizations.
15909 @item inline
15910 Enable dumps from all inlining optimizations.
15911 @item omp
15912 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15913 @item vec
15914 Enable dumps from all vectorization optimizations.
15915 @item optall
15916 Enable dumps from all optimizations. This is a superset of
15917 the optimization groups listed above.
15918 @end table
15920 If @var{options} is
15921 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15922 about successful optimizations from all the passes, omitting messages
15923 that are treated as ``internals''.
15925 If the @var{filename} is provided, then the dumps from all the
15926 applicable optimizations are concatenated into the @var{filename}.
15927 Otherwise the dump is output onto @file{stderr}. Though multiple
15928 @option{-fopt-info} options are accepted, only one of them can include
15929 a @var{filename}. If other filenames are provided then all but the
15930 first such option are ignored.
15932 Note that the output @var{filename} is overwritten
15933 in case of multiple translation units. If a combined output from
15934 multiple translation units is desired, @file{stderr} should be used
15935 instead.
15937 In the following example, the optimization info is output to
15938 @file{stderr}:
15940 @smallexample
15941 gcc -O3 -fopt-info
15942 @end smallexample
15944 This example:
15945 @smallexample
15946 gcc -O3 -fopt-info-missed=missed.all
15947 @end smallexample
15949 @noindent
15950 outputs missed optimization report from all the passes into
15951 @file{missed.all}, and this one:
15953 @smallexample
15954 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15955 @end smallexample
15957 @noindent
15958 prints information about missed optimization opportunities from
15959 vectorization passes on @file{stderr}.  
15960 Note that @option{-fopt-info-vec-missed} is equivalent to 
15961 @option{-fopt-info-missed-vec}.  The order of the optimization group
15962 names and message types listed after @option{-fopt-info} does not matter.
15964 As another example,
15965 @smallexample
15966 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15967 @end smallexample
15969 @noindent
15970 outputs information about missed optimizations as well as
15971 optimized locations from all the inlining passes into
15972 @file{inline.txt}.
15974 Finally, consider:
15976 @smallexample
15977 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15978 @end smallexample
15980 @noindent
15981 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15982 in conflict since only one output file is allowed. In this case, only
15983 the first option takes effect and the subsequent options are
15984 ignored. Thus only @file{vec.miss} is produced which contains
15985 dumps from the vectorizer about missed opportunities.
15987 @item -fsave-optimization-record
15988 @opindex fsave-optimization-record
15989 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15990 were performed, for those optimizations that support @option{-fopt-info}.
15992 This option is experimental and the format of the data within the
15993 compressed JSON file is subject to change.
15995 It is roughly equivalent to a machine-readable version of
15996 @option{-fopt-info-all}, as a collection of messages with source file,
15997 line number and column number, with the following additional data for
15998 each message:
16000 @itemize @bullet
16002 @item
16003 the execution count of the code being optimized, along with metadata about
16004 whether this was from actual profile data, or just an estimate, allowing
16005 consumers to prioritize messages by code hotness,
16007 @item
16008 the function name of the code being optimized, where applicable,
16010 @item
16011 the ``inlining chain'' for the code being optimized, so that when
16012 a function is inlined into several different places (which might
16013 themselves be inlined), the reader can distinguish between the copies,
16015 @item
16016 objects identifying those parts of the message that refer to expressions,
16017 statements or symbol-table nodes, which of these categories they are, and,
16018 when available, their source code location,
16020 @item
16021 the GCC pass that emitted the message, and
16023 @item
16024 the location in GCC's own code from which the message was emitted
16026 @end itemize
16028 Additionally, some messages are logically nested within other
16029 messages, reflecting implementation details of the optimization
16030 passes.
16032 @item -fsched-verbose=@var{n}
16033 @opindex fsched-verbose
16034 On targets that use instruction scheduling, this option controls the
16035 amount of debugging output the scheduler prints to the dump files.
16037 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16038 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16039 For @var{n} greater than one, it also output basic block probabilities,
16040 detailed ready list information and unit/insn info.  For @var{n} greater
16041 than two, it includes RTL at abort point, control-flow and regions info.
16042 And for @var{n} over four, @option{-fsched-verbose} also includes
16043 dependence info.
16047 @item -fenable-@var{kind}-@var{pass}
16048 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16049 @opindex fdisable-
16050 @opindex fenable-
16052 This is a set of options that are used to explicitly disable/enable
16053 optimization passes.  These options are intended for use for debugging GCC.
16054 Compiler users should use regular options for enabling/disabling
16055 passes instead.
16057 @table @gcctabopt
16059 @item -fdisable-ipa-@var{pass}
16060 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
16061 statically invoked in the compiler multiple times, the pass name should be
16062 appended with a sequential number starting from 1.
16064 @item -fdisable-rtl-@var{pass}
16065 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
16066 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16067 statically invoked in the compiler multiple times, the pass name should be
16068 appended with a sequential number starting from 1.  @var{range-list} is a 
16069 comma-separated list of function ranges or assembler names.  Each range is a number
16070 pair separated by a colon.  The range is inclusive in both ends.  If the range
16071 is trivial, the number pair can be simplified as a single number.  If the
16072 function's call graph node's @var{uid} falls within one of the specified ranges,
16073 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
16074 function header of a dump file, and the pass names can be dumped by using
16075 option @option{-fdump-passes}.
16077 @item -fdisable-tree-@var{pass}
16078 @itemx -fdisable-tree-@var{pass}=@var{range-list}
16079 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
16080 option arguments.
16082 @item -fenable-ipa-@var{pass}
16083 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16084 statically invoked in the compiler multiple times, the pass name should be
16085 appended with a sequential number starting from 1.
16087 @item -fenable-rtl-@var{pass}
16088 @itemx -fenable-rtl-@var{pass}=@var{range-list}
16089 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
16090 description and examples.
16092 @item -fenable-tree-@var{pass}
16093 @itemx -fenable-tree-@var{pass}=@var{range-list}
16094 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
16095 of option arguments.
16097 @end table
16099 Here are some examples showing uses of these options.
16101 @smallexample
16103 # disable ccp1 for all functions
16104    -fdisable-tree-ccp1
16105 # disable complete unroll for function whose cgraph node uid is 1
16106    -fenable-tree-cunroll=1
16107 # disable gcse2 for functions at the following ranges [1,1],
16108 # [300,400], and [400,1000]
16109 # disable gcse2 for functions foo and foo2
16110    -fdisable-rtl-gcse2=foo,foo2
16111 # disable early inlining
16112    -fdisable-tree-einline
16113 # disable ipa inlining
16114    -fdisable-ipa-inline
16115 # enable tree full unroll
16116    -fenable-tree-unroll
16118 @end smallexample
16120 @item -fchecking
16121 @itemx -fchecking=@var{n}
16122 @opindex fchecking
16123 @opindex fno-checking
16124 Enable internal consistency checking.  The default depends on
16125 the compiler configuration.  @option{-fchecking=2} enables further
16126 internal consistency checking that might affect code generation.
16128 @item -frandom-seed=@var{string}
16129 @opindex frandom-seed
16130 This option provides a seed that GCC uses in place of
16131 random numbers in generating certain symbol names
16132 that have to be different in every compiled file.  It is also used to
16133 place unique stamps in coverage data files and the object files that
16134 produce them.  You can use the @option{-frandom-seed} option to produce
16135 reproducibly identical object files.
16137 The @var{string} can either be a number (decimal, octal or hex) or an
16138 arbitrary string (in which case it's converted to a number by
16139 computing CRC32).
16141 The @var{string} should be different for every file you compile.
16143 @item -save-temps
16144 @itemx -save-temps=cwd
16145 @opindex save-temps
16146 Store the usual ``temporary'' intermediate files permanently; place them
16147 in the current directory and name them based on the source file.  Thus,
16148 compiling @file{foo.c} with @option{-c -save-temps} produces files
16149 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
16150 preprocessed @file{foo.i} output file even though the compiler now
16151 normally uses an integrated preprocessor.
16153 When used in combination with the @option{-x} command-line option,
16154 @option{-save-temps} is sensible enough to avoid over writing an
16155 input source file with the same extension as an intermediate file.
16156 The corresponding intermediate file may be obtained by renaming the
16157 source file before using @option{-save-temps}.
16159 If you invoke GCC in parallel, compiling several different source
16160 files that share a common base name in different subdirectories or the
16161 same source file compiled for multiple output destinations, it is
16162 likely that the different parallel compilers will interfere with each
16163 other, and overwrite the temporary files.  For instance:
16165 @smallexample
16166 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
16167 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
16168 @end smallexample
16170 may result in @file{foo.i} and @file{foo.o} being written to
16171 simultaneously by both compilers.
16173 @item -save-temps=obj
16174 @opindex save-temps=obj
16175 Store the usual ``temporary'' intermediate files permanently.  If the
16176 @option{-o} option is used, the temporary files are based on the
16177 object file.  If the @option{-o} option is not used, the
16178 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
16180 For example:
16182 @smallexample
16183 gcc -save-temps=obj -c foo.c
16184 gcc -save-temps=obj -c bar.c -o dir/xbar.o
16185 gcc -save-temps=obj foobar.c -o dir2/yfoobar
16186 @end smallexample
16188 @noindent
16189 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
16190 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
16191 @file{dir2/yfoobar.o}.
16193 @item -time@r{[}=@var{file}@r{]}
16194 @opindex time
16195 Report the CPU time taken by each subprocess in the compilation
16196 sequence.  For C source files, this is the compiler proper and assembler
16197 (plus the linker if linking is done).
16199 Without the specification of an output file, the output looks like this:
16201 @smallexample
16202 # cc1 0.12 0.01
16203 # as 0.00 0.01
16204 @end smallexample
16206 The first number on each line is the ``user time'', that is time spent
16207 executing the program itself.  The second number is ``system time'',
16208 time spent executing operating system routines on behalf of the program.
16209 Both numbers are in seconds.
16211 With the specification of an output file, the output is appended to the
16212 named file, and it looks like this:
16214 @smallexample
16215 0.12 0.01 cc1 @var{options}
16216 0.00 0.01 as @var{options}
16217 @end smallexample
16219 The ``user time'' and the ``system time'' are moved before the program
16220 name, and the options passed to the program are displayed, so that one
16221 can later tell what file was being compiled, and with which options.
16223 @item -fdump-final-insns@r{[}=@var{file}@r{]}
16224 @opindex fdump-final-insns
16225 Dump the final internal representation (RTL) to @var{file}.  If the
16226 optional argument is omitted (or if @var{file} is @code{.}), the name
16227 of the dump file is determined by appending @code{.gkd} to the
16228 compilation output file name.
16230 @item -fcompare-debug@r{[}=@var{opts}@r{]}
16231 @opindex fcompare-debug
16232 @opindex fno-compare-debug
16233 If no error occurs during compilation, run the compiler a second time,
16234 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16235 passed to the second compilation.  Dump the final internal
16236 representation in both compilations, and print an error if they differ.
16238 If the equal sign is omitted, the default @option{-gtoggle} is used.
16240 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16241 and nonzero, implicitly enables @option{-fcompare-debug}.  If
16242 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16243 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16244 is used.
16246 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
16247 is equivalent to @option{-fno-compare-debug}, which disables the dumping
16248 of the final representation and the second compilation, preventing even
16249 @env{GCC_COMPARE_DEBUG} from taking effect.
16251 To verify full coverage during @option{-fcompare-debug} testing, set
16252 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16253 which GCC rejects as an invalid option in any actual compilation
16254 (rather than preprocessing, assembly or linking).  To get just a
16255 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16256 not overridden} will do.
16258 @item -fcompare-debug-second
16259 @opindex fcompare-debug-second
16260 This option is implicitly passed to the compiler for the second
16261 compilation requested by @option{-fcompare-debug}, along with options to
16262 silence warnings, and omitting other options that would cause the compiler
16263 to produce output to files or to standard output as a side effect.  Dump
16264 files and preserved temporary files are renamed so as to contain the
16265 @code{.gk} additional extension during the second compilation, to avoid
16266 overwriting those generated by the first.
16268 When this option is passed to the compiler driver, it causes the
16269 @emph{first} compilation to be skipped, which makes it useful for little
16270 other than debugging the compiler proper.
16272 @item -gtoggle
16273 @opindex gtoggle
16274 Turn off generation of debug info, if leaving out this option
16275 generates it, or turn it on at level 2 otherwise.  The position of this
16276 argument in the command line does not matter; it takes effect after all
16277 other options are processed, and it does so only once, no matter how
16278 many times it is given.  This is mainly intended to be used with
16279 @option{-fcompare-debug}.
16281 @item -fvar-tracking-assignments-toggle
16282 @opindex fvar-tracking-assignments-toggle
16283 @opindex fno-var-tracking-assignments-toggle
16284 Toggle @option{-fvar-tracking-assignments}, in the same way that
16285 @option{-gtoggle} toggles @option{-g}.
16287 @item -Q
16288 @opindex Q
16289 Makes the compiler print out each function name as it is compiled, and
16290 print some statistics about each pass when it finishes.
16292 @item -ftime-report
16293 @opindex ftime-report
16294 Makes the compiler print some statistics about the time consumed by each
16295 pass when it finishes.
16297 @item -ftime-report-details
16298 @opindex ftime-report-details
16299 Record the time consumed by infrastructure parts separately for each pass.
16301 @item -fira-verbose=@var{n}
16302 @opindex fira-verbose
16303 Control the verbosity of the dump file for the integrated register allocator.
16304 The default value is 5.  If the value @var{n} is greater or equal to 10,
16305 the dump output is sent to stderr using the same format as @var{n} minus 10.
16307 @item -flto-report
16308 @opindex flto-report
16309 Prints a report with internal details on the workings of the link-time
16310 optimizer.  The contents of this report vary from version to version.
16311 It is meant to be useful to GCC developers when processing object
16312 files in LTO mode (via @option{-flto}).
16314 Disabled by default.
16316 @item -flto-report-wpa
16317 @opindex flto-report-wpa
16318 Like @option{-flto-report}, but only print for the WPA phase of link-time
16319 optimization.
16321 @item -fmem-report
16322 @opindex fmem-report
16323 Makes the compiler print some statistics about permanent memory
16324 allocation when it finishes.
16326 @item -fmem-report-wpa
16327 @opindex fmem-report-wpa
16328 Makes the compiler print some statistics about permanent memory
16329 allocation for the WPA phase only.
16331 @item -fpre-ipa-mem-report
16332 @opindex fpre-ipa-mem-report
16333 @item -fpost-ipa-mem-report
16334 @opindex fpost-ipa-mem-report
16335 Makes the compiler print some statistics about permanent memory
16336 allocation before or after interprocedural optimization.
16338 @item -fprofile-report
16339 @opindex fprofile-report
16340 Makes the compiler print some statistics about consistency of the
16341 (estimated) profile and effect of individual passes.
16343 @item -fstack-usage
16344 @opindex fstack-usage
16345 Makes the compiler output stack usage information for the program, on a
16346 per-function basis.  The filename for the dump is made by appending
16347 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
16348 the output file, if explicitly specified and it is not an executable,
16349 otherwise it is the basename of the source file.  An entry is made up
16350 of three fields:
16352 @itemize
16353 @item
16354 The name of the function.
16355 @item
16356 A number of bytes.
16357 @item
16358 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16359 @end itemize
16361 The qualifier @code{static} means that the function manipulates the stack
16362 statically: a fixed number of bytes are allocated for the frame on function
16363 entry and released on function exit; no stack adjustments are otherwise made
16364 in the function.  The second field is this fixed number of bytes.
16366 The qualifier @code{dynamic} means that the function manipulates the stack
16367 dynamically: in addition to the static allocation described above, stack
16368 adjustments are made in the body of the function, for example to push/pop
16369 arguments around function calls.  If the qualifier @code{bounded} is also
16370 present, the amount of these adjustments is bounded at compile time and
16371 the second field is an upper bound of the total amount of stack used by
16372 the function.  If it is not present, the amount of these adjustments is
16373 not bounded at compile time and the second field only represents the
16374 bounded part.
16376 @item -fstats
16377 @opindex fstats
16378 Emit statistics about front-end processing at the end of the compilation.
16379 This option is supported only by the C++ front end, and
16380 the information is generally only useful to the G++ development team.
16382 @item -fdbg-cnt-list
16383 @opindex fdbg-cnt-list
16384 Print the name and the counter upper bound for all debug counters.
16387 @item -fdbg-cnt=@var{counter-value-list}
16388 @opindex fdbg-cnt
16389 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
16390 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16391 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16392 the name of the counter and list of closed intervals.
16393 The @var{lower_bound} is optional and is zero
16394 initialized if not set.
16395 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16396 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16397 eleventh invocation.
16398 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16400 @item -print-file-name=@var{library}
16401 @opindex print-file-name
16402 Print the full absolute name of the library file @var{library} that
16403 would be used when linking---and don't do anything else.  With this
16404 option, GCC does not compile or link anything; it just prints the
16405 file name.
16407 @item -print-multi-directory
16408 @opindex print-multi-directory
16409 Print the directory name corresponding to the multilib selected by any
16410 other switches present in the command line.  This directory is supposed
16411 to exist in @env{GCC_EXEC_PREFIX}.
16413 @item -print-multi-lib
16414 @opindex print-multi-lib
16415 Print the mapping from multilib directory names to compiler switches
16416 that enable them.  The directory name is separated from the switches by
16417 @samp{;}, and each switch starts with an @samp{@@} instead of the
16418 @samp{-}, without spaces between multiple switches.  This is supposed to
16419 ease shell processing.
16421 @item -print-multi-os-directory
16422 @opindex print-multi-os-directory
16423 Print the path to OS libraries for the selected
16424 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
16425 present in the @file{lib} subdirectory and no multilibs are used, this is
16426 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16427 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16428 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16429 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16431 @item -print-multiarch
16432 @opindex print-multiarch
16433 Print the path to OS libraries for the selected multiarch,
16434 relative to some @file{lib} subdirectory.
16436 @item -print-prog-name=@var{program}
16437 @opindex print-prog-name
16438 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16440 @item -print-libgcc-file-name
16441 @opindex print-libgcc-file-name
16442 Same as @option{-print-file-name=libgcc.a}.
16444 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16445 but you do want to link with @file{libgcc.a}.  You can do:
16447 @smallexample
16448 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16449 @end smallexample
16451 @item -print-search-dirs
16452 @opindex print-search-dirs
16453 Print the name of the configured installation directory and a list of
16454 program and library directories @command{gcc} searches---and don't do anything else.
16456 This is useful when @command{gcc} prints the error message
16457 @samp{installation problem, cannot exec cpp0: No such file or directory}.
16458 To resolve this you either need to put @file{cpp0} and the other compiler
16459 components where @command{gcc} expects to find them, or you can set the environment
16460 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16461 Don't forget the trailing @samp{/}.
16462 @xref{Environment Variables}.
16464 @item -print-sysroot
16465 @opindex print-sysroot
16466 Print the target sysroot directory that is used during
16467 compilation.  This is the target sysroot specified either at configure
16468 time or using the @option{--sysroot} option, possibly with an extra
16469 suffix that depends on compilation options.  If no target sysroot is
16470 specified, the option prints nothing.
16472 @item -print-sysroot-headers-suffix
16473 @opindex print-sysroot-headers-suffix
16474 Print the suffix added to the target sysroot when searching for
16475 headers, or give an error if the compiler is not configured with such
16476 a suffix---and don't do anything else.
16478 @item -dumpmachine
16479 @opindex dumpmachine
16480 Print the compiler's target machine (for example,
16481 @samp{i686-pc-linux-gnu})---and don't do anything else.
16483 @item -dumpversion
16484 @opindex dumpversion
16485 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16486 anything else.  This is the compiler version used in filesystem paths and
16487 specs. Depending on how the compiler has been configured it can be just
16488 a single number (major version), two numbers separated by a dot (major and
16489 minor version) or three numbers separated by dots (major, minor and patchlevel
16490 version).
16492 @item -dumpfullversion
16493 @opindex dumpfullversion
16494 Print the full compiler version---and don't do anything else. The output is
16495 always three numbers separated by dots, major, minor and patchlevel version.
16497 @item -dumpspecs
16498 @opindex dumpspecs
16499 Print the compiler's built-in specs---and don't do anything else.  (This
16500 is used when GCC itself is being built.)  @xref{Spec Files}.
16501 @end table
16503 @node Submodel Options
16504 @section Machine-Dependent Options
16505 @cindex submodel options
16506 @cindex specifying hardware config
16507 @cindex hardware models and configurations, specifying
16508 @cindex target-dependent options
16509 @cindex machine-dependent options
16511 Each target machine supported by GCC can have its own options---for
16512 example, to allow you to compile for a particular processor variant or
16513 ABI, or to control optimizations specific to that machine.  By
16514 convention, the names of machine-specific options start with
16515 @samp{-m}.
16517 Some configurations of the compiler also support additional target-specific
16518 options, usually for compatibility with other compilers on the same
16519 platform.
16521 @c This list is ordered alphanumerically by subsection name.
16522 @c It should be the same order and spelling as these options are listed
16523 @c in Machine Dependent Options
16525 @menu
16526 * AArch64 Options::
16527 * Adapteva Epiphany Options::
16528 * AMD GCN Options::
16529 * ARC Options::
16530 * ARM Options::
16531 * AVR Options::
16532 * Blackfin Options::
16533 * C6X Options::
16534 * CRIS Options::
16535 * CR16 Options::
16536 * C-SKY Options::
16537 * Darwin Options::
16538 * DEC Alpha Options::
16539 * eBPF Options::
16540 * FR30 Options::
16541 * FT32 Options::
16542 * FRV Options::
16543 * GNU/Linux Options::
16544 * H8/300 Options::
16545 * HPPA Options::
16546 * IA-64 Options::
16547 * LM32 Options::
16548 * M32C Options::
16549 * M32R/D Options::
16550 * M680x0 Options::
16551 * MCore Options::
16552 * MeP Options::
16553 * MicroBlaze Options::
16554 * MIPS Options::
16555 * MMIX Options::
16556 * MN10300 Options::
16557 * Moxie Options::
16558 * MSP430 Options::
16559 * NDS32 Options::
16560 * Nios II Options::
16561 * Nvidia PTX Options::
16562 * OpenRISC Options::
16563 * PDP-11 Options::
16564 * picoChip Options::
16565 * PowerPC Options::
16566 * PRU Options::
16567 * RISC-V Options::
16568 * RL78 Options::
16569 * RS/6000 and PowerPC Options::
16570 * RX Options::
16571 * S/390 and zSeries Options::
16572 * Score Options::
16573 * SH Options::
16574 * Solaris 2 Options::
16575 * SPARC Options::
16576 * System V Options::
16577 * TILE-Gx Options::
16578 * TILEPro Options::
16579 * V850 Options::
16580 * VAX Options::
16581 * Visium Options::
16582 * VMS Options::
16583 * VxWorks Options::
16584 * x86 Options::
16585 * x86 Windows Options::
16586 * Xstormy16 Options::
16587 * Xtensa Options::
16588 * zSeries Options::
16589 @end menu
16591 @node AArch64 Options
16592 @subsection AArch64 Options
16593 @cindex AArch64 Options
16595 These options are defined for AArch64 implementations:
16597 @table @gcctabopt
16599 @item -mabi=@var{name}
16600 @opindex mabi
16601 Generate code for the specified data model.  Permissible values
16602 are @samp{ilp32} for SysV-like data model where int, long int and pointers
16603 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
16604 but long int and pointers are 64 bits.
16606 The default depends on the specific target configuration.  Note that
16607 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
16608 entire program with the same ABI, and link with a compatible set of libraries.
16610 @item -mbig-endian
16611 @opindex mbig-endian
16612 Generate big-endian code.  This is the default when GCC is configured for an
16613 @samp{aarch64_be-*-*} target.
16615 @item -mgeneral-regs-only
16616 @opindex mgeneral-regs-only
16617 Generate code which uses only the general-purpose registers.  This will prevent
16618 the compiler from using floating-point and Advanced SIMD registers but will not
16619 impose any restrictions on the assembler.
16621 @item -mlittle-endian
16622 @opindex mlittle-endian
16623 Generate little-endian code.  This is the default when GCC is configured for an
16624 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
16626 @item -mcmodel=tiny
16627 @opindex mcmodel=tiny
16628 Generate code for the tiny code model.  The program and its statically defined
16629 symbols must be within 1MB of each other.  Programs can be statically or
16630 dynamically linked.
16632 @item -mcmodel=small
16633 @opindex mcmodel=small
16634 Generate code for the small code model.  The program and its statically defined
16635 symbols must be within 4GB of each other.  Programs can be statically or
16636 dynamically linked.  This is the default code model.
16638 @item -mcmodel=large
16639 @opindex mcmodel=large
16640 Generate code for the large code model.  This makes no assumptions about
16641 addresses and sizes of sections.  Programs can be statically linked only.
16643 @item -mstrict-align
16644 @itemx -mno-strict-align
16645 @opindex mstrict-align
16646 @opindex mno-strict-align
16647 Avoid or allow generating memory accesses that may not be aligned on a natural
16648 object boundary as described in the architecture specification.
16650 @item -momit-leaf-frame-pointer
16651 @itemx -mno-omit-leaf-frame-pointer
16652 @opindex momit-leaf-frame-pointer
16653 @opindex mno-omit-leaf-frame-pointer
16654 Omit or keep the frame pointer in leaf functions.  The former behavior is the
16655 default.
16657 @item -mstack-protector-guard=@var{guard}
16658 @itemx -mstack-protector-guard-reg=@var{reg}
16659 @itemx -mstack-protector-guard-offset=@var{offset}
16660 @opindex mstack-protector-guard
16661 @opindex mstack-protector-guard-reg
16662 @opindex mstack-protector-guard-offset
16663 Generate stack protection code using canary at @var{guard}.  Supported
16664 locations are @samp{global} for a global canary or @samp{sysreg} for a
16665 canary in an appropriate system register.
16667 With the latter choice the options
16668 @option{-mstack-protector-guard-reg=@var{reg}} and
16669 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16670 which system register to use as base register for reading the canary,
16671 and from what offset from that base register. There is no default
16672 register or offset as this is entirely for use within the Linux
16673 kernel.
16675 @item -mstack-protector-guard=@var{guard}
16676 @itemx -mstack-protector-guard-reg=@var{reg}
16677 @itemx -mstack-protector-guard-offset=@var{offset}
16678 @opindex mstack-protector-guard
16679 @opindex mstack-protector-guard-reg
16680 @opindex mstack-protector-guard-offset
16681 Generate stack protection code using canary at @var{guard}.  Supported
16682 locations are @samp{global} for a global canary or @samp{sysreg} for a
16683 canary in an appropriate system register.
16685 With the latter choice the options
16686 @option{-mstack-protector-guard-reg=@var{reg}} and
16687 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16688 which system register to use as base register for reading the canary,
16689 and from what offset from that base register. There is no default
16690 register or offset as this is entirely for use within the Linux
16691 kernel.
16693 @item -mtls-dialect=desc
16694 @opindex mtls-dialect=desc
16695 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
16696 of TLS variables.  This is the default.
16698 @item -mtls-dialect=traditional
16699 @opindex mtls-dialect=traditional
16700 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
16701 of TLS variables.
16703 @item -mtls-size=@var{size}
16704 @opindex mtls-size
16705 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
16706 This option requires binutils 2.26 or newer.
16708 @item -mfix-cortex-a53-835769
16709 @itemx -mno-fix-cortex-a53-835769
16710 @opindex mfix-cortex-a53-835769
16711 @opindex mno-fix-cortex-a53-835769
16712 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
16713 This involves inserting a NOP instruction between memory instructions and
16714 64-bit integer multiply-accumulate instructions.
16716 @item -mfix-cortex-a53-843419
16717 @itemx -mno-fix-cortex-a53-843419
16718 @opindex mfix-cortex-a53-843419
16719 @opindex mno-fix-cortex-a53-843419
16720 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
16721 This erratum workaround is made at link time and this will only pass the
16722 corresponding flag to the linker.
16724 @item -mlow-precision-recip-sqrt
16725 @itemx -mno-low-precision-recip-sqrt
16726 @opindex mlow-precision-recip-sqrt
16727 @opindex mno-low-precision-recip-sqrt
16728 Enable or disable the reciprocal square root approximation.
16729 This option only has an effect if @option{-ffast-math} or
16730 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16731 precision of reciprocal square root results to about 16 bits for
16732 single precision and to 32 bits for double precision.
16734 @item -mlow-precision-sqrt
16735 @itemx -mno-low-precision-sqrt
16736 @opindex mlow-precision-sqrt
16737 @opindex mno-low-precision-sqrt
16738 Enable or disable the square root approximation.
16739 This option only has an effect if @option{-ffast-math} or
16740 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16741 precision of square root results to about 16 bits for
16742 single precision and to 32 bits for double precision.
16743 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16745 @item -mlow-precision-div
16746 @itemx -mno-low-precision-div
16747 @opindex mlow-precision-div
16748 @opindex mno-low-precision-div
16749 Enable or disable the division approximation.
16750 This option only has an effect if @option{-ffast-math} or
16751 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16752 precision of division results to about 16 bits for
16753 single precision and to 32 bits for double precision.
16755 @item -mtrack-speculation
16756 @itemx -mno-track-speculation
16757 Enable or disable generation of additional code to track speculative
16758 execution through conditional branches.  The tracking state can then
16759 be used by the compiler when expanding calls to
16760 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16761 sequence to be generated.
16763 @item -moutline-atomics
16764 @itemx -mno-outline-atomics
16765 Enable or disable calls to out-of-line helpers to implement atomic operations.
16766 These helpers will, at runtime, determine if the LSE instructions from
16767 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16768 instructions that are present in the base ARMv8.0 ISA.
16770 This option is only applicable when compiling for the base ARMv8.0
16771 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
16772 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16773 used directly.  The same applies when using @option{-mcpu=} when the
16774 selected cpu supports the @samp{lse} feature.
16776 @item -march=@var{name}
16777 @opindex march
16778 Specify the name of the target architecture and, optionally, one or
16779 more feature modifiers.  This option has the form
16780 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16782 The table below summarizes the permissible values for @var{arch}
16783 and the features that they enable by default:
16785 @multitable @columnfractions 0.20 0.20 0.60
16786 @headitem @var{arch} value @tab Architecture @tab Includes by default
16787 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
16788 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
16789 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
16790 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
16791 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
16792 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
16793 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
16794 @end multitable
16796 The value @samp{native} is available on native AArch64 GNU/Linux and
16797 causes the compiler to pick the architecture of the host system.  This
16798 option has no effect if the compiler is unable to recognize the
16799 architecture of the host system,
16801 The permissible values for @var{feature} are listed in the sub-section
16802 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16803 Feature Modifiers}.  Where conflicting feature modifiers are
16804 specified, the right-most feature is used.
16806 GCC uses @var{name} to determine what kind of instructions it can emit
16807 when generating assembly code.  If @option{-march} is specified
16808 without either of @option{-mtune} or @option{-mcpu} also being
16809 specified, the code is tuned to perform well across a range of target
16810 processors implementing the target architecture.
16812 @item -mtune=@var{name}
16813 @opindex mtune
16814 Specify the name of the target processor for which GCC should tune the
16815 performance of the code.  Permissible values for this option are:
16816 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16817 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16818 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16819 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16820 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16821 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16822 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16823 @samp{octeontx81},  @samp{octeontx83},
16824 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
16825 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
16826 @samp{octeontx2f95mm}
16827 @samp{thunderx}, @samp{thunderxt88},
16828 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16829 @samp{thunderxt83}, @samp{thunderx2t99},
16830 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16831 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16832 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16833 @samp{native}.
16835 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16836 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16837 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16838 should tune for a big.LITTLE system.
16840 Additionally on native AArch64 GNU/Linux systems the value
16841 @samp{native} tunes performance to the host system.  This option has no effect
16842 if the compiler is unable to recognize the processor of the host system.
16844 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16845 are specified, the code is tuned to perform well across a range
16846 of target processors.
16848 This option cannot be suffixed by feature modifiers.
16850 @item -mcpu=@var{name}
16851 @opindex mcpu
16852 Specify the name of the target processor, optionally suffixed by one
16853 or more feature modifiers.  This option has the form
16854 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16855 the permissible values for @var{cpu} are the same as those available
16856 for @option{-mtune}.  The permissible values for @var{feature} are
16857 documented in the sub-section on
16858 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16859 Feature Modifiers}.  Where conflicting feature modifiers are
16860 specified, the right-most feature is used.
16862 GCC uses @var{name} to determine what kind of instructions it can emit when
16863 generating assembly code (as if by @option{-march}) and to determine
16864 the target processor for which to tune for performance (as if
16865 by @option{-mtune}).  Where this option is used in conjunction
16866 with @option{-march} or @option{-mtune}, those options take precedence
16867 over the appropriate part of this option.
16869 @item -moverride=@var{string}
16870 @opindex moverride
16871 Override tuning decisions made by the back-end in response to a
16872 @option{-mtune=} switch.  The syntax, semantics, and accepted values
16873 for @var{string} in this option are not guaranteed to be consistent
16874 across releases.
16876 This option is only intended to be useful when developing GCC.
16878 @item -mverbose-cost-dump
16879 @opindex mverbose-cost-dump
16880 Enable verbose cost model dumping in the debug dump files.  This option is
16881 provided for use in debugging the compiler.
16883 @item -mpc-relative-literal-loads
16884 @itemx -mno-pc-relative-literal-loads
16885 @opindex mpc-relative-literal-loads
16886 @opindex mno-pc-relative-literal-loads
16887 Enable or disable PC-relative literal loads.  With this option literal pools are
16888 accessed using a single instruction and emitted after each function.  This
16889 limits the maximum size of functions to 1MB.  This is enabled by default for
16890 @option{-mcmodel=tiny}.
16892 @item -msign-return-address=@var{scope}
16893 @opindex msign-return-address
16894 Select the function scope on which return address signing will be applied.
16895 Permissible values are @samp{none}, which disables return address signing,
16896 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16897 functions, and @samp{all}, which enables pointer signing for all functions.  The
16898 default value is @samp{none}. This option has been deprecated by
16899 -mbranch-protection.
16901 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16902 @opindex mbranch-protection
16903 Select the branch protection features to use.
16904 @samp{none} is the default and turns off all types of branch protection.
16905 @samp{standard} turns on all types of branch protection features.  If a feature
16906 has additional tuning options, then @samp{standard} sets it to its standard
16907 level.
16908 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16909 level: signing functions that save the return address to memory (non-leaf
16910 functions will practically always do this) using the a-key.  The optional
16911 argument @samp{leaf} can be used to extend the signing to include leaf
16912 functions.  The optional argument @samp{b-key} can be used to sign the functions
16913 with the B-key instead of the A-key.
16914 @samp{bti} turns on branch target identification mechanism.
16916 @item -msve-vector-bits=@var{bits}
16917 @opindex msve-vector-bits
16918 Specify the number of bits in an SVE vector register.  This option only has
16919 an effect when SVE is enabled.
16921 GCC supports two forms of SVE code generation: ``vector-length
16922 agnostic'' output that works with any size of vector register and
16923 ``vector-length specific'' output that allows GCC to make assumptions
16924 about the vector length when it is useful for optimization reasons.
16925 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16926 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16927 Specifying @samp{scalable} selects vector-length agnostic
16928 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
16929 agnostic output for big-endian targets.  All other values generate
16930 vector-length specific code.  The behavior of these values may change
16931 in future releases and no value except @samp{scalable} should be
16932 relied on for producing code that is portable across different
16933 hardware SVE vector lengths.
16935 The default is @samp{-msve-vector-bits=scalable}, which produces
16936 vector-length agnostic code.
16937 @end table
16939 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16940 @anchor{aarch64-feature-modifiers}
16941 @cindex @option{-march} feature modifiers
16942 @cindex @option{-mcpu} feature modifiers
16943 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16944 the following and their inverses @option{no@var{feature}}:
16946 @table @samp
16947 @item crc
16948 Enable CRC extension.  This is on by default for
16949 @option{-march=armv8.1-a}.
16950 @item crypto
16951 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
16952 instructions.
16953 @item fp
16954 Enable floating-point instructions.  This is on by default for all possible
16955 values for options @option{-march} and @option{-mcpu}.
16956 @item simd
16957 Enable Advanced SIMD instructions.  This also enables floating-point
16958 instructions.  This is on by default for all possible values for options
16959 @option{-march} and @option{-mcpu}.
16960 @item sve
16961 Enable Scalable Vector Extension instructions.  This also enables Advanced
16962 SIMD and floating-point instructions.
16963 @item lse
16964 Enable Large System Extension instructions.  This is on by default for
16965 @option{-march=armv8.1-a}.
16966 @item rdma
16967 Enable Round Double Multiply Accumulate instructions.  This is on by default
16968 for @option{-march=armv8.1-a}.
16969 @item fp16
16970 Enable FP16 extension.  This also enables floating-point instructions.
16971 @item fp16fml
16972 Enable FP16 fmla extension.  This also enables FP16 extensions and
16973 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.
16975 @item rcpc
16976 Enable the RcPc extension.  This does not change code generation from GCC,
16977 but is passed on to the assembler, enabling inline asm statements to use
16978 instructions from the RcPc extension.
16979 @item dotprod
16980 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
16981 @item aes
16982 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
16983 SIMD instructions.
16984 @item sha2
16985 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
16986 @item sha3
16987 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
16988 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16989 @item sm4
16990 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
16991 Use of this option with architectures prior to Armv8.2-A is not supported.
16992 @item profile
16993 Enable the Statistical Profiling extension.  This option is only to enable the
16994 extension at the assembler level and does not affect code generation.
16995 @item rng
16996 Enable the Armv8.5-a Random Number instructions.  This option is only to
16997 enable the extension at the assembler level and does not affect code
16998 generation.
16999 @item memtag
17000 Enable the Armv8.5-a Memory Tagging Extensions.
17001 Use of this option with architectures prior to Armv8.5-A is not supported.
17002 @item sb
17003 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
17004 enable the extension at the assembler level and does not affect code
17005 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
17006 @item ssbs
17007 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
17008 is only to enable the extension at the assembler level and does not affect code
17009 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
17010 @item predres
17011 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17012 This option is only to enable the extension at the assembler level and does
17013 not affect code generation.  This option is enabled by default for
17014 @option{-march=armv8.5-a}.
17015 @item sve2
17016 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
17017 instructions.
17018 @item sve2-bitperm
17019 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
17020 @item sve2-sm4
17021 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
17022 @item sve2-aes
17023 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
17024 @item sve2-sha3
17025 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
17026 @item tme
17027 Enable the Transactional Memory Extension.
17028 @item i8mm
17029 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
17030 Advanced SIMD and floating-point instructions.  This option is enabled by
17031 default for @option{-march=armv8.6-a}.  Use of this option with architectures
17032 prior to Armv8.2-A is not supported.
17033 @item f32mm
17034 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
17035 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
17036 not supported.
17037 @item f64mm
17038 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
17039 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
17040 not supported.
17041 @item bf16
17042 Enable brain half-precision floating-point instructions.  This also enables
17043 Advanced SIMD and floating-point instructions.  This option is enabled by
17044 default for @option{-march=armv8.6-a}.  Use of this option with architectures
17045 prior to Armv8.2-A is not supported.
17047 @end table
17049 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17050 which implies @option{fp}.
17051 Conversely, @option{nofp} implies @option{nosimd}, which implies
17052 @option{nocrypto}, @option{noaes} and @option{nosha2}.
17054 @node Adapteva Epiphany Options
17055 @subsection Adapteva Epiphany Options
17057 These @samp{-m} options are defined for Adapteva Epiphany:
17059 @table @gcctabopt
17060 @item -mhalf-reg-file
17061 @opindex mhalf-reg-file
17062 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17063 That allows code to run on hardware variants that lack these registers.
17065 @item -mprefer-short-insn-regs
17066 @opindex mprefer-short-insn-regs
17067 Preferentially allocate registers that allow short instruction generation.
17068 This can result in increased instruction count, so this may either reduce or
17069 increase overall code size.
17071 @item -mbranch-cost=@var{num}
17072 @opindex mbranch-cost
17073 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17074 This cost is only a heuristic and is not guaranteed to produce
17075 consistent results across releases.
17077 @item -mcmove
17078 @opindex mcmove
17079 Enable the generation of conditional moves.
17081 @item -mnops=@var{num}
17082 @opindex mnops
17083 Emit @var{num} NOPs before every other generated instruction.
17085 @item -mno-soft-cmpsf
17086 @opindex mno-soft-cmpsf
17087 @opindex msoft-cmpsf
17088 For single-precision floating-point comparisons, emit an @code{fsub} instruction
17089 and test the flags.  This is faster than a software comparison, but can
17090 get incorrect results in the presence of NaNs, or when two different small
17091 numbers are compared such that their difference is calculated as zero.
17092 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17093 software comparisons.
17095 @item -mstack-offset=@var{num}
17096 @opindex mstack-offset
17097 Set the offset between the top of the stack and the stack pointer.
17098 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17099 can be used by leaf functions without stack allocation.
17100 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17101 Note also that this option changes the ABI; compiling a program with a
17102 different stack offset than the libraries have been compiled with
17103 generally does not work.
17104 This option can be useful if you want to evaluate if a different stack
17105 offset would give you better code, but to actually use a different stack
17106 offset to build working programs, it is recommended to configure the
17107 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17109 @item -mno-round-nearest
17110 @opindex mno-round-nearest
17111 @opindex mround-nearest
17112 Make the scheduler assume that the rounding mode has been set to
17113 truncating.  The default is @option{-mround-nearest}.
17115 @item -mlong-calls
17116 @opindex mlong-calls
17117 If not otherwise specified by an attribute, assume all calls might be beyond
17118 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17119 function address into a register before performing a (otherwise direct) call.
17120 This is the default.
17122 @item -mshort-calls
17123 @opindex short-calls
17124 If not otherwise specified by an attribute, assume all direct calls are
17125 in the range of the @code{b} / @code{bl} instructions, so use these instructions
17126 for direct calls.  The default is @option{-mlong-calls}.
17128 @item -msmall16
17129 @opindex msmall16
17130 Assume addresses can be loaded as 16-bit unsigned values.  This does not
17131 apply to function addresses for which @option{-mlong-calls} semantics
17132 are in effect.
17134 @item -mfp-mode=@var{mode}
17135 @opindex mfp-mode
17136 Set the prevailing mode of the floating-point unit.
17137 This determines the floating-point mode that is provided and expected
17138 at function call and return time.  Making this mode match the mode you
17139 predominantly need at function start can make your programs smaller and
17140 faster by avoiding unnecessary mode switches.
17142 @var{mode} can be set to one the following values:
17144 @table @samp
17145 @item caller
17146 Any mode at function entry is valid, and retained or restored when
17147 the function returns, and when it calls other functions.
17148 This mode is useful for compiling libraries or other compilation units
17149 you might want to incorporate into different programs with different
17150 prevailing FPU modes, and the convenience of being able to use a single
17151 object file outweighs the size and speed overhead for any extra
17152 mode switching that might be needed, compared with what would be needed
17153 with a more specific choice of prevailing FPU mode.
17155 @item truncate
17156 This is the mode used for floating-point calculations with
17157 truncating (i.e.@: round towards zero) rounding mode.  That includes
17158 conversion from floating point to integer.
17160 @item round-nearest
17161 This is the mode used for floating-point calculations with
17162 round-to-nearest-or-even rounding mode.
17164 @item int
17165 This is the mode used to perform integer calculations in the FPU, e.g.@:
17166 integer multiply, or integer multiply-and-accumulate.
17167 @end table
17169 The default is @option{-mfp-mode=caller}
17171 @item -mno-split-lohi
17172 @itemx -mno-postinc
17173 @itemx -mno-postmodify
17174 @opindex mno-split-lohi
17175 @opindex msplit-lohi
17176 @opindex mno-postinc
17177 @opindex mpostinc
17178 @opindex mno-postmodify
17179 @opindex mpostmodify
17180 Code generation tweaks that disable, respectively, splitting of 32-bit
17181 loads, generation of post-increment addresses, and generation of
17182 post-modify addresses.  The defaults are @option{msplit-lohi},
17183 @option{-mpost-inc}, and @option{-mpost-modify}.
17185 @item -mnovect-double
17186 @opindex mno-vect-double
17187 @opindex mvect-double
17188 Change the preferred SIMD mode to SImode.  The default is
17189 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
17191 @item -max-vect-align=@var{num}
17192 @opindex max-vect-align
17193 The maximum alignment for SIMD vector mode types.
17194 @var{num} may be 4 or 8.  The default is 8.
17195 Note that this is an ABI change, even though many library function
17196 interfaces are unaffected if they don't use SIMD vector modes
17197 in places that affect size and/or alignment of relevant types.
17199 @item -msplit-vecmove-early
17200 @opindex msplit-vecmove-early
17201 Split vector moves into single word moves before reload.  In theory this
17202 can give better register allocation, but so far the reverse seems to be
17203 generally the case.
17205 @item -m1reg-@var{reg}
17206 @opindex m1reg-
17207 Specify a register to hold the constant @minus{}1, which makes loading small negative
17208 constants and certain bitmasks faster.
17209 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17210 which specify use of that register as a fixed register,
17211 and @samp{none}, which means that no register is used for this
17212 purpose.  The default is @option{-m1reg-none}.
17214 @end table
17216 @node AMD GCN Options
17217 @subsection AMD GCN Options
17218 @cindex AMD GCN Options
17220 These options are defined specifically for the AMD GCN port.
17222 @table @gcctabopt
17224 @item -march=@var{gpu}
17225 @opindex march
17226 @itemx -mtune=@var{gpu}
17227 @opindex mtune
17228 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17231 @table @samp
17232 @opindex fiji
17233 @item fiji
17234 Compile for GCN3 Fiji devices (gfx803).
17236 @item gfx900
17237 Compile for GCN5 Vega 10 devices (gfx900).
17239 @item gfx906
17240 Compile for GCN5 Vega 20 devices (gfx906).
17242 @end table
17244 @item -mstack-size=@var{bytes}
17245 @opindex mstack-size
17246 Specify how many @var{bytes} of stack space will be requested for each GPU
17247 thread (wave-front).  Beware that there may be many threads and limited memory
17248 available.  The size of the stack allocation may also have an impact on
17249 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
17250 1MB otherwise.
17252 @end table
17254 @node ARC Options
17255 @subsection ARC Options
17256 @cindex ARC options
17258 The following options control the architecture variant for which code
17259 is being compiled:
17261 @c architecture variants
17262 @table @gcctabopt
17264 @item -mbarrel-shifter
17265 @opindex mbarrel-shifter
17266 Generate instructions supported by barrel shifter.  This is the default
17267 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17269 @item -mjli-always
17270 @opindex mjli-alawys
17271 Force to call a function using jli_s instruction.  This option is
17272 valid only for ARCv2 architecture.
17274 @item -mcpu=@var{cpu}
17275 @opindex mcpu
17276 Set architecture type, register usage, and instruction scheduling
17277 parameters for @var{cpu}.  There are also shortcut alias options
17278 available for backward compatibility and convenience.  Supported
17279 values for @var{cpu} are
17281 @table @samp
17282 @opindex mA6
17283 @opindex mARC600
17284 @item arc600
17285 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
17287 @item arc601
17288 @opindex mARC601
17289 Compile for ARC601.  Alias: @option{-mARC601}.
17291 @item arc700
17292 @opindex mA7
17293 @opindex mARC700
17294 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
17295 This is the default when configured with @option{--with-cpu=arc700}@.
17297 @item arcem
17298 Compile for ARC EM.
17300 @item archs
17301 Compile for ARC HS.
17303 @item em
17304 Compile for ARC EM CPU with no hardware extensions.
17306 @item em4
17307 Compile for ARC EM4 CPU.
17309 @item em4_dmips
17310 Compile for ARC EM4 DMIPS CPU.
17312 @item em4_fpus
17313 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17314 extension.
17316 @item em4_fpuda
17317 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17318 double assist instructions.
17320 @item hs
17321 Compile for ARC HS CPU with no hardware extensions except the atomic
17322 instructions.
17324 @item hs34
17325 Compile for ARC HS34 CPU.
17327 @item hs38
17328 Compile for ARC HS38 CPU.
17330 @item hs38_linux
17331 Compile for ARC HS38 CPU with all hardware extensions on.
17333 @item arc600_norm
17334 Compile for ARC 600 CPU with @code{norm} instructions enabled.
17336 @item arc600_mul32x16
17337 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
17338 instructions enabled.
17340 @item arc600_mul64
17341 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
17342 instructions enabled.
17344 @item arc601_norm
17345 Compile for ARC 601 CPU with @code{norm} instructions enabled.
17347 @item arc601_mul32x16
17348 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17349 instructions enabled.
17351 @item arc601_mul64
17352 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17353 instructions enabled.
17355 @item nps400
17356 Compile for ARC 700 on NPS400 chip.
17358 @item em_mini
17359 Compile for ARC EM minimalist configuration featuring reduced register
17360 set.
17362 @end table
17364 @item -mdpfp
17365 @opindex mdpfp
17366 @itemx -mdpfp-compact
17367 @opindex mdpfp-compact
17368 Generate double-precision FPX instructions, tuned for the compact
17369 implementation.
17371 @item -mdpfp-fast
17372 @opindex mdpfp-fast
17373 Generate double-precision FPX instructions, tuned for the fast
17374 implementation.
17376 @item -mno-dpfp-lrsr
17377 @opindex mno-dpfp-lrsr
17378 Disable @code{lr} and @code{sr} instructions from using FPX extension
17379 aux registers.
17381 @item -mea
17382 @opindex mea
17383 Generate extended arithmetic instructions.  Currently only
17384 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17385 supported.  Only valid for @option{-mcpu=ARC700}.
17387 @item -mno-mpy
17388 @opindex mno-mpy
17389 @opindex mmpy
17390 Do not generate @code{mpy}-family instructions for ARC700.  This option is
17391 deprecated.
17393 @item -mmul32x16
17394 @opindex mmul32x16
17395 Generate 32x16-bit multiply and multiply-accumulate instructions.
17397 @item -mmul64
17398 @opindex mmul64
17399 Generate @code{mul64} and @code{mulu64} instructions.  
17400 Only valid for @option{-mcpu=ARC600}.
17402 @item -mnorm
17403 @opindex mnorm
17404 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
17405 is in effect.
17407 @item -mspfp
17408 @opindex mspfp
17409 @itemx -mspfp-compact
17410 @opindex mspfp-compact
17411 Generate single-precision FPX instructions, tuned for the compact
17412 implementation.
17414 @item -mspfp-fast
17415 @opindex mspfp-fast
17416 Generate single-precision FPX instructions, tuned for the fast
17417 implementation.
17419 @item -msimd
17420 @opindex msimd
17421 Enable generation of ARC SIMD instructions via target-specific
17422 builtins.  Only valid for @option{-mcpu=ARC700}.
17424 @item -msoft-float
17425 @opindex msoft-float
17426 This option ignored; it is provided for compatibility purposes only.
17427 Software floating-point code is emitted by default, and this default
17428 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17429 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
17430 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17432 @item -mswap
17433 @opindex mswap
17434 Generate @code{swap} instructions.
17436 @item -matomic
17437 @opindex matomic
17438 This enables use of the locked load/store conditional extension to implement
17439 atomic memory built-in functions.  Not available for ARC 6xx or ARC
17440 EM cores.
17442 @item -mdiv-rem
17443 @opindex mdiv-rem
17444 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17446 @item -mcode-density
17447 @opindex mcode-density
17448 Enable code density instructions for ARC EM.  
17449 This option is on by default for ARC HS.
17451 @item -mll64
17452 @opindex mll64
17453 Enable double load/store operations for ARC HS cores.
17455 @item -mtp-regno=@var{regno}
17456 @opindex mtp-regno
17457 Specify thread pointer register number.
17459 @item -mmpy-option=@var{multo}
17460 @opindex mmpy-option
17461 Compile ARCv2 code with a multiplier design option.  You can specify 
17462 the option using either a string or numeric value for @var{multo}.  
17463 @samp{wlh1} is the default value.  The recognized values are:
17465 @table @samp
17466 @item 0
17467 @itemx none
17468 No multiplier available.
17470 @item 1
17471 @itemx w
17472 16x16 multiplier, fully pipelined.
17473 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17475 @item 2
17476 @itemx wlh1
17477 32x32 multiplier, fully
17478 pipelined (1 stage).  The following instructions are additionally
17479 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17481 @item 3
17482 @itemx wlh2
17483 32x32 multiplier, fully pipelined
17484 (2 stages).  The following instructions are additionally enabled: @code{mpy},
17485 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17487 @item 4
17488 @itemx wlh3
17489 Two 16x16 multipliers, blocking,
17490 sequential.  The following instructions are additionally enabled: @code{mpy},
17491 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17493 @item 5
17494 @itemx wlh4
17495 One 16x16 multiplier, blocking,
17496 sequential.  The following instructions are additionally enabled: @code{mpy},
17497 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17499 @item 6
17500 @itemx wlh5
17501 One 32x4 multiplier, blocking,
17502 sequential.  The following instructions are additionally enabled: @code{mpy},
17503 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17505 @item 7
17506 @itemx plus_dmpy
17507 ARC HS SIMD support.
17509 @item 8
17510 @itemx plus_macd
17511 ARC HS SIMD support.
17513 @item 9
17514 @itemx plus_qmacw
17515 ARC HS SIMD support.
17517 @end table
17519 This option is only available for ARCv2 cores@.
17521 @item -mfpu=@var{fpu}
17522 @opindex mfpu
17523 Enables support for specific floating-point hardware extensions for ARCv2
17524 cores.  Supported values for @var{fpu} are:
17526 @table @samp
17528 @item fpus
17529 Enables support for single-precision floating-point hardware
17530 extensions@.
17532 @item fpud
17533 Enables support for double-precision floating-point hardware
17534 extensions.  The single-precision floating-point extension is also
17535 enabled.  Not available for ARC EM@.
17537 @item fpuda
17538 Enables support for double-precision floating-point hardware
17539 extensions using double-precision assist instructions.  The single-precision
17540 floating-point extension is also enabled.  This option is
17541 only available for ARC EM@.
17543 @item fpuda_div
17544 Enables support for double-precision floating-point hardware
17545 extensions using double-precision assist instructions.
17546 The single-precision floating-point, square-root, and divide 
17547 extensions are also enabled.  This option is
17548 only available for ARC EM@.
17550 @item fpuda_fma
17551 Enables support for double-precision floating-point hardware
17552 extensions using double-precision assist instructions.
17553 The single-precision floating-point and fused multiply and add 
17554 hardware extensions are also enabled.  This option is
17555 only available for ARC EM@.
17557 @item fpuda_all
17558 Enables support for double-precision floating-point hardware
17559 extensions using double-precision assist instructions.
17560 All single-precision floating-point hardware extensions are also
17561 enabled.  This option is only available for ARC EM@.
17563 @item fpus_div
17564 Enables support for single-precision floating-point, square-root and divide 
17565 hardware extensions@.
17567 @item fpud_div
17568 Enables support for double-precision floating-point, square-root and divide 
17569 hardware extensions.  This option
17570 includes option @samp{fpus_div}. Not available for ARC EM@.
17572 @item fpus_fma
17573 Enables support for single-precision floating-point and 
17574 fused multiply and add hardware extensions@.
17576 @item fpud_fma
17577 Enables support for double-precision floating-point and 
17578 fused multiply and add hardware extensions.  This option
17579 includes option @samp{fpus_fma}.  Not available for ARC EM@.
17581 @item fpus_all
17582 Enables support for all single-precision floating-point hardware
17583 extensions@.
17585 @item fpud_all
17586 Enables support for all single- and double-precision floating-point
17587 hardware extensions.  Not available for ARC EM@.
17589 @end table
17591 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
17592 @opindex mirq-ctrl-saved
17593 Specifies general-purposes registers that the processor automatically
17594 saves/restores on interrupt entry and exit.  @var{register-range} is
17595 specified as two registers separated by a dash.  The register range
17596 always starts with @code{r0}, the upper limit is @code{fp} register.
17597 @var{blink} and @var{lp_count} are optional.  This option is only
17598 valid for ARC EM and ARC HS cores.
17600 @item -mrgf-banked-regs=@var{number}
17601 @opindex mrgf-banked-regs
17602 Specifies the number of registers replicated in second register bank
17603 on entry to fast interrupt.  Fast interrupts are interrupts with the
17604 highest priority level P0.  These interrupts save only PC and STATUS32
17605 registers to avoid memory transactions during interrupt entry and exit
17606 sequences.  Use this option when you are using fast interrupts in an
17607 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
17609 @item -mlpc-width=@var{width}
17610 @opindex mlpc-width
17611 Specify the width of the @code{lp_count} register.  Valid values for
17612 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
17613 fixed to 32 bits.  If the width is less than 32, the compiler does not
17614 attempt to transform loops in your program to use the zero-delay loop
17615 mechanism unless it is known that the @code{lp_count} register can
17616 hold the required loop-counter value.  Depending on the width
17617 specified, the compiler and run-time library might continue to use the
17618 loop mechanism for various needs.  This option defines macro
17619 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
17621 @item -mrf16
17622 @opindex mrf16
17623 This option instructs the compiler to generate code for a 16-entry
17624 register file.  This option defines the @code{__ARC_RF16__}
17625 preprocessor macro.
17627 @item -mbranch-index
17628 @opindex mbranch-index
17629 Enable use of @code{bi} or @code{bih} instructions to implement jump
17630 tables.
17632 @end table
17634 The following options are passed through to the assembler, and also
17635 define preprocessor macro symbols.
17637 @c Flags used by the assembler, but for which we define preprocessor
17638 @c macro symbols as well.
17639 @table @gcctabopt
17640 @item -mdsp-packa
17641 @opindex mdsp-packa
17642 Passed down to the assembler to enable the DSP Pack A extensions.
17643 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
17644 deprecated.
17646 @item -mdvbf
17647 @opindex mdvbf
17648 Passed down to the assembler to enable the dual Viterbi butterfly
17649 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
17650 option is deprecated.
17652 @c ARC700 4.10 extension instruction
17653 @item -mlock
17654 @opindex mlock
17655 Passed down to the assembler to enable the locked load/store
17656 conditional extension.  Also sets the preprocessor symbol
17657 @code{__Xlock}.
17659 @item -mmac-d16
17660 @opindex mmac-d16
17661 Passed down to the assembler.  Also sets the preprocessor symbol
17662 @code{__Xxmac_d16}.  This option is deprecated.
17664 @item -mmac-24
17665 @opindex mmac-24
17666 Passed down to the assembler.  Also sets the preprocessor symbol
17667 @code{__Xxmac_24}.  This option is deprecated.
17669 @c ARC700 4.10 extension instruction
17670 @item -mrtsc
17671 @opindex mrtsc
17672 Passed down to the assembler to enable the 64-bit time-stamp counter
17673 extension instruction.  Also sets the preprocessor symbol
17674 @code{__Xrtsc}.  This option is deprecated.
17676 @c ARC700 4.10 extension instruction
17677 @item -mswape
17678 @opindex mswape
17679 Passed down to the assembler to enable the swap byte ordering
17680 extension instruction.  Also sets the preprocessor symbol
17681 @code{__Xswape}.
17683 @item -mtelephony
17684 @opindex mtelephony
17685 Passed down to the assembler to enable dual- and single-operand
17686 instructions for telephony.  Also sets the preprocessor symbol
17687 @code{__Xtelephony}.  This option is deprecated.
17689 @item -mxy
17690 @opindex mxy
17691 Passed down to the assembler to enable the XY memory extension.  Also
17692 sets the preprocessor symbol @code{__Xxy}.
17694 @end table
17696 The following options control how the assembly code is annotated:
17698 @c Assembly annotation options
17699 @table @gcctabopt
17700 @item -misize
17701 @opindex misize
17702 Annotate assembler instructions with estimated addresses.
17704 @item -mannotate-align
17705 @opindex mannotate-align
17706 Explain what alignment considerations lead to the decision to make an
17707 instruction short or long.
17709 @end table
17711 The following options are passed through to the linker:
17713 @c options passed through to the linker
17714 @table @gcctabopt
17715 @item -marclinux
17716 @opindex marclinux
17717 Passed through to the linker, to specify use of the @code{arclinux} emulation.
17718 This option is enabled by default in tool chains built for
17719 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
17720 when profiling is not requested.
17722 @item -marclinux_prof
17723 @opindex marclinux_prof
17724 Passed through to the linker, to specify use of the
17725 @code{arclinux_prof} emulation.  This option is enabled by default in
17726 tool chains built for @w{@code{arc-linux-uclibc}} and
17727 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
17729 @end table
17731 The following options control the semantics of generated code:
17733 @c semantically relevant code generation options
17734 @table @gcctabopt
17735 @item -mlong-calls
17736 @opindex mlong-calls
17737 Generate calls as register indirect calls, thus providing access
17738 to the full 32-bit address range.
17740 @item -mmedium-calls
17741 @opindex mmedium-calls
17742 Don't use less than 25-bit addressing range for calls, which is the
17743 offset available for an unconditional branch-and-link
17744 instruction.  Conditional execution of function calls is suppressed, to
17745 allow use of the 25-bit range, rather than the 21-bit range with
17746 conditional branch-and-link.  This is the default for tool chains built
17747 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17749 @item -G @var{num}
17750 @opindex G
17751 Put definitions of externally-visible data in a small data section if
17752 that data is no bigger than @var{num} bytes.  The default value of
17753 @var{num} is 4 for any ARC configuration, or 8 when we have double
17754 load/store operations.
17756 @item -mno-sdata
17757 @opindex mno-sdata
17758 @opindex msdata
17759 Do not generate sdata references.  This is the default for tool chains
17760 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17761 targets.
17763 @item -mvolatile-cache
17764 @opindex mvolatile-cache
17765 Use ordinarily cached memory accesses for volatile references.  This is the
17766 default.
17768 @item -mno-volatile-cache
17769 @opindex mno-volatile-cache
17770 @opindex mvolatile-cache
17771 Enable cache bypass for volatile references.
17773 @end table
17775 The following options fine tune code generation:
17776 @c code generation tuning options
17777 @table @gcctabopt
17778 @item -malign-call
17779 @opindex malign-call
17780 Do alignment optimizations for call instructions.
17782 @item -mauto-modify-reg
17783 @opindex mauto-modify-reg
17784 Enable the use of pre/post modify with register displacement.
17786 @item -mbbit-peephole
17787 @opindex mbbit-peephole
17788 Enable bbit peephole2.
17790 @item -mno-brcc
17791 @opindex mno-brcc
17792 This option disables a target-specific pass in @file{arc_reorg} to
17793 generate compare-and-branch (@code{br@var{cc}}) instructions.  
17794 It has no effect on
17795 generation of these instructions driven by the combiner pass.
17797 @item -mcase-vector-pcrel
17798 @opindex mcase-vector-pcrel
17799 Use PC-relative switch case tables to enable case table shortening.
17800 This is the default for @option{-Os}.
17802 @item -mcompact-casesi
17803 @opindex mcompact-casesi
17804 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
17805 and only available for ARCv1 cores.  This option is deprecated.
17807 @item -mno-cond-exec
17808 @opindex mno-cond-exec
17809 Disable the ARCompact-specific pass to generate conditional 
17810 execution instructions.
17812 Due to delay slot scheduling and interactions between operand numbers,
17813 literal sizes, instruction lengths, and the support for conditional execution,
17814 the target-independent pass to generate conditional execution is often lacking,
17815 so the ARC port has kept a special pass around that tries to find more
17816 conditional execution generation opportunities after register allocation,
17817 branch shortening, and delay slot scheduling have been done.  This pass
17818 generally, but not always, improves performance and code size, at the cost of
17819 extra compilation time, which is why there is an option to switch it off.
17820 If you have a problem with call instructions exceeding their allowable
17821 offset range because they are conditionalized, you should consider using
17822 @option{-mmedium-calls} instead.
17824 @item -mearly-cbranchsi
17825 @opindex mearly-cbranchsi
17826 Enable pre-reload use of the @code{cbranchsi} pattern.
17828 @item -mexpand-adddi
17829 @opindex mexpand-adddi
17830 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17831 @code{add.f}, @code{adc} etc.  This option is deprecated.
17833 @item -mindexed-loads
17834 @opindex mindexed-loads
17835 Enable the use of indexed loads.  This can be problematic because some
17836 optimizers then assume that indexed stores exist, which is not
17837 the case.
17839 @item -mlra
17840 @opindex mlra
17841 Enable Local Register Allocation.  This is still experimental for ARC,
17842 so by default the compiler uses standard reload
17843 (i.e.@: @option{-mno-lra}).
17845 @item -mlra-priority-none
17846 @opindex mlra-priority-none
17847 Don't indicate any priority for target registers.
17849 @item -mlra-priority-compact
17850 @opindex mlra-priority-compact
17851 Indicate target register priority for r0..r3 / r12..r15.
17853 @item -mlra-priority-noncompact
17854 @opindex mlra-priority-noncompact
17855 Reduce target register priority for r0..r3 / r12..r15.
17857 @item -mmillicode
17858 @opindex mmillicode
17859 When optimizing for size (using @option{-Os}), prologues and epilogues
17860 that have to save or restore a large number of registers are often
17861 shortened by using call to a special function in libgcc; this is
17862 referred to as a @emph{millicode} call.  As these calls can pose
17863 performance issues, and/or cause linking issues when linking in a
17864 nonstandard way, this option is provided to turn on or off millicode
17865 call generation.
17867 @item -mcode-density-frame
17868 @opindex mcode-density-frame
17869 This option enable the compiler to emit @code{enter} and @code{leave}
17870 instructions.  These instructions are only valid for CPUs with
17871 code-density feature.
17873 @item -mmixed-code
17874 @opindex mmixed-code
17875 Tweak register allocation to help 16-bit instruction generation.
17876 This generally has the effect of decreasing the average instruction size
17877 while increasing the instruction count.
17879 @item -mq-class
17880 @opindex mq-class
17881 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
17882 This is the default for @option{-Os}.
17884 @item -mRcq
17885 @opindex mRcq
17886 Enable @samp{Rcq} constraint handling.  
17887 Most short code generation depends on this.
17888 This is the default.
17890 @item -mRcw
17891 @opindex mRcw
17892 Enable @samp{Rcw} constraint handling.  
17893 Most ccfsm condexec mostly depends on this.
17894 This is the default.
17896 @item -msize-level=@var{level}
17897 @opindex msize-level
17898 Fine-tune size optimization with regards to instruction lengths and alignment.
17899 The recognized values for @var{level} are:
17900 @table @samp
17901 @item 0
17902 No size optimization.  This level is deprecated and treated like @samp{1}.
17904 @item 1
17905 Short instructions are used opportunistically.
17907 @item 2
17908 In addition, alignment of loops and of code after barriers are dropped.
17910 @item 3
17911 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17913 @end table
17915 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
17916 the behavior when this is not set is equivalent to level @samp{1}.
17918 @item -mtune=@var{cpu}
17919 @opindex mtune
17920 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17921 by @option{-mcpu=}.
17923 Supported values for @var{cpu} are
17925 @table @samp
17926 @item ARC600
17927 Tune for ARC600 CPU.
17929 @item ARC601
17930 Tune for ARC601 CPU.
17932 @item ARC700
17933 Tune for ARC700 CPU with standard multiplier block.
17935 @item ARC700-xmac
17936 Tune for ARC700 CPU with XMAC block.
17938 @item ARC725D
17939 Tune for ARC725D CPU.
17941 @item ARC750D
17942 Tune for ARC750D CPU.
17944 @end table
17946 @item -mmultcost=@var{num}
17947 @opindex mmultcost
17948 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17949 normal instruction.
17951 @item -munalign-prob-threshold=@var{probability}
17952 @opindex munalign-prob-threshold
17953 Set probability threshold for unaligning branches.
17954 When tuning for @samp{ARC700} and optimizing for speed, branches without
17955 filled delay slot are preferably emitted unaligned and long, unless
17956 profiling indicates that the probability for the branch to be taken
17957 is below @var{probability}.  @xref{Cross-profiling}.
17958 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17960 @end table
17962 The following options are maintained for backward compatibility, but
17963 are now deprecated and will be removed in a future release:
17965 @c Deprecated options
17966 @table @gcctabopt
17968 @item -margonaut
17969 @opindex margonaut
17970 Obsolete FPX.
17972 @item -mbig-endian
17973 @opindex mbig-endian
17974 @itemx -EB
17975 @opindex EB
17976 Compile code for big-endian targets.  Use of these options is now
17977 deprecated.  Big-endian code is supported by configuring GCC to build
17978 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17979 for which big endian is the default.
17981 @item -mlittle-endian
17982 @opindex mlittle-endian
17983 @itemx -EL
17984 @opindex EL
17985 Compile code for little-endian targets.  Use of these options is now
17986 deprecated.  Little-endian code is supported by configuring GCC to build 
17987 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17988 for which little endian is the default.
17990 @item -mbarrel_shifter
17991 @opindex mbarrel_shifter
17992 Replaced by @option{-mbarrel-shifter}.
17994 @item -mdpfp_compact
17995 @opindex mdpfp_compact
17996 Replaced by @option{-mdpfp-compact}.
17998 @item -mdpfp_fast
17999 @opindex mdpfp_fast
18000 Replaced by @option{-mdpfp-fast}.
18002 @item -mdsp_packa
18003 @opindex mdsp_packa
18004 Replaced by @option{-mdsp-packa}.
18006 @item -mEA
18007 @opindex mEA
18008 Replaced by @option{-mea}.
18010 @item -mmac_24
18011 @opindex mmac_24
18012 Replaced by @option{-mmac-24}.
18014 @item -mmac_d16
18015 @opindex mmac_d16
18016 Replaced by @option{-mmac-d16}.
18018 @item -mspfp_compact
18019 @opindex mspfp_compact
18020 Replaced by @option{-mspfp-compact}.
18022 @item -mspfp_fast
18023 @opindex mspfp_fast
18024 Replaced by @option{-mspfp-fast}.
18026 @item -mtune=@var{cpu}
18027 @opindex mtune
18028 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18029 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18030 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18032 @item -multcost=@var{num}
18033 @opindex multcost
18034 Replaced by @option{-mmultcost}.
18036 @end table
18038 @node ARM Options
18039 @subsection ARM Options
18040 @cindex ARM options
18042 These @samp{-m} options are defined for the ARM port:
18044 @table @gcctabopt
18045 @item -mabi=@var{name}
18046 @opindex mabi
18047 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
18048 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18050 @item -mapcs-frame
18051 @opindex mapcs-frame
18052 Generate a stack frame that is compliant with the ARM Procedure Call
18053 Standard for all functions, even if this is not strictly necessary for
18054 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
18055 with this option causes the stack frames not to be generated for
18056 leaf functions.  The default is @option{-mno-apcs-frame}.
18057 This option is deprecated.
18059 @item -mapcs
18060 @opindex mapcs
18061 This is a synonym for @option{-mapcs-frame} and is deprecated.
18063 @ignore
18064 @c not currently implemented
18065 @item -mapcs-stack-check
18066 @opindex mapcs-stack-check
18067 Generate code to check the amount of stack space available upon entry to
18068 every function (that actually uses some stack space).  If there is
18069 insufficient space available then either the function
18070 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18071 called, depending upon the amount of stack space required.  The runtime
18072 system is required to provide these functions.  The default is
18073 @option{-mno-apcs-stack-check}, since this produces smaller code.
18075 @c not currently implemented
18076 @item -mapcs-reentrant
18077 @opindex mapcs-reentrant
18078 Generate reentrant, position-independent code.  The default is
18079 @option{-mno-apcs-reentrant}.
18080 @end ignore
18082 @item -mthumb-interwork
18083 @opindex mthumb-interwork
18084 Generate code that supports calling between the ARM and Thumb
18085 instruction sets.  Without this option, on pre-v5 architectures, the
18086 two instruction sets cannot be reliably used inside one program.  The
18087 default is @option{-mno-thumb-interwork}, since slightly larger code
18088 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
18089 configurations this option is meaningless.
18091 @item -mno-sched-prolog
18092 @opindex mno-sched-prolog
18093 @opindex msched-prolog
18094 Prevent the reordering of instructions in the function prologue, or the
18095 merging of those instruction with the instructions in the function's
18096 body.  This means that all functions start with a recognizable set
18097 of instructions (or in fact one of a choice from a small set of
18098 different function prologues), and this information can be used to
18099 locate the start of functions inside an executable piece of code.  The
18100 default is @option{-msched-prolog}.
18102 @item -mfloat-abi=@var{name}
18103 @opindex mfloat-abi
18104 Specifies which floating-point ABI to use.  Permissible values
18105 are: @samp{soft}, @samp{softfp} and @samp{hard}.
18107 Specifying @samp{soft} causes GCC to generate output containing
18108 library calls for floating-point operations.
18109 @samp{softfp} allows the generation of code using hardware floating-point
18110 instructions, but still uses the soft-float calling conventions.
18111 @samp{hard} allows generation of floating-point instructions
18112 and uses FPU-specific calling conventions.
18114 The default depends on the specific target configuration.  Note that
18115 the hard-float and soft-float ABIs are not link-compatible; you must
18116 compile your entire program with the same ABI, and link with a
18117 compatible set of libraries.
18119 @item -mgeneral-regs-only
18120 @opindex mgeneral-regs-only
18121 Generate code which uses only the general-purpose registers.  This will prevent
18122 the compiler from using floating-point and Advanced SIMD registers but will not
18123 impose any restrictions on the assembler.
18125 @item -mlittle-endian
18126 @opindex mlittle-endian
18127 Generate code for a processor running in little-endian mode.  This is
18128 the default for all standard configurations.
18130 @item -mbig-endian
18131 @opindex mbig-endian
18132 Generate code for a processor running in big-endian mode; the default is
18133 to compile code for a little-endian processor.
18135 @item -mbe8
18136 @itemx -mbe32
18137 @opindex mbe8
18138 When linking a big-endian image select between BE8 and BE32 formats.
18139 The option has no effect for little-endian images and is ignored.  The
18140 default is dependent on the selected target architecture.  For ARMv6
18141 and later architectures the default is BE8, for older architectures
18142 the default is BE32.  BE32 format has been deprecated by ARM.
18144 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
18145 @opindex march
18146 This specifies the name of the target ARM architecture.  GCC uses this
18147 name to determine what kind of instructions it can emit when generating
18148 assembly code.  This option can be used in conjunction with or instead
18149 of the @option{-mcpu=} option.
18151 Permissible names are:
18152 @samp{armv4t},
18153 @samp{armv5t}, @samp{armv5te},
18154 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18155 @samp{armv6z}, @samp{armv6zk},
18156 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
18157 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18158 @samp{armv8.4-a},
18159 @samp{armv8.5-a},
18160 @samp{armv8.6-a},
18161 @samp{armv7-r},
18162 @samp{armv8-r},
18163 @samp{armv6-m}, @samp{armv6s-m},
18164 @samp{armv7-m}, @samp{armv7e-m},
18165 @samp{armv8-m.base}, @samp{armv8-m.main},
18166 @samp{armv8.1-m.main},
18167 @samp{iwmmxt} and @samp{iwmmxt2}.
18169 Additionally, the following architectures, which lack support for the
18170 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18172 Many of the architectures support extensions.  These can be added by
18173 appending @samp{+@var{extension}} to the architecture name.  Extension
18174 options are processed in order and capabilities accumulate.  An extension
18175 will also enable any necessary base extensions
18176 upon which it depends.  For example, the @samp{+crypto} extension
18177 will always enable the @samp{+simd} extension.  The exception to the
18178 additive construction is for extensions that are prefixed with
18179 @samp{+no@dots{}}: these extensions disable the specified option and
18180 any other extensions that may depend on the presence of that
18181 extension.
18183 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18184 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18185 entirely disabled by the @samp{+nofp} option that follows it.
18187 Most extension names are generically named, but have an effect that is
18188 dependent upon the architecture to which it is applied.  For example,
18189 the @samp{+simd} option can be applied to both @samp{armv7-a} and
18190 @samp{armv8-a} architectures, but will enable the original ARMv7-A
18191 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18192 variant for @samp{armv8-a}.
18194 The table below lists the supported extensions for each architecture.
18195 Architectures not mentioned do not support any extensions.
18197 @table @samp
18198 @item armv5te
18199 @itemx armv6
18200 @itemx armv6j
18201 @itemx armv6k
18202 @itemx armv6kz
18203 @itemx armv6t2
18204 @itemx armv6z
18205 @itemx armv6zk
18206 @table @samp
18207 @item +fp
18208 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
18209 used as an alias for this extension.
18211 @item +nofp
18212 Disable the floating-point instructions.
18213 @end table
18215 @item armv7
18216 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18217 @table @samp
18218 @item +fp
18219 The VFPv3 floating-point instructions, with 16 double-precision
18220 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18221 for this extension.  Note that floating-point is not supported by the
18222 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18223 ARMv7-R architectures.
18225 @item +nofp
18226 Disable the floating-point instructions.
18227 @end table
18229 @item armv7-a
18230 @table @samp
18231 @item +mp
18232 The multiprocessing extension.
18234 @item +sec
18235 The security extension.
18237 @item +fp
18238 The VFPv3 floating-point instructions, with 16 double-precision
18239 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18240 for this extension.
18242 @item +simd
18243 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18244 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18245 for this extension.
18247 @item +vfpv3
18248 The VFPv3 floating-point instructions, with 32 double-precision
18249 registers.
18251 @item +vfpv3-d16-fp16
18252 The VFPv3 floating-point instructions, with 16 double-precision
18253 registers and the half-precision floating-point conversion operations.
18255 @item +vfpv3-fp16
18256 The VFPv3 floating-point instructions, with 32 double-precision
18257 registers and the half-precision floating-point conversion operations.
18259 @item +vfpv4-d16
18260 The VFPv4 floating-point instructions, with 16 double-precision
18261 registers.
18263 @item +vfpv4
18264 The VFPv4 floating-point instructions, with 32 double-precision
18265 registers.
18267 @item +neon-fp16
18268 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18269 the half-precision floating-point conversion operations.
18271 @item +neon-vfpv4
18272 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18274 @item +nosimd
18275 Disable the Advanced SIMD instructions (does not disable floating point).
18277 @item +nofp
18278 Disable the floating-point and Advanced SIMD instructions.
18279 @end table
18281 @item armv7ve
18282 The extended version of the ARMv7-A architecture with support for
18283 virtualization.
18284 @table @samp
18285 @item +fp
18286 The VFPv4 floating-point instructions, with 16 double-precision registers.
18287 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18289 @item +simd
18290 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
18291 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18293 @item +vfpv3-d16
18294 The VFPv3 floating-point instructions, with 16 double-precision
18295 registers.
18297 @item +vfpv3
18298 The VFPv3 floating-point instructions, with 32 double-precision
18299 registers.
18301 @item +vfpv3-d16-fp16
18302 The VFPv3 floating-point instructions, with 16 double-precision
18303 registers and the half-precision floating-point conversion operations.
18305 @item +vfpv3-fp16
18306 The VFPv3 floating-point instructions, with 32 double-precision
18307 registers and the half-precision floating-point conversion operations.
18309 @item +vfpv4-d16
18310 The VFPv4 floating-point instructions, with 16 double-precision
18311 registers.
18313 @item +vfpv4
18314 The VFPv4 floating-point instructions, with 32 double-precision
18315 registers.
18317 @item +neon
18318 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18319 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18321 @item +neon-fp16
18322 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18323 the half-precision floating-point conversion operations.
18325 @item +nosimd
18326 Disable the Advanced SIMD instructions (does not disable floating point).
18328 @item +nofp
18329 Disable the floating-point and Advanced SIMD instructions.
18330 @end table
18332 @item armv8-a
18333 @table @samp
18334 @item +crc
18335 The Cyclic Redundancy Check (CRC) instructions.
18336 @item +simd
18337 The ARMv8-A Advanced SIMD and floating-point instructions.
18338 @item +crypto
18339 The cryptographic instructions.
18340 @item +nocrypto
18341 Disable the cryptographic instructions.
18342 @item +nofp
18343 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18344 @item +sb
18345 Speculation Barrier Instruction.
18346 @item +predres
18347 Execution and Data Prediction Restriction Instructions.
18348 @end table
18350 @item armv8.1-a
18351 @table @samp
18352 @item +simd
18353 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18355 @item +crypto
18356 The cryptographic instructions.  This also enables the Advanced SIMD and
18357 floating-point instructions.
18359 @item +nocrypto
18360 Disable the cryptographic instructions.
18362 @item +nofp
18363 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18365 @item +sb
18366 Speculation Barrier Instruction.
18368 @item +predres
18369 Execution and Data Prediction Restriction Instructions.
18370 @end table
18372 @item armv8.2-a
18373 @itemx armv8.3-a
18374 @table @samp
18375 @item +fp16
18376 The half-precision floating-point data processing instructions.
18377 This also enables the Advanced SIMD and floating-point instructions.
18379 @item +fp16fml
18380 The half-precision floating-point fmla extension.  This also enables
18381 the half-precision floating-point extension and Advanced SIMD and
18382 floating-point instructions.
18384 @item +simd
18385 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18387 @item +crypto
18388 The cryptographic instructions.  This also enables the Advanced SIMD and
18389 floating-point instructions.
18391 @item +dotprod
18392 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
18394 @item +nocrypto
18395 Disable the cryptographic extension.
18397 @item +nofp
18398 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18400 @item +sb
18401 Speculation Barrier Instruction.
18403 @item +predres
18404 Execution and Data Prediction Restriction Instructions.
18406 @item +i8mm
18407 8-bit Integer Matrix Multiply instructions.
18408 This also enables Advanced SIMD and floating-point instructions.
18410 @item +bf16
18411 Brain half-precision floating-point instructions.
18412 This also enables Advanced SIMD and floating-point instructions.
18413 @end table
18415 @item armv8.4-a
18416 @table @samp
18417 @item +fp16
18418 The half-precision floating-point data processing instructions.
18419 This also enables the Advanced SIMD and floating-point instructions as well
18420 as the Dot Product extension and the half-precision floating-point fmla
18421 extension.
18423 @item +simd
18424 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18425 Dot Product extension.
18427 @item +crypto
18428 The cryptographic instructions.  This also enables the Advanced SIMD and
18429 floating-point instructions as well as the Dot Product extension.
18431 @item +nocrypto
18432 Disable the cryptographic extension.
18434 @item +nofp
18435 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18437 @item +sb
18438 Speculation Barrier Instruction.
18440 @item +predres
18441 Execution and Data Prediction Restriction Instructions.
18443 @item +i8mm
18444 8-bit Integer Matrix Multiply instructions.
18445 This also enables Advanced SIMD and floating-point instructions.
18447 @item +bf16
18448 Brain half-precision floating-point instructions.
18449 This also enables Advanced SIMD and floating-point instructions.
18450 @end table
18452 @item armv8.5-a
18453 @table @samp
18454 @item +fp16
18455 The half-precision floating-point data processing instructions.
18456 This also enables the Advanced SIMD and floating-point instructions as well
18457 as the Dot Product extension and the half-precision floating-point fmla
18458 extension.
18460 @item +simd
18461 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18462 Dot Product extension.
18464 @item +crypto
18465 The cryptographic instructions.  This also enables the Advanced SIMD and
18466 floating-point instructions as well as the Dot Product extension.
18468 @item +nocrypto
18469 Disable the cryptographic extension.
18471 @item +nofp
18472 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18474 @item +i8mm
18475 8-bit Integer Matrix Multiply instructions.
18476 This also enables Advanced SIMD and floating-point instructions.
18478 @item +bf16
18479 Brain half-precision floating-point instructions.
18480 This also enables Advanced SIMD and floating-point instructions.
18481 @end table
18483 @item armv8.6-a
18484 @table @samp
18485 @item +fp16
18486 The half-precision floating-point data processing instructions.
18487 This also enables the Advanced SIMD and floating-point instructions as well
18488 as the Dot Product extension and the half-precision floating-point fmla
18489 extension.
18491 @item +simd
18492 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18493 Dot Product extension.
18495 @item +crypto
18496 The cryptographic instructions.  This also enables the Advanced SIMD and
18497 floating-point instructions as well as the Dot Product extension.
18499 @item +nocrypto
18500 Disable the cryptographic extension.
18502 @item +nofp
18503 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18505 @item +i8mm
18506 8-bit Integer Matrix Multiply instructions.
18507 This also enables Advanced SIMD and floating-point instructions.
18509 @item +bf16
18510 Brain half-precision floating-point instructions.
18511 This also enables Advanced SIMD and floating-point instructions.
18512 @end table
18514 @item armv7-r
18515 @table @samp
18516 @item +fp.sp
18517 The single-precision VFPv3 floating-point instructions.  The extension
18518 @samp{+vfpv3xd} can be used as an alias for this extension.
18520 @item +fp
18521 The VFPv3 floating-point instructions with 16 double-precision registers.
18522 The extension +vfpv3-d16 can be used as an alias for this extension.
18524 @item +vfpv3xd-d16-fp16
18525 The single-precision VFPv3 floating-point instructions with 16 double-precision
18526 registers and the half-precision floating-point conversion operations.
18528 @item +vfpv3-d16-fp16
18529 The VFPv3 floating-point instructions with 16 double-precision
18530 registers and the half-precision floating-point conversion operations.
18532 @item +nofp
18533 Disable the floating-point extension.
18535 @item +idiv
18536 The ARM-state integer division instructions.
18538 @item +noidiv
18539 Disable the ARM-state integer division extension.
18540 @end table
18542 @item armv7e-m
18543 @table @samp
18544 @item +fp
18545 The single-precision VFPv4 floating-point instructions.
18547 @item +fpv5
18548 The single-precision FPv5 floating-point instructions.
18550 @item +fp.dp
18551 The single- and double-precision FPv5 floating-point instructions.
18553 @item +nofp
18554 Disable the floating-point extensions.
18555 @end table
18557 @item  armv8.1-m.main
18558 @table @samp
18560 @item +dsp
18561 The DSP instructions.
18563 @item +mve
18564 The M-Profile Vector Extension (MVE) integer instructions.
18566 @item +mve.fp
18567 The M-Profile Vector Extension (MVE) integer and single precision
18568 floating-point instructions.
18570 @item +fp
18571 The single-precision floating-point instructions.
18573 @item +fp.dp
18574 The single- and double-precision floating-point instructions.
18576 @item +nofp
18577 Disable the floating-point extension.
18578 @end table
18580 @item  armv8-m.main
18581 @table @samp
18582 @item +dsp
18583 The DSP instructions.
18585 @item +nodsp
18586 Disable the DSP extension.
18588 @item +fp
18589 The single-precision floating-point instructions.
18591 @item +fp.dp
18592 The single- and double-precision floating-point instructions.
18594 @item +nofp
18595 Disable the floating-point extension.
18596 @end table
18598 @item armv8-r
18599 @table @samp
18600 @item +crc
18601 The Cyclic Redundancy Check (CRC) instructions.
18602 @item +fp.sp
18603 The single-precision FPv5 floating-point instructions.
18604 @item +simd
18605 The ARMv8-A Advanced SIMD and floating-point instructions.
18606 @item +crypto
18607 The cryptographic instructions.
18608 @item +nocrypto
18609 Disable the cryptographic instructions.
18610 @item +nofp
18611 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18612 @end table
18614 @end table
18616 @option{-march=native} causes the compiler to auto-detect the architecture
18617 of the build computer.  At present, this feature is only supported on
18618 GNU/Linux, and not all architectures are recognized.  If the auto-detect
18619 is unsuccessful the option has no effect.
18621 @item -mtune=@var{name}
18622 @opindex mtune
18623 This option specifies the name of the target ARM processor for
18624 which GCC should tune the performance of the code.
18625 For some ARM implementations better performance can be obtained by using
18626 this option.
18627 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
18628 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
18629 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
18630 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
18631 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
18632 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
18633 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
18634 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
18635 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
18636 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
18637 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
18638 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18639 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18640 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18641 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
18642 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
18643 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
18644 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
18645 @samp{cortex-m35p},
18646 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
18647 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
18648 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
18649 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
18650 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
18652 Additionally, this option can specify that GCC should tune the performance
18653 of the code for a big.LITTLE system.  Permissible names are:
18654 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
18655 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18656 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
18657 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
18659 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
18660 performance for a blend of processors within architecture @var{arch}.
18661 The aim is to generate code that run well on the current most popular
18662 processors, balancing between optimizations that benefit some CPUs in the
18663 range, and avoiding performance pitfalls of other CPUs.  The effects of
18664 this option may change in future GCC versions as CPU models come and go.
18666 @option{-mtune} permits the same extension options as @option{-mcpu}, but
18667 the extension options do not affect the tuning of the generated code.
18669 @option{-mtune=native} causes the compiler to auto-detect the CPU
18670 of the build computer.  At present, this feature is only supported on
18671 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
18672 unsuccessful the option has no effect.
18674 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
18675 @opindex mcpu
18676 This specifies the name of the target ARM processor.  GCC uses this name
18677 to derive the name of the target ARM architecture (as if specified
18678 by @option{-march}) and the ARM processor type for which to tune for
18679 performance (as if specified by @option{-mtune}).  Where this option
18680 is used in conjunction with @option{-march} or @option{-mtune},
18681 those options take precedence over the appropriate part of this option.
18683 Many of the supported CPUs implement optional architectural
18684 extensions.  Where this is so the architectural extensions are
18685 normally enabled by default.  If implementations that lack the
18686 extension exist, then the extension syntax can be used to disable
18687 those extensions that have been omitted.  For floating-point and
18688 Advanced SIMD (Neon) instructions, the settings of the options
18689 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
18690 floating-point and Advanced SIMD instructions will only be used if
18691 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
18692 @option{-mfpu} other than @samp{auto} will override the available
18693 floating-point and SIMD extension instructions.
18695 For example, @samp{cortex-a9} can be found in three major
18696 configurations: integer only, with just a floating-point unit or with
18697 floating-point and Advanced SIMD.  The default is to enable all the
18698 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
18699 be used to disable just the SIMD or both the SIMD and floating-point
18700 instructions respectively.
18702 Permissible names for this option are the same as those for
18703 @option{-mtune}.
18705 The following extension options are common to the listed CPUs:
18707 @table @samp
18708 @item +nodsp
18709 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
18711 @item  +nofp
18712 Disables the floating-point instructions on @samp{arm9e},
18713 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
18714 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
18715 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
18716 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
18717 Disables the floating-point and SIMD instructions on
18718 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
18719 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
18720 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
18721 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
18722 @samp{cortex-a53} and @samp{cortex-a55}.
18724 @item +nofp.dp
18725 Disables the double-precision component of the floating-point instructions
18726 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
18727 @samp{cortex-m7}.
18729 @item +nosimd
18730 Disables the SIMD (but not floating-point) instructions on
18731 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
18732 and @samp{cortex-a9}.
18734 @item +crypto
18735 Enables the cryptographic instructions on @samp{cortex-a32},
18736 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
18737 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
18738 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18739 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
18740 @samp{cortex-a75.cortex-a55}.
18741 @end table
18743 Additionally the @samp{generic-armv7-a} pseudo target defaults to
18744 VFPv3 with 16 double-precision registers.  It supports the following
18745 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
18746 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
18747 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
18748 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
18749 the extensions to @option{-march=armv7-a}.
18751 @option{-mcpu=generic-@var{arch}} is also permissible, and is
18752 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
18753 See @option{-mtune} for more information.
18755 @option{-mcpu=native} causes the compiler to auto-detect the CPU
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.
18760 @item -mfpu=@var{name}
18761 @opindex mfpu
18762 This specifies what floating-point hardware (or hardware emulation) is
18763 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
18764 @samp{vfpv3},
18765 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
18766 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
18767 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
18768 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
18769 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
18770 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
18771 is an alias for @samp{vfpv2}.
18773 The setting @samp{auto} is the default and is special.  It causes the
18774 compiler to select the floating-point and Advanced SIMD instructions
18775 based on the settings of @option{-mcpu} and @option{-march}.
18777 If the selected floating-point hardware includes the NEON extension
18778 (e.g.@: @option{-mfpu=neon}), note that floating-point
18779 operations are not generated by GCC's auto-vectorization pass unless
18780 @option{-funsafe-math-optimizations} is also specified.  This is
18781 because NEON hardware does not fully implement the IEEE 754 standard for
18782 floating-point arithmetic (in particular denormal values are treated as
18783 zero), so the use of NEON instructions may lead to a loss of precision.
18785 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}).
18787 @item -mfp16-format=@var{name}
18788 @opindex mfp16-format
18789 Specify the format of the @code{__fp16} half-precision floating-point type.
18790 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
18791 the default is @samp{none}, in which case the @code{__fp16} type is not
18792 defined.  @xref{Half-Precision}, for more information.
18794 @item -mstructure-size-boundary=@var{n}
18795 @opindex mstructure-size-boundary
18796 The sizes of all structures and unions are rounded up to a multiple
18797 of the number of bits set by this option.  Permissible values are 8, 32
18798 and 64.  The default value varies for different toolchains.  For the COFF
18799 targeted toolchain the default value is 8.  A value of 64 is only allowed
18800 if the underlying ABI supports it.
18802 Specifying a larger number can produce faster, more efficient code, but
18803 can also increase the size of the program.  Different values are potentially
18804 incompatible.  Code compiled with one value cannot necessarily expect to
18805 work with code or libraries compiled with another value, if they exchange
18806 information using structures or unions.
18808 This option is deprecated.
18810 @item -mabort-on-noreturn
18811 @opindex mabort-on-noreturn
18812 Generate a call to the function @code{abort} at the end of a
18813 @code{noreturn} function.  It is executed if the function tries to
18814 return.
18816 @item -mlong-calls
18817 @itemx -mno-long-calls
18818 @opindex mlong-calls
18819 @opindex mno-long-calls
18820 Tells the compiler to perform function calls by first loading the
18821 address of the function into a register and then performing a subroutine
18822 call on this register.  This switch is needed if the target function
18823 lies outside of the 64-megabyte addressing range of the offset-based
18824 version of subroutine call instruction.
18826 Even if this switch is enabled, not all function calls are turned
18827 into long calls.  The heuristic is that static functions, functions
18828 that have the @code{short_call} attribute, functions that are inside
18829 the scope of a @code{#pragma no_long_calls} directive, and functions whose
18830 definitions have already been compiled within the current compilation
18831 unit are not turned into long calls.  The exceptions to this rule are
18832 that weak function definitions, functions with the @code{long_call}
18833 attribute or the @code{section} attribute, and functions that are within
18834 the scope of a @code{#pragma long_calls} directive are always
18835 turned into long calls.
18837 This feature is not enabled by default.  Specifying
18838 @option{-mno-long-calls} restores the default behavior, as does
18839 placing the function calls within the scope of a @code{#pragma
18840 long_calls_off} directive.  Note these switches have no effect on how
18841 the compiler generates code to handle function calls via function
18842 pointers.
18844 @item -msingle-pic-base
18845 @opindex msingle-pic-base
18846 Treat the register used for PIC addressing as read-only, rather than
18847 loading it in the prologue for each function.  The runtime system is
18848 responsible for initializing this register with an appropriate value
18849 before execution begins.
18851 @item -mpic-register=@var{reg}
18852 @opindex mpic-register
18853 Specify the register to be used for PIC addressing.
18854 For standard PIC base case, the default is any suitable register
18855 determined by compiler.  For single PIC base case, the default is
18856 @samp{R9} if target is EABI based or stack-checking is enabled,
18857 otherwise the default is @samp{R10}.
18859 @item -mpic-data-is-text-relative
18860 @opindex mpic-data-is-text-relative
18861 Assume that the displacement between the text and data segments is fixed
18862 at static link time.  This permits using PC-relative addressing
18863 operations to access data known to be in the data segment.  For
18864 non-VxWorks RTP targets, this option is enabled by default.  When
18865 disabled on such targets, it will enable @option{-msingle-pic-base} by
18866 default.
18868 @item -mpoke-function-name
18869 @opindex mpoke-function-name
18870 Write the name of each function into the text section, directly
18871 preceding the function prologue.  The generated code is similar to this:
18873 @smallexample
18874      t0
18875          .ascii "arm_poke_function_name", 0
18876          .align
18877      t1
18878          .word 0xff000000 + (t1 - t0)
18879      arm_poke_function_name
18880          mov     ip, sp
18881          stmfd   sp!, @{fp, ip, lr, pc@}
18882          sub     fp, ip, #4
18883 @end smallexample
18885 When performing a stack backtrace, code can inspect the value of
18886 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
18887 location @code{pc - 12} and the top 8 bits are set, then we know that
18888 there is a function name embedded immediately preceding this location
18889 and has length @code{((pc[-3]) & 0xff000000)}.
18891 @item -mthumb
18892 @itemx -marm
18893 @opindex marm
18894 @opindex mthumb
18896 Select between generating code that executes in ARM and Thumb
18897 states.  The default for most configurations is to generate code
18898 that executes in ARM state, but the default can be changed by
18899 configuring GCC with the @option{--with-mode=}@var{state}
18900 configure option.
18902 You can also override the ARM and Thumb mode for each function
18903 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18904 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18906 @item -mflip-thumb 
18907 @opindex mflip-thumb
18908 Switch ARM/Thumb modes on alternating functions.
18909 This option is provided for regression testing of mixed Thumb/ARM code
18910 generation, and is not intended for ordinary use in compiling code.
18912 @item -mtpcs-frame
18913 @opindex mtpcs-frame
18914 Generate a stack frame that is compliant with the Thumb Procedure Call
18915 Standard for all non-leaf functions.  (A leaf function is one that does
18916 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
18918 @item -mtpcs-leaf-frame
18919 @opindex mtpcs-leaf-frame
18920 Generate a stack frame that is compliant with the Thumb Procedure Call
18921 Standard for all leaf functions.  (A leaf function is one that does
18922 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
18924 @item -mcallee-super-interworking
18925 @opindex mcallee-super-interworking
18926 Gives all externally visible functions in the file being compiled an ARM
18927 instruction set header which switches to Thumb mode before executing the
18928 rest of the function.  This allows these functions to be called from
18929 non-interworking code.  This option is not valid in AAPCS configurations
18930 because interworking is enabled by default.
18932 @item -mcaller-super-interworking
18933 @opindex mcaller-super-interworking
18934 Allows calls via function pointers (including virtual functions) to
18935 execute correctly regardless of whether the target code has been
18936 compiled for interworking or not.  There is a small overhead in the cost
18937 of executing a function pointer if this option is enabled.  This option
18938 is not valid in AAPCS configurations because interworking is enabled
18939 by default.
18941 @item -mtp=@var{name}
18942 @opindex mtp
18943 Specify the access model for the thread local storage pointer.  The valid
18944 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18945 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18946 (supported in the arm6k architecture), and @samp{auto}, which uses the
18947 best available method for the selected processor.  The default setting is
18948 @samp{auto}.
18950 @item -mtls-dialect=@var{dialect}
18951 @opindex mtls-dialect
18952 Specify the dialect to use for accessing thread local storage.  Two
18953 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
18954 @samp{gnu} dialect selects the original GNU scheme for supporting
18955 local and global dynamic TLS models.  The @samp{gnu2} dialect
18956 selects the GNU descriptor scheme, which provides better performance
18957 for shared libraries.  The GNU descriptor scheme is compatible with
18958 the original scheme, but does require new assembler, linker and
18959 library support.  Initial and local exec TLS models are unaffected by
18960 this option and always use the original scheme.
18962 @item -mword-relocations
18963 @opindex mword-relocations
18964 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18965 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18966 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18967 is specified. This option conflicts with @option{-mslow-flash-data}.
18969 @item -mfix-cortex-m3-ldrd
18970 @opindex mfix-cortex-m3-ldrd
18971 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18972 with overlapping destination and base registers are used.  This option avoids
18973 generating these instructions.  This option is enabled by default when
18974 @option{-mcpu=cortex-m3} is specified.
18976 @item -munaligned-access
18977 @itemx -mno-unaligned-access
18978 @opindex munaligned-access
18979 @opindex mno-unaligned-access
18980 Enables (or disables) reading and writing of 16- and 32- bit values
18981 from addresses that are not 16- or 32- bit aligned.  By default
18982 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18983 ARMv8-M Baseline architectures, and enabled for all other
18984 architectures.  If unaligned access is not enabled then words in packed
18985 data structures are accessed a byte at a time.
18987 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18988 generated object file to either true or false, depending upon the
18989 setting of this option.  If unaligned access is enabled then the
18990 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18991 defined.
18993 @item -mneon-for-64bits
18994 @opindex mneon-for-64bits
18995 This option is deprecated and has no effect.
18997 @item -mslow-flash-data
18998 @opindex mslow-flash-data
18999 Assume loading data from flash is slower than fetching instruction.
19000 Therefore literal load is minimized for better performance.
19001 This option is only supported when compiling for ARMv7 M-profile and
19002 off by default. It conflicts with @option{-mword-relocations}.
19004 @item -masm-syntax-unified
19005 @opindex masm-syntax-unified
19006 Assume inline assembler is using unified asm syntax.  The default is
19007 currently off which implies divided syntax.  This option has no impact
19008 on Thumb2. However, this may change in future releases of GCC.
19009 Divided syntax should be considered deprecated.
19011 @item -mrestrict-it
19012 @opindex mrestrict-it
19013 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19014 IT blocks can only contain a single 16-bit instruction from a select
19015 set of instructions. This option is on by default for ARMv8-A Thumb mode.
19017 @item -mprint-tune-info
19018 @opindex mprint-tune-info
19019 Print CPU tuning information as comment in assembler file.  This is
19020 an option used only for regression testing of the compiler and not
19021 intended for ordinary use in compiling code.  This option is disabled
19022 by default.
19024 @item -mverbose-cost-dump
19025 @opindex mverbose-cost-dump
19026 Enable verbose cost model dumping in the debug dump files.  This option is
19027 provided for use in debugging the compiler.
19029 @item -mpure-code
19030 @opindex mpure-code
19031 Do not allow constant data to be placed in code sections.
19032 Additionally, when compiling for ELF object format give all text sections the
19033 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
19034 is only available when generating non-pic code for M-profile targets.
19036 @item -mcmse
19037 @opindex mcmse
19038 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19039 Development Tools Engineering Specification", which can be found on
19040 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
19042 @item -mfdpic
19043 @itemx -mno-fdpic
19044 @opindex mfdpic
19045 @opindex mno-fdpic
19046 Select the FDPIC ABI, which uses 64-bit function descriptors to
19047 represent pointers to functions.  When the compiler is configured for
19048 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19049 and implies @option{-fPIE} if none of the PIC/PIE-related options is
19050 provided.  On other targets, it only enables the FDPIC-specific code
19051 generation features, and the user should explicitly provide the
19052 PIC/PIE-related options as needed.
19054 Note that static linking is not supported because it would still
19055 involve the dynamic linker when the program self-relocates.  If such
19056 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19058 The opposite @option{-mno-fdpic} option is useful (and required) to
19059 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19060 toolchain as the one used to build the userland programs.
19062 @end table
19064 @node AVR Options
19065 @subsection AVR Options
19066 @cindex AVR Options
19068 These options are defined for AVR implementations:
19070 @table @gcctabopt
19071 @item -mmcu=@var{mcu}
19072 @opindex mmcu
19073 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19075 The default for this option is@tie{}@samp{avr2}.
19077 GCC supports the following AVR devices and ISAs:
19079 @include avr-mmcu.texi
19081 @item -mabsdata
19082 @opindex mabsdata
19084 Assume that all data in static storage can be accessed by LDS / STS
19085 instructions.  This option has only an effect on reduced Tiny devices like
19086 ATtiny40.  See also the @code{absdata}
19087 @ref{AVR Variable Attributes,variable attribute}.
19089 @item -maccumulate-args
19090 @opindex maccumulate-args
19091 Accumulate outgoing function arguments and acquire/release the needed
19092 stack space for outgoing function arguments once in function
19093 prologue/epilogue.  Without this option, outgoing arguments are pushed
19094 before calling a function and popped afterwards.
19096 Popping the arguments after the function call can be expensive on
19097 AVR so that accumulating the stack space might lead to smaller
19098 executables because arguments need not be removed from the
19099 stack after such a function call.
19101 This option can lead to reduced code size for functions that perform
19102 several calls to functions that get their arguments on the stack like
19103 calls to printf-like functions.
19105 @item -mbranch-cost=@var{cost}
19106 @opindex mbranch-cost
19107 Set the branch costs for conditional branch instructions to
19108 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
19109 integers. The default branch cost is 0.
19111 @item -mcall-prologues
19112 @opindex mcall-prologues
19113 Functions prologues/epilogues are expanded as calls to appropriate
19114 subroutines.  Code size is smaller.
19116 @item -mdouble=@var{bits}
19117 @itemx -mlong-double=@var{bits}
19118 @opindex mdouble
19119 @opindex mlong-double
19120 Set the size (in bits) of the @code{double} or @code{long double} type,
19121 respectively.  Possible values for @var{bits} are 32 and 64.
19122 Whether or not a specific value for @var{bits} is allowed depends on
19123 the @code{--with-double=} and @code{--with-long-double=}
19124 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19125 and the same applies for the default values of the options.
19127 @item -mgas-isr-prologues
19128 @opindex mgas-isr-prologues
19129 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19130 instruction supported by GNU Binutils.
19131 If this option is on, the feature can still be disabled for individual
19132 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19133 function attribute.  This feature is activated per default
19134 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19135 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19137 @item -mint8
19138 @opindex mint8
19139 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
19140 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19141 and @code{long long} is 4 bytes.  Please note that this option does not
19142 conform to the C standards, but it results in smaller code
19143 size.
19145 @item -mmain-is-OS_task
19146 @opindex mmain-is-OS_task
19147 Do not save registers in @code{main}.  The effect is the same like
19148 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19149 to @code{main}. It is activated per default if optimization is on.
19151 @item -mn-flash=@var{num}
19152 @opindex mn-flash
19153 Assume that the flash memory has a size of 
19154 @var{num} times 64@tie{}KiB.
19156 @item -mno-interrupts
19157 @opindex mno-interrupts
19158 Generated code is not compatible with hardware interrupts.
19159 Code size is smaller.
19161 @item -mrelax
19162 @opindex mrelax
19163 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19164 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19165 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19166 the assembler's command line and the @option{--relax} option to the
19167 linker's command line.
19169 Jump relaxing is performed by the linker because jump offsets are not
19170 known before code is located. Therefore, the assembler code generated by the
19171 compiler is the same, but the instructions in the executable may
19172 differ from instructions in the assembler code.
19174 Relaxing must be turned on if linker stubs are needed, see the
19175 section on @code{EIND} and linker stubs below.
19177 @item -mrmw
19178 @opindex mrmw
19179 Assume that the device supports the Read-Modify-Write
19180 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19182 @item -mshort-calls
19183 @opindex mshort-calls
19185 Assume that @code{RJMP} and @code{RCALL} can target the whole
19186 program memory.
19188 This option is used internally for multilib selection.  It is
19189 not an optimization option, and you don't need to set it by hand.
19191 @item -msp8
19192 @opindex msp8
19193 Treat the stack pointer register as an 8-bit register,
19194 i.e.@: assume the high byte of the stack pointer is zero.
19195 In general, you don't need to set this option by hand.
19197 This option is used internally by the compiler to select and
19198 build multilibs for architectures @code{avr2} and @code{avr25}.
19199 These architectures mix devices with and without @code{SPH}.
19200 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19201 the compiler driver adds or removes this option from the compiler
19202 proper's command line, because the compiler then knows if the device
19203 or architecture has an 8-bit stack pointer and thus no @code{SPH}
19204 register or not.
19206 @item -mstrict-X
19207 @opindex mstrict-X
19208 Use address register @code{X} in a way proposed by the hardware.  This means
19209 that @code{X} is only used in indirect, post-increment or
19210 pre-decrement addressing.
19212 Without this option, the @code{X} register may be used in the same way
19213 as @code{Y} or @code{Z} which then is emulated by additional
19214 instructions.  
19215 For example, loading a value with @code{X+const} addressing with a
19216 small non-negative @code{const < 64} to a register @var{Rn} is
19217 performed as
19219 @example
19220 adiw r26, const   ; X += const
19221 ld   @var{Rn}, X        ; @var{Rn} = *X
19222 sbiw r26, const   ; X -= const
19223 @end example
19225 @item -mtiny-stack
19226 @opindex mtiny-stack
19227 Only change the lower 8@tie{}bits of the stack pointer.
19229 @item -mfract-convert-truncate
19230 @opindex mfract-convert-truncate
19231 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19233 @item -nodevicelib
19234 @opindex nodevicelib
19235 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19237 @item -nodevicespecs
19238 @opindex nodevicespecs
19239 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19240 command line.  The user takes responsibility for supplying the sub-processes
19241 like compiler proper, assembler and linker with appropriate command line
19242 options.  This means that the user has to supply her private device specs
19243 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
19244 more need for option @option{-mmcu=@var{mcu}}.
19246 This option can also serve as a replacement for the older way of
19247 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19248 which contains a folder named @code{device-specs} which contains a specs file named
19249 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19251 @item -Waddr-space-convert
19252 @opindex Waddr-space-convert
19253 @opindex Wno-addr-space-convert
19254 Warn about conversions between address spaces in the case where the
19255 resulting address space is not contained in the incoming address space.
19257 @item -Wmisspelled-isr
19258 @opindex Wmisspelled-isr
19259 @opindex Wno-misspelled-isr
19260 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19261 Enabled by default.
19262 @end table
19264 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19265 @cindex @code{EIND}
19266 Pointers in the implementation are 16@tie{}bits wide.
19267 The address of a function or label is represented as word address so
19268 that indirect jumps and calls can target any code address in the
19269 range of 64@tie{}Ki words.
19271 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19272 bytes of program memory space, there is a special function register called
19273 @code{EIND} that serves as most significant part of the target address
19274 when @code{EICALL} or @code{EIJMP} instructions are used.
19276 Indirect jumps and calls on these devices are handled as follows by
19277 the compiler and are subject to some limitations:
19279 @itemize @bullet
19281 @item
19282 The compiler never sets @code{EIND}.
19284 @item
19285 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19286 instructions or might read @code{EIND} directly in order to emulate an
19287 indirect call/jump by means of a @code{RET} instruction.
19289 @item
19290 The compiler assumes that @code{EIND} never changes during the startup
19291 code or during the application. In particular, @code{EIND} is not
19292 saved/restored in function or interrupt service routine
19293 prologue/epilogue.
19295 @item
19296 For indirect calls to functions and computed goto, the linker
19297 generates @emph{stubs}. Stubs are jump pads sometimes also called
19298 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19299 The stub contains a direct jump to the desired address.
19301 @item
19302 Linker relaxation must be turned on so that the linker generates
19303 the stubs correctly in all situations. See the compiler option
19304 @option{-mrelax} and the linker option @option{--relax}.
19305 There are corner cases where the linker is supposed to generate stubs
19306 but aborts without relaxation and without a helpful error message.
19308 @item
19309 The default linker script is arranged for code with @code{EIND = 0}.
19310 If code is supposed to work for a setup with @code{EIND != 0}, a custom
19311 linker script has to be used in order to place the sections whose
19312 name start with @code{.trampolines} into the segment where @code{EIND}
19313 points to.
19315 @item
19316 The startup code from libgcc never sets @code{EIND}.
19317 Notice that startup code is a blend of code from libgcc and AVR-LibC.
19318 For the impact of AVR-LibC on @code{EIND}, see the
19319 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19321 @item
19322 It is legitimate for user-specific startup code to set up @code{EIND}
19323 early, for example by means of initialization code located in
19324 section @code{.init3}. Such code runs prior to general startup code
19325 that initializes RAM and calls constructors, but after the bit
19326 of startup code from AVR-LibC that sets @code{EIND} to the segment
19327 where the vector table is located.
19328 @example
19329 #include <avr/io.h>
19331 static void
19332 __attribute__((section(".init3"),naked,used,no_instrument_function))
19333 init3_set_eind (void)
19335   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19336                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19338 @end example
19340 @noindent
19341 The @code{__trampolines_start} symbol is defined in the linker script.
19343 @item
19344 Stubs are generated automatically by the linker if
19345 the following two conditions are met:
19346 @itemize @minus
19348 @item The address of a label is taken by means of the @code{gs} modifier
19349 (short for @emph{generate stubs}) like so:
19350 @example
19351 LDI r24, lo8(gs(@var{func}))
19352 LDI r25, hi8(gs(@var{func}))
19353 @end example
19354 @item The final location of that label is in a code segment
19355 @emph{outside} the segment where the stubs are located.
19356 @end itemize
19358 @item
19359 The compiler emits such @code{gs} modifiers for code labels in the
19360 following situations:
19361 @itemize @minus
19362 @item Taking address of a function or code label.
19363 @item Computed goto.
19364 @item If prologue-save function is used, see @option{-mcall-prologues}
19365 command-line option.
19366 @item Switch/case dispatch tables. If you do not want such dispatch
19367 tables you can specify the @option{-fno-jump-tables} command-line option.
19368 @item C and C++ constructors/destructors called during startup/shutdown.
19369 @item If the tools hit a @code{gs()} modifier explained above.
19370 @end itemize
19372 @item
19373 Jumping to non-symbolic addresses like so is @emph{not} supported:
19375 @example
19376 int main (void)
19378     /* Call function at word address 0x2 */
19379     return ((int(*)(void)) 0x2)();
19381 @end example
19383 Instead, a stub has to be set up, i.e.@: the function has to be called
19384 through a symbol (@code{func_4} in the example):
19386 @example
19387 int main (void)
19389     extern int func_4 (void);
19391     /* Call function at byte address 0x4 */
19392     return func_4();
19394 @end example
19396 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19397 Alternatively, @code{func_4} can be defined in the linker script.
19398 @end itemize
19400 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19401 @cindex @code{RAMPD}
19402 @cindex @code{RAMPX}
19403 @cindex @code{RAMPY}
19404 @cindex @code{RAMPZ}
19405 Some AVR devices support memories larger than the 64@tie{}KiB range
19406 that can be accessed with 16-bit pointers.  To access memory locations
19407 outside this 64@tie{}KiB range, the content of a @code{RAMP}
19408 register is used as high part of the address:
19409 The @code{X}, @code{Y}, @code{Z} address register is concatenated
19410 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19411 register, respectively, to get a wide address. Similarly,
19412 @code{RAMPD} is used together with direct addressing.
19414 @itemize
19415 @item
19416 The startup code initializes the @code{RAMP} special function
19417 registers with zero.
19419 @item
19420 If a @ref{AVR Named Address Spaces,named address space} other than
19421 generic or @code{__flash} is used, then @code{RAMPZ} is set
19422 as needed before the operation.
19424 @item
19425 If the device supports RAM larger than 64@tie{}KiB and the compiler
19426 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19427 is reset to zero after the operation.
19429 @item
19430 If the device comes with a specific @code{RAMP} register, the ISR
19431 prologue/epilogue saves/restores that SFR and initializes it with
19432 zero in case the ISR code might (implicitly) use it.
19434 @item
19435 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19436 If you use inline assembler to read from locations outside the
19437 16-bit address range and change one of the @code{RAMP} registers,
19438 you must reset it to zero after the access.
19440 @end itemize
19442 @subsubsection AVR Built-in Macros
19444 GCC defines several built-in macros so that the user code can test
19445 for the presence or absence of features.  Almost any of the following
19446 built-in macros are deduced from device capabilities and thus
19447 triggered by the @option{-mmcu=} command-line option.
19449 For even more AVR-specific built-in macros see
19450 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19452 @table @code
19454 @item __AVR_ARCH__
19455 Build-in macro that resolves to a decimal number that identifies the
19456 architecture and depends on the @option{-mmcu=@var{mcu}} option.
19457 Possible values are:
19459 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19460 @code{4}, @code{5}, @code{51}, @code{6}
19462 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19463 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19465 respectively and
19467 @code{100},
19468 @code{102}, @code{103}, @code{104},
19469 @code{105}, @code{106}, @code{107}
19471 for @var{mcu}=@code{avrtiny},
19472 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19473 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19474 If @var{mcu} specifies a device, this built-in macro is set
19475 accordingly. For example, with @option{-mmcu=atmega8} the macro is
19476 defined to @code{4}.
19478 @item __AVR_@var{Device}__
19479 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19480 the device's name. For example, @option{-mmcu=atmega8} defines the
19481 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19482 @code{__AVR_ATtiny261A__}, etc.
19484 The built-in macros' names follow
19485 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19486 the device name as from the AVR user manual. The difference between
19487 @var{Device} in the built-in macro and @var{device} in
19488 @option{-mmcu=@var{device}} is that the latter is always lowercase.
19490 If @var{device} is not a device but only a core architecture like
19491 @samp{avr51}, this macro is not defined.
19493 @item __AVR_DEVICE_NAME__
19494 Setting @option{-mmcu=@var{device}} defines this built-in macro to
19495 the device's name. For example, with @option{-mmcu=atmega8} the macro
19496 is defined to @code{atmega8}.
19498 If @var{device} is not a device but only a core architecture like
19499 @samp{avr51}, this macro is not defined.
19501 @item __AVR_XMEGA__
19502 The device / architecture belongs to the XMEGA family of devices.
19504 @item __AVR_HAVE_ELPM__
19505 The device has the @code{ELPM} instruction.
19507 @item __AVR_HAVE_ELPMX__
19508 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19509 R@var{n},Z+} instructions.
19511 @item __AVR_HAVE_MOVW__
19512 The device has the @code{MOVW} instruction to perform 16-bit
19513 register-register moves.
19515 @item __AVR_HAVE_LPMX__
19516 The device has the @code{LPM R@var{n},Z} and
19517 @code{LPM R@var{n},Z+} instructions.
19519 @item __AVR_HAVE_MUL__
19520 The device has a hardware multiplier. 
19522 @item __AVR_HAVE_JMP_CALL__
19523 The device has the @code{JMP} and @code{CALL} instructions.
19524 This is the case for devices with more than 8@tie{}KiB of program
19525 memory.
19527 @item __AVR_HAVE_EIJMP_EICALL__
19528 @itemx __AVR_3_BYTE_PC__
19529 The device has the @code{EIJMP} and @code{EICALL} instructions.
19530 This is the case for devices with more than 128@tie{}KiB of program memory.
19531 This also means that the program counter
19532 (PC) is 3@tie{}bytes wide.
19534 @item __AVR_2_BYTE_PC__
19535 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19536 with up to 128@tie{}KiB of program memory.
19538 @item __AVR_HAVE_8BIT_SP__
19539 @itemx __AVR_HAVE_16BIT_SP__
19540 The stack pointer (SP) register is treated as 8-bit respectively
19541 16-bit register by the compiler.
19542 The definition of these macros is affected by @option{-mtiny-stack}.
19544 @item __AVR_HAVE_SPH__
19545 @itemx __AVR_SP8__
19546 The device has the SPH (high part of stack pointer) special function
19547 register or has an 8-bit stack pointer, respectively.
19548 The definition of these macros is affected by @option{-mmcu=} and
19549 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
19550 by @option{-msp8}.
19552 @item __AVR_HAVE_RAMPD__
19553 @itemx __AVR_HAVE_RAMPX__
19554 @itemx __AVR_HAVE_RAMPY__
19555 @itemx __AVR_HAVE_RAMPZ__
19556 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
19557 @code{RAMPZ} special function register, respectively.
19559 @item __NO_INTERRUPTS__
19560 This macro reflects the @option{-mno-interrupts} command-line option.
19562 @item __AVR_ERRATA_SKIP__
19563 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
19564 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19565 instructions because of a hardware erratum.  Skip instructions are
19566 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
19567 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
19568 set.
19570 @item __AVR_ISA_RMW__
19571 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
19573 @item __AVR_SFR_OFFSET__=@var{offset}
19574 Instructions that can address I/O special function registers directly
19575 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
19576 address as if addressed by an instruction to access RAM like @code{LD}
19577 or @code{STS}. This offset depends on the device architecture and has
19578 to be subtracted from the RAM address in order to get the
19579 respective I/O@tie{}address.
19581 @item __AVR_SHORT_CALLS__
19582 The @option{-mshort-calls} command line option is set.
19584 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
19585 Some devices support reading from flash memory by means of @code{LD*}
19586 instructions.  The flash memory is seen in the data address space
19587 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
19588 is not defined, this feature is not available.  If defined,
19589 the address space is linear and there is no need to put
19590 @code{.rodata} into RAM.  This is handled by the default linker
19591 description file, and is currently available for
19592 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
19593 there is no need to use address spaces like @code{__flash} or
19594 features like attribute @code{progmem} and @code{pgm_read_*}.
19596 @item __WITH_AVRLIBC__
19597 The compiler is configured to be used together with AVR-Libc.
19598 See the @option{--with-avrlibc} configure option.
19600 @item __HAVE_DOUBLE_MULTILIB__
19601 Defined if @option{-mdouble=} acts as a multilib option.
19603 @item __HAVE_DOUBLE32__
19604 @itemx __HAVE_DOUBLE64__
19605 Defined if the compiler supports 32-bit double resp. 64-bit double.
19606 The actual layout is specified by option @option{-mdouble=}.
19608 @item __DEFAULT_DOUBLE__
19609 The size in bits of @code{double} if @option{-mdouble=} is not set.
19610 To test the layout of @code{double} in a program, use the built-in
19611 macro @code{__SIZEOF_DOUBLE__}.
19613 @item __HAVE_LONG_DOUBLE32__
19614 @itemx __HAVE_LONG_DOUBLE64__
19615 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
19616 @itemx __DEFAULT_LONG_DOUBLE__
19617 Same as above, but for @code{long double} instead of @code{double}.
19619 @item __WITH_DOUBLE_COMPARISON__
19620 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
19621 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
19622 and is defined to @code{2} or @code{3}.
19624 @item __WITH_LIBF7_LIBGCC__
19625 @itemx __WITH_LIBF7_MATH__
19626 @itemx __WITH_LIBF7_MATH_SYMBOLS__
19627 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
19628 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
19630 @end table
19632 @node Blackfin Options
19633 @subsection Blackfin Options
19634 @cindex Blackfin Options
19636 @table @gcctabopt
19637 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
19638 @opindex mcpu=
19639 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
19640 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
19641 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
19642 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
19643 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
19644 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
19645 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
19646 @samp{bf561}, @samp{bf592}.
19648 The optional @var{sirevision} specifies the silicon revision of the target
19649 Blackfin processor.  Any workarounds available for the targeted silicon revision
19650 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
19651 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
19652 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
19653 hexadecimal digits representing the major and minor numbers in the silicon
19654 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
19655 is not defined.  If @var{sirevision} is @samp{any}, the
19656 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
19657 If this optional @var{sirevision} is not used, GCC assumes the latest known
19658 silicon revision of the targeted Blackfin processor.
19660 GCC defines a preprocessor macro for the specified @var{cpu}.
19661 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
19662 provided by libgloss to be linked in if @option{-msim} is not given.
19664 Without this option, @samp{bf532} is used as the processor by default.
19666 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
19667 only the preprocessor macro is defined.
19669 @item -msim
19670 @opindex msim
19671 Specifies that the program will be run on the simulator.  This causes
19672 the simulator BSP provided by libgloss to be linked in.  This option
19673 has effect only for @samp{bfin-elf} toolchain.
19674 Certain other options, such as @option{-mid-shared-library} and
19675 @option{-mfdpic}, imply @option{-msim}.
19677 @item -momit-leaf-frame-pointer
19678 @opindex momit-leaf-frame-pointer
19679 Don't keep the frame pointer in a register for leaf functions.  This
19680 avoids the instructions to save, set up and restore frame pointers and
19681 makes an extra register available in leaf functions.
19683 @item -mspecld-anomaly
19684 @opindex mspecld-anomaly
19685 When enabled, the compiler ensures that the generated code does not
19686 contain speculative loads after jump instructions. If this option is used,
19687 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
19689 @item -mno-specld-anomaly
19690 @opindex mno-specld-anomaly
19691 @opindex mspecld-anomaly
19692 Don't generate extra code to prevent speculative loads from occurring.
19694 @item -mcsync-anomaly
19695 @opindex mcsync-anomaly
19696 When enabled, the compiler ensures that the generated code does not
19697 contain CSYNC or SSYNC instructions too soon after conditional branches.
19698 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
19700 @item -mno-csync-anomaly
19701 @opindex mno-csync-anomaly
19702 @opindex mcsync-anomaly
19703 Don't generate extra code to prevent CSYNC or SSYNC instructions from
19704 occurring too soon after a conditional branch.
19706 @item -mlow64k
19707 @opindex mlow64k
19708 When enabled, the compiler is free to take advantage of the knowledge that
19709 the entire program fits into the low 64k of memory.
19711 @item -mno-low64k
19712 @opindex mno-low64k
19713 Assume that the program is arbitrarily large.  This is the default.
19715 @item -mstack-check-l1
19716 @opindex mstack-check-l1
19717 Do stack checking using information placed into L1 scratchpad memory by the
19718 uClinux kernel.
19720 @item -mid-shared-library
19721 @opindex mid-shared-library
19722 Generate code that supports shared libraries via the library ID method.
19723 This allows for execute in place and shared libraries in an environment
19724 without virtual memory management.  This option implies @option{-fPIC}.
19725 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19727 @item -mno-id-shared-library
19728 @opindex mno-id-shared-library
19729 @opindex mid-shared-library
19730 Generate code that doesn't assume ID-based shared libraries are being used.
19731 This is the default.
19733 @item -mleaf-id-shared-library
19734 @opindex mleaf-id-shared-library
19735 Generate code that supports shared libraries via the library ID method,
19736 but assumes that this library or executable won't link against any other
19737 ID shared libraries.  That allows the compiler to use faster code for jumps
19738 and calls.
19740 @item -mno-leaf-id-shared-library
19741 @opindex mno-leaf-id-shared-library
19742 @opindex mleaf-id-shared-library
19743 Do not assume that the code being compiled won't link against any ID shared
19744 libraries.  Slower code is generated for jump and call insns.
19746 @item -mshared-library-id=n
19747 @opindex mshared-library-id
19748 Specifies the identification number of the ID-based shared library being
19749 compiled.  Specifying a value of 0 generates more compact code; specifying
19750 other values forces the allocation of that number to the current
19751 library but is no more space- or time-efficient than omitting this option.
19753 @item -msep-data
19754 @opindex msep-data
19755 Generate code that allows the data segment to be located in a different
19756 area of memory from the text segment.  This allows for execute in place in
19757 an environment without virtual memory management by eliminating relocations
19758 against the text section.
19760 @item -mno-sep-data
19761 @opindex mno-sep-data
19762 @opindex msep-data
19763 Generate code that assumes that the data segment follows the text segment.
19764 This is the default.
19766 @item -mlong-calls
19767 @itemx -mno-long-calls
19768 @opindex mlong-calls
19769 @opindex mno-long-calls
19770 Tells the compiler to perform function calls by first loading the
19771 address of the function into a register and then performing a subroutine
19772 call on this register.  This switch is needed if the target function
19773 lies outside of the 24-bit addressing range of the offset-based
19774 version of subroutine call instruction.
19776 This feature is not enabled by default.  Specifying
19777 @option{-mno-long-calls} restores the default behavior.  Note these
19778 switches have no effect on how the compiler generates code to handle
19779 function calls via function pointers.
19781 @item -mfast-fp
19782 @opindex mfast-fp
19783 Link with the fast floating-point library. This library relaxes some of
19784 the IEEE floating-point standard's rules for checking inputs against
19785 Not-a-Number (NAN), in the interest of performance.
19787 @item -minline-plt
19788 @opindex minline-plt
19789 Enable inlining of PLT entries in function calls to functions that are
19790 not known to bind locally.  It has no effect without @option{-mfdpic}.
19792 @item -mmulticore
19793 @opindex mmulticore
19794 Build a standalone application for multicore Blackfin processors. 
19795 This option causes proper start files and link scripts supporting 
19796 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
19797 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
19799 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
19800 selects the one-application-per-core programming model.  Without
19801 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
19802 programming model is used. In this model, the main function of Core B
19803 should be named as @code{coreb_main}.
19805 If this option is not used, the single-core application programming
19806 model is used.
19808 @item -mcorea
19809 @opindex mcorea
19810 Build a standalone application for Core A of BF561 when using
19811 the one-application-per-core programming model. Proper start files
19812 and link scripts are used to support Core A, and the macro
19813 @code{__BFIN_COREA} is defined.
19814 This option can only be used in conjunction with @option{-mmulticore}.
19816 @item -mcoreb
19817 @opindex mcoreb
19818 Build a standalone application for Core B of BF561 when using
19819 the one-application-per-core programming model. Proper start files
19820 and link scripts are used to support Core B, and the macro
19821 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
19822 should be used instead of @code{main}. 
19823 This option can only be used in conjunction with @option{-mmulticore}.
19825 @item -msdram
19826 @opindex msdram
19827 Build a standalone application for SDRAM. Proper start files and
19828 link scripts are used to put the application into SDRAM, and the macro
19829 @code{__BFIN_SDRAM} is defined.
19830 The loader should initialize SDRAM before loading the application.
19832 @item -micplb
19833 @opindex micplb
19834 Assume that ICPLBs are enabled at run time.  This has an effect on certain
19835 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
19836 are enabled; for standalone applications the default is off.
19837 @end table
19839 @node C6X Options
19840 @subsection C6X Options
19841 @cindex C6X Options
19843 @table @gcctabopt
19844 @item -march=@var{name}
19845 @opindex march
19846 This specifies the name of the target architecture.  GCC uses this
19847 name to determine what kind of instructions it can emit when generating
19848 assembly code.  Permissible names are: @samp{c62x},
19849 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
19851 @item -mbig-endian
19852 @opindex mbig-endian
19853 Generate code for a big-endian target.
19855 @item -mlittle-endian
19856 @opindex mlittle-endian
19857 Generate code for a little-endian target.  This is the default.
19859 @item -msim
19860 @opindex msim
19861 Choose startup files and linker script suitable for the simulator.
19863 @item -msdata=default
19864 @opindex msdata=default
19865 Put small global and static data in the @code{.neardata} section,
19866 which is pointed to by register @code{B14}.  Put small uninitialized
19867 global and static data in the @code{.bss} section, which is adjacent
19868 to the @code{.neardata} section.  Put small read-only data into the
19869 @code{.rodata} section.  The corresponding sections used for large
19870 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
19872 @item -msdata=all
19873 @opindex msdata=all
19874 Put all data, not just small objects, into the sections reserved for
19875 small data, and use addressing relative to the @code{B14} register to
19876 access them.
19878 @item -msdata=none
19879 @opindex msdata=none
19880 Make no use of the sections reserved for small data, and use absolute
19881 addresses to access all data.  Put all initialized global and static
19882 data in the @code{.fardata} section, and all uninitialized data in the
19883 @code{.far} section.  Put all constant data into the @code{.const}
19884 section.
19885 @end table
19887 @node CRIS Options
19888 @subsection CRIS Options
19889 @cindex CRIS Options
19891 These options are defined specifically for the CRIS ports.
19893 @table @gcctabopt
19894 @item -march=@var{architecture-type}
19895 @itemx -mcpu=@var{architecture-type}
19896 @opindex march
19897 @opindex mcpu
19898 Generate code for the specified architecture.  The choices for
19899 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
19900 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
19901 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
19902 @samp{v10}.
19904 @item -mtune=@var{architecture-type}
19905 @opindex mtune
19906 Tune to @var{architecture-type} everything applicable about the generated
19907 code, except for the ABI and the set of available instructions.  The
19908 choices for @var{architecture-type} are the same as for
19909 @option{-march=@var{architecture-type}}.
19911 @item -mmax-stack-frame=@var{n}
19912 @opindex mmax-stack-frame
19913 Warn when the stack frame of a function exceeds @var{n} bytes.
19915 @item -metrax4
19916 @itemx -metrax100
19917 @opindex metrax4
19918 @opindex metrax100
19919 The options @option{-metrax4} and @option{-metrax100} are synonyms for
19920 @option{-march=v3} and @option{-march=v8} respectively.
19922 @item -mmul-bug-workaround
19923 @itemx -mno-mul-bug-workaround
19924 @opindex mmul-bug-workaround
19925 @opindex mno-mul-bug-workaround
19926 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
19927 models where it applies.  This option is active by default.
19929 @item -mpdebug
19930 @opindex mpdebug
19931 Enable CRIS-specific verbose debug-related information in the assembly
19932 code.  This option also has the effect of turning off the @samp{#NO_APP}
19933 formatted-code indicator to the assembler at the beginning of the
19934 assembly file.
19936 @item -mcc-init
19937 @opindex mcc-init
19938 Do not use condition-code results from previous instruction; always emit
19939 compare and test instructions before use of condition codes.
19941 @item -mno-side-effects
19942 @opindex mno-side-effects
19943 @opindex mside-effects
19944 Do not emit instructions with side effects in addressing modes other than
19945 post-increment.
19947 @item -mstack-align
19948 @itemx -mno-stack-align
19949 @itemx -mdata-align
19950 @itemx -mno-data-align
19951 @itemx -mconst-align
19952 @itemx -mno-const-align
19953 @opindex mstack-align
19954 @opindex mno-stack-align
19955 @opindex mdata-align
19956 @opindex mno-data-align
19957 @opindex mconst-align
19958 @opindex mno-const-align
19959 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19960 stack frame, individual data and constants to be aligned for the maximum
19961 single data access size for the chosen CPU model.  The default is to
19962 arrange for 32-bit alignment.  ABI details such as structure layout are
19963 not affected by these options.
19965 @item -m32-bit
19966 @itemx -m16-bit
19967 @itemx -m8-bit
19968 @opindex m32-bit
19969 @opindex m16-bit
19970 @opindex m8-bit
19971 Similar to the stack- data- and const-align options above, these options
19972 arrange for stack frame, writable data and constants to all be 32-bit,
19973 16-bit or 8-bit aligned.  The default is 32-bit alignment.
19975 @item -mno-prologue-epilogue
19976 @itemx -mprologue-epilogue
19977 @opindex mno-prologue-epilogue
19978 @opindex mprologue-epilogue
19979 With @option{-mno-prologue-epilogue}, the normal function prologue and
19980 epilogue which set up the stack frame are omitted and no return
19981 instructions or return sequences are generated in the code.  Use this
19982 option only together with visual inspection of the compiled code: no
19983 warnings or errors are generated when call-saved registers must be saved,
19984 or storage for local variables needs to be allocated.
19986 @item -mno-gotplt
19987 @itemx -mgotplt
19988 @opindex mno-gotplt
19989 @opindex mgotplt
19990 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19991 instruction sequences that load addresses for functions from the PLT part
19992 of the GOT rather than (traditional on other architectures) calls to the
19993 PLT@.  The default is @option{-mgotplt}.
19995 @item -melf
19996 @opindex melf
19997 Legacy no-op option only recognized with the cris-axis-elf and
19998 cris-axis-linux-gnu targets.
20000 @item -mlinux
20001 @opindex mlinux
20002 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20004 @item -sim
20005 @opindex sim
20006 This option, recognized for the cris-axis-elf, arranges
20007 to link with input-output functions from a simulator library.  Code,
20008 initialized data and zero-initialized data are allocated consecutively.
20010 @item -sim2
20011 @opindex sim2
20012 Like @option{-sim}, but pass linker options to locate initialized data at
20013 0x40000000 and zero-initialized data at 0x80000000.
20014 @end table
20016 @node CR16 Options
20017 @subsection CR16 Options
20018 @cindex CR16 Options
20020 These options are defined specifically for the CR16 ports.
20022 @table @gcctabopt
20024 @item -mmac
20025 @opindex mmac
20026 Enable the use of multiply-accumulate instructions. Disabled by default.
20028 @item -mcr16cplus
20029 @itemx -mcr16c
20030 @opindex mcr16cplus
20031 @opindex mcr16c
20032 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 
20033 is default.
20035 @item -msim
20036 @opindex msim
20037 Links the library libsim.a which is in compatible with simulator. Applicable
20038 to ELF compiler only.
20040 @item -mint32
20041 @opindex mint32
20042 Choose integer type as 32-bit wide.
20044 @item -mbit-ops
20045 @opindex mbit-ops
20046 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20048 @item -mdata-model=@var{model}
20049 @opindex mdata-model
20050 Choose a data model. The choices for @var{model} are @samp{near},
20051 @samp{far} or @samp{medium}. @samp{medium} is default.
20052 However, @samp{far} is not valid with @option{-mcr16c}, as the
20053 CR16C architecture does not support the far data model.
20054 @end table
20056 @node C-SKY Options
20057 @subsection C-SKY Options
20058 @cindex C-SKY Options
20060 GCC supports these options when compiling for C-SKY V2 processors.
20062 @table @gcctabopt
20064 @item -march=@var{arch}
20065 @opindex march=
20066 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
20067 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20068 The default is @samp{ck810}.
20070 @item -mcpu=@var{cpu}
20071 @opindex mcpu=
20072 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
20073 @samp{ck801}, @samp{ck801t},
20074 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
20075 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20076 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20077 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20078 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20079 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20080 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20081 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20082 @samp{ck803eftr1}, @samp{ck803efhtr1},
20083 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20084 @samp{ck803sef}, @samp{ck803seft},
20085 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20086 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20087 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20088 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20090 @item -mbig-endian
20091 @opindex mbig-endian
20092 @itemx -EB
20093 @opindex EB
20094 @itemx -mlittle-endian
20095 @opindex mlittle-endian
20096 @itemx -EL
20097 @opindex EL
20099 Select big- or little-endian code.  The default is little-endian.
20101 @item -mhard-float
20102 @opindex mhard-float
20103 @itemx -msoft-float
20104 @opindex msoft-float
20106 Select hardware or software floating-point implementations.
20107 The default is soft float.
20109 @item -mdouble-float
20110 @itemx -mno-double-float
20111 @opindex mdouble-float
20112 When @option{-mhard-float} is in effect, enable generation of
20113 double-precision float instructions.  This is the default except
20114 when compiling for CK803.
20116 @item -mfdivdu
20117 @itemx -mno-fdivdu
20118 @opindex mfdivdu
20119 When @option{-mhard-float} is in effect, enable generation of
20120 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20121 This is the default except when compiling for CK803.
20123 @item -mfpu=@var{fpu}
20124 @opindex mfpu=
20125 Select the floating-point processor.  This option can only be used with
20126 @option{-mhard-float}.
20127 Values for @var{fpu} are
20128 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20129 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20130 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20132 @item -melrw
20133 @itemx -mno-elrw
20134 @opindex melrw
20135 Enable the extended @code{lrw} instruction.  This option defaults to on
20136 for CK801 and off otherwise.
20138 @item -mistack
20139 @itemx -mno-istack
20140 @opindex mistack
20141 Enable interrupt stack instructions; the default is off.
20143 The @option{-mistack} option is required to handle the
20144 @code{interrupt} and @code{isr} function attributes
20145 (@pxref{C-SKY Function Attributes}).
20147 @item -mmp
20148 @opindex mmp
20149 Enable multiprocessor instructions; the default is off.
20151 @item -mcp
20152 @opindex mcp
20153 Enable coprocessor instructions; the default is off.
20155 @item -mcache
20156 @opindex mcache
20157 Enable coprocessor instructions; the default is off.
20159 @item -msecurity
20160 @opindex msecurity
20161 Enable C-SKY security instructions; the default is off.
20163 @item -mtrust
20164 @opindex mtrust
20165 Enable C-SKY trust instructions; the default is off.
20167 @item -mdsp
20168 @opindex mdsp
20169 @itemx -medsp
20170 @opindex medsp
20171 @itemx -mvdsp
20172 @opindex mvdsp
20173 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20174 All of these options default to off.
20176 @item -mdiv
20177 @itemx -mno-div
20178 @opindex mdiv
20179 Generate divide instructions.  Default is off.
20181 @item -msmart
20182 @itemx -mno-smart
20183 @opindex msmart
20184 Generate code for Smart Mode, using only registers numbered 0-7 to allow
20185 use of 16-bit instructions.  This option is ignored for CK801 where this
20186 is the required behavior, and it defaults to on for CK802.
20187 For other targets, the default is off.
20189 @item -mhigh-registers
20190 @itemx -mno-high-registers
20191 @opindex mhigh-registers
20192 Generate code using the high registers numbered 16-31.  This option
20193 is not supported on CK801, CK802, or CK803, and is enabled by default
20194 for other processors.
20196 @item -manchor
20197 @itemx -mno-anchor
20198 @opindex manchor
20199 Generate code using global anchor symbol addresses.
20201 @item -mpushpop
20202 @itemx -mno-pushpop
20203 @opindex mpushpop
20204 Generate code using @code{push} and @code{pop} instructions.  This option
20205 defaults to on.
20207 @item -mmultiple-stld
20208 @itemx -mstm
20209 @itemx -mno-multiple-stld
20210 @itemx -mno-stm
20211 @opindex mmultiple-stld
20212 Generate code using @code{stm} and @code{ldm} instructions.  This option
20213 isn't supported on CK801 but is enabled by default on other processors.
20215 @item -mconstpool
20216 @itemx -mno-constpool
20217 @opindex mconstpool
20218 Create constant pools in the compiler instead of deferring it to the
20219 assembler.  This option is the default and required for correct code
20220 generation on CK801 and CK802, and is optional on other processors.
20222 @item -mstack-size
20223 @item -mno-stack-size
20224 @opindex mstack-size
20225 Emit @code{.stack_size} directives for each function in the assembly
20226 output.  This option defaults to off.
20228 @item -mccrt
20229 @itemx -mno-ccrt
20230 @opindex mccrt
20231 Generate code for the C-SKY compiler runtime instead of libgcc.  This
20232 option defaults to off.
20234 @item -mbranch-cost=@var{n}
20235 @opindex mbranch-cost=
20236 Set the branch costs to roughly @code{n} instructions.  The default is 1.
20238 @item -msched-prolog
20239 @itemx -mno-sched-prolog
20240 @opindex msched-prolog
20241 Permit scheduling of function prologue and epilogue sequences.  Using
20242 this option can result in code that is not compliant with the C-SKY V2 ABI
20243 prologue requirements and that cannot be debugged or backtraced.
20244 It is disabled by default.
20246 @end table
20248 @node Darwin Options
20249 @subsection Darwin Options
20250 @cindex Darwin options
20252 These options are defined for all architectures running the Darwin operating
20253 system.
20255 FSF GCC on Darwin does not create ``fat'' object files; it creates
20256 an object file for the single architecture that GCC was built to
20257 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
20258 @option{-arch} options are used; it does so by running the compiler or
20259 linker multiple times and joining the results together with
20260 @file{lipo}.
20262 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20263 @samp{i686}) is determined by the flags that specify the ISA
20264 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
20265 @option{-force_cpusubtype_ALL} option can be used to override this.
20267 The Darwin tools vary in their behavior when presented with an ISA
20268 mismatch.  The assembler, @file{as}, only permits instructions to
20269 be used that are valid for the subtype of the file it is generating,
20270 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20271 The linker for shared libraries, @file{/usr/bin/libtool}, fails
20272 and prints an error if asked to create a shared library with a less
20273 restrictive subtype than its input files (for instance, trying to put
20274 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
20275 for executables, @command{ld}, quietly gives the executable the most
20276 restrictive subtype of any of its input files.
20278 @table @gcctabopt
20279 @item -F@var{dir}
20280 @opindex F
20281 Add the framework directory @var{dir} to the head of the list of
20282 directories to be searched for header files.  These directories are
20283 interleaved with those specified by @option{-I} options and are
20284 scanned in a left-to-right order.
20286 A framework directory is a directory with frameworks in it.  A
20287 framework is a directory with a @file{Headers} and/or
20288 @file{PrivateHeaders} directory contained directly in it that ends
20289 in @file{.framework}.  The name of a framework is the name of this
20290 directory excluding the @file{.framework}.  Headers associated with
20291 the framework are found in one of those two directories, with
20292 @file{Headers} being searched first.  A subframework is a framework
20293 directory that is in a framework's @file{Frameworks} directory.
20294 Includes of subframework headers can only appear in a header of a
20295 framework that contains the subframework, or in a sibling subframework
20296 header.  Two subframeworks are siblings if they occur in the same
20297 framework.  A subframework should not have the same name as a
20298 framework; a warning is issued if this is violated.  Currently a
20299 subframework cannot have subframeworks; in the future, the mechanism
20300 may be extended to support this.  The standard frameworks can be found
20301 in @file{/System/Library/Frameworks} and
20302 @file{/Library/Frameworks}.  An example include looks like
20303 @code{#include <Framework/header.h>}, where @file{Framework} denotes
20304 the name of the framework and @file{header.h} is found in the
20305 @file{PrivateHeaders} or @file{Headers} directory.
20307 @item -iframework@var{dir}
20308 @opindex iframework
20309 Like @option{-F} except the directory is a treated as a system
20310 directory.  The main difference between this @option{-iframework} and
20311 @option{-F} is that with @option{-iframework} the compiler does not
20312 warn about constructs contained within header files found via
20313 @var{dir}.  This option is valid only for the C family of languages.
20315 @item -gused
20316 @opindex gused
20317 Emit debugging information for symbols that are used.  For stabs
20318 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20319 This is by default ON@.
20321 @item -gfull
20322 @opindex gfull
20323 Emit debugging information for all symbols and types.
20325 @item -mmacosx-version-min=@var{version}
20326 The earliest version of MacOS X that this executable will run on
20327 is @var{version}.  Typical values of @var{version} include @code{10.1},
20328 @code{10.2}, and @code{10.3.9}.
20330 If the compiler was built to use the system's headers by default,
20331 then the default for this option is the system version on which the
20332 compiler is running, otherwise the default is to make choices that
20333 are compatible with as many systems and code bases as possible.
20335 @item -mkernel
20336 @opindex mkernel
20337 Enable kernel development mode.  The @option{-mkernel} option sets
20338 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20339 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20340 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20341 applicable.  This mode also sets @option{-mno-altivec},
20342 @option{-msoft-float}, @option{-fno-builtin} and
20343 @option{-mlong-branch} for PowerPC targets.
20345 @item -mone-byte-bool
20346 @opindex mone-byte-bool
20347 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20348 By default @code{sizeof(bool)} is @code{4} when compiling for
20349 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20350 option has no effect on x86.
20352 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20353 to generate code that is not binary compatible with code generated
20354 without that switch.  Using this switch may require recompiling all
20355 other modules in a program, including system libraries.  Use this
20356 switch to conform to a non-default data model.
20358 @item -mfix-and-continue
20359 @itemx -ffix-and-continue
20360 @itemx -findirect-data
20361 @opindex mfix-and-continue
20362 @opindex ffix-and-continue
20363 @opindex findirect-data
20364 Generate code suitable for fast turnaround development, such as to
20365 allow GDB to dynamically load @file{.o} files into already-running
20366 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
20367 are provided for backwards compatibility.
20369 @item -all_load
20370 @opindex all_load
20371 Loads all members of static archive libraries.
20372 See man ld(1) for more information.
20374 @item -arch_errors_fatal
20375 @opindex arch_errors_fatal
20376 Cause the errors having to do with files that have the wrong architecture
20377 to be fatal.
20379 @item -bind_at_load
20380 @opindex bind_at_load
20381 Causes the output file to be marked such that the dynamic linker will
20382 bind all undefined references when the file is loaded or launched.
20384 @item -bundle
20385 @opindex bundle
20386 Produce a Mach-o bundle format file.
20387 See man ld(1) for more information.
20389 @item -bundle_loader @var{executable}
20390 @opindex bundle_loader
20391 This option specifies the @var{executable} that will load the build
20392 output file being linked.  See man ld(1) for more information.
20394 @item -dynamiclib
20395 @opindex dynamiclib
20396 When passed this option, GCC produces a dynamic library instead of
20397 an executable when linking, using the Darwin @file{libtool} command.
20399 @item -force_cpusubtype_ALL
20400 @opindex force_cpusubtype_ALL
20401 This causes GCC's output file to have the @samp{ALL} subtype, instead of
20402 one controlled by the @option{-mcpu} or @option{-march} option.
20404 @item -allowable_client  @var{client_name}
20405 @itemx -client_name
20406 @itemx -compatibility_version
20407 @itemx -current_version
20408 @itemx -dead_strip
20409 @itemx -dependency-file
20410 @itemx -dylib_file
20411 @itemx -dylinker_install_name
20412 @itemx -dynamic
20413 @itemx -exported_symbols_list
20414 @itemx -filelist
20415 @need 800
20416 @itemx -flat_namespace
20417 @itemx -force_flat_namespace
20418 @itemx -headerpad_max_install_names
20419 @itemx -image_base
20420 @itemx -init
20421 @itemx -install_name
20422 @itemx -keep_private_externs
20423 @itemx -multi_module
20424 @itemx -multiply_defined
20425 @itemx -multiply_defined_unused
20426 @need 800
20427 @itemx -noall_load
20428 @itemx -no_dead_strip_inits_and_terms
20429 @itemx -nofixprebinding
20430 @itemx -nomultidefs
20431 @itemx -noprebind
20432 @itemx -noseglinkedit
20433 @itemx -pagezero_size
20434 @itemx -prebind
20435 @itemx -prebind_all_twolevel_modules
20436 @itemx -private_bundle
20437 @need 800
20438 @itemx -read_only_relocs
20439 @itemx -sectalign
20440 @itemx -sectobjectsymbols
20441 @itemx -whyload
20442 @itemx -seg1addr
20443 @itemx -sectcreate
20444 @itemx -sectobjectsymbols
20445 @itemx -sectorder
20446 @itemx -segaddr
20447 @itemx -segs_read_only_addr
20448 @need 800
20449 @itemx -segs_read_write_addr
20450 @itemx -seg_addr_table
20451 @itemx -seg_addr_table_filename
20452 @itemx -seglinkedit
20453 @itemx -segprot
20454 @itemx -segs_read_only_addr
20455 @itemx -segs_read_write_addr
20456 @itemx -single_module
20457 @itemx -static
20458 @itemx -sub_library
20459 @need 800
20460 @itemx -sub_umbrella
20461 @itemx -twolevel_namespace
20462 @itemx -umbrella
20463 @itemx -undefined
20464 @itemx -unexported_symbols_list
20465 @itemx -weak_reference_mismatches
20466 @itemx -whatsloaded
20467 @opindex allowable_client
20468 @opindex client_name
20469 @opindex compatibility_version
20470 @opindex current_version
20471 @opindex dead_strip
20472 @opindex dependency-file
20473 @opindex dylib_file
20474 @opindex dylinker_install_name
20475 @opindex dynamic
20476 @opindex exported_symbols_list
20477 @opindex filelist
20478 @opindex flat_namespace
20479 @opindex force_flat_namespace
20480 @opindex headerpad_max_install_names
20481 @opindex image_base
20482 @opindex init
20483 @opindex install_name
20484 @opindex keep_private_externs
20485 @opindex multi_module
20486 @opindex multiply_defined
20487 @opindex multiply_defined_unused
20488 @opindex noall_load
20489 @opindex no_dead_strip_inits_and_terms
20490 @opindex nofixprebinding
20491 @opindex nomultidefs
20492 @opindex noprebind
20493 @opindex noseglinkedit
20494 @opindex pagezero_size
20495 @opindex prebind
20496 @opindex prebind_all_twolevel_modules
20497 @opindex private_bundle
20498 @opindex read_only_relocs
20499 @opindex sectalign
20500 @opindex sectobjectsymbols
20501 @opindex whyload
20502 @opindex seg1addr
20503 @opindex sectcreate
20504 @opindex sectobjectsymbols
20505 @opindex sectorder
20506 @opindex segaddr
20507 @opindex segs_read_only_addr
20508 @opindex segs_read_write_addr
20509 @opindex seg_addr_table
20510 @opindex seg_addr_table_filename
20511 @opindex seglinkedit
20512 @opindex segprot
20513 @opindex segs_read_only_addr
20514 @opindex segs_read_write_addr
20515 @opindex single_module
20516 @opindex static
20517 @opindex sub_library
20518 @opindex sub_umbrella
20519 @opindex twolevel_namespace
20520 @opindex umbrella
20521 @opindex undefined
20522 @opindex unexported_symbols_list
20523 @opindex weak_reference_mismatches
20524 @opindex whatsloaded
20525 These options are passed to the Darwin linker.  The Darwin linker man page
20526 describes them in detail.
20527 @end table
20529 @node DEC Alpha Options
20530 @subsection DEC Alpha Options
20532 These @samp{-m} options are defined for the DEC Alpha implementations:
20534 @table @gcctabopt
20535 @item -mno-soft-float
20536 @itemx -msoft-float
20537 @opindex mno-soft-float
20538 @opindex msoft-float
20539 Use (do not use) the hardware floating-point instructions for
20540 floating-point operations.  When @option{-msoft-float} is specified,
20541 functions in @file{libgcc.a} are used to perform floating-point
20542 operations.  Unless they are replaced by routines that emulate the
20543 floating-point operations, or compiled in such a way as to call such
20544 emulations routines, these routines issue floating-point
20545 operations.   If you are compiling for an Alpha without floating-point
20546 operations, you must ensure that the library is built so as not to call
20547 them.
20549 Note that Alpha implementations without floating-point operations are
20550 required to have floating-point registers.
20552 @item -mfp-reg
20553 @itemx -mno-fp-regs
20554 @opindex mfp-reg
20555 @opindex mno-fp-regs
20556 Generate code that uses (does not use) the floating-point register set.
20557 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
20558 register set is not used, floating-point operands are passed in integer
20559 registers as if they were integers and floating-point results are passed
20560 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
20561 so any function with a floating-point argument or return value called by code
20562 compiled with @option{-mno-fp-regs} must also be compiled with that
20563 option.
20565 A typical use of this option is building a kernel that does not use,
20566 and hence need not save and restore, any floating-point registers.
20568 @item -mieee
20569 @opindex mieee
20570 The Alpha architecture implements floating-point hardware optimized for
20571 maximum performance.  It is mostly compliant with the IEEE floating-point
20572 standard.  However, for full compliance, software assistance is
20573 required.  This option generates code fully IEEE-compliant code
20574 @emph{except} that the @var{inexact-flag} is not maintained (see below).
20575 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
20576 defined during compilation.  The resulting code is less efficient but is
20577 able to correctly support denormalized numbers and exceptional IEEE
20578 values such as not-a-number and plus/minus infinity.  Other Alpha
20579 compilers call this option @option{-ieee_with_no_inexact}.
20581 @item -mieee-with-inexact
20582 @opindex mieee-with-inexact
20583 This is like @option{-mieee} except the generated code also maintains
20584 the IEEE @var{inexact-flag}.  Turning on this option causes the
20585 generated code to implement fully-compliant IEEE math.  In addition to
20586 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
20587 macro.  On some Alpha implementations the resulting code may execute
20588 significantly slower than the code generated by default.  Since there is
20589 very little code that depends on the @var{inexact-flag}, you should
20590 normally not specify this option.  Other Alpha compilers call this
20591 option @option{-ieee_with_inexact}.
20593 @item -mfp-trap-mode=@var{trap-mode}
20594 @opindex mfp-trap-mode
20595 This option controls what floating-point related traps are enabled.
20596 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
20597 The trap mode can be set to one of four values:
20599 @table @samp
20600 @item n
20601 This is the default (normal) setting.  The only traps that are enabled
20602 are the ones that cannot be disabled in software (e.g., division by zero
20603 trap).
20605 @item u
20606 In addition to the traps enabled by @samp{n}, underflow traps are enabled
20607 as well.
20609 @item su
20610 Like @samp{u}, but the instructions are marked to be safe for software
20611 completion (see Alpha architecture manual for details).
20613 @item sui
20614 Like @samp{su}, but inexact traps are enabled as well.
20615 @end table
20617 @item -mfp-rounding-mode=@var{rounding-mode}
20618 @opindex mfp-rounding-mode
20619 Selects the IEEE rounding mode.  Other Alpha compilers call this option
20620 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
20623 @table @samp
20624 @item n
20625 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
20626 the nearest machine number or towards the even machine number in case
20627 of a tie.
20629 @item m
20630 Round towards minus infinity.
20632 @item c
20633 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
20635 @item d
20636 Dynamic rounding mode.  A field in the floating-point control register
20637 (@var{fpcr}, see Alpha architecture reference manual) controls the
20638 rounding mode in effect.  The C library initializes this register for
20639 rounding towards plus infinity.  Thus, unless your program modifies the
20640 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
20641 @end table
20643 @item -mtrap-precision=@var{trap-precision}
20644 @opindex mtrap-precision
20645 In the Alpha architecture, floating-point traps are imprecise.  This
20646 means without software assistance it is impossible to recover from a
20647 floating trap and program execution normally needs to be terminated.
20648 GCC can generate code that can assist operating system trap handlers
20649 in determining the exact location that caused a floating-point trap.
20650 Depending on the requirements of an application, different levels of
20651 precisions can be selected:
20653 @table @samp
20654 @item p
20655 Program precision.  This option is the default and means a trap handler
20656 can only identify which program caused a floating-point exception.
20658 @item f
20659 Function precision.  The trap handler can determine the function that
20660 caused a floating-point exception.
20662 @item i
20663 Instruction precision.  The trap handler can determine the exact
20664 instruction that caused a floating-point exception.
20665 @end table
20667 Other Alpha compilers provide the equivalent options called
20668 @option{-scope_safe} and @option{-resumption_safe}.
20670 @item -mieee-conformant
20671 @opindex mieee-conformant
20672 This option marks the generated code as IEEE conformant.  You must not
20673 use this option unless you also specify @option{-mtrap-precision=i} and either
20674 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
20675 is to emit the line @samp{.eflag 48} in the function prologue of the
20676 generated assembly file.
20678 @item -mbuild-constants
20679 @opindex mbuild-constants
20680 Normally GCC examines a 32- or 64-bit integer constant to
20681 see if it can construct it from smaller constants in two or three
20682 instructions.  If it cannot, it outputs the constant as a literal and
20683 generates code to load it from the data segment at run time.
20685 Use this option to require GCC to construct @emph{all} integer constants
20686 using code, even if it takes more instructions (the maximum is six).
20688 You typically use this option to build a shared library dynamic
20689 loader.  Itself a shared library, it must relocate itself in memory
20690 before it can find the variables and constants in its own data segment.
20692 @item -mbwx
20693 @itemx -mno-bwx
20694 @itemx -mcix
20695 @itemx -mno-cix
20696 @itemx -mfix
20697 @itemx -mno-fix
20698 @itemx -mmax
20699 @itemx -mno-max
20700 @opindex mbwx
20701 @opindex mno-bwx
20702 @opindex mcix
20703 @opindex mno-cix
20704 @opindex mfix
20705 @opindex mno-fix
20706 @opindex mmax
20707 @opindex mno-max
20708 Indicate whether GCC should generate code to use the optional BWX,
20709 CIX, FIX and MAX instruction sets.  The default is to use the instruction
20710 sets supported by the CPU type specified via @option{-mcpu=} option or that
20711 of the CPU on which GCC was built if none is specified.
20713 @item -mfloat-vax
20714 @itemx -mfloat-ieee
20715 @opindex mfloat-vax
20716 @opindex mfloat-ieee
20717 Generate code that uses (does not use) VAX F and G floating-point
20718 arithmetic instead of IEEE single and double precision.
20720 @item -mexplicit-relocs
20721 @itemx -mno-explicit-relocs
20722 @opindex mexplicit-relocs
20723 @opindex mno-explicit-relocs
20724 Older Alpha assemblers provided no way to generate symbol relocations
20725 except via assembler macros.  Use of these macros does not allow
20726 optimal instruction scheduling.  GNU binutils as of version 2.12
20727 supports a new syntax that allows the compiler to explicitly mark
20728 which relocations should apply to which instructions.  This option
20729 is mostly useful for debugging, as GCC detects the capabilities of
20730 the assembler when it is built and sets the default accordingly.
20732 @item -msmall-data
20733 @itemx -mlarge-data
20734 @opindex msmall-data
20735 @opindex mlarge-data
20736 When @option{-mexplicit-relocs} is in effect, static data is
20737 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
20738 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
20739 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
20740 16-bit relocations off of the @code{$gp} register.  This limits the
20741 size of the small data area to 64KB, but allows the variables to be
20742 directly accessed via a single instruction.
20744 The default is @option{-mlarge-data}.  With this option the data area
20745 is limited to just below 2GB@.  Programs that require more than 2GB of
20746 data must use @code{malloc} or @code{mmap} to allocate the data in the
20747 heap instead of in the program's data segment.
20749 When generating code for shared libraries, @option{-fpic} implies
20750 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
20752 @item -msmall-text
20753 @itemx -mlarge-text
20754 @opindex msmall-text
20755 @opindex mlarge-text
20756 When @option{-msmall-text} is used, the compiler assumes that the
20757 code of the entire program (or shared library) fits in 4MB, and is
20758 thus reachable with a branch instruction.  When @option{-msmall-data}
20759 is used, the compiler can assume that all local symbols share the
20760 same @code{$gp} value, and thus reduce the number of instructions
20761 required for a function call from 4 to 1.
20763 The default is @option{-mlarge-text}.
20765 @item -mcpu=@var{cpu_type}
20766 @opindex mcpu
20767 Set the instruction set and instruction scheduling parameters for
20768 machine type @var{cpu_type}.  You can specify either the @samp{EV}
20769 style name or the corresponding chip number.  GCC supports scheduling
20770 parameters for the EV4, EV5 and EV6 family of processors and
20771 chooses the default values for the instruction set from the processor
20772 you specify.  If you do not specify a processor type, GCC defaults
20773 to the processor on which the compiler was built.
20775 Supported values for @var{cpu_type} are
20777 @table @samp
20778 @item ev4
20779 @itemx ev45
20780 @itemx 21064
20781 Schedules as an EV4 and has no instruction set extensions.
20783 @item ev5
20784 @itemx 21164
20785 Schedules as an EV5 and has no instruction set extensions.
20787 @item ev56
20788 @itemx 21164a
20789 Schedules as an EV5 and supports the BWX extension.
20791 @item pca56
20792 @itemx 21164pc
20793 @itemx 21164PC
20794 Schedules as an EV5 and supports the BWX and MAX extensions.
20796 @item ev6
20797 @itemx 21264
20798 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
20800 @item ev67
20801 @itemx 21264a
20802 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
20803 @end table
20805 Native toolchains also support the value @samp{native},
20806 which selects the best architecture option for the host processor.
20807 @option{-mcpu=native} has no effect if GCC does not recognize
20808 the processor.
20810 @item -mtune=@var{cpu_type}
20811 @opindex mtune
20812 Set only the instruction scheduling parameters for machine type
20813 @var{cpu_type}.  The instruction set is not changed.
20815 Native toolchains also support the value @samp{native},
20816 which selects the best architecture option for the host processor.
20817 @option{-mtune=native} has no effect if GCC does not recognize
20818 the processor.
20820 @item -mmemory-latency=@var{time}
20821 @opindex mmemory-latency
20822 Sets the latency the scheduler should assume for typical memory
20823 references as seen by the application.  This number is highly
20824 dependent on the memory access patterns used by the application
20825 and the size of the external cache on the machine.
20827 Valid options for @var{time} are
20829 @table @samp
20830 @item @var{number}
20831 A decimal number representing clock cycles.
20833 @item L1
20834 @itemx L2
20835 @itemx L3
20836 @itemx main
20837 The compiler contains estimates of the number of clock cycles for
20838 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20839 (also called Dcache, Scache, and Bcache), as well as to main memory.
20840 Note that L3 is only valid for EV5.
20842 @end table
20843 @end table
20845 @node eBPF Options
20846 @subsection eBPF Options
20847 @cindex eBPF Options
20849 @table @gcctabopt
20850 @item -mframe-limit=@var{bytes}
20851 This specifies the hard limit for frame sizes, in bytes.  Currently,
20852 the value that can be specified should be less than or equal to
20853 @samp{32767}.  Defaults to whatever limit is imposed by the version of
20854 the Linux kernel targeted.
20856 @item -mkernel=@var{version}
20857 @opindex mkernel
20858 This specifies the minimum version of the kernel that will run the
20859 compiled program.  GCC uses this version to determine which
20860 instructions to use, what kernel helpers to allow, etc.  Currently,
20861 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
20862 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
20863 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
20864 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
20865 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
20866 @samp{5.2}, @samp{latest} and @samp{native}.
20868 @item -mbig-endian
20869 @opindex mbig-endian
20870 Generate code for a big-endian target.
20872 @item -mlittle-endian
20873 @opindex mlittle-endian
20874 Generate code for a little-endian target.  This is the default.
20875 @end table
20877 @node FR30 Options
20878 @subsection FR30 Options
20879 @cindex FR30 Options
20881 These options are defined specifically for the FR30 port.
20883 @table @gcctabopt
20885 @item -msmall-model
20886 @opindex msmall-model
20887 Use the small address space model.  This can produce smaller code, but
20888 it does assume that all symbolic values and addresses fit into a
20889 20-bit range.
20891 @item -mno-lsim
20892 @opindex mno-lsim
20893 Assume that runtime support has been provided and so there is no need
20894 to include the simulator library (@file{libsim.a}) on the linker
20895 command line.
20897 @end table
20899 @node FT32 Options
20900 @subsection FT32 Options
20901 @cindex FT32 Options
20903 These options are defined specifically for the FT32 port.
20905 @table @gcctabopt
20907 @item -msim
20908 @opindex msim
20909 Specifies that the program will be run on the simulator.  This causes
20910 an alternate runtime startup and library to be linked.
20911 You must not use this option when generating programs that will run on
20912 real hardware; you must provide your own runtime library for whatever
20913 I/O functions are needed.
20915 @item -mlra
20916 @opindex mlra
20917 Enable Local Register Allocation.  This is still experimental for FT32,
20918 so by default the compiler uses standard reload.
20920 @item -mnodiv
20921 @opindex mnodiv
20922 Do not use div and mod instructions.
20924 @item -mft32b
20925 @opindex mft32b
20926 Enable use of the extended instructions of the FT32B processor.
20928 @item -mcompress
20929 @opindex mcompress
20930 Compress all code using the Ft32B code compression scheme.
20932 @item -mnopm
20933 @opindex  mnopm
20934 Do not generate code that reads program memory.
20936 @end table
20938 @node FRV Options
20939 @subsection FRV Options
20940 @cindex FRV Options
20942 @table @gcctabopt
20943 @item -mgpr-32
20944 @opindex mgpr-32
20946 Only use the first 32 general-purpose registers.
20948 @item -mgpr-64
20949 @opindex mgpr-64
20951 Use all 64 general-purpose registers.
20953 @item -mfpr-32
20954 @opindex mfpr-32
20956 Use only the first 32 floating-point registers.
20958 @item -mfpr-64
20959 @opindex mfpr-64
20961 Use all 64 floating-point registers.
20963 @item -mhard-float
20964 @opindex mhard-float
20966 Use hardware instructions for floating-point operations.
20968 @item -msoft-float
20969 @opindex msoft-float
20971 Use library routines for floating-point operations.
20973 @item -malloc-cc
20974 @opindex malloc-cc
20976 Dynamically allocate condition code registers.
20978 @item -mfixed-cc
20979 @opindex mfixed-cc
20981 Do not try to dynamically allocate condition code registers, only
20982 use @code{icc0} and @code{fcc0}.
20984 @item -mdword
20985 @opindex mdword
20987 Change ABI to use double word insns.
20989 @item -mno-dword
20990 @opindex mno-dword
20991 @opindex mdword
20993 Do not use double word instructions.
20995 @item -mdouble
20996 @opindex mdouble
20998 Use floating-point double instructions.
21000 @item -mno-double
21001 @opindex mno-double
21003 Do not use floating-point double instructions.
21005 @item -mmedia
21006 @opindex mmedia
21008 Use media instructions.
21010 @item -mno-media
21011 @opindex mno-media
21013 Do not use media instructions.
21015 @item -mmuladd
21016 @opindex mmuladd
21018 Use multiply and add/subtract instructions.
21020 @item -mno-muladd
21021 @opindex mno-muladd
21023 Do not use multiply and add/subtract instructions.
21025 @item -mfdpic
21026 @opindex mfdpic
21028 Select the FDPIC ABI, which uses function descriptors to represent
21029 pointers to functions.  Without any PIC/PIE-related options, it
21030 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
21031 assumes GOT entries and small data are within a 12-bit range from the
21032 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21033 are computed with 32 bits.
21034 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21036 @item -minline-plt
21037 @opindex minline-plt
21039 Enable inlining of PLT entries in function calls to functions that are
21040 not known to bind locally.  It has no effect without @option{-mfdpic}.
21041 It's enabled by default if optimizing for speed and compiling for
21042 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21043 optimization option such as @option{-O3} or above is present in the
21044 command line.
21046 @item -mTLS
21047 @opindex mTLS
21049 Assume a large TLS segment when generating thread-local code.
21051 @item -mtls
21052 @opindex mtls
21054 Do not assume a large TLS segment when generating thread-local code.
21056 @item -mgprel-ro
21057 @opindex mgprel-ro
21059 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21060 that is known to be in read-only sections.  It's enabled by default,
21061 except for @option{-fpic} or @option{-fpie}: even though it may help
21062 make the global offset table smaller, it trades 1 instruction for 4.
21063 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21064 one of which may be shared by multiple symbols, and it avoids the need
21065 for a GOT entry for the referenced symbol, so it's more likely to be a
21066 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
21068 @item -multilib-library-pic
21069 @opindex multilib-library-pic
21071 Link with the (library, not FD) pic libraries.  It's implied by
21072 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
21073 @option{-fpic} without @option{-mfdpic}.  You should never have to use
21074 it explicitly.
21076 @item -mlinked-fp
21077 @opindex mlinked-fp
21079 Follow the EABI requirement of always creating a frame pointer whenever
21080 a stack frame is allocated.  This option is enabled by default and can
21081 be disabled with @option{-mno-linked-fp}.
21083 @item -mlong-calls
21084 @opindex mlong-calls
21086 Use indirect addressing to call functions outside the current
21087 compilation unit.  This allows the functions to be placed anywhere
21088 within the 32-bit address space.
21090 @item -malign-labels
21091 @opindex malign-labels
21093 Try to align labels to an 8-byte boundary by inserting NOPs into the
21094 previous packet.  This option only has an effect when VLIW packing
21095 is enabled.  It doesn't create new packets; it merely adds NOPs to
21096 existing ones.
21098 @item -mlibrary-pic
21099 @opindex mlibrary-pic
21101 Generate position-independent EABI code.
21103 @item -macc-4
21104 @opindex macc-4
21106 Use only the first four media accumulator registers.
21108 @item -macc-8
21109 @opindex macc-8
21111 Use all eight media accumulator registers.
21113 @item -mpack
21114 @opindex mpack
21116 Pack VLIW instructions.
21118 @item -mno-pack
21119 @opindex mno-pack
21121 Do not pack VLIW instructions.
21123 @item -mno-eflags
21124 @opindex mno-eflags
21126 Do not mark ABI switches in e_flags.
21128 @item -mcond-move
21129 @opindex mcond-move
21131 Enable the use of conditional-move instructions (default).
21133 This switch is mainly for debugging the compiler and will likely be removed
21134 in a future version.
21136 @item -mno-cond-move
21137 @opindex mno-cond-move
21139 Disable the use of conditional-move instructions.
21141 This switch is mainly for debugging the compiler and will likely be removed
21142 in a future version.
21144 @item -mscc
21145 @opindex mscc
21147 Enable the use of conditional set instructions (default).
21149 This switch is mainly for debugging the compiler and will likely be removed
21150 in a future version.
21152 @item -mno-scc
21153 @opindex mno-scc
21155 Disable the use of conditional set instructions.
21157 This switch is mainly for debugging the compiler and will likely be removed
21158 in a future version.
21160 @item -mcond-exec
21161 @opindex mcond-exec
21163 Enable the use of conditional execution (default).
21165 This switch is mainly for debugging the compiler and will likely be removed
21166 in a future version.
21168 @item -mno-cond-exec
21169 @opindex mno-cond-exec
21171 Disable the use of conditional execution.
21173 This switch is mainly for debugging the compiler and will likely be removed
21174 in a future version.
21176 @item -mvliw-branch
21177 @opindex mvliw-branch
21179 Run a pass to pack branches into VLIW instructions (default).
21181 This switch is mainly for debugging the compiler and will likely be removed
21182 in a future version.
21184 @item -mno-vliw-branch
21185 @opindex mno-vliw-branch
21187 Do not run a pass to pack branches into VLIW instructions.
21189 This switch is mainly for debugging the compiler and will likely be removed
21190 in a future version.
21192 @item -mmulti-cond-exec
21193 @opindex mmulti-cond-exec
21195 Enable optimization of @code{&&} and @code{||} in conditional execution
21196 (default).
21198 This switch is mainly for debugging the compiler and will likely be removed
21199 in a future version.
21201 @item -mno-multi-cond-exec
21202 @opindex mno-multi-cond-exec
21204 Disable optimization of @code{&&} and @code{||} in conditional execution.
21206 This switch is mainly for debugging the compiler and will likely be removed
21207 in a future version.
21209 @item -mnested-cond-exec
21210 @opindex mnested-cond-exec
21212 Enable nested conditional execution optimizations (default).
21214 This switch is mainly for debugging the compiler and will likely be removed
21215 in a future version.
21217 @item -mno-nested-cond-exec
21218 @opindex mno-nested-cond-exec
21220 Disable nested conditional execution optimizations.
21222 This switch is mainly for debugging the compiler and will likely be removed
21223 in a future version.
21225 @item -moptimize-membar
21226 @opindex moptimize-membar
21228 This switch removes redundant @code{membar} instructions from the
21229 compiler-generated code.  It is enabled by default.
21231 @item -mno-optimize-membar
21232 @opindex mno-optimize-membar
21233 @opindex moptimize-membar
21235 This switch disables the automatic removal of redundant @code{membar}
21236 instructions from the generated code.
21238 @item -mtomcat-stats
21239 @opindex mtomcat-stats
21241 Cause gas to print out tomcat statistics.
21243 @item -mcpu=@var{cpu}
21244 @opindex mcpu
21246 Select the processor type for which to generate code.  Possible values are
21247 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21248 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21250 @end table
21252 @node GNU/Linux Options
21253 @subsection GNU/Linux Options
21255 These @samp{-m} options are defined for GNU/Linux targets:
21257 @table @gcctabopt
21258 @item -mglibc
21259 @opindex mglibc
21260 Use the GNU C library.  This is the default except
21261 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21262 @samp{*-*-linux-*android*} targets.
21264 @item -muclibc
21265 @opindex muclibc
21266 Use uClibc C library.  This is the default on
21267 @samp{*-*-linux-*uclibc*} targets.
21269 @item -mmusl
21270 @opindex mmusl
21271 Use the musl C library.  This is the default on
21272 @samp{*-*-linux-*musl*} targets.
21274 @item -mbionic
21275 @opindex mbionic
21276 Use Bionic C library.  This is the default on
21277 @samp{*-*-linux-*android*} targets.
21279 @item -mandroid
21280 @opindex mandroid
21281 Compile code compatible with Android platform.  This is the default on
21282 @samp{*-*-linux-*android*} targets.
21284 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21285 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
21286 this option makes the GCC driver pass Android-specific options to the linker.
21287 Finally, this option causes the preprocessor macro @code{__ANDROID__}
21288 to be defined.
21290 @item -tno-android-cc
21291 @opindex tno-android-cc
21292 Disable compilation effects of @option{-mandroid}, i.e., do not enable
21293 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21294 @option{-fno-rtti} by default.
21296 @item -tno-android-ld
21297 @opindex tno-android-ld
21298 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21299 linking options to the linker.
21301 @end table
21303 @node H8/300 Options
21304 @subsection H8/300 Options
21306 These @samp{-m} options are defined for the H8/300 implementations:
21308 @table @gcctabopt
21309 @item -mrelax
21310 @opindex mrelax
21311 Shorten some address references at link time, when possible; uses the
21312 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
21313 ld, Using ld}, for a fuller description.
21315 @item -mh
21316 @opindex mh
21317 Generate code for the H8/300H@.
21319 @item -ms
21320 @opindex ms
21321 Generate code for the H8S@.
21323 @item -mn
21324 @opindex mn
21325 Generate code for the H8S and H8/300H in the normal mode.  This switch
21326 must be used either with @option{-mh} or @option{-ms}.
21328 @item -ms2600
21329 @opindex ms2600
21330 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
21332 @item -mexr
21333 @opindex mexr
21334 Extended registers are stored on stack before execution of function
21335 with monitor attribute. Default option is @option{-mexr}.
21336 This option is valid only for H8S targets.
21338 @item -mno-exr
21339 @opindex mno-exr
21340 @opindex mexr
21341 Extended registers are not stored on stack before execution of function 
21342 with monitor attribute. Default option is @option{-mno-exr}. 
21343 This option is valid only for H8S targets.
21345 @item -mint32
21346 @opindex mint32
21347 Make @code{int} data 32 bits by default.
21349 @item -malign-300
21350 @opindex malign-300
21351 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21352 The default for the H8/300H and H8S is to align longs and floats on
21353 4-byte boundaries.
21354 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
21355 This option has no effect on the H8/300.
21356 @end table
21358 @node HPPA Options
21359 @subsection HPPA Options
21360 @cindex HPPA Options
21362 These @samp{-m} options are defined for the HPPA family of computers:
21364 @table @gcctabopt
21365 @item -march=@var{architecture-type}
21366 @opindex march
21367 Generate code for the specified architecture.  The choices for
21368 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
21369 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
21370 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21371 architecture option for your machine.  Code compiled for lower numbered
21372 architectures runs on higher numbered architectures, but not the
21373 other way around.
21375 @item -mpa-risc-1-0
21376 @itemx -mpa-risc-1-1
21377 @itemx -mpa-risc-2-0
21378 @opindex mpa-risc-1-0
21379 @opindex mpa-risc-1-1
21380 @opindex mpa-risc-2-0
21381 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21383 @item -mcaller-copies
21384 @opindex mcaller-copies
21385 The caller copies function arguments passed by hidden reference.  This
21386 option should be used with care as it is not compatible with the default
21387 32-bit runtime.  However, only aggregates larger than eight bytes are
21388 passed by hidden reference and the option provides better compatibility
21389 with OpenMP.
21391 @item -mjump-in-delay
21392 @opindex mjump-in-delay
21393 This option is ignored and provided for compatibility purposes only.
21395 @item -mdisable-fpregs
21396 @opindex mdisable-fpregs
21397 Prevent floating-point registers from being used in any manner.  This is
21398 necessary for compiling kernels that perform lazy context switching of
21399 floating-point registers.  If you use this option and attempt to perform
21400 floating-point operations, the compiler aborts.
21402 @item -mdisable-indexing
21403 @opindex mdisable-indexing
21404 Prevent the compiler from using indexing address modes.  This avoids some
21405 rather obscure problems when compiling MIG generated code under MACH@.
21407 @item -mno-space-regs
21408 @opindex mno-space-regs
21409 @opindex mspace-regs
21410 Generate code that assumes the target has no space registers.  This allows
21411 GCC to generate faster indirect calls and use unscaled index address modes.
21413 Such code is suitable for level 0 PA systems and kernels.
21415 @item -mfast-indirect-calls
21416 @opindex mfast-indirect-calls
21417 Generate code that assumes calls never cross space boundaries.  This
21418 allows GCC to emit code that performs faster indirect calls.
21420 This option does not work in the presence of shared libraries or nested
21421 functions.
21423 @item -mfixed-range=@var{register-range}
21424 @opindex mfixed-range
21425 Generate code treating the given register range as fixed registers.
21426 A fixed register is one that the register allocator cannot use.  This is
21427 useful when compiling kernel code.  A register range is specified as
21428 two registers separated by a dash.  Multiple register ranges can be
21429 specified separated by a comma.
21431 @item -mlong-load-store
21432 @opindex mlong-load-store
21433 Generate 3-instruction load and store sequences as sometimes required by
21434 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
21435 the HP compilers.
21437 @item -mportable-runtime
21438 @opindex mportable-runtime
21439 Use the portable calling conventions proposed by HP for ELF systems.
21441 @item -mgas
21442 @opindex mgas
21443 Enable the use of assembler directives only GAS understands.
21445 @item -mschedule=@var{cpu-type}
21446 @opindex mschedule
21447 Schedule code according to the constraints for the machine type
21448 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
21449 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
21450 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21451 proper scheduling option for your machine.  The default scheduling is
21452 @samp{8000}.
21454 @item -mlinker-opt
21455 @opindex mlinker-opt
21456 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
21457 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
21458 linkers in which they give bogus error messages when linking some programs.
21460 @item -msoft-float
21461 @opindex msoft-float
21462 Generate output containing library calls for floating point.
21463 @strong{Warning:} the requisite libraries are not available for all HPPA
21464 targets.  Normally the facilities of the machine's usual C compiler are
21465 used, but this cannot be done directly in cross-compilation.  You must make
21466 your own arrangements to provide suitable library functions for
21467 cross-compilation.
21469 @option{-msoft-float} changes the calling convention in the output file;
21470 therefore, it is only useful if you compile @emph{all} of a program with
21471 this option.  In particular, you need to compile @file{libgcc.a}, the
21472 library that comes with GCC, with @option{-msoft-float} in order for
21473 this to work.
21475 @item -msio
21476 @opindex msio
21477 Generate the predefine, @code{_SIO}, for server IO@.  The default is
21478 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
21479 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
21480 options are available under HP-UX and HI-UX@.
21482 @item -mgnu-ld
21483 @opindex mgnu-ld
21484 Use options specific to GNU @command{ld}.
21485 This passes @option{-shared} to @command{ld} when
21486 building a shared library.  It is the default when GCC is configured,
21487 explicitly or implicitly, with the GNU linker.  This option does not
21488 affect which @command{ld} is called; it only changes what parameters
21489 are passed to that @command{ld}.
21490 The @command{ld} that is called is determined by the
21491 @option{--with-ld} configure option, GCC's program search path, and
21492 finally by the user's @env{PATH}.  The linker used by GCC can be printed
21493 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
21494 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21496 @item -mhp-ld
21497 @opindex mhp-ld
21498 Use options specific to HP @command{ld}.
21499 This passes @option{-b} to @command{ld} when building
21500 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21501 links.  It is the default when GCC is configured, explicitly or
21502 implicitly, with the HP linker.  This option does not affect
21503 which @command{ld} is called; it only changes what parameters are passed to that
21504 @command{ld}.
21505 The @command{ld} that is called is determined by the @option{--with-ld}
21506 configure option, GCC's program search path, and finally by the user's
21507 @env{PATH}.  The linker used by GCC can be printed using @samp{which
21508 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
21509 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21511 @item -mlong-calls
21512 @opindex mno-long-calls
21513 @opindex mlong-calls
21514 Generate code that uses long call sequences.  This ensures that a call
21515 is always able to reach linker generated stubs.  The default is to generate
21516 long calls only when the distance from the call site to the beginning
21517 of the function or translation unit, as the case may be, exceeds a
21518 predefined limit set by the branch type being used.  The limits for
21519 normal calls are 7,600,000 and 240,000 bytes, respectively for the
21520 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
21521 240,000 bytes.
21523 Distances are measured from the beginning of functions when using the
21524 @option{-ffunction-sections} option, or when using the @option{-mgas}
21525 and @option{-mno-portable-runtime} options together under HP-UX with
21526 the SOM linker.
21528 It is normally not desirable to use this option as it degrades
21529 performance.  However, it may be useful in large applications,
21530 particularly when partial linking is used to build the application.
21532 The types of long calls used depends on the capabilities of the
21533 assembler and linker, and the type of code being generated.  The
21534 impact on systems that support long absolute calls, and long pic
21535 symbol-difference or pc-relative calls should be relatively small.
21536 However, an indirect call is used on 32-bit ELF systems in pic code
21537 and it is quite long.
21539 @item -munix=@var{unix-std}
21540 @opindex march
21541 Generate compiler predefines and select a startfile for the specified
21542 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
21543 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
21544 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
21545 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
21546 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
21547 and later.
21549 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
21550 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
21551 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
21552 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
21553 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
21554 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
21556 It is @emph{important} to note that this option changes the interfaces
21557 for various library routines.  It also affects the operational behavior
21558 of the C library.  Thus, @emph{extreme} care is needed in using this
21559 option.
21561 Library code that is intended to operate with more than one UNIX
21562 standard must test, set and restore the variable @code{__xpg4_extended_mask}
21563 as appropriate.  Most GNU software doesn't provide this capability.
21565 @item -nolibdld
21566 @opindex nolibdld
21567 Suppress the generation of link options to search libdld.sl when the
21568 @option{-static} option is specified on HP-UX 10 and later.
21570 @item -static
21571 @opindex static
21572 The HP-UX implementation of setlocale in libc has a dependency on
21573 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
21574 when the @option{-static} option is specified, special link options
21575 are needed to resolve this dependency.
21577 On HP-UX 10 and later, the GCC driver adds the necessary options to
21578 link with libdld.sl when the @option{-static} option is specified.
21579 This causes the resulting binary to be dynamic.  On the 64-bit port,
21580 the linkers generate dynamic binaries by default in any case.  The
21581 @option{-nolibdld} option can be used to prevent the GCC driver from
21582 adding these link options.
21584 @item -threads
21585 @opindex threads
21586 Add support for multithreading with the @dfn{dce thread} library
21587 under HP-UX@.  This option sets flags for both the preprocessor and
21588 linker.
21589 @end table
21591 @node IA-64 Options
21592 @subsection IA-64 Options
21593 @cindex IA-64 Options
21595 These are the @samp{-m} options defined for the Intel IA-64 architecture.
21597 @table @gcctabopt
21598 @item -mbig-endian
21599 @opindex mbig-endian
21600 Generate code for a big-endian target.  This is the default for HP-UX@.
21602 @item -mlittle-endian
21603 @opindex mlittle-endian
21604 Generate code for a little-endian target.  This is the default for AIX5
21605 and GNU/Linux.
21607 @item -mgnu-as
21608 @itemx -mno-gnu-as
21609 @opindex mgnu-as
21610 @opindex mno-gnu-as
21611 Generate (or don't) code for the GNU assembler.  This is the default.
21612 @c Also, this is the default if the configure option @option{--with-gnu-as}
21613 @c is used.
21615 @item -mgnu-ld
21616 @itemx -mno-gnu-ld
21617 @opindex mgnu-ld
21618 @opindex mno-gnu-ld
21619 Generate (or don't) code for the GNU linker.  This is the default.
21620 @c Also, this is the default if the configure option @option{--with-gnu-ld}
21621 @c is used.
21623 @item -mno-pic
21624 @opindex mno-pic
21625 Generate code that does not use a global pointer register.  The result
21626 is not position independent code, and violates the IA-64 ABI@.
21628 @item -mvolatile-asm-stop
21629 @itemx -mno-volatile-asm-stop
21630 @opindex mvolatile-asm-stop
21631 @opindex mno-volatile-asm-stop
21632 Generate (or don't) a stop bit immediately before and after volatile asm
21633 statements.
21635 @item -mregister-names
21636 @itemx -mno-register-names
21637 @opindex mregister-names
21638 @opindex mno-register-names
21639 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
21640 the stacked registers.  This may make assembler output more readable.
21642 @item -mno-sdata
21643 @itemx -msdata
21644 @opindex mno-sdata
21645 @opindex msdata
21646 Disable (or enable) optimizations that use the small data section.  This may
21647 be useful for working around optimizer bugs.
21649 @item -mconstant-gp
21650 @opindex mconstant-gp
21651 Generate code that uses a single constant global pointer value.  This is
21652 useful when compiling kernel code.
21654 @item -mauto-pic
21655 @opindex mauto-pic
21656 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
21657 This is useful when compiling firmware code.
21659 @item -minline-float-divide-min-latency
21660 @opindex minline-float-divide-min-latency
21661 Generate code for inline divides of floating-point values
21662 using the minimum latency algorithm.
21664 @item -minline-float-divide-max-throughput
21665 @opindex minline-float-divide-max-throughput
21666 Generate code for inline divides of floating-point values
21667 using the maximum throughput algorithm.
21669 @item -mno-inline-float-divide
21670 @opindex mno-inline-float-divide
21671 Do not generate inline code for divides of floating-point values.
21673 @item -minline-int-divide-min-latency
21674 @opindex minline-int-divide-min-latency
21675 Generate code for inline divides of integer values
21676 using the minimum latency algorithm.
21678 @item -minline-int-divide-max-throughput
21679 @opindex minline-int-divide-max-throughput
21680 Generate code for inline divides of integer values
21681 using the maximum throughput algorithm.
21683 @item -mno-inline-int-divide
21684 @opindex mno-inline-int-divide
21685 @opindex minline-int-divide
21686 Do not generate inline code for divides of integer values.
21688 @item -minline-sqrt-min-latency
21689 @opindex minline-sqrt-min-latency
21690 Generate code for inline square roots
21691 using the minimum latency algorithm.
21693 @item -minline-sqrt-max-throughput
21694 @opindex minline-sqrt-max-throughput
21695 Generate code for inline square roots
21696 using the maximum throughput algorithm.
21698 @item -mno-inline-sqrt
21699 @opindex mno-inline-sqrt
21700 Do not generate inline code for @code{sqrt}.
21702 @item -mfused-madd
21703 @itemx -mno-fused-madd
21704 @opindex mfused-madd
21705 @opindex mno-fused-madd
21706 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
21707 instructions.  The default is to use these instructions.
21709 @item -mno-dwarf2-asm
21710 @itemx -mdwarf2-asm
21711 @opindex mno-dwarf2-asm
21712 @opindex mdwarf2-asm
21713 Don't (or do) generate assembler code for the DWARF line number debugging
21714 info.  This may be useful when not using the GNU assembler.
21716 @item -mearly-stop-bits
21717 @itemx -mno-early-stop-bits
21718 @opindex mearly-stop-bits
21719 @opindex mno-early-stop-bits
21720 Allow stop bits to be placed earlier than immediately preceding the
21721 instruction that triggered the stop bit.  This can improve instruction
21722 scheduling, but does not always do so.
21724 @item -mfixed-range=@var{register-range}
21725 @opindex mfixed-range
21726 Generate code treating the given register range as fixed registers.
21727 A fixed register is one that the register allocator cannot use.  This is
21728 useful when compiling kernel code.  A register range is specified as
21729 two registers separated by a dash.  Multiple register ranges can be
21730 specified separated by a comma.
21732 @item -mtls-size=@var{tls-size}
21733 @opindex mtls-size
21734 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
21737 @item -mtune=@var{cpu-type}
21738 @opindex mtune
21739 Tune the instruction scheduling for a particular CPU, Valid values are
21740 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
21741 and @samp{mckinley}.
21743 @item -milp32
21744 @itemx -mlp64
21745 @opindex milp32
21746 @opindex mlp64
21747 Generate code for a 32-bit or 64-bit environment.
21748 The 32-bit environment sets int, long and pointer to 32 bits.
21749 The 64-bit environment sets int to 32 bits and long and pointer
21750 to 64 bits.  These are HP-UX specific flags.
21752 @item -mno-sched-br-data-spec
21753 @itemx -msched-br-data-spec
21754 @opindex mno-sched-br-data-spec
21755 @opindex msched-br-data-spec
21756 (Dis/En)able data speculative scheduling before reload.
21757 This results in generation of @code{ld.a} instructions and
21758 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21759 The default setting is disabled.
21761 @item -msched-ar-data-spec
21762 @itemx -mno-sched-ar-data-spec
21763 @opindex msched-ar-data-spec
21764 @opindex mno-sched-ar-data-spec
21765 (En/Dis)able data speculative scheduling after reload.
21766 This results in generation of @code{ld.a} instructions and
21767 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21768 The default setting is enabled.
21770 @item -mno-sched-control-spec
21771 @itemx -msched-control-spec
21772 @opindex mno-sched-control-spec
21773 @opindex msched-control-spec
21774 (Dis/En)able control speculative scheduling.  This feature is
21775 available only during region scheduling (i.e.@: before reload).
21776 This results in generation of the @code{ld.s} instructions and
21777 the corresponding check instructions @code{chk.s}.
21778 The default setting is disabled.
21780 @item -msched-br-in-data-spec
21781 @itemx -mno-sched-br-in-data-spec
21782 @opindex msched-br-in-data-spec
21783 @opindex mno-sched-br-in-data-spec
21784 (En/Dis)able speculative scheduling of the instructions that
21785 are dependent on the data speculative loads before reload.
21786 This is effective only with @option{-msched-br-data-spec} enabled.
21787 The default setting is enabled.
21789 @item -msched-ar-in-data-spec
21790 @itemx -mno-sched-ar-in-data-spec
21791 @opindex msched-ar-in-data-spec
21792 @opindex mno-sched-ar-in-data-spec
21793 (En/Dis)able speculative scheduling of the instructions that
21794 are dependent on the data speculative loads after reload.
21795 This is effective only with @option{-msched-ar-data-spec} enabled.
21796 The default setting is enabled.
21798 @item -msched-in-control-spec
21799 @itemx -mno-sched-in-control-spec
21800 @opindex msched-in-control-spec
21801 @opindex mno-sched-in-control-spec
21802 (En/Dis)able speculative scheduling of the instructions that
21803 are dependent on the control speculative loads.
21804 This is effective only with @option{-msched-control-spec} enabled.
21805 The default setting is enabled.
21807 @item -mno-sched-prefer-non-data-spec-insns
21808 @itemx -msched-prefer-non-data-spec-insns
21809 @opindex mno-sched-prefer-non-data-spec-insns
21810 @opindex msched-prefer-non-data-spec-insns
21811 If enabled, data-speculative instructions are chosen for schedule
21812 only if there are no other choices at the moment.  This makes
21813 the use of the data speculation much more conservative.
21814 The default setting is disabled.
21816 @item -mno-sched-prefer-non-control-spec-insns
21817 @itemx -msched-prefer-non-control-spec-insns
21818 @opindex mno-sched-prefer-non-control-spec-insns
21819 @opindex msched-prefer-non-control-spec-insns
21820 If enabled, control-speculative instructions are chosen for schedule
21821 only if there are no other choices at the moment.  This makes
21822 the use of the control speculation much more conservative.
21823 The default setting is disabled.
21825 @item -mno-sched-count-spec-in-critical-path
21826 @itemx -msched-count-spec-in-critical-path
21827 @opindex mno-sched-count-spec-in-critical-path
21828 @opindex msched-count-spec-in-critical-path
21829 If enabled, speculative dependencies are considered during
21830 computation of the instructions priorities.  This makes the use of the
21831 speculation a bit more conservative.
21832 The default setting is disabled.
21834 @item -msched-spec-ldc
21835 @opindex msched-spec-ldc
21836 Use a simple data speculation check.  This option is on by default.
21838 @item -msched-control-spec-ldc
21839 @opindex msched-spec-ldc
21840 Use a simple check for control speculation.  This option is on by default.
21842 @item -msched-stop-bits-after-every-cycle
21843 @opindex msched-stop-bits-after-every-cycle
21844 Place a stop bit after every cycle when scheduling.  This option is on
21845 by default.
21847 @item -msched-fp-mem-deps-zero-cost
21848 @opindex msched-fp-mem-deps-zero-cost
21849 Assume that floating-point stores and loads are not likely to cause a conflict
21850 when placed into the same instruction group.  This option is disabled by
21851 default.
21853 @item -msel-sched-dont-check-control-spec
21854 @opindex msel-sched-dont-check-control-spec
21855 Generate checks for control speculation in selective scheduling.
21856 This flag is disabled by default.
21858 @item -msched-max-memory-insns=@var{max-insns}
21859 @opindex msched-max-memory-insns
21860 Limit on the number of memory insns per instruction group, giving lower
21861 priority to subsequent memory insns attempting to schedule in the same
21862 instruction group. Frequently useful to prevent cache bank conflicts.
21863 The default value is 1.
21865 @item -msched-max-memory-insns-hard-limit
21866 @opindex msched-max-memory-insns-hard-limit
21867 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
21868 disallowing more than that number in an instruction group.
21869 Otherwise, the limit is ``soft'', meaning that non-memory operations
21870 are preferred when the limit is reached, but memory operations may still
21871 be scheduled.
21873 @end table
21875 @node LM32 Options
21876 @subsection LM32 Options
21877 @cindex LM32 options
21879 These @option{-m} options are defined for the LatticeMico32 architecture:
21881 @table @gcctabopt
21882 @item -mbarrel-shift-enabled
21883 @opindex mbarrel-shift-enabled
21884 Enable barrel-shift instructions.
21886 @item -mdivide-enabled
21887 @opindex mdivide-enabled
21888 Enable divide and modulus instructions.
21890 @item -mmultiply-enabled
21891 @opindex multiply-enabled
21892 Enable multiply instructions.
21894 @item -msign-extend-enabled
21895 @opindex msign-extend-enabled
21896 Enable sign extend instructions.
21898 @item -muser-enabled
21899 @opindex muser-enabled
21900 Enable user-defined instructions.
21902 @end table
21904 @node M32C Options
21905 @subsection M32C Options
21906 @cindex M32C options
21908 @table @gcctabopt
21909 @item -mcpu=@var{name}
21910 @opindex mcpu=
21911 Select the CPU for which code is generated.  @var{name} may be one of
21912 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
21913 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
21914 the M32C/80 series.
21916 @item -msim
21917 @opindex msim
21918 Specifies that the program will be run on the simulator.  This causes
21919 an alternate runtime library to be linked in which supports, for
21920 example, file I/O@.  You must not use this option when generating
21921 programs that will run on real hardware; you must provide your own
21922 runtime library for whatever I/O functions are needed.
21924 @item -memregs=@var{number}
21925 @opindex memregs=
21926 Specifies the number of memory-based pseudo-registers GCC uses
21927 during code generation.  These pseudo-registers are used like real
21928 registers, so there is a tradeoff between GCC's ability to fit the
21929 code into available registers, and the performance penalty of using
21930 memory instead of registers.  Note that all modules in a program must
21931 be compiled with the same value for this option.  Because of that, you
21932 must not use this option with GCC's default runtime libraries.
21934 @end table
21936 @node M32R/D Options
21937 @subsection M32R/D Options
21938 @cindex M32R/D options
21940 These @option{-m} options are defined for Renesas M32R/D architectures:
21942 @table @gcctabopt
21943 @item -m32r2
21944 @opindex m32r2
21945 Generate code for the M32R/2@.
21947 @item -m32rx
21948 @opindex m32rx
21949 Generate code for the M32R/X@.
21951 @item -m32r
21952 @opindex m32r
21953 Generate code for the M32R@.  This is the default.
21955 @item -mmodel=small
21956 @opindex mmodel=small
21957 Assume all objects live in the lower 16MB of memory (so that their addresses
21958 can be loaded with the @code{ld24} instruction), and assume all subroutines
21959 are reachable with the @code{bl} instruction.
21960 This is the default.
21962 The addressability of a particular object can be set with the
21963 @code{model} attribute.
21965 @item -mmodel=medium
21966 @opindex mmodel=medium
21967 Assume objects may be anywhere in the 32-bit address space (the compiler
21968 generates @code{seth/add3} instructions to load their addresses), and
21969 assume all subroutines are reachable with the @code{bl} instruction.
21971 @item -mmodel=large
21972 @opindex mmodel=large
21973 Assume objects may be anywhere in the 32-bit address space (the compiler
21974 generates @code{seth/add3} instructions to load their addresses), and
21975 assume subroutines may not be reachable with the @code{bl} instruction
21976 (the compiler generates the much slower @code{seth/add3/jl}
21977 instruction sequence).
21979 @item -msdata=none
21980 @opindex msdata=none
21981 Disable use of the small data area.  Variables are put into
21982 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21983 @code{section} attribute has been specified).
21984 This is the default.
21986 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21987 Objects may be explicitly put in the small data area with the
21988 @code{section} attribute using one of these sections.
21990 @item -msdata=sdata
21991 @opindex msdata=sdata
21992 Put small global and static data in the small data area, but do not
21993 generate special code to reference them.
21995 @item -msdata=use
21996 @opindex msdata=use
21997 Put small global and static data in the small data area, and generate
21998 special instructions to reference them.
22000 @item -G @var{num}
22001 @opindex G
22002 @cindex smaller data references
22003 Put global and static objects less than or equal to @var{num} bytes
22004 into the small data or BSS sections instead of the normal data or BSS
22005 sections.  The default value of @var{num} is 8.
22006 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22007 for this option to have any effect.
22009 All modules should be compiled with the same @option{-G @var{num}} value.
22010 Compiling with different values of @var{num} may or may not work; if it
22011 doesn't the linker gives an error message---incorrect code is not
22012 generated.
22014 @item -mdebug
22015 @opindex mdebug
22016 Makes the M32R-specific code in the compiler display some statistics
22017 that might help in debugging programs.
22019 @item -malign-loops
22020 @opindex malign-loops
22021 Align all loops to a 32-byte boundary.
22023 @item -mno-align-loops
22024 @opindex mno-align-loops
22025 Do not enforce a 32-byte alignment for loops.  This is the default.
22027 @item -missue-rate=@var{number}
22028 @opindex missue-rate=@var{number}
22029 Issue @var{number} instructions per cycle.  @var{number} can only be 1
22030 or 2.
22032 @item -mbranch-cost=@var{number}
22033 @opindex mbranch-cost=@var{number}
22034 @var{number} can only be 1 or 2.  If it is 1 then branches are
22035 preferred over conditional code, if it is 2, then the opposite applies.
22037 @item -mflush-trap=@var{number}
22038 @opindex mflush-trap=@var{number}
22039 Specifies the trap number to use to flush the cache.  The default is
22040 12.  Valid numbers are between 0 and 15 inclusive.
22042 @item -mno-flush-trap
22043 @opindex mno-flush-trap
22044 Specifies that the cache cannot be flushed by using a trap.
22046 @item -mflush-func=@var{name}
22047 @opindex mflush-func=@var{name}
22048 Specifies the name of the operating system function to call to flush
22049 the cache.  The default is @samp{_flush_cache}, but a function call
22050 is only used if a trap is not available.
22052 @item -mno-flush-func
22053 @opindex mno-flush-func
22054 Indicates that there is no OS function for flushing the cache.
22056 @end table
22058 @node M680x0 Options
22059 @subsection M680x0 Options
22060 @cindex M680x0 options
22062 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22063 The default settings depend on which architecture was selected when
22064 the compiler was configured; the defaults for the most common choices
22065 are given below.
22067 @table @gcctabopt
22068 @item -march=@var{arch}
22069 @opindex march
22070 Generate code for a specific M680x0 or ColdFire instruction set
22071 architecture.  Permissible values of @var{arch} for M680x0
22072 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22073 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
22074 architectures are selected according to Freescale's ISA classification
22075 and the permissible values are: @samp{isaa}, @samp{isaaplus},
22076 @samp{isab} and @samp{isac}.
22078 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22079 code for a ColdFire target.  The @var{arch} in this macro is one of the
22080 @option{-march} arguments given above.
22082 When used together, @option{-march} and @option{-mtune} select code
22083 that runs on a family of similar processors but that is optimized
22084 for a particular microarchitecture.
22086 @item -mcpu=@var{cpu}
22087 @opindex mcpu
22088 Generate code for a specific M680x0 or ColdFire processor.
22089 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22090 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22091 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
22092 below, which also classifies the CPUs into families:
22094 @multitable @columnfractions 0.20 0.80
22095 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22096 @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}
22097 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22098 @item @samp{5206e} @tab @samp{5206e}
22099 @item @samp{5208} @tab @samp{5207} @samp{5208}
22100 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22101 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22102 @item @samp{5216} @tab @samp{5214} @samp{5216}
22103 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22104 @item @samp{5225} @tab @samp{5224} @samp{5225}
22105 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22106 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22107 @item @samp{5249} @tab @samp{5249}
22108 @item @samp{5250} @tab @samp{5250}
22109 @item @samp{5271} @tab @samp{5270} @samp{5271}
22110 @item @samp{5272} @tab @samp{5272}
22111 @item @samp{5275} @tab @samp{5274} @samp{5275}
22112 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22113 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22114 @item @samp{5307} @tab @samp{5307}
22115 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22116 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22117 @item @samp{5407} @tab @samp{5407}
22118 @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}
22119 @end multitable
22121 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22122 @var{arch} is compatible with @var{cpu}.  Other combinations of
22123 @option{-mcpu} and @option{-march} are rejected.
22125 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22126 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
22127 where the value of @var{family} is given by the table above.
22129 @item -mtune=@var{tune}
22130 @opindex mtune
22131 Tune the code for a particular microarchitecture within the
22132 constraints set by @option{-march} and @option{-mcpu}.
22133 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22134 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22135 and @samp{cpu32}.  The ColdFire microarchitectures
22136 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22138 You can also use @option{-mtune=68020-40} for code that needs
22139 to run relatively well on 68020, 68030 and 68040 targets.
22140 @option{-mtune=68020-60} is similar but includes 68060 targets
22141 as well.  These two options select the same tuning decisions as
22142 @option{-m68020-40} and @option{-m68020-60} respectively.
22144 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22145 when tuning for 680x0 architecture @var{arch}.  It also defines
22146 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22147 option is used.  If GCC is tuning for a range of architectures,
22148 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22149 it defines the macros for every architecture in the range.
22151 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22152 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22153 of the arguments given above.
22155 @item -m68000
22156 @itemx -mc68000
22157 @opindex m68000
22158 @opindex mc68000
22159 Generate output for a 68000.  This is the default
22160 when the compiler is configured for 68000-based systems.
22161 It is equivalent to @option{-march=68000}.
22163 Use this option for microcontrollers with a 68000 or EC000 core,
22164 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22166 @item -m68010
22167 @opindex m68010
22168 Generate output for a 68010.  This is the default
22169 when the compiler is configured for 68010-based systems.
22170 It is equivalent to @option{-march=68010}.
22172 @item -m68020
22173 @itemx -mc68020
22174 @opindex m68020
22175 @opindex mc68020
22176 Generate output for a 68020.  This is the default
22177 when the compiler is configured for 68020-based systems.
22178 It is equivalent to @option{-march=68020}.
22180 @item -m68030
22181 @opindex m68030
22182 Generate output for a 68030.  This is the default when the compiler is
22183 configured for 68030-based systems.  It is equivalent to
22184 @option{-march=68030}.
22186 @item -m68040
22187 @opindex m68040
22188 Generate output for a 68040.  This is the default when the compiler is
22189 configured for 68040-based systems.  It is equivalent to
22190 @option{-march=68040}.
22192 This option inhibits the use of 68881/68882 instructions that have to be
22193 emulated by software on the 68040.  Use this option if your 68040 does not
22194 have code to emulate those instructions.
22196 @item -m68060
22197 @opindex m68060
22198 Generate output for a 68060.  This is the default when the compiler is
22199 configured for 68060-based systems.  It is equivalent to
22200 @option{-march=68060}.
22202 This option inhibits the use of 68020 and 68881/68882 instructions that
22203 have to be emulated by software on the 68060.  Use this option if your 68060
22204 does not have code to emulate those instructions.
22206 @item -mcpu32
22207 @opindex mcpu32
22208 Generate output for a CPU32.  This is the default
22209 when the compiler is configured for CPU32-based systems.
22210 It is equivalent to @option{-march=cpu32}.
22212 Use this option for microcontrollers with a
22213 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
22214 68336, 68340, 68341, 68349 and 68360.
22216 @item -m5200
22217 @opindex m5200
22218 Generate output for a 520X ColdFire CPU@.  This is the default
22219 when the compiler is configured for 520X-based systems.
22220 It is equivalent to @option{-mcpu=5206}, and is now deprecated
22221 in favor of that option.
22223 Use this option for microcontroller with a 5200 core, including
22224 the MCF5202, MCF5203, MCF5204 and MCF5206.
22226 @item -m5206e
22227 @opindex m5206e
22228 Generate output for a 5206e ColdFire CPU@.  The option is now
22229 deprecated in favor of the equivalent @option{-mcpu=5206e}.
22231 @item -m528x
22232 @opindex m528x
22233 Generate output for a member of the ColdFire 528X family.
22234 The option is now deprecated in favor of the equivalent
22235 @option{-mcpu=528x}.
22237 @item -m5307
22238 @opindex m5307
22239 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
22240 in favor of the equivalent @option{-mcpu=5307}.
22242 @item -m5407
22243 @opindex m5407
22244 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
22245 in favor of the equivalent @option{-mcpu=5407}.
22247 @item -mcfv4e
22248 @opindex mcfv4e
22249 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22250 This includes use of hardware floating-point instructions.
22251 The option is equivalent to @option{-mcpu=547x}, and is now
22252 deprecated in favor of that option.
22254 @item -m68020-40
22255 @opindex m68020-40
22256 Generate output for a 68040, without using any of the new instructions.
22257 This results in code that can run relatively efficiently on either a
22258 68020/68881 or a 68030 or a 68040.  The generated code does use the
22259 68881 instructions that are emulated on the 68040.
22261 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22263 @item -m68020-60
22264 @opindex m68020-60
22265 Generate output for a 68060, without using any of the new instructions.
22266 This results in code that can run relatively efficiently on either a
22267 68020/68881 or a 68030 or a 68040.  The generated code does use the
22268 68881 instructions that are emulated on the 68060.
22270 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22272 @item -mhard-float
22273 @itemx -m68881
22274 @opindex mhard-float
22275 @opindex m68881
22276 Generate floating-point instructions.  This is the default for 68020
22277 and above, and for ColdFire devices that have an FPU@.  It defines the
22278 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22279 on ColdFire targets.
22281 @item -msoft-float
22282 @opindex msoft-float
22283 Do not generate floating-point instructions; use library calls instead.
22284 This is the default for 68000, 68010, and 68832 targets.  It is also
22285 the default for ColdFire devices that have no FPU.
22287 @item -mdiv
22288 @itemx -mno-div
22289 @opindex mdiv
22290 @opindex mno-div
22291 Generate (do not generate) ColdFire hardware divide and remainder
22292 instructions.  If @option{-march} is used without @option{-mcpu},
22293 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22294 architectures.  Otherwise, the default is taken from the target CPU
22295 (either the default CPU, or the one specified by @option{-mcpu}).  For
22296 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22297 @option{-mcpu=5206e}.
22299 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22301 @item -mshort
22302 @opindex mshort
22303 Consider type @code{int} to be 16 bits wide, like @code{short int}.
22304 Additionally, parameters passed on the stack are also aligned to a
22305 16-bit boundary even on targets whose API mandates promotion to 32-bit.
22307 @item -mno-short
22308 @opindex mno-short
22309 Do not consider type @code{int} to be 16 bits wide.  This is the default.
22311 @item -mnobitfield
22312 @itemx -mno-bitfield
22313 @opindex mnobitfield
22314 @opindex mno-bitfield
22315 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
22316 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22318 @item -mbitfield
22319 @opindex mbitfield
22320 Do use the bit-field instructions.  The @option{-m68020} option implies
22321 @option{-mbitfield}.  This is the default if you use a configuration
22322 designed for a 68020.
22324 @item -mrtd
22325 @opindex mrtd
22326 Use a different function-calling convention, in which functions
22327 that take a fixed number of arguments return with the @code{rtd}
22328 instruction, which pops their arguments while returning.  This
22329 saves one instruction in the caller since there is no need to pop
22330 the arguments there.
22332 This calling convention is incompatible with the one normally
22333 used on Unix, so you cannot use it if you need to call libraries
22334 compiled with the Unix compiler.
22336 Also, you must provide function prototypes for all functions that
22337 take variable numbers of arguments (including @code{printf});
22338 otherwise incorrect code is generated for calls to those
22339 functions.
22341 In addition, seriously incorrect code results if you call a
22342 function with too many arguments.  (Normally, extra arguments are
22343 harmlessly ignored.)
22345 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
22346 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22348 The default is @option{-mno-rtd}.
22350 @item -malign-int
22351 @itemx -mno-align-int
22352 @opindex malign-int
22353 @opindex mno-align-int
22354 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22355 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
22356 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22357 Aligning variables on 32-bit boundaries produces code that runs somewhat
22358 faster on processors with 32-bit busses at the expense of more memory.
22360 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
22361 aligns structures containing the above types differently than
22362 most published application binary interface specifications for the m68k.
22364 @opindex mpcrel
22365 Use the pc-relative addressing mode of the 68000 directly, instead of
22366 using a global offset table.  At present, this option implies @option{-fpic},
22367 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
22368 not presently supported with @option{-mpcrel}, though this could be supported for
22369 68020 and higher processors.
22371 @item -mno-strict-align
22372 @itemx -mstrict-align
22373 @opindex mno-strict-align
22374 @opindex mstrict-align
22375 Do not (do) assume that unaligned memory references are handled by
22376 the system.
22378 @item -msep-data
22379 Generate code that allows the data segment to be located in a different
22380 area of memory from the text segment.  This allows for execute-in-place in
22381 an environment without virtual memory management.  This option implies
22382 @option{-fPIC}.
22384 @item -mno-sep-data
22385 Generate code that assumes that the data segment follows the text segment.
22386 This is the default.
22388 @item -mid-shared-library
22389 Generate code that supports shared libraries via the library ID method.
22390 This allows for execute-in-place and shared libraries in an environment
22391 without virtual memory management.  This option implies @option{-fPIC}.
22393 @item -mno-id-shared-library
22394 Generate code that doesn't assume ID-based shared libraries are being used.
22395 This is the default.
22397 @item -mshared-library-id=n
22398 Specifies the identification number of the ID-based shared library being
22399 compiled.  Specifying a value of 0 generates more compact code; specifying
22400 other values forces the allocation of that number to the current
22401 library, but is no more space- or time-efficient than omitting this option.
22403 @item -mxgot
22404 @itemx -mno-xgot
22405 @opindex mxgot
22406 @opindex mno-xgot
22407 When generating position-independent code for ColdFire, generate code
22408 that works if the GOT has more than 8192 entries.  This code is
22409 larger and slower than code generated without this option.  On M680x0
22410 processors, this option is not needed; @option{-fPIC} suffices.
22412 GCC normally uses a single instruction to load values from the GOT@.
22413 While this is relatively efficient, it only works if the GOT
22414 is smaller than about 64k.  Anything larger causes the linker
22415 to report an error such as:
22417 @cindex relocation truncated to fit (ColdFire)
22418 @smallexample
22419 relocation truncated to fit: R_68K_GOT16O foobar
22420 @end smallexample
22422 If this happens, you should recompile your code with @option{-mxgot}.
22423 It should then work with very large GOTs.  However, code generated with
22424 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22425 the value of a global symbol.
22427 Note that some linkers, including newer versions of the GNU linker,
22428 can create multiple GOTs and sort GOT entries.  If you have such a linker,
22429 you should only need to use @option{-mxgot} when compiling a single
22430 object file that accesses more than 8192 GOT entries.  Very few do.
22432 These options have no effect unless GCC is generating
22433 position-independent code.
22435 @item -mlong-jump-table-offsets
22436 @opindex mlong-jump-table-offsets
22437 Use 32-bit offsets in @code{switch} tables.  The default is to use
22438 16-bit offsets.
22440 @end table
22442 @node MCore Options
22443 @subsection MCore Options
22444 @cindex MCore options
22446 These are the @samp{-m} options defined for the Motorola M*Core
22447 processors.
22449 @table @gcctabopt
22451 @item -mhardlit
22452 @itemx -mno-hardlit
22453 @opindex mhardlit
22454 @opindex mno-hardlit
22455 Inline constants into the code stream if it can be done in two
22456 instructions or less.
22458 @item -mdiv
22459 @itemx -mno-div
22460 @opindex mdiv
22461 @opindex mno-div
22462 Use the divide instruction.  (Enabled by default).
22464 @item -mrelax-immediate
22465 @itemx -mno-relax-immediate
22466 @opindex mrelax-immediate
22467 @opindex mno-relax-immediate
22468 Allow arbitrary-sized immediates in bit operations.
22470 @item -mwide-bitfields
22471 @itemx -mno-wide-bitfields
22472 @opindex mwide-bitfields
22473 @opindex mno-wide-bitfields
22474 Always treat bit-fields as @code{int}-sized.
22476 @item -m4byte-functions
22477 @itemx -mno-4byte-functions
22478 @opindex m4byte-functions
22479 @opindex mno-4byte-functions
22480 Force all functions to be aligned to a 4-byte boundary.
22482 @item -mcallgraph-data
22483 @itemx -mno-callgraph-data
22484 @opindex mcallgraph-data
22485 @opindex mno-callgraph-data
22486 Emit callgraph information.
22488 @item -mslow-bytes
22489 @itemx -mno-slow-bytes
22490 @opindex mslow-bytes
22491 @opindex mno-slow-bytes
22492 Prefer word access when reading byte quantities.
22494 @item -mlittle-endian
22495 @itemx -mbig-endian
22496 @opindex mlittle-endian
22497 @opindex mbig-endian
22498 Generate code for a little-endian target.
22500 @item -m210
22501 @itemx -m340
22502 @opindex m210
22503 @opindex m340
22504 Generate code for the 210 processor.
22506 @item -mno-lsim
22507 @opindex mno-lsim
22508 Assume that runtime support has been provided and so omit the
22509 simulator library (@file{libsim.a)} from the linker command line.
22511 @item -mstack-increment=@var{size}
22512 @opindex mstack-increment
22513 Set the maximum amount for a single stack increment operation.  Large
22514 values can increase the speed of programs that contain functions
22515 that need a large amount of stack space, but they can also trigger a
22516 segmentation fault if the stack is extended too much.  The default
22517 value is 0x1000.
22519 @end table
22521 @node MeP Options
22522 @subsection MeP Options
22523 @cindex MeP options
22525 @table @gcctabopt
22527 @item -mabsdiff
22528 @opindex mabsdiff
22529 Enables the @code{abs} instruction, which is the absolute difference
22530 between two registers.
22532 @item -mall-opts
22533 @opindex mall-opts
22534 Enables all the optional instructions---average, multiply, divide, bit
22535 operations, leading zero, absolute difference, min/max, clip, and
22536 saturation.
22539 @item -maverage
22540 @opindex maverage
22541 Enables the @code{ave} instruction, which computes the average of two
22542 registers.
22544 @item -mbased=@var{n}
22545 @opindex mbased=
22546 Variables of size @var{n} bytes or smaller are placed in the
22547 @code{.based} section by default.  Based variables use the @code{$tp}
22548 register as a base register, and there is a 128-byte limit to the
22549 @code{.based} section.
22551 @item -mbitops
22552 @opindex mbitops
22553 Enables the bit operation instructions---bit test (@code{btstm}), set
22554 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
22555 test-and-set (@code{tas}).
22557 @item -mc=@var{name}
22558 @opindex mc=
22559 Selects which section constant data is placed in.  @var{name} may
22560 be @samp{tiny}, @samp{near}, or @samp{far}.
22562 @item -mclip
22563 @opindex mclip
22564 Enables the @code{clip} instruction.  Note that @option{-mclip} is not
22565 useful unless you also provide @option{-mminmax}.
22567 @item -mconfig=@var{name}
22568 @opindex mconfig=
22569 Selects one of the built-in core configurations.  Each MeP chip has
22570 one or more modules in it; each module has a core CPU and a variety of
22571 coprocessors, optional instructions, and peripherals.  The
22572 @code{MeP-Integrator} tool, not part of GCC, provides these
22573 configurations through this option; using this option is the same as
22574 using all the corresponding command-line options.  The default
22575 configuration is @samp{default}.
22577 @item -mcop
22578 @opindex mcop
22579 Enables the coprocessor instructions.  By default, this is a 32-bit
22580 coprocessor.  Note that the coprocessor is normally enabled via the
22581 @option{-mconfig=} option.
22583 @item -mcop32
22584 @opindex mcop32
22585 Enables the 32-bit coprocessor's instructions.
22587 @item -mcop64
22588 @opindex mcop64
22589 Enables the 64-bit coprocessor's instructions.
22591 @item -mivc2
22592 @opindex mivc2
22593 Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
22595 @item -mdc
22596 @opindex mdc
22597 Causes constant variables to be placed in the @code{.near} section.
22599 @item -mdiv
22600 @opindex mdiv
22601 Enables the @code{div} and @code{divu} instructions.
22603 @item -meb
22604 @opindex meb
22605 Generate big-endian code.
22607 @item -mel
22608 @opindex mel
22609 Generate little-endian code.
22611 @item -mio-volatile
22612 @opindex mio-volatile
22613 Tells the compiler that any variable marked with the @code{io}
22614 attribute is to be considered volatile.
22616 @item -ml
22617 @opindex ml
22618 Causes variables to be assigned to the @code{.far} section by default.
22620 @item -mleadz
22621 @opindex mleadz
22622 Enables the @code{leadz} (leading zero) instruction.
22624 @item -mm
22625 @opindex mm
22626 Causes variables to be assigned to the @code{.near} section by default.
22628 @item -mminmax
22629 @opindex mminmax
22630 Enables the @code{min} and @code{max} instructions.
22632 @item -mmult
22633 @opindex mmult
22634 Enables the multiplication and multiply-accumulate instructions.
22636 @item -mno-opts
22637 @opindex mno-opts
22638 Disables all the optional instructions enabled by @option{-mall-opts}.
22640 @item -mrepeat
22641 @opindex mrepeat
22642 Enables the @code{repeat} and @code{erepeat} instructions, used for
22643 low-overhead looping.
22645 @item -ms
22646 @opindex ms
22647 Causes all variables to default to the @code{.tiny} section.  Note
22648 that there is a 65536-byte limit to this section.  Accesses to these
22649 variables use the @code{%gp} base register.
22651 @item -msatur
22652 @opindex msatur
22653 Enables the saturation instructions.  Note that the compiler does not
22654 currently generate these itself, but this option is included for
22655 compatibility with other tools, like @code{as}.
22657 @item -msdram
22658 @opindex msdram
22659 Link the SDRAM-based runtime instead of the default ROM-based runtime.
22661 @item -msim
22662 @opindex msim
22663 Link the simulator run-time libraries.
22665 @item -msimnovec
22666 @opindex msimnovec
22667 Link the simulator runtime libraries, excluding built-in support
22668 for reset and exception vectors and tables.
22670 @item -mtf
22671 @opindex mtf
22672 Causes all functions to default to the @code{.far} section.  Without
22673 this option, functions default to the @code{.near} section.
22675 @item -mtiny=@var{n}
22676 @opindex mtiny=
22677 Variables that are @var{n} bytes or smaller are allocated to the
22678 @code{.tiny} section.  These variables use the @code{$gp} base
22679 register.  The default for this option is 4, but note that there's a
22680 65536-byte limit to the @code{.tiny} section.
22682 @end table
22684 @node MicroBlaze Options
22685 @subsection MicroBlaze Options
22686 @cindex MicroBlaze Options
22688 @table @gcctabopt
22690 @item -msoft-float
22691 @opindex msoft-float
22692 Use software emulation for floating point (default).
22694 @item -mhard-float
22695 @opindex mhard-float
22696 Use hardware floating-point instructions.
22698 @item -mmemcpy
22699 @opindex mmemcpy
22700 Do not optimize block moves, use @code{memcpy}.
22702 @item -mno-clearbss
22703 @opindex mno-clearbss
22704 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
22706 @item -mcpu=@var{cpu-type}
22707 @opindex mcpu=
22708 Use features of, and schedule code for, the given CPU.
22709 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
22710 where @var{X} is a major version, @var{YY} is the minor version, and
22711 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
22712 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
22714 @item -mxl-soft-mul
22715 @opindex mxl-soft-mul
22716 Use software multiply emulation (default).
22718 @item -mxl-soft-div
22719 @opindex mxl-soft-div
22720 Use software emulation for divides (default).
22722 @item -mxl-barrel-shift
22723 @opindex mxl-barrel-shift
22724 Use the hardware barrel shifter.
22726 @item -mxl-pattern-compare
22727 @opindex mxl-pattern-compare
22728 Use pattern compare instructions.
22730 @item -msmall-divides
22731 @opindex msmall-divides
22732 Use table lookup optimization for small signed integer divisions.
22734 @item -mxl-stack-check
22735 @opindex mxl-stack-check
22736 This option is deprecated.  Use @option{-fstack-check} instead.
22738 @item -mxl-gp-opt
22739 @opindex mxl-gp-opt
22740 Use GP-relative @code{.sdata}/@code{.sbss} sections.
22742 @item -mxl-multiply-high
22743 @opindex mxl-multiply-high
22744 Use multiply high instructions for high part of 32x32 multiply.
22746 @item -mxl-float-convert
22747 @opindex mxl-float-convert
22748 Use hardware floating-point conversion instructions.
22750 @item -mxl-float-sqrt
22751 @opindex mxl-float-sqrt
22752 Use hardware floating-point square root instruction.
22754 @item -mbig-endian
22755 @opindex mbig-endian
22756 Generate code for a big-endian target.
22758 @item -mlittle-endian
22759 @opindex mlittle-endian
22760 Generate code for a little-endian target.
22762 @item -mxl-reorder
22763 @opindex mxl-reorder
22764 Use reorder instructions (swap and byte reversed load/store).
22766 @item -mxl-mode-@var{app-model}
22767 Select application model @var{app-model}.  Valid models are
22768 @table @samp
22769 @item executable
22770 normal executable (default), uses startup code @file{crt0.o}.
22772 @item -mpic-data-is-text-relative
22773 @opindex mpic-data-is-text-relative
22774 Assume that the displacement between the text and data segments is fixed
22775 at static link time.  This allows data to be referenced by offset from start of
22776 text address instead of GOT since PC-relative addressing is not supported.
22778 @item xmdstub
22779 for use with Xilinx Microprocessor Debugger (XMD) based
22780 software intrusive debug agent called xmdstub. This uses startup file
22781 @file{crt1.o} and sets the start address of the program to 0x800.
22783 @item bootstrap
22784 for applications that are loaded using a bootloader.
22785 This model uses startup file @file{crt2.o} which does not contain a processor
22786 reset vector handler. This is suitable for transferring control on a
22787 processor reset to the bootloader rather than the application.
22789 @item novectors
22790 for applications that do not require any of the
22791 MicroBlaze vectors. This option may be useful for applications running
22792 within a monitoring application. This model uses @file{crt3.o} as a startup file.
22793 @end table
22795 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
22796 @option{-mxl-mode-@var{app-model}}.
22798 @end table
22800 @node MIPS Options
22801 @subsection MIPS Options
22802 @cindex MIPS options
22804 @table @gcctabopt
22806 @item -EB
22807 @opindex EB
22808 Generate big-endian code.
22810 @item -EL
22811 @opindex EL
22812 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
22813 configurations.
22815 @item -march=@var{arch}
22816 @opindex march
22817 Generate code that runs on @var{arch}, which can be the name of a
22818 generic MIPS ISA, or the name of a particular processor.
22819 The ISA names are:
22820 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
22821 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
22822 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
22823 @samp{mips64r5} and @samp{mips64r6}.
22824 The processor names are:
22825 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
22826 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
22827 @samp{5kc}, @samp{5kf},
22828 @samp{20kc},
22829 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
22830 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
22831 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
22832 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
22833 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
22834 @samp{i6400}, @samp{i6500},
22835 @samp{interaptiv},
22836 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
22837 @samp{gs464e}, @samp{gs264e},
22838 @samp{m4k},
22839 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
22840 @samp{m5100}, @samp{m5101},
22841 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
22842 @samp{orion},
22843 @samp{p5600}, @samp{p6600},
22844 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
22845 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
22846 @samp{r6000}, @samp{r8000},
22847 @samp{rm7000}, @samp{rm9000},
22848 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
22849 @samp{sb1},
22850 @samp{sr71000},
22851 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
22852 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
22853 @samp{xlr} and @samp{xlp}.
22854 The special value @samp{from-abi} selects the
22855 most compatible architecture for the selected ABI (that is,
22856 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
22858 The native Linux/GNU toolchain also supports the value @samp{native},
22859 which selects the best architecture option for the host processor.
22860 @option{-march=native} has no effect if GCC does not recognize
22861 the processor.
22863 In processor names, a final @samp{000} can be abbreviated as @samp{k}
22864 (for example, @option{-march=r2k}).  Prefixes are optional, and
22865 @samp{vr} may be written @samp{r}.
22867 Names of the form @samp{@var{n}f2_1} refer to processors with
22868 FPUs clocked at half the rate of the core, names of the form
22869 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
22870 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
22871 processors with FPUs clocked a ratio of 3:2 with respect to the core.
22872 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
22873 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
22874 accepted as synonyms for @samp{@var{n}f1_1}.
22876 GCC defines two macros based on the value of this option.  The first
22877 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
22878 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
22879 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
22880 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
22881 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
22883 Note that the @code{_MIPS_ARCH} macro uses the processor names given
22884 above.  In other words, it has the full prefix and does not
22885 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
22886 the macro names the resolved architecture (either @code{"mips1"} or
22887 @code{"mips3"}).  It names the default architecture when no
22888 @option{-march} option is given.
22890 @item -mtune=@var{arch}
22891 @opindex mtune
22892 Optimize for @var{arch}.  Among other things, this option controls
22893 the way instructions are scheduled, and the perceived cost of arithmetic
22894 operations.  The list of @var{arch} values is the same as for
22895 @option{-march}.
22897 When this option is not used, GCC optimizes for the processor
22898 specified by @option{-march}.  By using @option{-march} and
22899 @option{-mtune} together, it is possible to generate code that
22900 runs on a family of processors, but optimize the code for one
22901 particular member of that family.
22903 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
22904 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
22905 @option{-march} ones described above.
22907 @item -mips1
22908 @opindex mips1
22909 Equivalent to @option{-march=mips1}.
22911 @item -mips2
22912 @opindex mips2
22913 Equivalent to @option{-march=mips2}.
22915 @item -mips3
22916 @opindex mips3
22917 Equivalent to @option{-march=mips3}.
22919 @item -mips4
22920 @opindex mips4
22921 Equivalent to @option{-march=mips4}.
22923 @item -mips32
22924 @opindex mips32
22925 Equivalent to @option{-march=mips32}.
22927 @item -mips32r3
22928 @opindex mips32r3
22929 Equivalent to @option{-march=mips32r3}.
22931 @item -mips32r5
22932 @opindex mips32r5
22933 Equivalent to @option{-march=mips32r5}.
22935 @item -mips32r6
22936 @opindex mips32r6
22937 Equivalent to @option{-march=mips32r6}.
22939 @item -mips64
22940 @opindex mips64
22941 Equivalent to @option{-march=mips64}.
22943 @item -mips64r2
22944 @opindex mips64r2
22945 Equivalent to @option{-march=mips64r2}.
22947 @item -mips64r3
22948 @opindex mips64r3
22949 Equivalent to @option{-march=mips64r3}.
22951 @item -mips64r5
22952 @opindex mips64r5
22953 Equivalent to @option{-march=mips64r5}.
22955 @item -mips64r6
22956 @opindex mips64r6
22957 Equivalent to @option{-march=mips64r6}.
22959 @item -mips16
22960 @itemx -mno-mips16
22961 @opindex mips16
22962 @opindex mno-mips16
22963 Generate (do not generate) MIPS16 code.  If GCC is targeting a
22964 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22966 MIPS16 code generation can also be controlled on a per-function basis
22967 by means of @code{mips16} and @code{nomips16} attributes.
22968 @xref{Function Attributes}, for more information.
22970 @item -mflip-mips16
22971 @opindex mflip-mips16
22972 Generate MIPS16 code on alternating functions.  This option is provided
22973 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22974 not intended for ordinary use in compiling user code.
22976 @item -minterlink-compressed
22977 @itemx -mno-interlink-compressed
22978 @opindex minterlink-compressed
22979 @opindex mno-interlink-compressed
22980 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22981 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22983 For example, code using the standard ISA encoding cannot jump directly
22984 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22985 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22986 knows that the target of the jump is not compressed.
22988 @item -minterlink-mips16
22989 @itemx -mno-interlink-mips16
22990 @opindex minterlink-mips16
22991 @opindex mno-interlink-mips16
22992 Aliases of @option{-minterlink-compressed} and
22993 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
22994 and are retained for backwards compatibility.
22996 @item -mabi=32
22997 @itemx -mabi=o64
22998 @itemx -mabi=n32
22999 @itemx -mabi=64
23000 @itemx -mabi=eabi
23001 @opindex mabi=32
23002 @opindex mabi=o64
23003 @opindex mabi=n32
23004 @opindex mabi=64
23005 @opindex mabi=eabi
23006 Generate code for the given ABI@.
23008 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
23009 generates 64-bit code when you select a 64-bit architecture, but you
23010 can use @option{-mgp32} to get 32-bit code instead.
23012 For information about the O64 ABI, see
23013 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23015 GCC supports a variant of the o32 ABI in which floating-point registers
23016 are 64 rather than 32 bits wide.  You can select this combination with
23017 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
23018 and @code{mfhc1} instructions and is therefore only supported for
23019 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23021 The register assignments for arguments and return values remain the
23022 same, but each scalar value is passed in a single 64-bit register
23023 rather than a pair of 32-bit registers.  For example, scalar
23024 floating-point values are returned in @samp{$f0} only, not a
23025 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
23026 remains the same in that the even-numbered double-precision registers
23027 are saved.
23029 Two additional variants of the o32 ABI are supported to enable
23030 a transition from 32-bit to 64-bit registers.  These are FPXX
23031 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23032 The FPXX extension mandates that all code must execute correctly
23033 when run using 32-bit or 64-bit registers.  The code can be interlinked
23034 with either FP32 or FP64, but not both.
23035 The FP64A extension is similar to the FP64 extension but forbids the
23036 use of odd-numbered single-precision registers.  This can be used
23037 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23038 processors and allows both FP32 and FP64A code to interlink and
23039 run in the same process without changing FPU modes.
23041 @item -mabicalls
23042 @itemx -mno-abicalls
23043 @opindex mabicalls
23044 @opindex mno-abicalls
23045 Generate (do not generate) code that is suitable for SVR4-style
23046 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
23047 systems.
23049 @item -mshared
23050 @itemx -mno-shared
23051 Generate (do not generate) code that is fully position-independent,
23052 and that can therefore be linked into shared libraries.  This option
23053 only affects @option{-mabicalls}.
23055 All @option{-mabicalls} code has traditionally been position-independent,
23056 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
23057 as an extension, the GNU toolchain allows executables to use absolute
23058 accesses for locally-binding symbols.  It can also use shorter GP
23059 initialization sequences and generate direct calls to locally-defined
23060 functions.  This mode is selected by @option{-mno-shared}.
23062 @option{-mno-shared} depends on binutils 2.16 or higher and generates
23063 objects that can only be linked by the GNU linker.  However, the option
23064 does not affect the ABI of the final executable; it only affects the ABI
23065 of relocatable objects.  Using @option{-mno-shared} generally makes
23066 executables both smaller and quicker.
23068 @option{-mshared} is the default.
23070 @item -mplt
23071 @itemx -mno-plt
23072 @opindex mplt
23073 @opindex mno-plt
23074 Assume (do not assume) that the static and dynamic linkers
23075 support PLTs and copy relocations.  This option only affects
23076 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
23077 has no effect without @option{-msym32}.
23079 You can make @option{-mplt} the default by configuring
23080 GCC with @option{--with-mips-plt}.  The default is
23081 @option{-mno-plt} otherwise.
23083 @item -mxgot
23084 @itemx -mno-xgot
23085 @opindex mxgot
23086 @opindex mno-xgot
23087 Lift (do not lift) the usual restrictions on the size of the global
23088 offset table.
23090 GCC normally uses a single instruction to load values from the GOT@.
23091 While this is relatively efficient, it only works if the GOT
23092 is smaller than about 64k.  Anything larger causes the linker
23093 to report an error such as:
23095 @cindex relocation truncated to fit (MIPS)
23096 @smallexample
23097 relocation truncated to fit: R_MIPS_GOT16 foobar
23098 @end smallexample
23100 If this happens, you should recompile your code with @option{-mxgot}.
23101 This works with very large GOTs, although the code is also
23102 less efficient, since it takes three instructions to fetch the
23103 value of a global symbol.
23105 Note that some linkers can create multiple GOTs.  If you have such a
23106 linker, you should only need to use @option{-mxgot} when a single object
23107 file accesses more than 64k's worth of GOT entries.  Very few do.
23109 These options have no effect unless GCC is generating position
23110 independent code.
23112 @item -mgp32
23113 @opindex mgp32
23114 Assume that general-purpose registers are 32 bits wide.
23116 @item -mgp64
23117 @opindex mgp64
23118 Assume that general-purpose registers are 64 bits wide.
23120 @item -mfp32
23121 @opindex mfp32
23122 Assume that floating-point registers are 32 bits wide.
23124 @item -mfp64
23125 @opindex mfp64
23126 Assume that floating-point registers are 64 bits wide.
23128 @item -mfpxx
23129 @opindex mfpxx
23130 Do not assume the width of floating-point registers.
23132 @item -mhard-float
23133 @opindex mhard-float
23134 Use floating-point coprocessor instructions.
23136 @item -msoft-float
23137 @opindex msoft-float
23138 Do not use floating-point coprocessor instructions.  Implement
23139 floating-point calculations using library calls instead.
23141 @item -mno-float
23142 @opindex mno-float
23143 Equivalent to @option{-msoft-float}, but additionally asserts that the
23144 program being compiled does not perform any floating-point operations.
23145 This option is presently supported only by some bare-metal MIPS
23146 configurations, where it may select a special set of libraries
23147 that lack all floating-point support (including, for example, the
23148 floating-point @code{printf} formats).  
23149 If code compiled with @option{-mno-float} accidentally contains
23150 floating-point operations, it is likely to suffer a link-time
23151 or run-time failure.
23153 @item -msingle-float
23154 @opindex msingle-float
23155 Assume that the floating-point coprocessor only supports single-precision
23156 operations.
23158 @item -mdouble-float
23159 @opindex mdouble-float
23160 Assume that the floating-point coprocessor supports double-precision
23161 operations.  This is the default.
23163 @item -modd-spreg
23164 @itemx -mno-odd-spreg
23165 @opindex modd-spreg
23166 @opindex mno-odd-spreg
23167 Enable the use of odd-numbered single-precision floating-point registers
23168 for the o32 ABI.  This is the default for processors that are known to
23169 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23170 is set by default.
23172 @item -mabs=2008
23173 @itemx -mabs=legacy
23174 @opindex mabs=2008
23175 @opindex mabs=legacy
23176 These options control the treatment of the special not-a-number (NaN)
23177 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23178 @code{neg.@i{fmt}} machine instructions.
23180 By default or when @option{-mabs=legacy} is used the legacy
23181 treatment is selected.  In this case these instructions are considered
23182 arithmetic and avoided where correct operation is required and the
23183 input operand might be a NaN.  A longer sequence of instructions that
23184 manipulate the sign bit of floating-point datum manually is used
23185 instead unless the @option{-ffinite-math-only} option has also been
23186 specified.
23188 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
23189 this case these instructions are considered non-arithmetic and therefore
23190 operating correctly in all cases, including in particular where the
23191 input operand is a NaN.  These instructions are therefore always used
23192 for the respective operations.
23194 @item -mnan=2008
23195 @itemx -mnan=legacy
23196 @opindex mnan=2008
23197 @opindex mnan=legacy
23198 These options control the encoding of the special not-a-number (NaN)
23199 IEEE 754 floating-point data.
23201 The @option{-mnan=legacy} option selects the legacy encoding.  In this
23202 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23203 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23204 by the first bit of their trailing significand field being 1.
23206 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
23207 this case qNaNs are denoted by the first bit of their trailing
23208 significand field being 1, whereas sNaNs are denoted by the first bit of
23209 their trailing significand field being 0.
23211 The default is @option{-mnan=legacy} unless GCC has been configured with
23212 @option{--with-nan=2008}.
23214 @item -mllsc
23215 @itemx -mno-llsc
23216 @opindex mllsc
23217 @opindex mno-llsc
23218 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23219 implement atomic memory built-in functions.  When neither option is
23220 specified, GCC uses the instructions if the target architecture
23221 supports them.
23223 @option{-mllsc} is useful if the runtime environment can emulate the
23224 instructions and @option{-mno-llsc} can be useful when compiling for
23225 nonstandard ISAs.  You can make either option the default by
23226 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23227 respectively.  @option{--with-llsc} is the default for some
23228 configurations; see the installation documentation for details.
23230 @item -mdsp
23231 @itemx -mno-dsp
23232 @opindex mdsp
23233 @opindex mno-dsp
23234 Use (do not use) revision 1 of the MIPS DSP ASE@.
23235 @xref{MIPS DSP Built-in Functions}.  This option defines the
23236 preprocessor macro @code{__mips_dsp}.  It also defines
23237 @code{__mips_dsp_rev} to 1.
23239 @item -mdspr2
23240 @itemx -mno-dspr2
23241 @opindex mdspr2
23242 @opindex mno-dspr2
23243 Use (do not use) revision 2 of the MIPS DSP ASE@.
23244 @xref{MIPS DSP Built-in Functions}.  This option defines the
23245 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23246 It also defines @code{__mips_dsp_rev} to 2.
23248 @item -msmartmips
23249 @itemx -mno-smartmips
23250 @opindex msmartmips
23251 @opindex mno-smartmips
23252 Use (do not use) the MIPS SmartMIPS ASE.
23254 @item -mpaired-single
23255 @itemx -mno-paired-single
23256 @opindex mpaired-single
23257 @opindex mno-paired-single
23258 Use (do not use) paired-single floating-point instructions.
23259 @xref{MIPS Paired-Single Support}.  This option requires
23260 hardware floating-point support to be enabled.
23262 @item -mdmx
23263 @itemx -mno-mdmx
23264 @opindex mdmx
23265 @opindex mno-mdmx
23266 Use (do not use) MIPS Digital Media Extension instructions.
23267 This option can only be used when generating 64-bit code and requires
23268 hardware floating-point support to be enabled.
23270 @item -mips3d
23271 @itemx -mno-mips3d
23272 @opindex mips3d
23273 @opindex mno-mips3d
23274 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
23275 The option @option{-mips3d} implies @option{-mpaired-single}.
23277 @item -mmicromips
23278 @itemx -mno-micromips
23279 @opindex mmicromips
23280 @opindex mno-mmicromips
23281 Generate (do not generate) microMIPS code.
23283 MicroMIPS code generation can also be controlled on a per-function basis
23284 by means of @code{micromips} and @code{nomicromips} attributes.
23285 @xref{Function Attributes}, for more information.
23287 @item -mmt
23288 @itemx -mno-mt
23289 @opindex mmt
23290 @opindex mno-mt
23291 Use (do not use) MT Multithreading instructions.
23293 @item -mmcu
23294 @itemx -mno-mcu
23295 @opindex mmcu
23296 @opindex mno-mcu
23297 Use (do not use) the MIPS MCU ASE instructions.
23299 @item -meva
23300 @itemx -mno-eva
23301 @opindex meva
23302 @opindex mno-eva
23303 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23305 @item -mvirt
23306 @itemx -mno-virt
23307 @opindex mvirt
23308 @opindex mno-virt
23309 Use (do not use) the MIPS Virtualization (VZ) instructions.
23311 @item -mxpa
23312 @itemx -mno-xpa
23313 @opindex mxpa
23314 @opindex mno-xpa
23315 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23317 @item -mcrc
23318 @itemx -mno-crc
23319 @opindex mcrc
23320 @opindex mno-crc
23321 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23323 @item -mginv
23324 @itemx -mno-ginv
23325 @opindex mginv
23326 @opindex mno-ginv
23327 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23329 @item -mloongson-mmi
23330 @itemx -mno-loongson-mmi
23331 @opindex mloongson-mmi
23332 @opindex mno-loongson-mmi
23333 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23335 @item -mloongson-ext
23336 @itemx -mno-loongson-ext
23337 @opindex mloongson-ext
23338 @opindex mno-loongson-ext
23339 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23341 @item -mloongson-ext2
23342 @itemx -mno-loongson-ext2
23343 @opindex mloongson-ext2
23344 @opindex mno-loongson-ext2
23345 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23347 @item -mlong64
23348 @opindex mlong64
23349 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
23350 an explanation of the default and the way that the pointer size is
23351 determined.
23353 @item -mlong32
23354 @opindex mlong32
23355 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23357 The default size of @code{int}s, @code{long}s and pointers depends on
23358 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
23359 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
23360 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
23361 or the same size as integer registers, whichever is smaller.
23363 @item -msym32
23364 @itemx -mno-sym32
23365 @opindex msym32
23366 @opindex mno-sym32
23367 Assume (do not assume) that all symbols have 32-bit values, regardless
23368 of the selected ABI@.  This option is useful in combination with
23369 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23370 to generate shorter and faster references to symbolic addresses.
23372 @item -G @var{num}
23373 @opindex G
23374 Put definitions of externally-visible data in a small data section
23375 if that data is no bigger than @var{num} bytes.  GCC can then generate
23376 more efficient accesses to the data; see @option{-mgpopt} for details.
23378 The default @option{-G} option depends on the configuration.
23380 @item -mlocal-sdata
23381 @itemx -mno-local-sdata
23382 @opindex mlocal-sdata
23383 @opindex mno-local-sdata
23384 Extend (do not extend) the @option{-G} behavior to local data too,
23385 such as to static variables in C@.  @option{-mlocal-sdata} is the
23386 default for all configurations.
23388 If the linker complains that an application is using too much small data,
23389 you might want to try rebuilding the less performance-critical parts with
23390 @option{-mno-local-sdata}.  You might also want to build large
23391 libraries with @option{-mno-local-sdata}, so that the libraries leave
23392 more room for the main program.
23394 @item -mextern-sdata
23395 @itemx -mno-extern-sdata
23396 @opindex mextern-sdata
23397 @opindex mno-extern-sdata
23398 Assume (do not assume) that externally-defined data is in
23399 a small data section if the size of that data is within the @option{-G} limit.
23400 @option{-mextern-sdata} is the default for all configurations.
23402 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23403 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23404 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23405 is placed in a small data section.  If @var{Var} is defined by another
23406 module, you must either compile that module with a high-enough
23407 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23408 definition.  If @var{Var} is common, you must link the application
23409 with a high-enough @option{-G} setting.
23411 The easiest way of satisfying these restrictions is to compile
23412 and link every module with the same @option{-G} option.  However,
23413 you may wish to build a library that supports several different
23414 small data limits.  You can do this by compiling the library with
23415 the highest supported @option{-G} setting and additionally using
23416 @option{-mno-extern-sdata} to stop the library from making assumptions
23417 about externally-defined data.
23419 @item -mgpopt
23420 @itemx -mno-gpopt
23421 @opindex mgpopt
23422 @opindex mno-gpopt
23423 Use (do not use) GP-relative accesses for symbols that are known to be
23424 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23425 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
23426 configurations.
23428 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
23429 might not hold the value of @code{_gp}.  For example, if the code is
23430 part of a library that might be used in a boot monitor, programs that
23431 call boot monitor routines pass an unknown value in @code{$gp}.
23432 (In such situations, the boot monitor itself is usually compiled
23433 with @option{-G0}.)
23435 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
23436 @option{-mno-extern-sdata}.
23438 @item -membedded-data
23439 @itemx -mno-embedded-data
23440 @opindex membedded-data
23441 @opindex mno-embedded-data
23442 Allocate variables to the read-only data section first if possible, then
23443 next in the small data section if possible, otherwise in data.  This gives
23444 slightly slower code than the default, but reduces the amount of RAM required
23445 when executing, and thus may be preferred for some embedded systems.
23447 @item -muninit-const-in-rodata
23448 @itemx -mno-uninit-const-in-rodata
23449 @opindex muninit-const-in-rodata
23450 @opindex mno-uninit-const-in-rodata
23451 Put uninitialized @code{const} variables in the read-only data section.
23452 This option is only meaningful in conjunction with @option{-membedded-data}.
23454 @item -mcode-readable=@var{setting}
23455 @opindex mcode-readable
23456 Specify whether GCC may generate code that reads from executable sections.
23457 There are three possible settings:
23459 @table @gcctabopt
23460 @item -mcode-readable=yes
23461 Instructions may freely access executable sections.  This is the
23462 default setting.
23464 @item -mcode-readable=pcrel
23465 MIPS16 PC-relative load instructions can access executable sections,
23466 but other instructions must not do so.  This option is useful on 4KSc
23467 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23468 It is also useful on processors that can be configured to have a dual
23469 instruction/data SRAM interface and that, like the M4K, automatically
23470 redirect PC-relative loads to the instruction RAM.
23472 @item -mcode-readable=no
23473 Instructions must not access executable sections.  This option can be
23474 useful on targets that are configured to have a dual instruction/data
23475 SRAM interface but that (unlike the M4K) do not automatically redirect
23476 PC-relative loads to the instruction RAM.
23477 @end table
23479 @item -msplit-addresses
23480 @itemx -mno-split-addresses
23481 @opindex msplit-addresses
23482 @opindex mno-split-addresses
23483 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23484 relocation operators.  This option has been superseded by
23485 @option{-mexplicit-relocs} but is retained for backwards compatibility.
23487 @item -mexplicit-relocs
23488 @itemx -mno-explicit-relocs
23489 @opindex mexplicit-relocs
23490 @opindex mno-explicit-relocs
23491 Use (do not use) assembler relocation operators when dealing with symbolic
23492 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
23493 is to use assembler macros instead.
23495 @option{-mexplicit-relocs} is the default if GCC was configured
23496 to use an assembler that supports relocation operators.
23498 @item -mcheck-zero-division
23499 @itemx -mno-check-zero-division
23500 @opindex mcheck-zero-division
23501 @opindex mno-check-zero-division
23502 Trap (do not trap) on integer division by zero.
23504 The default is @option{-mcheck-zero-division}.
23506 @item -mdivide-traps
23507 @itemx -mdivide-breaks
23508 @opindex mdivide-traps
23509 @opindex mdivide-breaks
23510 MIPS systems check for division by zero by generating either a
23511 conditional trap or a break instruction.  Using traps results in
23512 smaller code, but is only supported on MIPS II and later.  Also, some
23513 versions of the Linux kernel have a bug that prevents trap from
23514 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
23515 allow conditional traps on architectures that support them and
23516 @option{-mdivide-breaks} to force the use of breaks.
23518 The default is usually @option{-mdivide-traps}, but this can be
23519 overridden at configure time using @option{--with-divide=breaks}.
23520 Divide-by-zero checks can be completely disabled using
23521 @option{-mno-check-zero-division}.
23523 @item -mload-store-pairs
23524 @itemx -mno-load-store-pairs
23525 @opindex mload-store-pairs
23526 @opindex mno-load-store-pairs
23527 Enable (disable) an optimization that pairs consecutive load or store
23528 instructions to enable load/store bonding.  This option is enabled by
23529 default but only takes effect when the selected architecture is known
23530 to support bonding.
23532 @item -mmemcpy
23533 @itemx -mno-memcpy
23534 @opindex mmemcpy
23535 @opindex mno-memcpy
23536 Force (do not force) the use of @code{memcpy} for non-trivial block
23537 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
23538 most constant-sized copies.
23540 @item -mlong-calls
23541 @itemx -mno-long-calls
23542 @opindex mlong-calls
23543 @opindex mno-long-calls
23544 Disable (do not disable) use of the @code{jal} instruction.  Calling
23545 functions using @code{jal} is more efficient but requires the caller
23546 and callee to be in the same 256 megabyte segment.
23548 This option has no effect on abicalls code.  The default is
23549 @option{-mno-long-calls}.
23551 @item -mmad
23552 @itemx -mno-mad
23553 @opindex mmad
23554 @opindex mno-mad
23555 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
23556 instructions, as provided by the R4650 ISA@.
23558 @item -mimadd
23559 @itemx -mno-imadd
23560 @opindex mimadd
23561 @opindex mno-imadd
23562 Enable (disable) use of the @code{madd} and @code{msub} integer
23563 instructions.  The default is @option{-mimadd} on architectures
23564 that support @code{madd} and @code{msub} except for the 74k 
23565 architecture where it was found to generate slower code.
23567 @item -mfused-madd
23568 @itemx -mno-fused-madd
23569 @opindex mfused-madd
23570 @opindex mno-fused-madd
23571 Enable (disable) use of the floating-point multiply-accumulate
23572 instructions, when they are available.  The default is
23573 @option{-mfused-madd}.
23575 On the R8000 CPU when multiply-accumulate instructions are used,
23576 the intermediate product is calculated to infinite precision
23577 and is not subject to the FCSR Flush to Zero bit.  This may be
23578 undesirable in some circumstances.  On other processors the result
23579 is numerically identical to the equivalent computation using
23580 separate multiply, add, subtract and negate instructions.
23582 @item -nocpp
23583 @opindex nocpp
23584 Tell the MIPS assembler to not run its preprocessor over user
23585 assembler files (with a @samp{.s} suffix) when assembling them.
23587 @item -mfix-24k
23588 @itemx -mno-fix-24k
23589 @opindex mfix-24k
23590 @opindex mno-fix-24k
23591 Work around the 24K E48 (lost data on stores during refill) errata.
23592 The workarounds are implemented by the assembler rather than by GCC@.
23594 @item -mfix-r4000
23595 @itemx -mno-fix-r4000
23596 @opindex mfix-r4000
23597 @opindex mno-fix-r4000
23598 Work around certain R4000 CPU errata:
23599 @itemize @minus
23600 @item
23601 A double-word or a variable shift may give an incorrect result if executed
23602 immediately after starting an integer division.
23603 @item
23604 A double-word or a variable shift may give an incorrect result if executed
23605 while an integer multiplication is in progress.
23606 @item
23607 An integer division may give an incorrect result if started in a delay slot
23608 of a taken branch or a jump.
23609 @end itemize
23611 @item -mfix-r4400
23612 @itemx -mno-fix-r4400
23613 @opindex mfix-r4400
23614 @opindex mno-fix-r4400
23615 Work around certain R4400 CPU errata:
23616 @itemize @minus
23617 @item
23618 A double-word or a variable shift may give an incorrect result if executed
23619 immediately after starting an integer division.
23620 @end itemize
23622 @item -mfix-r10000
23623 @itemx -mno-fix-r10000
23624 @opindex mfix-r10000
23625 @opindex mno-fix-r10000
23626 Work around certain R10000 errata:
23627 @itemize @minus
23628 @item
23629 @code{ll}/@code{sc} sequences may not behave atomically on revisions
23630 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
23631 @end itemize
23633 This option can only be used if the target architecture supports
23634 branch-likely instructions.  @option{-mfix-r10000} is the default when
23635 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
23636 otherwise.
23638 @item -mfix-r5900
23639 @itemx -mno-fix-r5900
23640 @opindex mfix-r5900
23641 Do not attempt to schedule the preceding instruction into the delay slot
23642 of a branch instruction placed at the end of a short loop of six
23643 instructions or fewer and always schedule a @code{nop} instruction there
23644 instead.  The short loop bug under certain conditions causes loops to
23645 execute only once or twice, due to a hardware bug in the R5900 chip.  The
23646 workaround is implemented by the assembler rather than by GCC@.
23648 @item -mfix-rm7000
23649 @itemx -mno-fix-rm7000
23650 @opindex mfix-rm7000
23651 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
23652 workarounds are implemented by the assembler rather than by GCC@.
23654 @item -mfix-vr4120
23655 @itemx -mno-fix-vr4120
23656 @opindex mfix-vr4120
23657 Work around certain VR4120 errata:
23658 @itemize @minus
23659 @item
23660 @code{dmultu} does not always produce the correct result.
23661 @item
23662 @code{div} and @code{ddiv} do not always produce the correct result if one
23663 of the operands is negative.
23664 @end itemize
23665 The workarounds for the division errata rely on special functions in
23666 @file{libgcc.a}.  At present, these functions are only provided by
23667 the @code{mips64vr*-elf} configurations.
23669 Other VR4120 errata require a NOP to be inserted between certain pairs of
23670 instructions.  These errata are handled by the assembler, not by GCC itself.
23672 @item -mfix-vr4130
23673 @opindex mfix-vr4130
23674 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
23675 workarounds are implemented by the assembler rather than by GCC,
23676 although GCC avoids using @code{mflo} and @code{mfhi} if the
23677 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
23678 instructions are available instead.
23680 @item -mfix-sb1
23681 @itemx -mno-fix-sb1
23682 @opindex mfix-sb1
23683 Work around certain SB-1 CPU core errata.
23684 (This flag currently works around the SB-1 revision 2
23685 ``F1'' and ``F2'' floating-point errata.)
23687 @item -mr10k-cache-barrier=@var{setting}
23688 @opindex mr10k-cache-barrier
23689 Specify whether GCC should insert cache barriers to avoid the
23690 side effects of speculation on R10K processors.
23692 In common with many processors, the R10K tries to predict the outcome
23693 of a conditional branch and speculatively executes instructions from
23694 the ``taken'' branch.  It later aborts these instructions if the
23695 predicted outcome is wrong.  However, on the R10K, even aborted
23696 instructions can have side effects.
23698 This problem only affects kernel stores and, depending on the system,
23699 kernel loads.  As an example, a speculatively-executed store may load
23700 the target memory into cache and mark the cache line as dirty, even if
23701 the store itself is later aborted.  If a DMA operation writes to the
23702 same area of memory before the ``dirty'' line is flushed, the cached
23703 data overwrites the DMA-ed data.  See the R10K processor manual
23704 for a full description, including other potential problems.
23706 One workaround is to insert cache barrier instructions before every memory
23707 access that might be speculatively executed and that might have side
23708 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
23709 controls GCC's implementation of this workaround.  It assumes that
23710 aborted accesses to any byte in the following regions does not have
23711 side effects:
23713 @enumerate
23714 @item
23715 the memory occupied by the current function's stack frame;
23717 @item
23718 the memory occupied by an incoming stack argument;
23720 @item
23721 the memory occupied by an object with a link-time-constant address.
23722 @end enumerate
23724 It is the kernel's responsibility to ensure that speculative
23725 accesses to these regions are indeed safe.
23727 If the input program contains a function declaration such as:
23729 @smallexample
23730 void foo (void);
23731 @end smallexample
23733 then the implementation of @code{foo} must allow @code{j foo} and
23734 @code{jal foo} to be executed speculatively.  GCC honors this
23735 restriction for functions it compiles itself.  It expects non-GCC
23736 functions (such as hand-written assembly code) to do the same.
23738 The option has three forms:
23740 @table @gcctabopt
23741 @item -mr10k-cache-barrier=load-store
23742 Insert a cache barrier before a load or store that might be
23743 speculatively executed and that might have side effects even
23744 if aborted.
23746 @item -mr10k-cache-barrier=store
23747 Insert a cache barrier before a store that might be speculatively
23748 executed and that might have side effects even if aborted.
23750 @item -mr10k-cache-barrier=none
23751 Disable the insertion of cache barriers.  This is the default setting.
23752 @end table
23754 @item -mflush-func=@var{func}
23755 @itemx -mno-flush-func
23756 @opindex mflush-func
23757 Specifies the function to call to flush the I and D caches, or to not
23758 call any such function.  If called, the function must take the same
23759 arguments as the common @code{_flush_func}, that is, the address of the
23760 memory range for which the cache is being flushed, the size of the
23761 memory range, and the number 3 (to flush both caches).  The default
23762 depends on the target GCC was configured for, but commonly is either
23763 @code{_flush_func} or @code{__cpu_flush}.
23765 @item mbranch-cost=@var{num}
23766 @opindex mbranch-cost
23767 Set the cost of branches to roughly @var{num} ``simple'' instructions.
23768 This cost is only a heuristic and is not guaranteed to produce
23769 consistent results across releases.  A zero cost redundantly selects
23770 the default, which is based on the @option{-mtune} setting.
23772 @item -mbranch-likely
23773 @itemx -mno-branch-likely
23774 @opindex mbranch-likely
23775 @opindex mno-branch-likely
23776 Enable or disable use of Branch Likely instructions, regardless of the
23777 default for the selected architecture.  By default, Branch Likely
23778 instructions may be generated if they are supported by the selected
23779 architecture.  An exception is for the MIPS32 and MIPS64 architectures
23780 and processors that implement those architectures; for those, Branch
23781 Likely instructions are not be generated by default because the MIPS32
23782 and MIPS64 architectures specifically deprecate their use.
23784 @item -mcompact-branches=never
23785 @itemx -mcompact-branches=optimal
23786 @itemx -mcompact-branches=always
23787 @opindex mcompact-branches=never
23788 @opindex mcompact-branches=optimal
23789 @opindex mcompact-branches=always
23790 These options control which form of branches will be generated.  The
23791 default is @option{-mcompact-branches=optimal}.
23793 The @option{-mcompact-branches=never} option ensures that compact branch
23794 instructions will never be generated.
23796 The @option{-mcompact-branches=always} option ensures that a compact
23797 branch instruction will be generated if available.  If a compact branch
23798 instruction is not available, a delay slot form of the branch will be
23799 used instead.
23801 This option is supported from MIPS Release 6 onwards.
23803 The @option{-mcompact-branches=optimal} option will cause a delay slot
23804 branch to be used if one is available in the current ISA and the delay
23805 slot is successfully filled.  If the delay slot is not filled, a compact
23806 branch will be chosen if one is available.
23808 @item -mfp-exceptions
23809 @itemx -mno-fp-exceptions
23810 @opindex mfp-exceptions
23811 Specifies whether FP exceptions are enabled.  This affects how
23812 FP instructions are scheduled for some processors.
23813 The default is that FP exceptions are
23814 enabled.
23816 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
23817 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
23818 FP pipe.
23820 @item -mvr4130-align
23821 @itemx -mno-vr4130-align
23822 @opindex mvr4130-align
23823 The VR4130 pipeline is two-way superscalar, but can only issue two
23824 instructions together if the first one is 8-byte aligned.  When this
23825 option is enabled, GCC aligns pairs of instructions that it
23826 thinks should execute in parallel.
23828 This option only has an effect when optimizing for the VR4130.
23829 It normally makes code faster, but at the expense of making it bigger.
23830 It is enabled by default at optimization level @option{-O3}.
23832 @item -msynci
23833 @itemx -mno-synci
23834 @opindex msynci
23835 Enable (disable) generation of @code{synci} instructions on
23836 architectures that support it.  The @code{synci} instructions (if
23837 enabled) are generated when @code{__builtin___clear_cache} is
23838 compiled.
23840 This option defaults to @option{-mno-synci}, but the default can be
23841 overridden by configuring GCC with @option{--with-synci}.
23843 When compiling code for single processor systems, it is generally safe
23844 to use @code{synci}.  However, on many multi-core (SMP) systems, it
23845 does not invalidate the instruction caches on all cores and may lead
23846 to undefined behavior.
23848 @item -mrelax-pic-calls
23849 @itemx -mno-relax-pic-calls
23850 @opindex mrelax-pic-calls
23851 Try to turn PIC calls that are normally dispatched via register
23852 @code{$25} into direct calls.  This is only possible if the linker can
23853 resolve the destination at link time and if the destination is within
23854 range for a direct call.
23856 @option{-mrelax-pic-calls} is the default if GCC was configured to use
23857 an assembler and a linker that support the @code{.reloc} assembly
23858 directive and @option{-mexplicit-relocs} is in effect.  With
23859 @option{-mno-explicit-relocs}, this optimization can be performed by the
23860 assembler and the linker alone without help from the compiler.
23862 @item -mmcount-ra-address
23863 @itemx -mno-mcount-ra-address
23864 @opindex mmcount-ra-address
23865 @opindex mno-mcount-ra-address
23866 Emit (do not emit) code that allows @code{_mcount} to modify the
23867 calling function's return address.  When enabled, this option extends
23868 the usual @code{_mcount} interface with a new @var{ra-address}
23869 parameter, which has type @code{intptr_t *} and is passed in register
23870 @code{$12}.  @code{_mcount} can then modify the return address by
23871 doing both of the following:
23872 @itemize
23873 @item
23874 Returning the new address in register @code{$31}.
23875 @item
23876 Storing the new address in @code{*@var{ra-address}},
23877 if @var{ra-address} is nonnull.
23878 @end itemize
23880 The default is @option{-mno-mcount-ra-address}.
23882 @item -mframe-header-opt
23883 @itemx -mno-frame-header-opt
23884 @opindex mframe-header-opt
23885 Enable (disable) frame header optimization in the o32 ABI.  When using the
23886 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
23887 function to write out register arguments.  When enabled, this optimization
23888 will suppress the allocation of the frame header if it can be determined that
23889 it is unused.
23891 This optimization is off by default at all optimization levels.
23893 @item -mlxc1-sxc1
23894 @itemx -mno-lxc1-sxc1
23895 @opindex mlxc1-sxc1
23896 When applicable, enable (disable) the generation of @code{lwxc1},
23897 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
23899 @item -mmadd4
23900 @itemx -mno-madd4
23901 @opindex mmadd4
23902 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
23903 @code{madd.d} and related instructions.  Enabled by default.
23905 @end table
23907 @node MMIX Options
23908 @subsection MMIX Options
23909 @cindex MMIX Options
23911 These options are defined for the MMIX:
23913 @table @gcctabopt
23914 @item -mlibfuncs
23915 @itemx -mno-libfuncs
23916 @opindex mlibfuncs
23917 @opindex mno-libfuncs
23918 Specify that intrinsic library functions are being compiled, passing all
23919 values in registers, no matter the size.
23921 @item -mepsilon
23922 @itemx -mno-epsilon
23923 @opindex mepsilon
23924 @opindex mno-epsilon
23925 Generate floating-point comparison instructions that compare with respect
23926 to the @code{rE} epsilon register.
23928 @item -mabi=mmixware
23929 @itemx -mabi=gnu
23930 @opindex mabi=mmixware
23931 @opindex mabi=gnu
23932 Generate code that passes function parameters and return values that (in
23933 the called function) are seen as registers @code{$0} and up, as opposed to
23934 the GNU ABI which uses global registers @code{$231} and up.
23936 @item -mzero-extend
23937 @itemx -mno-zero-extend
23938 @opindex mzero-extend
23939 @opindex mno-zero-extend
23940 When reading data from memory in sizes shorter than 64 bits, use (do not
23941 use) zero-extending load instructions by default, rather than
23942 sign-extending ones.
23944 @item -mknuthdiv
23945 @itemx -mno-knuthdiv
23946 @opindex mknuthdiv
23947 @opindex mno-knuthdiv
23948 Make the result of a division yielding a remainder have the same sign as
23949 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
23950 remainder follows the sign of the dividend.  Both methods are
23951 arithmetically valid, the latter being almost exclusively used.
23953 @item -mtoplevel-symbols
23954 @itemx -mno-toplevel-symbols
23955 @opindex mtoplevel-symbols
23956 @opindex mno-toplevel-symbols
23957 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23958 code can be used with the @code{PREFIX} assembly directive.
23960 @item -melf
23961 @opindex melf
23962 Generate an executable in the ELF format, rather than the default
23963 @samp{mmo} format used by the @command{mmix} simulator.
23965 @item -mbranch-predict
23966 @itemx -mno-branch-predict
23967 @opindex mbranch-predict
23968 @opindex mno-branch-predict
23969 Use (do not use) the probable-branch instructions, when static branch
23970 prediction indicates a probable branch.
23972 @item -mbase-addresses
23973 @itemx -mno-base-addresses
23974 @opindex mbase-addresses
23975 @opindex mno-base-addresses
23976 Generate (do not generate) code that uses @emph{base addresses}.  Using a
23977 base address automatically generates a request (handled by the assembler
23978 and the linker) for a constant to be set up in a global register.  The
23979 register is used for one or more base address requests within the range 0
23980 to 255 from the value held in the register.  The generally leads to short
23981 and fast code, but the number of different data items that can be
23982 addressed is limited.  This means that a program that uses lots of static
23983 data may require @option{-mno-base-addresses}.
23985 @item -msingle-exit
23986 @itemx -mno-single-exit
23987 @opindex msingle-exit
23988 @opindex mno-single-exit
23989 Force (do not force) generated code to have a single exit point in each
23990 function.
23991 @end table
23993 @node MN10300 Options
23994 @subsection MN10300 Options
23995 @cindex MN10300 options
23997 These @option{-m} options are defined for Matsushita MN10300 architectures:
23999 @table @gcctabopt
24000 @item -mmult-bug
24001 @opindex mmult-bug
24002 Generate code to avoid bugs in the multiply instructions for the MN10300
24003 processors.  This is the default.
24005 @item -mno-mult-bug
24006 @opindex mno-mult-bug
24007 Do not generate code to avoid bugs in the multiply instructions for the
24008 MN10300 processors.
24010 @item -mam33
24011 @opindex mam33
24012 Generate code using features specific to the AM33 processor.
24014 @item -mno-am33
24015 @opindex mno-am33
24016 Do not generate code using features specific to the AM33 processor.  This
24017 is the default.
24019 @item -mam33-2
24020 @opindex mam33-2
24021 Generate code using features specific to the AM33/2.0 processor.
24023 @item -mam34
24024 @opindex mam34
24025 Generate code using features specific to the AM34 processor.
24027 @item -mtune=@var{cpu-type}
24028 @opindex mtune
24029 Use the timing characteristics of the indicated CPU type when
24030 scheduling instructions.  This does not change the targeted processor
24031 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
24032 @samp{am33-2} or @samp{am34}.
24034 @item -mreturn-pointer-on-d0
24035 @opindex mreturn-pointer-on-d0
24036 When generating a function that returns a pointer, return the pointer
24037 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
24038 only in @code{a0}, and attempts to call such functions without a prototype
24039 result in errors.  Note that this option is on by default; use
24040 @option{-mno-return-pointer-on-d0} to disable it.
24042 @item -mno-crt0
24043 @opindex mno-crt0
24044 Do not link in the C run-time initialization object file.
24046 @item -mrelax
24047 @opindex mrelax
24048 Indicate to the linker that it should perform a relaxation optimization pass
24049 to shorten branches, calls and absolute memory addresses.  This option only
24050 has an effect when used on the command line for the final link step.
24052 This option makes symbolic debugging impossible.
24054 @item -mliw
24055 @opindex mliw
24056 Allow the compiler to generate @emph{Long Instruction Word}
24057 instructions if the target is the @samp{AM33} or later.  This is the
24058 default.  This option defines the preprocessor macro @code{__LIW__}.
24060 @item -mno-liw
24061 @opindex mno-liw
24062 Do not allow the compiler to generate @emph{Long Instruction Word}
24063 instructions.  This option defines the preprocessor macro
24064 @code{__NO_LIW__}.
24066 @item -msetlb
24067 @opindex msetlb
24068 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24069 instructions if the target is the @samp{AM33} or later.  This is the
24070 default.  This option defines the preprocessor macro @code{__SETLB__}.
24072 @item -mno-setlb
24073 @opindex mno-setlb
24074 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24075 instructions.  This option defines the preprocessor macro
24076 @code{__NO_SETLB__}.
24078 @end table
24080 @node Moxie Options
24081 @subsection Moxie Options
24082 @cindex Moxie Options
24084 @table @gcctabopt
24086 @item -meb
24087 @opindex meb
24088 Generate big-endian code.  This is the default for @samp{moxie-*-*}
24089 configurations.
24091 @item -mel
24092 @opindex mel
24093 Generate little-endian code.
24095 @item -mmul.x
24096 @opindex mmul.x
24097 Generate mul.x and umul.x instructions.  This is the default for
24098 @samp{moxiebox-*-*} configurations.
24100 @item -mno-crt0
24101 @opindex mno-crt0
24102 Do not link in the C run-time initialization object file.
24104 @end table
24106 @node MSP430 Options
24107 @subsection MSP430 Options
24108 @cindex MSP430 Options
24110 These options are defined for the MSP430:
24112 @table @gcctabopt
24114 @item -masm-hex
24115 @opindex masm-hex
24116 Force assembly output to always use hex constants.  Normally such
24117 constants are signed decimals, but this option is available for
24118 testsuite and/or aesthetic purposes.
24120 @item -mmcu=
24121 @opindex mmcu=
24122 Select the MCU to target.  This is used to create a C preprocessor
24123 symbol based upon the MCU name, converted to upper case and pre- and
24124 post-fixed with @samp{__}.  This in turn is used by the
24125 @file{msp430.h} header file to select an MCU-specific supplementary
24126 header file.
24128 The option also sets the ISA to use.  If the MCU name is one that is
24129 known to only support the 430 ISA then that is selected, otherwise the
24130 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
24131 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
24132 name selects the 430X ISA.
24134 In addition an MCU-specific linker script is added to the linker
24135 command line.  The script's name is the name of the MCU with
24136 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24137 command line defines the C preprocessor symbol @code{__XXX__} and
24138 cause the linker to search for a script called @file{xxx.ld}.
24140 The ISA and hardware multiply supported for the different MCUs is hard-coded
24141 into GCC.  However, an external @samp{devices.csv} file can be used to
24142 extend device support beyond those that have been hard-coded.
24144 GCC searches for the @samp{devices.csv} file using the following methods in the
24145 given precedence order, where the first method takes precendence over the
24146 second which takes precedence over the third.
24148 @table @asis
24149 @item Include path specified with @code{-I} and @code{-L}
24150 @samp{devices.csv} will be searched for in each of the directories specified by
24151 include paths and linker library search paths.
24152 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24153 Define the value of the global environment variable
24154 @samp{MSP430_GCC_INCLUDE_DIR}
24155 to the full path to the directory containing devices.csv, and GCC will search
24156 this directory for devices.csv.  If devices.csv is found, this directory will
24157 also be registered as an include path, and linker library path.  Header files
24158 and linker scripts in this directory can therefore be used without manually
24159 specifying @code{-I} and @code{-L} on the command line.
24160 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
24161 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24162 toolchain root directory.  This directory does not exist in a default
24163 installation, but if the user has created it and copied @samp{devices.csv}
24164 there, then the MCU data will be read.  As above, this directory will
24165 also be registered as an include path, and linker library path.
24167 @end table
24168 If none of the above search methods find @samp{devices.csv}, then the
24169 hard-coded MCU data is used.
24172 @item -mwarn-mcu
24173 @itemx -mno-warn-mcu
24174 @opindex mwarn-mcu
24175 @opindex mno-warn-mcu
24176 This option enables or disables warnings about conflicts between the
24177 MCU name specified by the @option{-mmcu} option and the ISA set by the
24178 @option{-mcpu} option and/or the hardware multiply support set by the
24179 @option{-mhwmult} option.  It also toggles warnings about unrecognized
24180 MCU names.  This option is on by default.
24182 @item -mcpu=
24183 @opindex mcpu=
24184 Specifies the ISA to use.  Accepted values are @samp{msp430},
24185 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
24186 @option{-mmcu=} option should be used to select the ISA.
24188 @item -msim
24189 @opindex msim
24190 Link to the simulator runtime libraries and linker script.  Overrides
24191 any scripts that would be selected by the @option{-mmcu=} option.
24193 @item -mlarge
24194 @opindex mlarge
24195 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24197 @item -msmall
24198 @opindex msmall
24199 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24201 @item -mrelax
24202 @opindex mrelax
24203 This option is passed to the assembler and linker, and allows the
24204 linker to perform certain optimizations that cannot be done until
24205 the final link.
24207 @item mhwmult=
24208 @opindex mhwmult=
24209 Describes the type of hardware multiply supported by the target.
24210 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24211 for the original 16-bit-only multiply supported by early MCUs.
24212 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24213 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24214 A value of @samp{auto} can also be given.  This tells GCC to deduce
24215 the hardware multiply support based upon the MCU name provided by the
24216 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
24217 the MCU name is not recognized then no hardware multiply support is
24218 assumed.  @code{auto} is the default setting.
24220 Hardware multiplies are normally performed by calling a library
24221 routine.  This saves space in the generated code.  When compiling at
24222 @option{-O3} or higher however the hardware multiplier is invoked
24223 inline.  This makes for bigger, but faster code.
24225 The hardware multiply routines disable interrupts whilst running and
24226 restore the previous interrupt state when they finish.  This makes
24227 them safe to use inside interrupt handlers as well as in normal code.
24229 @item -minrt
24230 @opindex minrt
24231 Enable the use of a minimum runtime environment - no static
24232 initializers or constructors.  This is intended for memory-constrained
24233 devices.  The compiler includes special symbols in some objects
24234 that tell the linker and runtime which code fragments are required.
24236 @item -mtiny-printf
24237 @opindex mtiny-printf
24238 Enable reduced code size @code{printf} and @code{puts} library functions.
24239 The @samp{tiny} implementations of these functions are not reentrant, so
24240 must be used with caution in multi-threaded applications.
24242 Support for streams has been removed and the string to be printed will
24243 always be sent to stdout via the @code{write} syscall.  The string is not
24244 buffered before it is sent to write.
24246 This option requires Newlib Nano IO, so GCC must be configured with
24247 @samp{--enable-newlib-nano-formatted-io}.
24249 @item -mcode-region=
24250 @itemx -mdata-region=
24251 @opindex mcode-region
24252 @opindex mdata-region
24253 These options tell the compiler where to place functions and data that
24254 do not have one of the @code{lower}, @code{upper}, @code{either} or
24255 @code{section} attributes.  Possible values are @code{lower},
24256 @code{upper}, @code{either} or @code{any}.  The first three behave
24257 like the corresponding attribute.  The fourth possible value -
24258 @code{any} - is the default.  It leaves placement entirely up to the
24259 linker script and how it assigns the standard sections
24260 (@code{.text}, @code{.data}, etc) to the memory regions.
24262 @item -msilicon-errata=
24263 @opindex msilicon-errata
24264 This option passes on a request to assembler to enable the fixes for
24265 the named silicon errata.
24267 @item -msilicon-errata-warn=
24268 @opindex msilicon-errata-warn
24269 This option passes on a request to the assembler to enable warning
24270 messages when a silicon errata might need to be applied.
24272 @item -mwarn-devices-csv
24273 @itemx -mno-warn-devices-csv
24274 @opindex mwarn-devices-csv
24275 @opindex mno-warn-devices-csv
24276 Warn if @samp{devices.csv} is not found or there are problem parsing it
24277 (default: on).
24279 @end table
24281 @node NDS32 Options
24282 @subsection NDS32 Options
24283 @cindex NDS32 Options
24285 These options are defined for NDS32 implementations:
24287 @table @gcctabopt
24289 @item -mbig-endian
24290 @opindex mbig-endian
24291 Generate code in big-endian mode.
24293 @item -mlittle-endian
24294 @opindex mlittle-endian
24295 Generate code in little-endian mode.
24297 @item -mreduced-regs
24298 @opindex mreduced-regs
24299 Use reduced-set registers for register allocation.
24301 @item -mfull-regs
24302 @opindex mfull-regs
24303 Use full-set registers for register allocation.
24305 @item -mcmov
24306 @opindex mcmov
24307 Generate conditional move instructions.
24309 @item -mno-cmov
24310 @opindex mno-cmov
24311 Do not generate conditional move instructions.
24313 @item -mext-perf
24314 @opindex mext-perf
24315 Generate performance extension instructions.
24317 @item -mno-ext-perf
24318 @opindex mno-ext-perf
24319 Do not generate performance extension instructions.
24321 @item -mext-perf2
24322 @opindex mext-perf2
24323 Generate performance extension 2 instructions.
24325 @item -mno-ext-perf2
24326 @opindex mno-ext-perf2
24327 Do not generate performance extension 2 instructions.
24329 @item -mext-string
24330 @opindex mext-string
24331 Generate string extension instructions.
24333 @item -mno-ext-string
24334 @opindex mno-ext-string
24335 Do not generate string extension instructions.
24337 @item -mv3push
24338 @opindex mv3push
24339 Generate v3 push25/pop25 instructions.
24341 @item -mno-v3push
24342 @opindex mno-v3push
24343 Do not generate v3 push25/pop25 instructions.
24345 @item -m16-bit
24346 @opindex m16-bit
24347 Generate 16-bit instructions.
24349 @item -mno-16-bit
24350 @opindex mno-16-bit
24351 Do not generate 16-bit instructions.
24353 @item -misr-vector-size=@var{num}
24354 @opindex misr-vector-size
24355 Specify the size of each interrupt vector, which must be 4 or 16.
24357 @item -mcache-block-size=@var{num}
24358 @opindex mcache-block-size
24359 Specify the size of each cache block,
24360 which must be a power of 2 between 4 and 512.
24362 @item -march=@var{arch}
24363 @opindex march
24364 Specify the name of the target architecture.
24366 @item -mcmodel=@var{code-model}
24367 @opindex mcmodel
24368 Set the code model to one of
24369 @table @asis
24370 @item @samp{small}
24371 All the data and read-only data segments must be within 512KB addressing space.
24372 The text segment must be within 16MB addressing space.
24373 @item @samp{medium}
24374 The data segment must be within 512KB while the read-only data segment can be
24375 within 4GB addressing space.  The text segment should be still within 16MB
24376 addressing space.
24377 @item @samp{large}
24378 All the text and data segments can be within 4GB addressing space.
24379 @end table
24381 @item -mctor-dtor
24382 @opindex mctor-dtor
24383 Enable constructor/destructor feature.
24385 @item -mrelax
24386 @opindex mrelax
24387 Guide linker to relax instructions.
24389 @end table
24391 @node Nios II Options
24392 @subsection Nios II Options
24393 @cindex Nios II options
24394 @cindex Altera Nios II options
24396 These are the options defined for the Altera Nios II processor.
24398 @table @gcctabopt
24400 @item -G @var{num}
24401 @opindex G
24402 @cindex smaller data references
24403 Put global and static objects less than or equal to @var{num} bytes
24404 into the small data or BSS sections instead of the normal data or BSS
24405 sections.  The default value of @var{num} is 8.
24407 @item -mgpopt=@var{option}
24408 @itemx -mgpopt
24409 @itemx -mno-gpopt
24410 @opindex mgpopt
24411 @opindex mno-gpopt
24412 Generate (do not generate) GP-relative accesses.  The following 
24413 @var{option} names are recognized:
24415 @table @samp
24417 @item none
24418 Do not generate GP-relative accesses.
24420 @item local
24421 Generate GP-relative accesses for small data objects that are not 
24422 external, weak, or uninitialized common symbols.  
24423 Also use GP-relative addressing for objects that
24424 have been explicitly placed in a small data section via a @code{section}
24425 attribute.
24427 @item global
24428 As for @samp{local}, but also generate GP-relative accesses for
24429 small data objects that are external, weak, or common.  If you use this option,
24430 you must ensure that all parts of your program (including libraries) are
24431 compiled with the same @option{-G} setting.
24433 @item data
24434 Generate GP-relative accesses for all data objects in the program.  If you
24435 use this option, the entire data and BSS segments
24436 of your program must fit in 64K of memory and you must use an appropriate
24437 linker script to allocate them within the addressable range of the
24438 global pointer.
24440 @item all
24441 Generate GP-relative addresses for function pointers as well as data
24442 pointers.  If you use this option, the entire text, data, and BSS segments
24443 of your program must fit in 64K of memory and you must use an appropriate
24444 linker script to allocate them within the addressable range of the
24445 global pointer.
24447 @end table
24449 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24450 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24452 The default is @option{-mgpopt} except when @option{-fpic} or
24453 @option{-fPIC} is specified to generate position-independent code.
24454 Note that the Nios II ABI does not permit GP-relative accesses from
24455 shared libraries.
24457 You may need to specify @option{-mno-gpopt} explicitly when building
24458 programs that include large amounts of small data, including large
24459 GOT data sections.  In this case, the 16-bit offset for GP-relative
24460 addressing may not be large enough to allow access to the entire 
24461 small data section.
24463 @item -mgprel-sec=@var{regexp}
24464 @opindex mgprel-sec
24465 This option specifies additional section names that can be accessed via
24466 GP-relative addressing.  It is most useful in conjunction with 
24467 @code{section} attributes on variable declarations 
24468 (@pxref{Common Variable Attributes}) and a custom linker script.  
24469 The @var{regexp} is a POSIX Extended Regular Expression.
24471 This option does not affect the behavior of the @option{-G} option, and 
24472 the specified sections are in addition to the standard @code{.sdata}
24473 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24475 @item -mr0rel-sec=@var{regexp}
24476 @opindex mr0rel-sec
24477 This option specifies names of sections that can be accessed via a 
24478 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
24479 of the 32-bit address space.  It is most useful in conjunction with 
24480 @code{section} attributes on variable declarations 
24481 (@pxref{Common Variable Attributes}) and a custom linker script.  
24482 The @var{regexp} is a POSIX Extended Regular Expression.
24484 In contrast to the use of GP-relative addressing for small data, 
24485 zero-based addressing is never generated by default and there are no 
24486 conventional section names used in standard linker scripts for sections
24487 in the low or high areas of memory.
24489 @item -mel
24490 @itemx -meb
24491 @opindex mel
24492 @opindex meb
24493 Generate little-endian (default) or big-endian (experimental) code,
24494 respectively.
24496 @item -march=@var{arch}
24497 @opindex march
24498 This specifies the name of the target Nios II architecture.  GCC uses this
24499 name to determine what kind of instructions it can emit when generating
24500 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
24502 The preprocessor macro @code{__nios2_arch__} is available to programs,
24503 with value 1 or 2, indicating the targeted ISA level.
24505 @item -mbypass-cache
24506 @itemx -mno-bypass-cache
24507 @opindex mno-bypass-cache
24508 @opindex mbypass-cache
24509 Force all load and store instructions to always bypass cache by 
24510 using I/O variants of the instructions. The default is not to
24511 bypass the cache.
24513 @item -mno-cache-volatile 
24514 @itemx -mcache-volatile       
24515 @opindex mcache-volatile 
24516 @opindex mno-cache-volatile
24517 Volatile memory access bypass the cache using the I/O variants of 
24518 the load and store instructions. The default is not to bypass the cache.
24520 @item -mno-fast-sw-div
24521 @itemx -mfast-sw-div
24522 @opindex mno-fast-sw-div
24523 @opindex mfast-sw-div
24524 Do not use table-based fast divide for small numbers. The default 
24525 is to use the fast divide at @option{-O3} and above.
24527 @item -mno-hw-mul
24528 @itemx -mhw-mul
24529 @itemx -mno-hw-mulx
24530 @itemx -mhw-mulx
24531 @itemx -mno-hw-div
24532 @itemx -mhw-div
24533 @opindex mno-hw-mul
24534 @opindex mhw-mul
24535 @opindex mno-hw-mulx
24536 @opindex mhw-mulx
24537 @opindex mno-hw-div
24538 @opindex mhw-div
24539 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
24540 instructions by the compiler. The default is to emit @code{mul}
24541 and not emit @code{div} and @code{mulx}.
24543 @item -mbmx
24544 @itemx -mno-bmx
24545 @itemx -mcdx
24546 @itemx -mno-cdx
24547 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
24548 CDX (code density) instructions.  Enabling these instructions also
24549 requires @option{-march=r2}.  Since these instructions are optional
24550 extensions to the R2 architecture, the default is not to emit them.
24552 @item -mcustom-@var{insn}=@var{N}
24553 @itemx -mno-custom-@var{insn}
24554 @opindex mcustom-@var{insn}
24555 @opindex mno-custom-@var{insn}
24556 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
24557 custom instruction with encoding @var{N} when generating code that uses 
24558 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
24559 instruction 253 for single-precision floating-point add operations instead
24560 of the default behavior of using a library call.
24562 The following values of @var{insn} are supported.  Except as otherwise
24563 noted, floating-point operations are expected to be implemented with
24564 normal IEEE 754 semantics and correspond directly to the C operators or the
24565 equivalent GCC built-in functions (@pxref{Other Builtins}).
24567 Single-precision floating point:
24568 @table @asis
24570 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
24571 Binary arithmetic operations.
24573 @item @samp{fnegs}
24574 Unary negation.
24576 @item @samp{fabss}
24577 Unary absolute value.
24579 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
24580 Comparison operations.
24582 @item @samp{fmins}, @samp{fmaxs}
24583 Floating-point minimum and maximum.  These instructions are only
24584 generated if @option{-ffinite-math-only} is specified.
24586 @item @samp{fsqrts}
24587 Unary square root operation.
24589 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
24590 Floating-point trigonometric and exponential functions.  These instructions
24591 are only generated if @option{-funsafe-math-optimizations} is also specified.
24593 @end table
24595 Double-precision floating point:
24596 @table @asis
24598 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
24599 Binary arithmetic operations.
24601 @item @samp{fnegd}
24602 Unary negation.
24604 @item @samp{fabsd}
24605 Unary absolute value.
24607 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
24608 Comparison operations.
24610 @item @samp{fmind}, @samp{fmaxd}
24611 Double-precision minimum and maximum.  These instructions are only
24612 generated if @option{-ffinite-math-only} is specified.
24614 @item @samp{fsqrtd}
24615 Unary square root operation.
24617 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
24618 Double-precision trigonometric and exponential functions.  These instructions
24619 are only generated if @option{-funsafe-math-optimizations} is also specified.
24621 @end table
24623 Conversions:
24624 @table @asis
24625 @item @samp{fextsd}
24626 Conversion from single precision to double precision.
24628 @item @samp{ftruncds}
24629 Conversion from double precision to single precision.
24631 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
24632 Conversion from floating point to signed or unsigned integer types, with
24633 truncation towards zero.
24635 @item @samp{round}
24636 Conversion from single-precision floating point to signed integer,
24637 rounding to the nearest integer and ties away from zero.
24638 This corresponds to the @code{__builtin_lroundf} function when
24639 @option{-fno-math-errno} is used.
24641 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
24642 Conversion from signed or unsigned integer types to floating-point types.
24644 @end table
24646 In addition, all of the following transfer instructions for internal
24647 registers X and Y must be provided to use any of the double-precision
24648 floating-point instructions.  Custom instructions taking two
24649 double-precision source operands expect the first operand in the
24650 64-bit register X.  The other operand (or only operand of a unary
24651 operation) is given to the custom arithmetic instruction with the
24652 least significant half in source register @var{src1} and the most
24653 significant half in @var{src2}.  A custom instruction that returns a
24654 double-precision result returns the most significant 32 bits in the
24655 destination register and the other half in 32-bit register Y.  
24656 GCC automatically generates the necessary code sequences to write
24657 register X and/or read register Y when double-precision floating-point
24658 instructions are used.
24660 @table @asis
24662 @item @samp{fwrx}
24663 Write @var{src1} into the least significant half of X and @var{src2} into
24664 the most significant half of X.
24666 @item @samp{fwry}
24667 Write @var{src1} into Y.
24669 @item @samp{frdxhi}, @samp{frdxlo}
24670 Read the most or least (respectively) significant half of X and store it in
24671 @var{dest}.
24673 @item @samp{frdy}
24674 Read the value of Y and store it into @var{dest}.
24675 @end table
24677 Note that you can gain more local control over generation of Nios II custom
24678 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
24679 and @code{target("no-custom-@var{insn}")} function attributes
24680 (@pxref{Function Attributes})
24681 or pragmas (@pxref{Function Specific Option Pragmas}).
24683 @item -mcustom-fpu-cfg=@var{name}
24684 @opindex mcustom-fpu-cfg
24686 This option enables a predefined, named set of custom instruction encodings
24687 (see @option{-mcustom-@var{insn}} above).  
24688 Currently, the following sets are defined:
24690 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
24691 @gccoptlist{-mcustom-fmuls=252 @gol
24692 -mcustom-fadds=253 @gol
24693 -mcustom-fsubs=254 @gol
24694 -fsingle-precision-constant}
24696 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
24697 @gccoptlist{-mcustom-fmuls=252 @gol
24698 -mcustom-fadds=253 @gol
24699 -mcustom-fsubs=254 @gol
24700 -mcustom-fdivs=255 @gol
24701 -fsingle-precision-constant}
24703 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
24704 @gccoptlist{-mcustom-floatus=243 @gol
24705 -mcustom-fixsi=244 @gol
24706 -mcustom-floatis=245 @gol
24707 -mcustom-fcmpgts=246 @gol
24708 -mcustom-fcmples=249 @gol
24709 -mcustom-fcmpeqs=250 @gol
24710 -mcustom-fcmpnes=251 @gol
24711 -mcustom-fmuls=252 @gol
24712 -mcustom-fadds=253 @gol
24713 -mcustom-fsubs=254 @gol
24714 -mcustom-fdivs=255 @gol
24715 -fsingle-precision-constant}
24717 Custom instruction assignments given by individual
24718 @option{-mcustom-@var{insn}=} options override those given by
24719 @option{-mcustom-fpu-cfg=}, regardless of the
24720 order of the options on the command line.
24722 Note that you can gain more local control over selection of a FPU
24723 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
24724 function attribute (@pxref{Function Attributes})
24725 or pragma (@pxref{Function Specific Option Pragmas}).
24727 @end table
24729 These additional @samp{-m} options are available for the Altera Nios II
24730 ELF (bare-metal) target:
24732 @table @gcctabopt
24734 @item -mhal
24735 @opindex mhal
24736 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
24737 startup and termination code, and is typically used in conjunction with
24738 @option{-msys-crt0=} to specify the location of the alternate startup code
24739 provided by the HAL BSP.
24741 @item -msmallc
24742 @opindex msmallc
24743 Link with a limited version of the C library, @option{-lsmallc}, rather than
24744 Newlib.
24746 @item -msys-crt0=@var{startfile}
24747 @opindex msys-crt0
24748 @var{startfile} is the file name of the startfile (crt0) to use 
24749 when linking.  This option is only useful in conjunction with @option{-mhal}.
24751 @item -msys-lib=@var{systemlib}
24752 @opindex msys-lib
24753 @var{systemlib} is the library name of the library that provides
24754 low-level system calls required by the C library,
24755 e.g.@: @code{read} and @code{write}.
24756 This option is typically used to link with a library provided by a HAL BSP.
24758 @end table
24760 @node Nvidia PTX Options
24761 @subsection Nvidia PTX Options
24762 @cindex Nvidia PTX options
24763 @cindex nvptx options
24765 These options are defined for Nvidia PTX:
24767 @table @gcctabopt
24769 @item -m32
24770 @itemx -m64
24771 @opindex m32
24772 @opindex m64
24773 Generate code for 32-bit or 64-bit ABI.
24775 @item -misa=@var{ISA-string}
24776 @opindex march
24777 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
24778 strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
24779 @samp{sm_35}.  The default ISA is sm_30.
24781 @item -mmainkernel
24782 @opindex mmainkernel
24783 Link in code for a __main kernel.  This is for stand-alone instead of
24784 offloading execution.
24786 @item -moptimize
24787 @opindex moptimize
24788 Apply partitioned execution optimizations.  This is the default when any
24789 level of optimization is selected.
24791 @item -msoft-stack
24792 @opindex msoft-stack
24793 Generate code that does not use @code{.local} memory
24794 directly for stack storage. Instead, a per-warp stack pointer is
24795 maintained explicitly. This enables variable-length stack allocation (with
24796 variable-length arrays or @code{alloca}), and when global memory is used for
24797 underlying storage, makes it possible to access automatic variables from other
24798 threads, or with atomic instructions. This code generation variant is used
24799 for OpenMP offloading, but the option is exposed on its own for the purpose
24800 of testing the compiler; to generate code suitable for linking into programs
24801 using OpenMP offloading, use option @option{-mgomp}.
24803 @item -muniform-simt
24804 @opindex muniform-simt
24805 Switch to code generation variant that allows to execute all threads in each
24806 warp, while maintaining memory state and side effects as if only one thread
24807 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
24808 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
24809 current lane index equals the master lane index), and the register being
24810 assigned is copied via a shuffle instruction from the master lane.  Outside of
24811 SIMD regions lane 0 is the master; inside, each thread sees itself as the
24812 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
24813 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
24814 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
24815 with current lane index to compute the master lane index.
24817 @item -mgomp
24818 @opindex mgomp
24819 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
24820 @option{-muniform-simt} options, and selects corresponding multilib variant.
24822 @end table
24824 @node OpenRISC Options
24825 @subsection OpenRISC Options
24826 @cindex OpenRISC Options
24828 These options are defined for OpenRISC:
24830 @table @gcctabopt
24832 @item -mboard=@var{name}
24833 @opindex mboard
24834 Configure a board specific runtime.  This will be passed to the linker for
24835 newlib board library linking.  The default is @code{or1ksim}.
24837 @item -mnewlib
24838 @opindex mnewlib
24839 This option is ignored; it is for compatibility purposes only.  This used to
24840 select linker and preprocessor options for use with newlib.
24842 @item -msoft-div
24843 @itemx -mhard-div
24844 @opindex msoft-div
24845 @opindex mhard-div
24846 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
24847 This default is hardware divide.
24849 @item -msoft-mul
24850 @itemx -mhard-mul
24851 @opindex msoft-mul
24852 @opindex mhard-mul
24853 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
24854 This default is hardware multiply.
24856 @item -msoft-float
24857 @itemx -mhard-float
24858 @opindex msoft-float
24859 @opindex mhard-float
24860 Select software or hardware for floating point operations.
24861 The default is software.
24863 @item -mdouble-float
24864 @opindex mdouble-float
24865 When @option{-mhard-float} is selected, enables generation of double-precision
24866 floating point instructions.  By default functions from @file{libgcc} are used
24867 to perform double-precision floating point operations.
24869 @item -munordered-float
24870 @opindex munordered-float
24871 When @option{-mhard-float} is selected, enables generation of unordered
24872 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
24873 functions from @file{libgcc} are used to perform unordered floating point
24874 compare and set flag operations.
24876 @item -mcmov
24877 @opindex mcmov
24878 Enable generation of conditional move (@code{l.cmov}) instructions.  By
24879 default the equivalent will be generated using using set and branch.
24881 @item -mror
24882 @opindex mror
24883 Enable generation of rotate right (@code{l.ror}) instructions.  By default
24884 functions from @file{libgcc} are used to perform rotate right operations.
24886 @item -mrori
24887 @opindex mrori
24888 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
24889 By default functions from @file{libgcc} are used to perform rotate right with
24890 immediate operations.
24892 @item -msext
24893 @opindex msext
24894 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
24895 memory loads are used to perform sign extension.
24897 @item -msfimm
24898 @opindex msfimm
24899 Enable generation of compare and set flag with immediate (@code{l.sf*i})
24900 instructions.  By default extra instructions will be generated to store the
24901 immediate to a register first.
24903 @item -mshftimm
24904 @opindex mshftimm
24905 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
24906 @code{l.slli}) instructions.  By default extra instructions will be generated
24907 to store the immediate to a register first.
24910 @end table
24912 @node PDP-11 Options
24913 @subsection PDP-11 Options
24914 @cindex PDP-11 Options
24916 These options are defined for the PDP-11:
24918 @table @gcctabopt
24919 @item -mfpu
24920 @opindex mfpu
24921 Use hardware FPP floating point.  This is the default.  (FIS floating
24922 point on the PDP-11/40 is not supported.)  Implies -m45.
24924 @item -msoft-float
24925 @opindex msoft-float
24926 Do not use hardware floating point.
24928 @item -mac0
24929 @opindex mac0
24930 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
24932 @item -mno-ac0
24933 @opindex mno-ac0
24934 Return floating-point results in memory.  This is the default.
24936 @item -m40
24937 @opindex m40
24938 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
24940 @item -m45
24941 @opindex m45
24942 Generate code for a PDP-11/45.  This is the default.
24944 @item -m10
24945 @opindex m10
24946 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
24948 @item -mint16
24949 @itemx -mno-int32
24950 @opindex mint16
24951 @opindex mno-int32
24952 Use 16-bit @code{int}.  This is the default.
24954 @item -mint32
24955 @itemx -mno-int16
24956 @opindex mint32
24957 @opindex mno-int16
24958 Use 32-bit @code{int}.
24960 @item -msplit
24961 @opindex msplit
24962 Target has split instruction and data space.  Implies -m45.
24964 @item -munix-asm
24965 @opindex munix-asm
24966 Use Unix assembler syntax.
24968 @item -mdec-asm
24969 @opindex mdec-asm
24970 Use DEC assembler syntax.
24972 @item -mgnu-asm
24973 @opindex mgnu-asm
24974 Use GNU assembler syntax.  This is the default.
24976 @item -mlra
24977 @opindex mlra
24978 Use the new LRA register allocator.  By default, the old ``reload''
24979 allocator is used.
24980 @end table
24982 @node picoChip Options
24983 @subsection picoChip Options
24984 @cindex picoChip options
24986 These @samp{-m} options are defined for picoChip implementations:
24988 @table @gcctabopt
24990 @item -mae=@var{ae_type}
24991 @opindex mcpu
24992 Set the instruction set, register set, and instruction scheduling
24993 parameters for array element type @var{ae_type}.  Supported values
24994 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24996 @option{-mae=ANY} selects a completely generic AE type.  Code
24997 generated with this option runs on any of the other AE types.  The
24998 code is not as efficient as it would be if compiled for a specific
24999 AE type, and some types of operation (e.g., multiplication) do not
25000 work properly on all types of AE.
25002 @option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
25003 for compiled code, and is the default.
25005 @option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
25006 option may suffer from poor performance of byte (char) manipulation,
25007 since the DSP AE does not provide hardware support for byte load/stores.
25009 @item -msymbol-as-address
25010 Enable the compiler to directly use a symbol name as an address in a
25011 load/store instruction, without first loading it into a
25012 register.  Typically, the use of this option generates larger
25013 programs, which run faster than when the option isn't used.  However, the
25014 results vary from program to program, so it is left as a user option,
25015 rather than being permanently enabled.
25017 @item -mno-inefficient-warnings
25018 Disables warnings about the generation of inefficient code.  These
25019 warnings can be generated, for example, when compiling code that
25020 performs byte-level memory operations on the MAC AE type.  The MAC AE has
25021 no hardware support for byte-level memory operations, so all byte
25022 load/stores must be synthesized from word load/store operations.  This is
25023 inefficient and a warning is generated to indicate
25024 that you should rewrite the code to avoid byte operations, or to target
25025 an AE type that has the necessary hardware support.  This option disables
25026 these warnings.
25028 @end table
25030 @node PowerPC Options
25031 @subsection PowerPC Options
25032 @cindex PowerPC options
25034 These are listed under @xref{RS/6000 and PowerPC Options}.
25036 @node PRU Options
25037 @subsection PRU Options
25038 @cindex PRU Options
25040 These command-line options are defined for PRU target:
25042 @table @gcctabopt
25043 @item -minrt
25044 @opindex minrt
25045 Link with a minimum runtime environment, with no support for static
25046 initializers and constructors.  Using this option can significantly reduce
25047 the size of the final ELF binary.  Beware that the compiler could still
25048 generate code with static initializers and constructors.  It is up to the
25049 programmer to ensure that the source program will not use those features.
25051 @item -mmcu=@var{mcu}
25052 @opindex mmcu
25053 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
25054 supported MCUs.
25056 @item -mno-relax
25057 @opindex mno-relax
25058 Make GCC pass the @option{--no-relax} command-line option to the linker
25059 instead of the @option{--relax} option.
25061 @item -mloop
25062 @opindex mloop
25063 Allow (or do not allow) GCC to use the LOOP instruction.
25065 @item -mabi=@var{variant}
25066 @opindex mabi
25067 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
25068 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25069 more naturally with certain GCC assumptions.  These are the differences:
25071 @table @samp
25072 @item Function Pointer Size
25073 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25074 supports only 32-bit data and code pointers.
25076 @item Optional Return Value Pointer
25077 Function return values larger than 64 bits are passed by using a hidden
25078 pointer as the first argument of the function.  TI ABI, though, mandates that
25079 the pointer can be NULL in case the caller is not using the returned value.
25080 GNU always passes and expects a valid return value pointer.
25082 @end table
25084 The current @option{-mabi=ti} implementation simply raises a compile error
25085 when any of the above code constructs is detected.  As a consequence
25086 the standard C library cannot be built and it is omitted when linking with
25087 @option{-mabi=ti}.
25089 Relaxation is a GNU feature and for safety reasons is disabled when using
25090 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
25091 instructions, so the GNU linker cannot adjust them when shortening adjacent
25092 LDI32 pseudo instructions.
25094 @end table
25096 @node RISC-V Options
25097 @subsection RISC-V Options
25098 @cindex RISC-V Options
25100 These command-line options are defined for RISC-V targets:
25102 @table @gcctabopt
25103 @item -mbranch-cost=@var{n}
25104 @opindex mbranch-cost
25105 Set the cost of branches to roughly @var{n} instructions.
25107 @item -mplt
25108 @itemx -mno-plt
25109 @opindex plt
25110 When generating PIC code, do or don't allow the use of PLTs. Ignored for
25111 non-PIC.  The default is @option{-mplt}.
25113 @item -mabi=@var{ABI-string}
25114 @opindex mabi
25115 Specify integer and floating-point calling convention.  @var{ABI-string}
25116 contains two parts: the size of integer types and the registers used for
25117 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
25118 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
25119 32-bit), and that floating-point values up to 64 bits wide are passed in F
25120 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25121 allows the compiler to generate code that uses the F and D extensions but only
25122 allows floating-point values up to 32 bits long to be passed in registers; or
25123 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25124 passed in registers.
25126 The default for this argument is system dependent, users who want a specific
25127 calling convention should specify one explicitly.  The valid calling
25128 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25129 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
25130 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25131 invalid because the ABI requires 64-bit values be passed in F registers, but F
25132 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
25133 only be used with the @samp{rv32e} architecture.  This ABI is not well
25134 specified at present, and is subject to change.
25136 @item -mfdiv
25137 @itemx -mno-fdiv
25138 @opindex mfdiv
25139 Do or don't use hardware floating-point divide and square root instructions.
25140 This requires the F or D extensions for floating-point registers.  The default
25141 is to use them if the specified architecture has these instructions.
25143 @item -mdiv
25144 @itemx -mno-div
25145 @opindex mdiv
25146 Do or don't use hardware instructions for integer division.  This requires the
25147 M extension.  The default is to use them if the specified architecture has
25148 these instructions.
25150 @item -march=@var{ISA-string}
25151 @opindex march
25152 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
25153 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25154 @samp{rv32imaf}.
25156 @item -mtune=@var{processor-string}
25157 @opindex mtune
25158 Optimize the output for the given processor, specified by microarchitecture
25159 name.  Permissible values for this option are: @samp{rocket},
25160 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25161 and @samp{size}.
25163 When @option{-mtune=} is not specified, the default is @samp{rocket}.
25165 The @samp{size} choice is not intended for use by end-users.  This is used
25166 when @option{-Os} is specified.  It overrides the instruction cost info
25167 provided by @option{-mtune=}, but does not override the pipeline info.  This
25168 helps reduce code size while still giving good performance.
25170 @item -mpreferred-stack-boundary=@var{num}
25171 @opindex mpreferred-stack-boundary
25172 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25173 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
25174 the default is 4 (16 bytes or 128-bits).
25176 @strong{Warning:} If you use this switch, then you must build all modules with
25177 the same value, including any libraries.  This includes the system libraries
25178 and startup modules.
25180 @item -msmall-data-limit=@var{n}
25181 @opindex msmall-data-limit
25182 Put global and static data smaller than @var{n} bytes into a special section
25183 (on some targets).
25185 @item -msave-restore
25186 @itemx -mno-save-restore
25187 @opindex msave-restore
25188 Do or don't use smaller but slower prologue and epilogue code that uses
25189 library function calls.  The default is to use fast inline prologues and
25190 epilogues.
25192 @item -mstrict-align
25193 @itemx -mno-strict-align
25194 @opindex mstrict-align
25195 Do not or do generate unaligned memory accesses.  The default is set depending
25196 on whether the processor we are optimizing for supports fast unaligned access
25197 or not.
25199 @item -mcmodel=medlow
25200 @opindex mcmodel=medlow
25201 Generate code for the medium-low code model. The program and its statically
25202 defined symbols must lie within a single 2 GiB address range and must lie
25203 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25204 statically or dynamically linked. This is the default code model.
25206 @item -mcmodel=medany
25207 @opindex mcmodel=medany
25208 Generate code for the medium-any code model. The program and its statically
25209 defined symbols must be within any single 2 GiB address range. Programs can be
25210 statically or dynamically linked.
25212 @item -mexplicit-relocs
25213 @itemx -mno-exlicit-relocs
25214 Use or do not use assembler relocation operators when dealing with symbolic
25215 addresses.  The alternative is to use assembler macros instead, which may
25216 limit optimization.
25218 @item -mrelax
25219 @itemx -mno-relax
25220 Take advantage of linker relaxations to reduce the number of instructions
25221 required to materialize symbol addresses. The default is to take advantage of
25222 linker relaxations.
25224 @item -memit-attribute
25225 @itemx -mno-emit-attribute
25226 Emit (do not emit) RISC-V attribute to record extra information into ELF
25227 objects.  This feature requires at least binutils 2.32.
25229 @item -malign-data=@var{type}
25230 @opindex malign-data
25231 Control how GCC aligns variables and constants of array, structure, or union
25232 types.  Supported values for @var{type} are @samp{xlen} which uses x register
25233 width as the alignment value, and @samp{natural} which uses natural alignment.
25234 @samp{xlen} is the default.
25235 @end table
25237 @node RL78 Options
25238 @subsection RL78 Options
25239 @cindex RL78 Options
25241 @table @gcctabopt
25243 @item -msim
25244 @opindex msim
25245 Links in additional target libraries to support operation within a
25246 simulator.
25248 @item -mmul=none
25249 @itemx -mmul=g10
25250 @itemx -mmul=g13
25251 @itemx -mmul=g14
25252 @itemx -mmul=rl78
25253 @opindex mmul
25254 Specifies the type of hardware multiplication and division support to
25255 be used.  The simplest is @code{none}, which uses software for both
25256 multiplication and division.  This is the default.  The @code{g13}
25257 value is for the hardware multiply/divide peripheral found on the
25258 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
25259 the multiplication and division instructions supported by the RL78/G14
25260 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
25261 the value @code{mg10} is an alias for @code{none}.
25263 In addition a C preprocessor macro is defined, based upon the setting
25264 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
25265 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25267 @item -mcpu=g10
25268 @itemx -mcpu=g13
25269 @itemx -mcpu=g14
25270 @itemx -mcpu=rl78
25271 @opindex mcpu
25272 Specifies the RL78 core to target.  The default is the G14 core, also
25273 known as an S3 core or just RL78.  The G13 or S2 core does not have
25274 multiply or divide instructions, instead it uses a hardware peripheral
25275 for these operations.  The G10 or S1 core does not have register
25276 banks, so it uses a different calling convention.
25278 If this option is set it also selects the type of hardware multiply
25279 support to use, unless this is overridden by an explicit
25280 @option{-mmul=none} option on the command line.  Thus specifying
25281 @option{-mcpu=g13} enables the use of the G13 hardware multiply
25282 peripheral and specifying @option{-mcpu=g10} disables the use of
25283 hardware multiplications altogether.
25285 Note, although the RL78/G14 core is the default target, specifying
25286 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25287 change the behavior of the toolchain since it also enables G14
25288 hardware multiply support.  If these options are not specified on the
25289 command line then software multiplication routines will be used even
25290 though the code targets the RL78 core.  This is for backwards
25291 compatibility with older toolchains which did not have hardware
25292 multiply and divide support.
25294 In addition a C preprocessor macro is defined, based upon the setting
25295 of this option.  Possible values are: @code{__RL78_G10__},
25296 @code{__RL78_G13__} or @code{__RL78_G14__}.
25298 @item -mg10
25299 @itemx -mg13
25300 @itemx -mg14
25301 @itemx -mrl78
25302 @opindex mg10
25303 @opindex mg13
25304 @opindex mg14
25305 @opindex mrl78
25306 These are aliases for the corresponding @option{-mcpu=} option.  They
25307 are provided for backwards compatibility.
25309 @item -mallregs
25310 @opindex mallregs
25311 Allow the compiler to use all of the available registers.  By default
25312 registers @code{r24..r31} are reserved for use in interrupt handlers.
25313 With this option enabled these registers can be used in ordinary
25314 functions as well.
25316 @item -m64bit-doubles
25317 @itemx -m32bit-doubles
25318 @opindex m64bit-doubles
25319 @opindex m32bit-doubles
25320 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25321 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
25322 @option{-m32bit-doubles}.
25324 @item -msave-mduc-in-interrupts
25325 @itemx -mno-save-mduc-in-interrupts
25326 @opindex msave-mduc-in-interrupts
25327 @opindex mno-save-mduc-in-interrupts
25328 Specifies that interrupt handler functions should preserve the
25329 MDUC registers.  This is only necessary if normal code might use
25330 the MDUC registers, for example because it performs multiplication
25331 and division operations.  The default is to ignore the MDUC registers
25332 as this makes the interrupt handlers faster.  The target option -mg13
25333 needs to be passed for this to work as this feature is only available
25334 on the G13 target (S2 core).  The MDUC registers will only be saved
25335 if the interrupt handler performs a multiplication or division
25336 operation or it calls another function.
25338 @end table
25340 @node RS/6000 and PowerPC Options
25341 @subsection IBM RS/6000 and PowerPC Options
25342 @cindex RS/6000 and PowerPC Options
25343 @cindex IBM RS/6000 and PowerPC Options
25345 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25346 @table @gcctabopt
25347 @item -mpowerpc-gpopt
25348 @itemx -mno-powerpc-gpopt
25349 @itemx -mpowerpc-gfxopt
25350 @itemx -mno-powerpc-gfxopt
25351 @need 800
25352 @itemx -mpowerpc64
25353 @itemx -mno-powerpc64
25354 @itemx -mmfcrf
25355 @itemx -mno-mfcrf
25356 @itemx -mpopcntb
25357 @itemx -mno-popcntb
25358 @itemx -mpopcntd
25359 @itemx -mno-popcntd
25360 @itemx -mfprnd
25361 @itemx -mno-fprnd
25362 @need 800
25363 @itemx -mcmpb
25364 @itemx -mno-cmpb
25365 @itemx -mhard-dfp
25366 @itemx -mno-hard-dfp
25367 @opindex mpowerpc-gpopt
25368 @opindex mno-powerpc-gpopt
25369 @opindex mpowerpc-gfxopt
25370 @opindex mno-powerpc-gfxopt
25371 @opindex mpowerpc64
25372 @opindex mno-powerpc64
25373 @opindex mmfcrf
25374 @opindex mno-mfcrf
25375 @opindex mpopcntb
25376 @opindex mno-popcntb
25377 @opindex mpopcntd
25378 @opindex mno-popcntd
25379 @opindex mfprnd
25380 @opindex mno-fprnd
25381 @opindex mcmpb
25382 @opindex mno-cmpb
25383 @opindex mhard-dfp
25384 @opindex mno-hard-dfp
25385 You use these options to specify which instructions are available on the
25386 processor you are using.  The default value of these options is
25387 determined when configuring GCC@.  Specifying the
25388 @option{-mcpu=@var{cpu_type}} overrides the specification of these
25389 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
25390 rather than the options listed above.
25392 Specifying @option{-mpowerpc-gpopt} allows
25393 GCC to use the optional PowerPC architecture instructions in the
25394 General Purpose group, including floating-point square root.  Specifying
25395 @option{-mpowerpc-gfxopt} allows GCC to
25396 use the optional PowerPC architecture instructions in the Graphics
25397 group, including floating-point select.
25399 The @option{-mmfcrf} option allows GCC to generate the move from
25400 condition register field instruction implemented on the POWER4
25401 processor and other processors that support the PowerPC V2.01
25402 architecture.
25403 The @option{-mpopcntb} option allows GCC to generate the popcount and
25404 double-precision FP reciprocal estimate instruction implemented on the
25405 POWER5 processor and other processors that support the PowerPC V2.02
25406 architecture.
25407 The @option{-mpopcntd} option allows GCC to generate the popcount
25408 instruction implemented on the POWER7 processor and other processors
25409 that support the PowerPC V2.06 architecture.
25410 The @option{-mfprnd} option allows GCC to generate the FP round to
25411 integer instructions implemented on the POWER5+ processor and other
25412 processors that support the PowerPC V2.03 architecture.
25413 The @option{-mcmpb} option allows GCC to generate the compare bytes
25414 instruction implemented on the POWER6 processor and other processors
25415 that support the PowerPC V2.05 architecture.
25416 The @option{-mhard-dfp} option allows GCC to generate the decimal
25417 floating-point instructions implemented on some POWER processors.
25419 The @option{-mpowerpc64} option allows GCC to generate the additional
25420 64-bit instructions that are found in the full PowerPC64 architecture
25421 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
25422 @option{-mno-powerpc64}.
25424 @item -mcpu=@var{cpu_type}
25425 @opindex mcpu
25426 Set architecture type, register usage, and
25427 instruction scheduling parameters for machine type @var{cpu_type}.
25428 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25429 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25430 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25431 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25432 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25433 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25434 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25435 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25436 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25437 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25438 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
25439 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25441 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25442 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25443 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25444 architecture machine types, with an appropriate, generic processor
25445 model assumed for scheduling purposes.
25447 Specifying @samp{native} as cpu type detects and selects the
25448 architecture option that corresponds to the host processor of the
25449 system performing the compilation.
25450 @option{-mcpu=native} has no effect if GCC does not recognize the
25451 processor.
25453 The other options specify a specific processor.  Code generated under
25454 those options runs best on that processor, and may not run at all on
25455 others.
25457 The @option{-mcpu} options automatically enable or disable the
25458 following options:
25460 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
25461 -mpopcntb  -mpopcntd  -mpowerpc64 @gol
25462 -mpowerpc-gpopt  -mpowerpc-gfxopt @gol
25463 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
25464 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
25465 -mquad-memory  -mquad-memory-atomic  -mfloat128  -mfloat128-hardware}
25467 The particular options set for any particular CPU varies between
25468 compiler versions, depending on what setting seems to produce optimal
25469 code for that CPU; it doesn't necessarily reflect the actual hardware's
25470 capabilities.  If you wish to set an individual option to a particular
25471 value, you may specify it after the @option{-mcpu} option, like
25472 @option{-mcpu=970 -mno-altivec}.
25474 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25475 not enabled or disabled by the @option{-mcpu} option at present because
25476 AIX does not have full support for these options.  You may still
25477 enable or disable them individually if you're sure it'll work in your
25478 environment.
25480 @item -mtune=@var{cpu_type}
25481 @opindex mtune
25482 Set the instruction scheduling parameters for machine type
25483 @var{cpu_type}, but do not set the architecture type or register usage,
25484 as @option{-mcpu=@var{cpu_type}} does.  The same
25485 values for @var{cpu_type} are used for @option{-mtune} as for
25486 @option{-mcpu}.  If both are specified, the code generated uses the
25487 architecture and registers set by @option{-mcpu}, but the
25488 scheduling parameters set by @option{-mtune}.
25490 @item -mcmodel=small
25491 @opindex mcmodel=small
25492 Generate PowerPC64 code for the small model: The TOC is limited to
25493 64k.
25495 @item -mcmodel=medium
25496 @opindex mcmodel=medium
25497 Generate PowerPC64 code for the medium model: The TOC and other static
25498 data may be up to a total of 4G in size.  This is the default for 64-bit
25499 Linux.
25501 @item -mcmodel=large
25502 @opindex mcmodel=large
25503 Generate PowerPC64 code for the large model: The TOC may be up to 4G
25504 in size.  Other data and code is only limited by the 64-bit address
25505 space.
25507 @item -maltivec
25508 @itemx -mno-altivec
25509 @opindex maltivec
25510 @opindex mno-altivec
25511 Generate code that uses (does not use) AltiVec instructions, and also
25512 enable the use of built-in functions that allow more direct access to
25513 the AltiVec instruction set.  You may also need to set
25514 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25515 enhancements.
25517 When @option{-maltivec} is used, the element order for AltiVec intrinsics
25518 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
25519 match array element order corresponding to the endianness of the
25520 target.  That is, element zero identifies the leftmost element in a
25521 vector register when targeting a big-endian platform, and identifies
25522 the rightmost element in a vector register when targeting a
25523 little-endian platform.
25525 @item -mvrsave
25526 @itemx -mno-vrsave
25527 @opindex mvrsave
25528 @opindex mno-vrsave
25529 Generate VRSAVE instructions when generating AltiVec code.
25531 @item -msecure-plt
25532 @opindex msecure-plt
25533 Generate code that allows @command{ld} and @command{ld.so}
25534 to build executables and shared
25535 libraries with non-executable @code{.plt} and @code{.got} sections.
25536 This is a PowerPC
25537 32-bit SYSV ABI option.
25539 @item -mbss-plt
25540 @opindex mbss-plt
25541 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
25542 fills in, and
25543 requires @code{.plt} and @code{.got}
25544 sections that are both writable and executable.
25545 This is a PowerPC 32-bit SYSV ABI option.
25547 @item -misel
25548 @itemx -mno-isel
25549 @opindex misel
25550 @opindex mno-isel
25551 This switch enables or disables the generation of ISEL instructions.
25553 @item -mvsx
25554 @itemx -mno-vsx
25555 @opindex mvsx
25556 @opindex mno-vsx
25557 Generate code that uses (does not use) vector/scalar (VSX)
25558 instructions, and also enable the use of built-in functions that allow
25559 more direct access to the VSX instruction set.
25561 @item -mcrypto
25562 @itemx -mno-crypto
25563 @opindex mcrypto
25564 @opindex mno-crypto
25565 Enable the use (disable) of the built-in functions that allow direct
25566 access to the cryptographic instructions that were added in version
25567 2.07 of the PowerPC ISA.
25569 @item -mhtm
25570 @itemx -mno-htm
25571 @opindex mhtm
25572 @opindex mno-htm
25573 Enable (disable) the use of the built-in functions that allow direct
25574 access to the Hardware Transactional Memory (HTM) instructions that
25575 were added in version 2.07 of the PowerPC ISA.
25577 @item -mpower8-fusion
25578 @itemx -mno-power8-fusion
25579 @opindex mpower8-fusion
25580 @opindex mno-power8-fusion
25581 Generate code that keeps (does not keeps) some integer operations
25582 adjacent so that the instructions can be fused together on power8 and
25583 later processors.
25585 @item -mpower8-vector
25586 @itemx -mno-power8-vector
25587 @opindex mpower8-vector
25588 @opindex mno-power8-vector
25589 Generate code that uses (does not use) the vector and scalar
25590 instructions that were added in version 2.07 of the PowerPC ISA.  Also
25591 enable the use of built-in functions that allow more direct access to
25592 the vector instructions.
25594 @item -mquad-memory
25595 @itemx -mno-quad-memory
25596 @opindex mquad-memory
25597 @opindex mno-quad-memory
25598 Generate code that uses (does not use) the non-atomic quad word memory
25599 instructions.  The @option{-mquad-memory} option requires use of
25600 64-bit mode.
25602 @item -mquad-memory-atomic
25603 @itemx -mno-quad-memory-atomic
25604 @opindex mquad-memory-atomic
25605 @opindex mno-quad-memory-atomic
25606 Generate code that uses (does not use) the atomic quad word memory
25607 instructions.  The @option{-mquad-memory-atomic} option requires use of
25608 64-bit mode.
25610 @item -mfloat128
25611 @itemx -mno-float128
25612 @opindex mfloat128
25613 @opindex mno-float128
25614 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
25615 and use either software emulation for IEEE 128-bit floating point or
25616 hardware instructions.
25618 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
25619 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
25620 use the IEEE 128-bit floating point support.  The IEEE 128-bit
25621 floating point support only works on PowerPC Linux systems.
25623 The default for @option{-mfloat128} is enabled on PowerPC Linux
25624 systems using the VSX instruction set, and disabled on other systems.
25626 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
25627 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
25628 point support will also enable the generation of ISA 3.0 IEEE 128-bit
25629 floating point instructions.  Otherwise, if you do not specify to
25630 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
25631 system, IEEE 128-bit floating point will be done with software
25632 emulation.
25634 @item -mfloat128-hardware
25635 @itemx -mno-float128-hardware
25636 @opindex mfloat128-hardware
25637 @opindex mno-float128-hardware
25638 Enable/disable using ISA 3.0 hardware instructions to support the
25639 @var{__float128} data type.
25641 The default for @option{-mfloat128-hardware} is enabled on PowerPC
25642 Linux systems using the ISA 3.0 instruction set, and disabled on other
25643 systems.
25645 @item -m32
25646 @itemx -m64
25647 @opindex m32
25648 @opindex m64
25649 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25650 targets (including GNU/Linux).  The 32-bit environment sets int, long
25651 and pointer to 32 bits and generates code that runs on any PowerPC
25652 variant.  The 64-bit environment sets int to 32 bits and long and
25653 pointer to 64 bits, and generates code for PowerPC64, as for
25654 @option{-mpowerpc64}.
25656 @item -mfull-toc
25657 @itemx -mno-fp-in-toc
25658 @itemx -mno-sum-in-toc
25659 @itemx -mminimal-toc
25660 @opindex mfull-toc
25661 @opindex mno-fp-in-toc
25662 @opindex mno-sum-in-toc
25663 @opindex mminimal-toc
25664 Modify generation of the TOC (Table Of Contents), which is created for
25665 every executable file.  The @option{-mfull-toc} option is selected by
25666 default.  In that case, GCC allocates at least one TOC entry for
25667 each unique non-automatic variable reference in your program.  GCC
25668 also places floating-point constants in the TOC@.  However, only
25669 16,384 entries are available in the TOC@.
25671 If you receive a linker error message that saying you have overflowed
25672 the available TOC space, you can reduce the amount of TOC space used
25673 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
25674 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
25675 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
25676 generate code to calculate the sum of an address and a constant at
25677 run time instead of putting that sum into the TOC@.  You may specify one
25678 or both of these options.  Each causes GCC to produce very slightly
25679 slower and larger code at the expense of conserving TOC space.
25681 If you still run out of space in the TOC even when you specify both of
25682 these options, specify @option{-mminimal-toc} instead.  This option causes
25683 GCC to make only one TOC entry for every file.  When you specify this
25684 option, GCC produces code that is slower and larger but which
25685 uses extremely little TOC space.  You may wish to use this option
25686 only on files that contain less frequently-executed code.
25688 @item -maix64
25689 @itemx -maix32
25690 @opindex maix64
25691 @opindex maix32
25692 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
25693 @code{long} type, and the infrastructure needed to support them.
25694 Specifying @option{-maix64} implies @option{-mpowerpc64},
25695 while @option{-maix32} disables the 64-bit ABI and
25696 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
25698 @item -mxl-compat
25699 @itemx -mno-xl-compat
25700 @opindex mxl-compat
25701 @opindex mno-xl-compat
25702 Produce code that conforms more closely to IBM XL compiler semantics
25703 when using AIX-compatible ABI@.  Pass floating-point arguments to
25704 prototyped functions beyond the register save area (RSA) on the stack
25705 in addition to argument FPRs.  Do not assume that most significant
25706 double in 128-bit long double value is properly rounded when comparing
25707 values and converting to double.  Use XL symbol names for long double
25708 support routines.
25710 The AIX calling convention was extended but not initially documented to
25711 handle an obscure K&R C case of calling a function that takes the
25712 address of its arguments with fewer arguments than declared.  IBM XL
25713 compilers access floating-point arguments that do not fit in the
25714 RSA from the stack when a subroutine is compiled without
25715 optimization.  Because always storing floating-point arguments on the
25716 stack is inefficient and rarely needed, this option is not enabled by
25717 default and only is necessary when calling subroutines compiled by IBM
25718 XL compilers without optimization.
25720 @item -mpe
25721 @opindex mpe
25722 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
25723 application written to use message passing with special startup code to
25724 enable the application to run.  The system must have PE installed in the
25725 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
25726 must be overridden with the @option{-specs=} option to specify the
25727 appropriate directory location.  The Parallel Environment does not
25728 support threads, so the @option{-mpe} option and the @option{-pthread}
25729 option are incompatible.
25731 @item -malign-natural
25732 @itemx -malign-power
25733 @opindex malign-natural
25734 @opindex malign-power
25735 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25736 @option{-malign-natural} overrides the ABI-defined alignment of larger
25737 types, such as floating-point doubles, on their natural size-based boundary.
25738 The option @option{-malign-power} instructs GCC to follow the ABI-specified
25739 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
25741 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
25742 is not supported.
25744 @item -msoft-float
25745 @itemx -mhard-float
25746 @opindex msoft-float
25747 @opindex mhard-float
25748 Generate code that does not use (uses) the floating-point register set.
25749 Software floating-point emulation is provided if you use the
25750 @option{-msoft-float} option, and pass the option to GCC when linking.
25752 @item -mmultiple
25753 @itemx -mno-multiple
25754 @opindex mmultiple
25755 @opindex mno-multiple
25756 Generate code that uses (does not use) the load multiple word
25757 instructions and the store multiple word instructions.  These
25758 instructions are generated by default on POWER systems, and not
25759 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
25760 PowerPC systems, since those instructions do not work when the
25761 processor is in little-endian mode.  The exceptions are PPC740 and
25762 PPC750 which permit these instructions in little-endian mode.
25764 @item -mupdate
25765 @itemx -mno-update
25766 @opindex mupdate
25767 @opindex mno-update
25768 Generate code that uses (does not use) the load or store instructions
25769 that update the base register to the address of the calculated memory
25770 location.  These instructions are generated by default.  If you use
25771 @option{-mno-update}, there is a small window between the time that the
25772 stack pointer is updated and the address of the previous frame is
25773 stored, which means code that walks the stack frame across interrupts or
25774 signals may get corrupted data.
25776 @item -mavoid-indexed-addresses
25777 @itemx -mno-avoid-indexed-addresses
25778 @opindex mavoid-indexed-addresses
25779 @opindex mno-avoid-indexed-addresses
25780 Generate code that tries to avoid (not avoid) the use of indexed load
25781 or store instructions. These instructions can incur a performance
25782 penalty on Power6 processors in certain situations, such as when
25783 stepping through large arrays that cross a 16M boundary.  This option
25784 is enabled by default when targeting Power6 and disabled otherwise.
25786 @item -mfused-madd
25787 @itemx -mno-fused-madd
25788 @opindex mfused-madd
25789 @opindex mno-fused-madd
25790 Generate code that uses (does not use) the floating-point multiply and
25791 accumulate instructions.  These instructions are generated by default
25792 if hardware floating point is used.  The machine-dependent
25793 @option{-mfused-madd} option is now mapped to the machine-independent
25794 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25795 mapped to @option{-ffp-contract=off}.
25797 @item -mmulhw
25798 @itemx -mno-mulhw
25799 @opindex mmulhw
25800 @opindex mno-mulhw
25801 Generate code that uses (does not use) the half-word multiply and
25802 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
25803 These instructions are generated by default when targeting those
25804 processors.
25806 @item -mdlmzb
25807 @itemx -mno-dlmzb
25808 @opindex mdlmzb
25809 @opindex mno-dlmzb
25810 Generate code that uses (does not use) the string-search @samp{dlmzb}
25811 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
25812 generated by default when targeting those processors.
25814 @item -mno-bit-align
25815 @itemx -mbit-align
25816 @opindex mno-bit-align
25817 @opindex mbit-align
25818 On System V.4 and embedded PowerPC systems do not (do) force structures
25819 and unions that contain bit-fields to be aligned to the base type of the
25820 bit-field.
25822 For example, by default a structure containing nothing but 8
25823 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
25824 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
25825 the structure is aligned to a 1-byte boundary and is 1 byte in
25826 size.
25828 @item -mno-strict-align
25829 @itemx -mstrict-align
25830 @opindex mno-strict-align
25831 @opindex mstrict-align
25832 On System V.4 and embedded PowerPC systems do not (do) assume that
25833 unaligned memory references are handled by the system.
25835 @item -mrelocatable
25836 @itemx -mno-relocatable
25837 @opindex mrelocatable
25838 @opindex mno-relocatable
25839 Generate code that allows (does not allow) a static executable to be
25840 relocated to a different address at run time.  A simple embedded
25841 PowerPC system loader should relocate the entire contents of
25842 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
25843 a table of 32-bit addresses generated by this option.  For this to
25844 work, all objects linked together must be compiled with
25845 @option{-mrelocatable} or @option{-mrelocatable-lib}.
25846 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
25848 @item -mrelocatable-lib
25849 @itemx -mno-relocatable-lib
25850 @opindex mrelocatable-lib
25851 @opindex mno-relocatable-lib
25852 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
25853 @code{.fixup} section to allow static executables to be relocated at
25854 run time, but @option{-mrelocatable-lib} does not use the smaller stack
25855 alignment of @option{-mrelocatable}.  Objects compiled with
25856 @option{-mrelocatable-lib} may be linked with objects compiled with
25857 any combination of the @option{-mrelocatable} options.
25859 @item -mno-toc
25860 @itemx -mtoc
25861 @opindex mno-toc
25862 @opindex mtoc
25863 On System V.4 and embedded PowerPC systems do not (do) assume that
25864 register 2 contains a pointer to a global area pointing to the addresses
25865 used in the program.
25867 @item -mlittle
25868 @itemx -mlittle-endian
25869 @opindex mlittle
25870 @opindex mlittle-endian
25871 On System V.4 and embedded PowerPC systems compile code for the
25872 processor in little-endian mode.  The @option{-mlittle-endian} option is
25873 the same as @option{-mlittle}.
25875 @item -mbig
25876 @itemx -mbig-endian
25877 @opindex mbig
25878 @opindex mbig-endian
25879 On System V.4 and embedded PowerPC systems compile code for the
25880 processor in big-endian mode.  The @option{-mbig-endian} option is
25881 the same as @option{-mbig}.
25883 @item -mdynamic-no-pic
25884 @opindex mdynamic-no-pic
25885 On Darwin and Mac OS X systems, compile code so that it is not
25886 relocatable, but that its external references are relocatable.  The
25887 resulting code is suitable for applications, but not shared
25888 libraries.
25890 @item -msingle-pic-base
25891 @opindex msingle-pic-base
25892 Treat the register used for PIC addressing as read-only, rather than
25893 loading it in the prologue for each function.  The runtime system is
25894 responsible for initializing this register with an appropriate value
25895 before execution begins.
25897 @item -mprioritize-restricted-insns=@var{priority}
25898 @opindex mprioritize-restricted-insns
25899 This option controls the priority that is assigned to
25900 dispatch-slot restricted instructions during the second scheduling
25901 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
25902 or @samp{2} to assign no, highest, or second-highest (respectively) 
25903 priority to dispatch-slot restricted
25904 instructions.
25906 @item -msched-costly-dep=@var{dependence_type}
25907 @opindex msched-costly-dep
25908 This option controls which dependences are considered costly
25909 by the target during instruction scheduling.  The argument
25910 @var{dependence_type} takes one of the following values:
25912 @table @asis
25913 @item @samp{no}
25914 No dependence is costly.
25916 @item @samp{all}
25917 All dependences are costly.
25919 @item @samp{true_store_to_load}
25920 A true dependence from store to load is costly.
25922 @item @samp{store_to_load}
25923 Any dependence from store to load is costly.
25925 @item @var{number}
25926 Any dependence for which the latency is greater than or equal to 
25927 @var{number} is costly.
25928 @end table
25930 @item -minsert-sched-nops=@var{scheme}
25931 @opindex minsert-sched-nops
25932 This option controls which NOP insertion scheme is used during
25933 the second scheduling pass.  The argument @var{scheme} takes one of the
25934 following values:
25936 @table @asis
25937 @item @samp{no}
25938 Don't insert NOPs.
25940 @item @samp{pad}
25941 Pad with NOPs any dispatch group that has vacant issue slots,
25942 according to the scheduler's grouping.
25944 @item @samp{regroup_exact}
25945 Insert NOPs to force costly dependent insns into
25946 separate groups.  Insert exactly as many NOPs as needed to force an insn
25947 to a new group, according to the estimated processor grouping.
25949 @item @var{number}
25950 Insert NOPs to force costly dependent insns into
25951 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
25952 @end table
25954 @item -mcall-sysv
25955 @opindex mcall-sysv
25956 On System V.4 and embedded PowerPC systems compile code using calling
25957 conventions that adhere to the March 1995 draft of the System V
25958 Application Binary Interface, PowerPC processor supplement.  This is the
25959 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25961 @item -mcall-sysv-eabi
25962 @itemx -mcall-eabi
25963 @opindex mcall-sysv-eabi
25964 @opindex mcall-eabi
25965 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25967 @item -mcall-sysv-noeabi
25968 @opindex mcall-sysv-noeabi
25969 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25971 @item -mcall-aixdesc
25972 @opindex m
25973 On System V.4 and embedded PowerPC systems compile code for the AIX
25974 operating system.
25976 @item -mcall-linux
25977 @opindex mcall-linux
25978 On System V.4 and embedded PowerPC systems compile code for the
25979 Linux-based GNU system.
25981 @item -mcall-freebsd
25982 @opindex mcall-freebsd
25983 On System V.4 and embedded PowerPC systems compile code for the
25984 FreeBSD operating system.
25986 @item -mcall-netbsd
25987 @opindex mcall-netbsd
25988 On System V.4 and embedded PowerPC systems compile code for the
25989 NetBSD operating system.
25991 @item -mcall-openbsd
25992 @opindex mcall-netbsd
25993 On System V.4 and embedded PowerPC systems compile code for the
25994 OpenBSD operating system.
25996 @item -mtraceback=@var{traceback_type}
25997 @opindex mtraceback
25998 Select the type of traceback table. Valid values for @var{traceback_type}
25999 are @samp{full}, @samp{part}, and @samp{no}.
26001 @item -maix-struct-return
26002 @opindex maix-struct-return
26003 Return all structures in memory (as specified by the AIX ABI)@.
26005 @item -msvr4-struct-return
26006 @opindex msvr4-struct-return
26007 Return structures smaller than 8 bytes in registers (as specified by the
26008 SVR4 ABI)@.
26010 @item -mabi=@var{abi-type}
26011 @opindex mabi
26012 Extend the current ABI with a particular extension, or remove such extension.
26013 Valid values are @samp{altivec}, @samp{no-altivec},
26014 @samp{ibmlongdouble}, @samp{ieeelongdouble},
26015 @samp{elfv1}, @samp{elfv2}@.
26017 @item -mabi=ibmlongdouble
26018 @opindex mabi=ibmlongdouble
26019 Change the current ABI to use IBM extended-precision long double.
26020 This is not likely to work if your system defaults to using IEEE
26021 extended-precision long double.  If you change the long double type
26022 from IEEE extended-precision, the compiler will issue a warning unless
26023 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26024 to be enabled.
26026 @item -mabi=ieeelongdouble
26027 @opindex mabi=ieeelongdouble
26028 Change the current ABI to use IEEE extended-precision long double.
26029 This is not likely to work if your system defaults to using IBM
26030 extended-precision long double.  If you change the long double type
26031 from IBM extended-precision, the compiler will issue a warning unless
26032 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26033 to be enabled.
26035 @item -mabi=elfv1
26036 @opindex mabi=elfv1
26037 Change the current ABI to use the ELFv1 ABI.
26038 This is the default ABI for big-endian PowerPC 64-bit Linux.
26039 Overriding the default ABI requires special system support and is
26040 likely to fail in spectacular ways.
26042 @item -mabi=elfv2
26043 @opindex mabi=elfv2
26044 Change the current ABI to use the ELFv2 ABI.
26045 This is the default ABI for little-endian PowerPC 64-bit Linux.
26046 Overriding the default ABI requires special system support and is
26047 likely to fail in spectacular ways.
26049 @item -mgnu-attribute
26050 @itemx -mno-gnu-attribute
26051 @opindex mgnu-attribute
26052 @opindex mno-gnu-attribute
26053 Emit .gnu_attribute assembly directives to set tag/value pairs in a
26054 .gnu.attributes section that specify ABI variations in function
26055 parameters or return values.
26057 @item -mprototype
26058 @itemx -mno-prototype
26059 @opindex mprototype
26060 @opindex mno-prototype
26061 On System V.4 and embedded PowerPC systems assume that all calls to
26062 variable argument functions are properly prototyped.  Otherwise, the
26063 compiler must insert an instruction before every non-prototyped call to
26064 set or clear bit 6 of the condition code register (@code{CR}) to
26065 indicate whether floating-point values are passed in the floating-point
26066 registers in case the function takes variable arguments.  With
26067 @option{-mprototype}, only calls to prototyped variable argument functions
26068 set or clear the bit.
26070 @item -msim
26071 @opindex msim
26072 On embedded PowerPC systems, assume that the startup module is called
26073 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26074 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
26075 configurations.
26077 @item -mmvme
26078 @opindex mmvme
26079 On embedded PowerPC systems, assume that the startup module is called
26080 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26081 @file{libc.a}.
26083 @item -mads
26084 @opindex mads
26085 On embedded PowerPC systems, assume that the startup module is called
26086 @file{crt0.o} and the standard C libraries are @file{libads.a} and
26087 @file{libc.a}.
26089 @item -myellowknife
26090 @opindex myellowknife
26091 On embedded PowerPC systems, assume that the startup module is called
26092 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
26093 @file{libc.a}.
26095 @item -mvxworks
26096 @opindex mvxworks
26097 On System V.4 and embedded PowerPC systems, specify that you are
26098 compiling for a VxWorks system.
26100 @item -memb
26101 @opindex memb
26102 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26103 header to indicate that @samp{eabi} extended relocations are used.
26105 @item -meabi
26106 @itemx -mno-eabi
26107 @opindex meabi
26108 @opindex mno-eabi
26109 On System V.4 and embedded PowerPC systems do (do not) adhere to the
26110 Embedded Applications Binary Interface (EABI), which is a set of
26111 modifications to the System V.4 specifications.  Selecting @option{-meabi}
26112 means that the stack is aligned to an 8-byte boundary, a function
26113 @code{__eabi} is called from @code{main} to set up the EABI
26114 environment, and the @option{-msdata} option can use both @code{r2} and
26115 @code{r13} to point to two separate small data areas.  Selecting
26116 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26117 no EABI initialization function is called from @code{main}, and the
26118 @option{-msdata} option only uses @code{r13} to point to a single
26119 small data area.  The @option{-meabi} option is on by default if you
26120 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26122 @item -msdata=eabi
26123 @opindex msdata=eabi
26124 On System V.4 and embedded PowerPC systems, put small initialized
26125 @code{const} global and static data in the @code{.sdata2} section, which
26126 is pointed to by register @code{r2}.  Put small initialized
26127 non-@code{const} global and static data in the @code{.sdata} section,
26128 which is pointed to by register @code{r13}.  Put small uninitialized
26129 global and static data in the @code{.sbss} section, which is adjacent to
26130 the @code{.sdata} section.  The @option{-msdata=eabi} option is
26131 incompatible with the @option{-mrelocatable} option.  The
26132 @option{-msdata=eabi} option also sets the @option{-memb} option.
26134 @item -msdata=sysv
26135 @opindex msdata=sysv
26136 On System V.4 and embedded PowerPC systems, put small global and static
26137 data in the @code{.sdata} section, which is pointed to by register
26138 @code{r13}.  Put small uninitialized global and static data in the
26139 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
26140 The @option{-msdata=sysv} option is incompatible with the
26141 @option{-mrelocatable} option.
26143 @item -msdata=default
26144 @itemx -msdata
26145 @opindex msdata=default
26146 @opindex msdata
26147 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26148 compile code the same as @option{-msdata=eabi}, otherwise compile code the
26149 same as @option{-msdata=sysv}.
26151 @item -msdata=data
26152 @opindex msdata=data
26153 On System V.4 and embedded PowerPC systems, put small global
26154 data in the @code{.sdata} section.  Put small uninitialized global
26155 data in the @code{.sbss} section.  Do not use register @code{r13}
26156 to address small data however.  This is the default behavior unless
26157 other @option{-msdata} options are used.
26159 @item -msdata=none
26160 @itemx -mno-sdata
26161 @opindex msdata=none
26162 @opindex mno-sdata
26163 On embedded PowerPC systems, put all initialized global and static data
26164 in the @code{.data} section, and all uninitialized data in the
26165 @code{.bss} section.
26167 @item -mreadonly-in-sdata
26168 @opindex mreadonly-in-sdata
26169 @opindex mno-readonly-in-sdata
26170 Put read-only objects in the @code{.sdata} section as well.  This is the
26171 default.
26173 @item -mblock-move-inline-limit=@var{num}
26174 @opindex mblock-move-inline-limit
26175 Inline all block moves (such as calls to @code{memcpy} or structure
26176 copies) less than or equal to @var{num} bytes.  The minimum value for
26177 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26178 targets.  The default value is target-specific.
26180 @item -mblock-compare-inline-limit=@var{num}
26181 @opindex mblock-compare-inline-limit
26182 Generate non-looping inline code for all block compares (such as calls
26183 to @code{memcmp} or structure compares) less than or equal to @var{num}
26184 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26185 block compare is disabled. The default value is target-specific.
26187 @item -mblock-compare-inline-loop-limit=@var{num}
26188 @opindex mblock-compare-inline-loop-limit
26189 Generate an inline expansion using loop code for all block compares that
26190 are less than or equal to @var{num} bytes, but greater than the limit
26191 for non-loop inline block compare expansion. If the block length is not
26192 constant, at most @var{num} bytes will be compared before @code{memcmp}
26193 is called to compare the remainder of the block. The default value is
26194 target-specific.
26196 @item -mstring-compare-inline-limit=@var{num}
26197 @opindex mstring-compare-inline-limit
26198 Compare at most @var{num} string bytes with inline code.
26199 If the difference or end of string is not found at the
26200 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26201 take care of the rest of the comparison. The default is 64 bytes.
26203 @item -G @var{num}
26204 @opindex G
26205 @cindex smaller data references (PowerPC)
26206 @cindex .sdata/.sdata2 references (PowerPC)
26207 On embedded PowerPC systems, put global and static items less than or
26208 equal to @var{num} bytes into the small data or BSS sections instead of
26209 the normal data or BSS section.  By default, @var{num} is 8.  The
26210 @option{-G @var{num}} switch is also passed to the linker.
26211 All modules should be compiled with the same @option{-G @var{num}} value.
26213 @item -mregnames
26214 @itemx -mno-regnames
26215 @opindex mregnames
26216 @opindex mno-regnames
26217 On System V.4 and embedded PowerPC systems do (do not) emit register
26218 names in the assembly language output using symbolic forms.
26220 @item -mlongcall
26221 @itemx -mno-longcall
26222 @opindex mlongcall
26223 @opindex mno-longcall
26224 By default assume that all calls are far away so that a longer and more
26225 expensive calling sequence is required.  This is required for calls
26226 farther than 32 megabytes (33,554,432 bytes) from the current location.
26227 A short call is generated if the compiler knows
26228 the call cannot be that far away.  This setting can be overridden by
26229 the @code{shortcall} function attribute, or by @code{#pragma
26230 longcall(0)}.
26232 Some linkers are capable of detecting out-of-range calls and generating
26233 glue code on the fly.  On these systems, long calls are unnecessary and
26234 generate slower code.  As of this writing, the AIX linker can do this,
26235 as can the GNU linker for PowerPC/64.  It is planned to add this feature
26236 to the GNU linker for 32-bit PowerPC systems as well.
26238 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26239 GCC can generate long calls using an inline PLT call sequence (see
26240 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
26241 ELFv1 (big-endian) do not support inline PLT calls.
26243 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26244 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
26245 addresses represent the callee and the branch island.  The
26246 Darwin/PPC linker prefers the first address and generates a @code{bl
26247 callee} if the PPC @code{bl} instruction reaches the callee directly;
26248 otherwise, the linker generates @code{bl L42} to call the branch
26249 island.  The branch island is appended to the body of the
26250 calling function; it computes the full 32-bit address of the callee
26251 and jumps to it.
26253 On Mach-O (Darwin) systems, this option directs the compiler emit to
26254 the glue for every direct call, and the Darwin linker decides whether
26255 to use or discard it.
26257 In the future, GCC may ignore all longcall specifications
26258 when the linker is known to generate glue.
26260 @item -mpltseq
26261 @itemx -mno-pltseq
26262 @opindex mpltseq
26263 @opindex mno-pltseq
26264 Implement (do not implement) -fno-plt and long calls using an inline
26265 PLT call sequence that supports lazy linking and long calls to
26266 functions in dlopen'd shared libraries.  Inline PLT calls are only
26267 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26268 linkers, and are enabled by default if the support is detected when
26269 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26270 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
26271 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26272 linked together.
26274 @item -mtls-markers
26275 @itemx -mno-tls-markers
26276 @opindex mtls-markers
26277 @opindex mno-tls-markers
26278 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26279 specifying the function argument.  The relocation allows the linker to
26280 reliably associate function call with argument setup instructions for
26281 TLS optimization, which in turn allows GCC to better schedule the
26282 sequence.
26284 @item -mrecip
26285 @itemx -mno-recip
26286 @opindex mrecip
26287 This option enables use of the reciprocal estimate and
26288 reciprocal square root estimate instructions with additional
26289 Newton-Raphson steps to increase precision instead of doing a divide or
26290 square root and divide for floating-point arguments.  You should use
26291 the @option{-ffast-math} option when using @option{-mrecip} (or at
26292 least @option{-funsafe-math-optimizations},
26293 @option{-ffinite-math-only}, @option{-freciprocal-math} and
26294 @option{-fno-trapping-math}).  Note that while the throughput of the
26295 sequence is generally higher than the throughput of the non-reciprocal
26296 instruction, the precision of the sequence can be decreased by up to 2
26297 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26298 roots.
26300 @item -mrecip=@var{opt}
26301 @opindex mrecip=opt
26302 This option controls which reciprocal estimate instructions
26303 may be used.  @var{opt} is a comma-separated list of options, which may
26304 be preceded by a @code{!} to invert the option:
26306 @table @samp
26308 @item all
26309 Enable all estimate instructions.
26311 @item default 
26312 Enable the default instructions, equivalent to @option{-mrecip}.
26314 @item none 
26315 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26317 @item div 
26318 Enable the reciprocal approximation instructions for both 
26319 single and double precision.
26321 @item divf 
26322 Enable the single-precision reciprocal approximation instructions.
26324 @item divd 
26325 Enable the double-precision reciprocal approximation instructions.
26327 @item rsqrt 
26328 Enable the reciprocal square root approximation instructions for both
26329 single and double precision.
26331 @item rsqrtf 
26332 Enable the single-precision reciprocal square root approximation instructions.
26334 @item rsqrtd 
26335 Enable the double-precision reciprocal square root approximation instructions.
26337 @end table
26339 So, for example, @option{-mrecip=all,!rsqrtd} enables
26340 all of the reciprocal estimate instructions, except for the
26341 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26342 which handle the double-precision reciprocal square root calculations.
26344 @item -mrecip-precision
26345 @itemx -mno-recip-precision
26346 @opindex mrecip-precision
26347 Assume (do not assume) that the reciprocal estimate instructions
26348 provide higher-precision estimates than is mandated by the PowerPC
26349 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26350 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26351 The double-precision square root estimate instructions are not generated by
26352 default on low-precision machines, since they do not provide an
26353 estimate that converges after three steps.
26355 @item -mveclibabi=@var{type}
26356 @opindex mveclibabi
26357 Specifies the ABI type to use for vectorizing intrinsics using an
26358 external library.  The only type supported at present is @samp{mass},
26359 which specifies to use IBM's Mathematical Acceleration Subsystem
26360 (MASS) libraries for vectorizing intrinsics using external libraries.
26361 GCC currently emits calls to @code{acosd2}, @code{acosf4},
26362 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26363 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26364 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26365 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26366 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26367 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26368 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26369 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26370 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26371 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26372 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26373 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26374 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26375 for power7.  Both @option{-ftree-vectorize} and
26376 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
26377 libraries must be specified at link time.
26379 @item -mfriz
26380 @itemx -mno-friz
26381 @opindex mfriz
26382 Generate (do not generate) the @code{friz} instruction when the
26383 @option{-funsafe-math-optimizations} option is used to optimize
26384 rounding of floating-point values to 64-bit integer and back to floating
26385 point.  The @code{friz} instruction does not return the same value if
26386 the floating-point number is too large to fit in an integer.
26388 @item -mpointers-to-nested-functions
26389 @itemx -mno-pointers-to-nested-functions
26390 @opindex mpointers-to-nested-functions
26391 Generate (do not generate) code to load up the static chain register
26392 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26393 systems where a function pointer points to a 3-word descriptor giving
26394 the function address, TOC value to be loaded in register @code{r2}, and
26395 static chain value to be loaded in register @code{r11}.  The
26396 @option{-mpointers-to-nested-functions} is on by default.  You cannot
26397 call through pointers to nested functions or pointers
26398 to functions compiled in other languages that use the static chain if
26399 you use @option{-mno-pointers-to-nested-functions}.
26401 @item -msave-toc-indirect
26402 @itemx -mno-save-toc-indirect
26403 @opindex msave-toc-indirect
26404 Generate (do not generate) code to save the TOC value in the reserved
26405 stack location in the function prologue if the function calls through
26406 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
26407 saved in the prologue, it is saved just before the call through the
26408 pointer.  The @option{-mno-save-toc-indirect} option is the default.
26410 @item -mcompat-align-parm
26411 @itemx -mno-compat-align-parm
26412 @opindex mcompat-align-parm
26413 Generate (do not generate) code to pass structure parameters with a
26414 maximum alignment of 64 bits, for compatibility with older versions
26415 of GCC.
26417 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26418 structure parameter on a 128-bit boundary when that structure contained
26419 a member requiring 128-bit alignment.  This is corrected in more
26420 recent versions of GCC.  This option may be used to generate code
26421 that is compatible with functions compiled with older versions of
26422 GCC.
26424 The @option{-mno-compat-align-parm} option is the default.
26426 @item -mstack-protector-guard=@var{guard}
26427 @itemx -mstack-protector-guard-reg=@var{reg}
26428 @itemx -mstack-protector-guard-offset=@var{offset}
26429 @itemx -mstack-protector-guard-symbol=@var{symbol}
26430 @opindex mstack-protector-guard
26431 @opindex mstack-protector-guard-reg
26432 @opindex mstack-protector-guard-offset
26433 @opindex mstack-protector-guard-symbol
26434 Generate stack protection code using canary at @var{guard}.  Supported
26435 locations are @samp{global} for global canary or @samp{tls} for per-thread
26436 canary in the TLS block (the default with GNU libc version 2.4 or later).
26438 With the latter choice the options
26439 @option{-mstack-protector-guard-reg=@var{reg}} and
26440 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26441 which register to use as base register for reading the canary, and from what
26442 offset from that base register. The default for those is as specified in the
26443 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26444 the offset with a symbol reference to a canary in the TLS block.
26446 @item -mpcrel
26447 @itemx -mno-pcrel
26448 @opindex mpcrel
26449 @opindex mno-pcrel
26450 Generate (do not generate) pc-relative addressing when the option
26451 @option{-mcpu=future} is used.  The @option{-mpcrel} option requires
26452 that the medium code model (@option{-mcmodel=medium}) and prefixed
26453 addressing (@option{-mprefixed}) options are enabled.
26455 @item -mprefixed
26456 @itemx -mno-prefixed
26457 @opindex mprefixed
26458 @opindex mno-prefixed
26459 Generate (do not generate) addressing modes using prefixed load and
26460 store instructions when the option @option{-mcpu=future} is used.
26461 @end table
26463 @node RX Options
26464 @subsection RX Options
26465 @cindex RX Options
26467 These command-line options are defined for RX targets:
26469 @table @gcctabopt
26470 @item -m64bit-doubles
26471 @itemx -m32bit-doubles
26472 @opindex m64bit-doubles
26473 @opindex m32bit-doubles
26474 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26475 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
26476 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
26477 works on 32-bit values, which is why the default is
26478 @option{-m32bit-doubles}.
26480 @item -fpu
26481 @itemx -nofpu
26482 @opindex fpu
26483 @opindex nofpu
26484 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26485 floating-point hardware.  The default is enabled for the RX600
26486 series and disabled for the RX200 series.
26488 Floating-point instructions are only generated for 32-bit floating-point 
26489 values, however, so the FPU hardware is not used for doubles if the
26490 @option{-m64bit-doubles} option is used.
26492 @emph{Note} If the @option{-fpu} option is enabled then
26493 @option{-funsafe-math-optimizations} is also enabled automatically.
26494 This is because the RX FPU instructions are themselves unsafe.
26496 @item -mcpu=@var{name}
26497 @opindex mcpu
26498 Selects the type of RX CPU to be targeted.  Currently three types are
26499 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26500 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
26502 The only difference between @samp{RX600} and @samp{RX610} is that the
26503 @samp{RX610} does not support the @code{MVTIPL} instruction.
26505 The @samp{RX200} series does not have a hardware floating-point unit
26506 and so @option{-nofpu} is enabled by default when this type is
26507 selected.
26509 @item -mbig-endian-data
26510 @itemx -mlittle-endian-data
26511 @opindex mbig-endian-data
26512 @opindex mlittle-endian-data
26513 Store data (but not code) in the big-endian format.  The default is
26514 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26515 format.
26517 @item -msmall-data-limit=@var{N}
26518 @opindex msmall-data-limit
26519 Specifies the maximum size in bytes of global and static variables
26520 which can be placed into the small data area.  Using the small data
26521 area can lead to smaller and faster code, but the size of area is
26522 limited and it is up to the programmer to ensure that the area does
26523 not overflow.  Also when the small data area is used one of the RX's
26524 registers (usually @code{r13}) is reserved for use pointing to this
26525 area, so it is no longer available for use by the compiler.  This
26526 could result in slower and/or larger code if variables are pushed onto
26527 the stack instead of being held in this register.
26529 Note, common variables (variables that have not been initialized) and
26530 constants are not placed into the small data area as they are assigned
26531 to other sections in the output executable.
26533 The default value is zero, which disables this feature.  Note, this
26534 feature is not enabled by default with higher optimization levels
26535 (@option{-O2} etc) because of the potentially detrimental effects of
26536 reserving a register.  It is up to the programmer to experiment and
26537 discover whether this feature is of benefit to their program.  See the
26538 description of the @option{-mpid} option for a description of how the
26539 actual register to hold the small data area pointer is chosen.
26541 @item -msim
26542 @itemx -mno-sim
26543 @opindex msim
26544 @opindex mno-sim
26545 Use the simulator runtime.  The default is to use the libgloss
26546 board-specific runtime.
26548 @item -mas100-syntax
26549 @itemx -mno-as100-syntax
26550 @opindex mas100-syntax
26551 @opindex mno-as100-syntax
26552 When generating assembler output use a syntax that is compatible with
26553 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
26554 assembler, but it has some restrictions so it is not generated by default.
26556 @item -mmax-constant-size=@var{N}
26557 @opindex mmax-constant-size
26558 Specifies the maximum size, in bytes, of a constant that can be used as
26559 an operand in a RX instruction.  Although the RX instruction set does
26560 allow constants of up to 4 bytes in length to be used in instructions,
26561 a longer value equates to a longer instruction.  Thus in some
26562 circumstances it can be beneficial to restrict the size of constants
26563 that are used in instructions.  Constants that are too big are instead
26564 placed into a constant pool and referenced via register indirection.
26566 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
26567 or 4 means that constants of any size are allowed.
26569 @item -mrelax
26570 @opindex mrelax
26571 Enable linker relaxation.  Linker relaxation is a process whereby the
26572 linker attempts to reduce the size of a program by finding shorter
26573 versions of various instructions.  Disabled by default.
26575 @item -mint-register=@var{N}
26576 @opindex mint-register
26577 Specify the number of registers to reserve for fast interrupt handler
26578 functions.  The value @var{N} can be between 0 and 4.  A value of 1
26579 means that register @code{r13} is reserved for the exclusive use
26580 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
26581 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
26582 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
26583 A value of 0, the default, does not reserve any registers.
26585 @item -msave-acc-in-interrupts
26586 @opindex msave-acc-in-interrupts
26587 Specifies that interrupt handler functions should preserve the
26588 accumulator register.  This is only necessary if normal code might use
26589 the accumulator register, for example because it performs 64-bit
26590 multiplications.  The default is to ignore the accumulator as this
26591 makes the interrupt handlers faster.
26593 @item -mpid
26594 @itemx -mno-pid
26595 @opindex mpid
26596 @opindex mno-pid
26597 Enables the generation of position independent data.  When enabled any
26598 access to constant data is done via an offset from a base address
26599 held in a register.  This allows the location of constant data to be
26600 determined at run time without requiring the executable to be
26601 relocated, which is a benefit to embedded applications with tight
26602 memory constraints.  Data that can be modified is not affected by this
26603 option.
26605 Note, using this feature reserves a register, usually @code{r13}, for
26606 the constant data base address.  This can result in slower and/or
26607 larger code, especially in complicated functions.
26609 The actual register chosen to hold the constant data base address
26610 depends upon whether the @option{-msmall-data-limit} and/or the
26611 @option{-mint-register} command-line options are enabled.  Starting
26612 with register @code{r13} and proceeding downwards, registers are
26613 allocated first to satisfy the requirements of @option{-mint-register},
26614 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
26615 is possible for the small data area register to be @code{r8} if both
26616 @option{-mint-register=4} and @option{-mpid} are specified on the
26617 command line.
26619 By default this feature is not enabled.  The default can be restored
26620 via the @option{-mno-pid} command-line option.
26622 @item -mno-warn-multiple-fast-interrupts
26623 @itemx -mwarn-multiple-fast-interrupts
26624 @opindex mno-warn-multiple-fast-interrupts
26625 @opindex mwarn-multiple-fast-interrupts
26626 Prevents GCC from issuing a warning message if it finds more than one
26627 fast interrupt handler when it is compiling a file.  The default is to
26628 issue a warning for each extra fast interrupt handler found, as the RX
26629 only supports one such interrupt.
26631 @item -mallow-string-insns
26632 @itemx -mno-allow-string-insns
26633 @opindex mallow-string-insns
26634 @opindex mno-allow-string-insns
26635 Enables or disables the use of the string manipulation instructions
26636 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
26637 @code{SWHILE} and also the @code{RMPA} instruction.  These
26638 instructions may prefetch data, which is not safe to do if accessing
26639 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
26640 for more information).
26642 The default is to allow these instructions, but it is not possible for
26643 GCC to reliably detect all circumstances where a string instruction
26644 might be used to access an I/O register, so their use cannot be
26645 disabled automatically.  Instead it is reliant upon the programmer to
26646 use the @option{-mno-allow-string-insns} option if their program
26647 accesses I/O space.
26649 When the instructions are enabled GCC defines the C preprocessor
26650 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
26651 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
26653 @item -mjsr
26654 @itemx -mno-jsr
26655 @opindex mjsr
26656 @opindex mno-jsr
26657 Use only (or not only) @code{JSR} instructions to access functions.
26658 This option can be used when code size exceeds the range of @code{BSR}
26659 instructions.  Note that @option{-mno-jsr} does not mean to not use
26660 @code{JSR} but instead means that any type of branch may be used.
26661 @end table
26663 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
26664 has special significance to the RX port when used with the
26665 @code{interrupt} function attribute.  This attribute indicates a
26666 function intended to process fast interrupts.  GCC ensures
26667 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
26668 and/or @code{r13} and only provided that the normal use of the
26669 corresponding registers have been restricted via the
26670 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
26671 options.
26673 @node S/390 and zSeries Options
26674 @subsection S/390 and zSeries Options
26675 @cindex S/390 and zSeries Options
26677 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
26679 @table @gcctabopt
26680 @item -mhard-float
26681 @itemx -msoft-float
26682 @opindex mhard-float
26683 @opindex msoft-float
26684 Use (do not use) the hardware floating-point instructions and registers
26685 for floating-point operations.  When @option{-msoft-float} is specified,
26686 functions in @file{libgcc.a} are used to perform floating-point
26687 operations.  When @option{-mhard-float} is specified, the compiler
26688 generates IEEE floating-point instructions.  This is the default.
26690 @item -mhard-dfp
26691 @itemx -mno-hard-dfp
26692 @opindex mhard-dfp
26693 @opindex mno-hard-dfp
26694 Use (do not use) the hardware decimal-floating-point instructions for
26695 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
26696 specified, functions in @file{libgcc.a} are used to perform
26697 decimal-floating-point operations.  When @option{-mhard-dfp} is
26698 specified, the compiler generates decimal-floating-point hardware
26699 instructions.  This is the default for @option{-march=z9-ec} or higher.
26701 @item -mlong-double-64
26702 @itemx -mlong-double-128
26703 @opindex mlong-double-64
26704 @opindex mlong-double-128
26705 These switches control the size of @code{long double} type. A size
26706 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26707 type. This is the default.
26709 @item -mbackchain
26710 @itemx -mno-backchain
26711 @opindex mbackchain
26712 @opindex mno-backchain
26713 Store (do not store) the address of the caller's frame as backchain pointer
26714 into the callee's stack frame.
26715 A backchain may be needed to allow debugging using tools that do not understand
26716 DWARF call frame information.
26717 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
26718 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
26719 the backchain is placed into the topmost word of the 96/160 byte register
26720 save area.
26722 In general, code compiled with @option{-mbackchain} is call-compatible with
26723 code compiled with @option{-mmo-backchain}; however, use of the backchain
26724 for debugging purposes usually requires that the whole binary is built with
26725 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
26726 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
26727 to build a linux kernel use @option{-msoft-float}.
26729 The default is to not maintain the backchain.
26731 @item -mpacked-stack
26732 @itemx -mno-packed-stack
26733 @opindex mpacked-stack
26734 @opindex mno-packed-stack
26735 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
26736 specified, the compiler uses the all fields of the 96/160 byte register save
26737 area only for their default purpose; unused fields still take up stack space.
26738 When @option{-mpacked-stack} is specified, register save slots are densely
26739 packed at the top of the register save area; unused space is reused for other
26740 purposes, allowing for more efficient use of the available stack space.
26741 However, when @option{-mbackchain} is also in effect, the topmost word of
26742 the save area is always used to store the backchain, and the return address
26743 register is always saved two words below the backchain.
26745 As long as the stack frame backchain is not used, code generated with
26746 @option{-mpacked-stack} is call-compatible with code generated with
26747 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
26748 S/390 or zSeries generated code that uses the stack frame backchain at run
26749 time, not just for debugging purposes.  Such code is not call-compatible
26750 with code compiled with @option{-mpacked-stack}.  Also, note that the
26751 combination of @option{-mbackchain},
26752 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
26753 to build a linux kernel use @option{-msoft-float}.
26755 The default is to not use the packed stack layout.
26757 @item -msmall-exec
26758 @itemx -mno-small-exec
26759 @opindex msmall-exec
26760 @opindex mno-small-exec
26761 Generate (or do not generate) code using the @code{bras} instruction
26762 to do subroutine calls.
26763 This only works reliably if the total executable size does not
26764 exceed 64k.  The default is to use the @code{basr} instruction instead,
26765 which does not have this limitation.
26767 @item -m64
26768 @itemx -m31
26769 @opindex m64
26770 @opindex m31
26771 When @option{-m31} is specified, generate code compliant to the
26772 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
26773 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
26774 particular to generate 64-bit instructions.  For the @samp{s390}
26775 targets, the default is @option{-m31}, while the @samp{s390x}
26776 targets default to @option{-m64}.
26778 @item -mzarch
26779 @itemx -mesa
26780 @opindex mzarch
26781 @opindex mesa
26782 When @option{-mzarch} is specified, generate code using the
26783 instructions available on z/Architecture.
26784 When @option{-mesa} is specified, generate code using the
26785 instructions available on ESA/390.  Note that @option{-mesa} is
26786 not possible with @option{-m64}.
26787 When generating code compliant to the GNU/Linux for S/390 ABI,
26788 the default is @option{-mesa}.  When generating code compliant
26789 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
26791 @item -mhtm
26792 @itemx -mno-htm
26793 @opindex mhtm
26794 @opindex mno-htm
26795 The @option{-mhtm} option enables a set of builtins making use of
26796 instructions available with the transactional execution facility
26797 introduced with the IBM zEnterprise EC12 machine generation
26798 @ref{S/390 System z Built-in Functions}.
26799 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
26801 @item -mvx
26802 @itemx -mno-vx
26803 @opindex mvx
26804 @opindex mno-vx
26805 When @option{-mvx} is specified, generate code using the instructions
26806 available with the vector extension facility introduced with the IBM
26807 z13 machine generation.
26808 This option changes the ABI for some vector type values with regard to
26809 alignment and calling conventions.  In case vector type values are
26810 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
26811 command will be added to mark the resulting binary with the ABI used.
26812 @option{-mvx} is enabled by default when using @option{-march=z13}.
26814 @item -mzvector
26815 @itemx -mno-zvector
26816 @opindex mzvector
26817 @opindex mno-zvector
26818 The @option{-mzvector} option enables vector language extensions and
26819 builtins using instructions available with the vector extension
26820 facility introduced with the IBM z13 machine generation.
26821 This option adds support for @samp{vector} to be used as a keyword to
26822 define vector type variables and arguments.  @samp{vector} is only
26823 available when GNU extensions are enabled.  It will not be expanded
26824 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
26825 In addition to the GCC low-level builtins @option{-mzvector} enables
26826 a set of builtins added for compatibility with AltiVec-style
26827 implementations like Power and Cell.  In order to make use of these
26828 builtins the header file @file{vecintrin.h} needs to be included.
26829 @option{-mzvector} is disabled by default.
26831 @item -mmvcle
26832 @itemx -mno-mvcle
26833 @opindex mmvcle
26834 @opindex mno-mvcle
26835 Generate (or do not generate) code using the @code{mvcle} instruction
26836 to perform block moves.  When @option{-mno-mvcle} is specified,
26837 use a @code{mvc} loop instead.  This is the default unless optimizing for
26838 size.
26840 @item -mdebug
26841 @itemx -mno-debug
26842 @opindex mdebug
26843 @opindex mno-debug
26844 Print (or do not print) additional debug information when compiling.
26845 The default is to not print debug information.
26847 @item -march=@var{cpu-type}
26848 @opindex march
26849 Generate code that runs on @var{cpu-type}, which is the name of a
26850 system representing a certain processor type.  Possible values for
26851 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
26852 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
26853 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
26854 @samp{z14}/@samp{arch12}, and @samp{native}.
26856 The default is @option{-march=z900}.
26858 Specifying @samp{native} as cpu type can be used to select the best
26859 architecture option for the host processor.
26860 @option{-march=native} has no effect if GCC does not recognize the
26861 processor.
26863 @item -mtune=@var{cpu-type}
26864 @opindex mtune
26865 Tune to @var{cpu-type} everything applicable about the generated code,
26866 except for the ABI and the set of available instructions.
26867 The list of @var{cpu-type} values is the same as for @option{-march}.
26868 The default is the value used for @option{-march}.
26870 @item -mtpf-trace
26871 @itemx -mno-tpf-trace
26872 @opindex mtpf-trace
26873 @opindex mno-tpf-trace
26874 Generate code that adds (does not add) in TPF OS specific branches to trace
26875 routines in the operating system.  This option is off by default, even
26876 when compiling for the TPF OS@.
26878 @item -mfused-madd
26879 @itemx -mno-fused-madd
26880 @opindex mfused-madd
26881 @opindex mno-fused-madd
26882 Generate code that uses (does not use) the floating-point multiply and
26883 accumulate instructions.  These instructions are generated by default if
26884 hardware floating point is used.
26886 @item -mwarn-framesize=@var{framesize}
26887 @opindex mwarn-framesize
26888 Emit a warning if the current function exceeds the given frame size.  Because
26889 this is a compile-time check it doesn't need to be a real problem when the program
26890 runs.  It is intended to identify functions that most probably cause
26891 a stack overflow.  It is useful to be used in an environment with limited stack
26892 size e.g.@: the linux kernel.
26894 @item -mwarn-dynamicstack
26895 @opindex mwarn-dynamicstack
26896 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
26897 arrays.  This is generally a bad idea with a limited stack size.
26899 @item -mstack-guard=@var{stack-guard}
26900 @itemx -mstack-size=@var{stack-size}
26901 @opindex mstack-guard
26902 @opindex mstack-size
26903 If these options are provided the S/390 back end emits additional instructions in
26904 the function prologue that trigger a trap if the stack size is @var{stack-guard}
26905 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
26906 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
26907 the frame size of the compiled function is chosen.
26908 These options are intended to be used to help debugging stack overflow problems.
26909 The additionally emitted code causes only little overhead and hence can also be
26910 used in production-like systems without greater performance degradation.  The given
26911 values have to be exact powers of 2 and @var{stack-size} has to be greater than
26912 @var{stack-guard} without exceeding 64k.
26913 In order to be efficient the extra code makes the assumption that the stack starts
26914 at an address aligned to the value given by @var{stack-size}.
26915 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
26917 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
26918 @opindex mhotpatch
26919 If the hotpatch option is enabled, a ``hot-patching'' function
26920 prologue is generated for all functions in the compilation unit.
26921 The funtion label is prepended with the given number of two-byte
26922 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
26923 the label, 2 * @var{post-halfwords} bytes are appended, using the
26924 largest NOP like instructions the architecture allows (maximum
26925 1000000).
26927 If both arguments are zero, hotpatching is disabled.
26929 This option can be overridden for individual functions with the
26930 @code{hotpatch} attribute.
26931 @end table
26933 @node Score Options
26934 @subsection Score Options
26935 @cindex Score Options
26937 These options are defined for Score implementations:
26939 @table @gcctabopt
26940 @item -meb
26941 @opindex meb
26942 Compile code for big-endian mode.  This is the default.
26944 @item -mel
26945 @opindex mel
26946 Compile code for little-endian mode.
26948 @item -mnhwloop
26949 @opindex mnhwloop
26950 Disable generation of @code{bcnz} instructions.
26952 @item -muls
26953 @opindex muls
26954 Enable generation of unaligned load and store instructions.
26956 @item -mmac
26957 @opindex mmac
26958 Enable the use of multiply-accumulate instructions. Disabled by default.
26960 @item -mscore5
26961 @opindex mscore5
26962 Specify the SCORE5 as the target architecture.
26964 @item -mscore5u
26965 @opindex mscore5u
26966 Specify the SCORE5U of the target architecture.
26968 @item -mscore7
26969 @opindex mscore7
26970 Specify the SCORE7 as the target architecture. This is the default.
26972 @item -mscore7d
26973 @opindex mscore7d
26974 Specify the SCORE7D as the target architecture.
26975 @end table
26977 @node SH Options
26978 @subsection SH Options
26980 These @samp{-m} options are defined for the SH implementations:
26982 @table @gcctabopt
26983 @item -m1
26984 @opindex m1
26985 Generate code for the SH1.
26987 @item -m2
26988 @opindex m2
26989 Generate code for the SH2.
26991 @item -m2e
26992 Generate code for the SH2e.
26994 @item -m2a-nofpu
26995 @opindex m2a-nofpu
26996 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26997 that the floating-point unit is not used.
26999 @item -m2a-single-only
27000 @opindex m2a-single-only
27001 Generate code for the SH2a-FPU, in such a way that no double-precision
27002 floating-point operations are used.
27004 @item -m2a-single
27005 @opindex m2a-single
27006 Generate code for the SH2a-FPU assuming the floating-point unit is in
27007 single-precision mode by default.
27009 @item -m2a
27010 @opindex m2a
27011 Generate code for the SH2a-FPU assuming the floating-point unit is in
27012 double-precision mode by default.
27014 @item -m3
27015 @opindex m3
27016 Generate code for the SH3.
27018 @item -m3e
27019 @opindex m3e
27020 Generate code for the SH3e.
27022 @item -m4-nofpu
27023 @opindex m4-nofpu
27024 Generate code for the SH4 without a floating-point unit.
27026 @item -m4-single-only
27027 @opindex m4-single-only
27028 Generate code for the SH4 with a floating-point unit that only
27029 supports single-precision arithmetic.
27031 @item -m4-single
27032 @opindex m4-single
27033 Generate code for the SH4 assuming the floating-point unit is in
27034 single-precision mode by default.
27036 @item -m4
27037 @opindex m4
27038 Generate code for the SH4.
27040 @item -m4-100
27041 @opindex m4-100
27042 Generate code for SH4-100.
27044 @item -m4-100-nofpu
27045 @opindex m4-100-nofpu
27046 Generate code for SH4-100 in such a way that the
27047 floating-point unit is not used.
27049 @item -m4-100-single
27050 @opindex m4-100-single
27051 Generate code for SH4-100 assuming the floating-point unit is in
27052 single-precision mode by default.
27054 @item -m4-100-single-only
27055 @opindex m4-100-single-only
27056 Generate code for SH4-100 in such a way that no double-precision
27057 floating-point operations are used.
27059 @item -m4-200
27060 @opindex m4-200
27061 Generate code for SH4-200.
27063 @item -m4-200-nofpu
27064 @opindex m4-200-nofpu
27065 Generate code for SH4-200 without in such a way that the
27066 floating-point unit is not used.
27068 @item -m4-200-single
27069 @opindex m4-200-single
27070 Generate code for SH4-200 assuming the floating-point unit is in
27071 single-precision mode by default.
27073 @item -m4-200-single-only
27074 @opindex m4-200-single-only
27075 Generate code for SH4-200 in such a way that no double-precision
27076 floating-point operations are used.
27078 @item -m4-300
27079 @opindex m4-300
27080 Generate code for SH4-300.
27082 @item -m4-300-nofpu
27083 @opindex m4-300-nofpu
27084 Generate code for SH4-300 without in such a way that the
27085 floating-point unit is not used.
27087 @item -m4-300-single
27088 @opindex m4-300-single
27089 Generate code for SH4-300 in such a way that no double-precision
27090 floating-point operations are used.
27092 @item -m4-300-single-only
27093 @opindex m4-300-single-only
27094 Generate code for SH4-300 in such a way that no double-precision
27095 floating-point operations are used.
27097 @item -m4-340
27098 @opindex m4-340
27099 Generate code for SH4-340 (no MMU, no FPU).
27101 @item -m4-500
27102 @opindex m4-500
27103 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
27104 assembler.
27106 @item -m4a-nofpu
27107 @opindex m4a-nofpu
27108 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27109 floating-point unit is not used.
27111 @item -m4a-single-only
27112 @opindex m4a-single-only
27113 Generate code for the SH4a, in such a way that no double-precision
27114 floating-point operations are used.
27116 @item -m4a-single
27117 @opindex m4a-single
27118 Generate code for the SH4a assuming the floating-point unit is in
27119 single-precision mode by default.
27121 @item -m4a
27122 @opindex m4a
27123 Generate code for the SH4a.
27125 @item -m4al
27126 @opindex m4al
27127 Same as @option{-m4a-nofpu}, except that it implicitly passes
27128 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
27129 instructions at the moment.
27131 @item -mb
27132 @opindex mb
27133 Compile code for the processor in big-endian mode.
27135 @item -ml
27136 @opindex ml
27137 Compile code for the processor in little-endian mode.
27139 @item -mdalign
27140 @opindex mdalign
27141 Align doubles at 64-bit boundaries.  Note that this changes the calling
27142 conventions, and thus some functions from the standard C library do
27143 not work unless you recompile it first with @option{-mdalign}.
27145 @item -mrelax
27146 @opindex mrelax
27147 Shorten some address references at link time, when possible; uses the
27148 linker option @option{-relax}.
27150 @item -mbigtable
27151 @opindex mbigtable
27152 Use 32-bit offsets in @code{switch} tables.  The default is to use
27153 16-bit offsets.
27155 @item -mbitops
27156 @opindex mbitops
27157 Enable the use of bit manipulation instructions on SH2A.
27159 @item -mfmovd
27160 @opindex mfmovd
27161 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
27162 alignment constraints.
27164 @item -mrenesas
27165 @opindex mrenesas
27166 Comply with the calling conventions defined by Renesas.
27168 @item -mno-renesas
27169 @opindex mno-renesas
27170 Comply with the calling conventions defined for GCC before the Renesas
27171 conventions were available.  This option is the default for all
27172 targets of the SH toolchain.
27174 @item -mnomacsave
27175 @opindex mnomacsave
27176 Mark the @code{MAC} register as call-clobbered, even if
27177 @option{-mrenesas} is given.
27179 @item -mieee
27180 @itemx -mno-ieee
27181 @opindex mieee
27182 @opindex mno-ieee
27183 Control the IEEE compliance of floating-point comparisons, which affects the
27184 handling of cases where the result of a comparison is unordered.  By default
27185 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
27186 enabled @option{-mno-ieee} is implicitly set, which results in faster
27187 floating-point greater-equal and less-equal comparisons.  The implicit settings
27188 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27190 @item -minline-ic_invalidate
27191 @opindex minline-ic_invalidate
27192 Inline code to invalidate instruction cache entries after setting up
27193 nested function trampolines.
27194 This option has no effect if @option{-musermode} is in effect and the selected
27195 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27196 instruction.
27197 If the selected code generation option does not allow the use of the @code{icbi}
27198 instruction, and @option{-musermode} is not in effect, the inlined code
27199 manipulates the instruction cache address array directly with an associative
27200 write.  This not only requires privileged mode at run time, but it also
27201 fails if the cache line had been mapped via the TLB and has become unmapped.
27203 @item -misize
27204 @opindex misize
27205 Dump instruction size and location in the assembly code.
27207 @item -mpadstruct
27208 @opindex mpadstruct
27209 This option is deprecated.  It pads structures to multiple of 4 bytes,
27210 which is incompatible with the SH ABI@.
27212 @item -matomic-model=@var{model}
27213 @opindex matomic-model=@var{model}
27214 Sets the model of atomic operations and additional parameters as a comma
27215 separated list.  For details on the atomic built-in functions see
27216 @ref{__atomic Builtins}.  The following models and parameters are supported:
27218 @table @samp
27220 @item none
27221 Disable compiler generated atomic sequences and emit library calls for atomic
27222 operations.  This is the default if the target is not @code{sh*-*-linux*}.
27224 @item soft-gusa
27225 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27226 built-in functions.  The generated atomic sequences require additional support
27227 from the interrupt/exception handling code of the system and are only suitable
27228 for SH3* and SH4* single-core systems.  This option is enabled by default when
27229 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
27230 this option also partially utilizes the hardware atomic instructions
27231 @code{movli.l} and @code{movco.l} to create more efficient code, unless
27232 @samp{strict} is specified.  
27234 @item soft-tcb
27235 Generate software atomic sequences that use a variable in the thread control
27236 block.  This is a variation of the gUSA sequences which can also be used on
27237 SH1* and SH2* targets.  The generated atomic sequences require additional
27238 support from the interrupt/exception handling code of the system and are only
27239 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
27240 parameter has to be specified as well.
27242 @item soft-imask
27243 Generate software atomic sequences that temporarily disable interrupts by
27244 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
27245 in privileged mode and is only suitable for single-core systems.  Additional
27246 support from the interrupt/exception handling code of the system is not
27247 required.  This model is enabled by default when the target is
27248 @code{sh*-*-linux*} and SH1* or SH2*.
27250 @item hard-llcs
27251 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27252 instructions only.  This is only available on SH4A and is suitable for
27253 multi-core systems.  Since the hardware instructions support only 32 bit atomic
27254 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27255 Code compiled with this option is also compatible with other software
27256 atomic model interrupt/exception handling systems if executed on an SH4A
27257 system.  Additional support from the interrupt/exception handling code of the
27258 system is not required for this model.
27260 @item gbr-offset=
27261 This parameter specifies the offset in bytes of the variable in the thread
27262 control block structure that should be used by the generated atomic sequences
27263 when the @samp{soft-tcb} model has been selected.  For other models this
27264 parameter is ignored.  The specified value must be an integer multiple of four
27265 and in the range 0-1020.
27267 @item strict
27268 This parameter prevents mixed usage of multiple atomic models, even if they
27269 are compatible, and makes the compiler generate atomic sequences of the
27270 specified model only.
27272 @end table
27274 @item -mtas
27275 @opindex mtas
27276 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27277 Notice that depending on the particular hardware and software configuration
27278 this can degrade overall performance due to the operand cache line flushes
27279 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
27280 processors the @code{tas.b} instruction must be used with caution since it
27281 can result in data corruption for certain cache configurations.
27283 @item -mprefergot
27284 @opindex mprefergot
27285 When generating position-independent code, emit function calls using
27286 the Global Offset Table instead of the Procedure Linkage Table.
27288 @item -musermode
27289 @itemx -mno-usermode
27290 @opindex musermode
27291 @opindex mno-usermode
27292 Don't allow (allow) the compiler generating privileged mode code.  Specifying
27293 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27294 inlined code would not work in user mode.  @option{-musermode} is the default
27295 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
27296 @option{-musermode} has no effect, since there is no user mode.
27298 @item -multcost=@var{number}
27299 @opindex multcost=@var{number}
27300 Set the cost to assume for a multiply insn.
27302 @item -mdiv=@var{strategy}
27303 @opindex mdiv=@var{strategy}
27304 Set the division strategy to be used for integer division operations.
27305 @var{strategy} can be one of: 
27307 @table @samp
27309 @item call-div1
27310 Calls a library function that uses the single-step division instruction
27311 @code{div1} to perform the operation.  Division by zero calculates an
27312 unspecified result and does not trap.  This is the default except for SH4,
27313 SH2A and SHcompact.
27315 @item call-fp
27316 Calls a library function that performs the operation in double precision
27317 floating point.  Division by zero causes a floating-point exception.  This is
27318 the default for SHcompact with FPU.  Specifying this for targets that do not
27319 have a double precision FPU defaults to @code{call-div1}.
27321 @item call-table
27322 Calls a library function that uses a lookup table for small divisors and
27323 the @code{div1} instruction with case distinction for larger divisors.  Division
27324 by zero calculates an unspecified result and does not trap.  This is the default
27325 for SH4.  Specifying this for targets that do not have dynamic shift
27326 instructions defaults to @code{call-div1}.
27328 @end table
27330 When a division strategy has not been specified the default strategy is
27331 selected based on the current target.  For SH2A the default strategy is to
27332 use the @code{divs} and @code{divu} instructions instead of library function
27333 calls.
27335 @item -maccumulate-outgoing-args
27336 @opindex maccumulate-outgoing-args
27337 Reserve space once for outgoing arguments in the function prologue rather
27338 than around each call.  Generally beneficial for performance and size.  Also
27339 needed for unwinding to avoid changing the stack frame around conditional code.
27341 @item -mdivsi3_libfunc=@var{name}
27342 @opindex mdivsi3_libfunc=@var{name}
27343 Set the name of the library function used for 32-bit signed division to
27344 @var{name}.
27345 This only affects the name used in the @samp{call} division strategies, and
27346 the compiler still expects the same sets of input/output/clobbered registers as
27347 if this option were not present.
27349 @item -mfixed-range=@var{register-range}
27350 @opindex mfixed-range
27351 Generate code treating the given register range as fixed registers.
27352 A fixed register is one that the register allocator cannot use.  This is
27353 useful when compiling kernel code.  A register range is specified as
27354 two registers separated by a dash.  Multiple register ranges can be
27355 specified separated by a comma.
27357 @item -mbranch-cost=@var{num}
27358 @opindex mbranch-cost=@var{num}
27359 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
27360 make the compiler try to generate more branch-free code if possible.  
27361 If not specified the value is selected depending on the processor type that
27362 is being compiled for.
27364 @item -mzdcbranch
27365 @itemx -mno-zdcbranch
27366 @opindex mzdcbranch
27367 @opindex mno-zdcbranch
27368 Assume (do not assume) that zero displacement conditional branch instructions
27369 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
27370 compiler prefers zero displacement branch code sequences.  This is
27371 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
27372 disabled by specifying @option{-mno-zdcbranch}.
27374 @item -mcbranch-force-delay-slot
27375 @opindex mcbranch-force-delay-slot
27376 Force the usage of delay slots for conditional branches, which stuffs the delay
27377 slot with a @code{nop} if a suitable instruction cannot be found.  By default
27378 this option is disabled.  It can be enabled to work around hardware bugs as
27379 found in the original SH7055.
27381 @item -mfused-madd
27382 @itemx -mno-fused-madd
27383 @opindex mfused-madd
27384 @opindex mno-fused-madd
27385 Generate code that uses (does not use) the floating-point multiply and
27386 accumulate instructions.  These instructions are generated by default
27387 if hardware floating point is used.  The machine-dependent
27388 @option{-mfused-madd} option is now mapped to the machine-independent
27389 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27390 mapped to @option{-ffp-contract=off}.
27392 @item -mfsca
27393 @itemx -mno-fsca
27394 @opindex mfsca
27395 @opindex mno-fsca
27396 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27397 and cosine approximations.  The option @option{-mfsca} must be used in
27398 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
27399 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
27400 approximations even if @option{-funsafe-math-optimizations} is in effect.
27402 @item -mfsrra
27403 @itemx -mno-fsrra
27404 @opindex mfsrra
27405 @opindex mno-fsrra
27406 Allow or disallow the compiler to emit the @code{fsrra} instruction for
27407 reciprocal square root approximations.  The option @option{-mfsrra} must be used
27408 in combination with @option{-funsafe-math-optimizations} and
27409 @option{-ffinite-math-only}.  It is enabled by default when generating code for
27410 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
27411 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27412 in effect.
27414 @item -mpretend-cmove
27415 @opindex mpretend-cmove
27416 Prefer zero-displacement conditional branches for conditional move instruction
27417 patterns.  This can result in faster code on the SH4 processor.
27419 @item -mfdpic
27420 @opindex fdpic
27421 Generate code using the FDPIC ABI.
27423 @end table
27425 @node Solaris 2 Options
27426 @subsection Solaris 2 Options
27427 @cindex Solaris 2 options
27429 These @samp{-m} options are supported on Solaris 2:
27431 @table @gcctabopt
27432 @item -mclear-hwcap
27433 @opindex mclear-hwcap
27434 @option{-mclear-hwcap} tells the compiler to remove the hardware
27435 capabilities generated by the Solaris assembler.  This is only necessary
27436 when object files use ISA extensions not supported by the current
27437 machine, but check at runtime whether or not to use them.
27439 @item -mimpure-text
27440 @opindex mimpure-text
27441 @option{-mimpure-text}, used in addition to @option{-shared}, tells
27442 the compiler to not pass @option{-z text} to the linker when linking a
27443 shared object.  Using this option, you can link position-dependent
27444 code into a shared object.
27446 @option{-mimpure-text} suppresses the ``relocations remain against
27447 allocatable but non-writable sections'' linker error message.
27448 However, the necessary relocations trigger copy-on-write, and the
27449 shared object is not actually shared across processes.  Instead of
27450 using @option{-mimpure-text}, you should compile all source code with
27451 @option{-fpic} or @option{-fPIC}.
27453 @end table
27455 These switches are supported in addition to the above on Solaris 2:
27457 @table @gcctabopt
27458 @item -pthreads
27459 @opindex pthreads
27460 This is a synonym for @option{-pthread}.
27461 @end table
27463 @node SPARC Options
27464 @subsection SPARC Options
27465 @cindex SPARC options
27467 These @samp{-m} options are supported on the SPARC:
27469 @table @gcctabopt
27470 @item -mno-app-regs
27471 @itemx -mapp-regs
27472 @opindex mno-app-regs
27473 @opindex mapp-regs
27474 Specify @option{-mapp-regs} to generate output using the global registers
27475 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
27476 global register 1, each global register 2 through 4 is then treated as an
27477 allocable register that is clobbered by function calls.  This is the default.
27479 To be fully SVR4 ABI-compliant at the cost of some performance loss,
27480 specify @option{-mno-app-regs}.  You should compile libraries and system
27481 software with this option.
27483 @item -mflat
27484 @itemx -mno-flat
27485 @opindex mflat
27486 @opindex mno-flat
27487 With @option{-mflat}, the compiler does not generate save/restore instructions
27488 and uses a ``flat'' or single register window model.  This model is compatible
27489 with the regular register window model.  The local registers and the input
27490 registers (0--5) are still treated as ``call-saved'' registers and are
27491 saved on the stack as needed.
27493 With @option{-mno-flat} (the default), the compiler generates save/restore
27494 instructions (except for leaf functions).  This is the normal operating mode.
27496 @item -mfpu
27497 @itemx -mhard-float
27498 @opindex mfpu
27499 @opindex mhard-float
27500 Generate output containing floating-point instructions.  This is the
27501 default.
27503 @item -mno-fpu
27504 @itemx -msoft-float
27505 @opindex mno-fpu
27506 @opindex msoft-float
27507 Generate output containing library calls for floating point.
27508 @strong{Warning:} the requisite libraries are not available for all SPARC
27509 targets.  Normally the facilities of the machine's usual C compiler are
27510 used, but this cannot be done directly in cross-compilation.  You must make
27511 your own arrangements to provide suitable library functions for
27512 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
27513 @samp{sparclite-*-*} do provide software floating-point support.
27515 @option{-msoft-float} changes the calling convention in the output file;
27516 therefore, it is only useful if you compile @emph{all} of a program with
27517 this option.  In particular, you need to compile @file{libgcc.a}, the
27518 library that comes with GCC, with @option{-msoft-float} in order for
27519 this to work.
27521 @item -mhard-quad-float
27522 @opindex mhard-quad-float
27523 Generate output containing quad-word (long double) floating-point
27524 instructions.
27526 @item -msoft-quad-float
27527 @opindex msoft-quad-float
27528 Generate output containing library calls for quad-word (long double)
27529 floating-point instructions.  The functions called are those specified
27530 in the SPARC ABI@.  This is the default.
27532 As of this writing, there are no SPARC implementations that have hardware
27533 support for the quad-word floating-point instructions.  They all invoke
27534 a trap handler for one of these instructions, and then the trap handler
27535 emulates the effect of the instruction.  Because of the trap handler overhead,
27536 this is much slower than calling the ABI library routines.  Thus the
27537 @option{-msoft-quad-float} option is the default.
27539 @item -mno-unaligned-doubles
27540 @itemx -munaligned-doubles
27541 @opindex mno-unaligned-doubles
27542 @opindex munaligned-doubles
27543 Assume that doubles have 8-byte alignment.  This is the default.
27545 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
27546 alignment only if they are contained in another type, or if they have an
27547 absolute address.  Otherwise, it assumes they have 4-byte alignment.
27548 Specifying this option avoids some rare compatibility problems with code
27549 generated by other compilers.  It is not the default because it results
27550 in a performance loss, especially for floating-point code.
27552 @item -muser-mode
27553 @itemx -mno-user-mode
27554 @opindex muser-mode
27555 @opindex mno-user-mode
27556 Do not generate code that can only run in supervisor mode.  This is relevant
27557 only for the @code{casa} instruction emitted for the LEON3 processor.  This
27558 is the default.
27560 @item -mfaster-structs
27561 @itemx -mno-faster-structs
27562 @opindex mfaster-structs
27563 @opindex mno-faster-structs
27564 With @option{-mfaster-structs}, the compiler assumes that structures
27565 should have 8-byte alignment.  This enables the use of pairs of
27566 @code{ldd} and @code{std} instructions for copies in structure
27567 assignment, in place of twice as many @code{ld} and @code{st} pairs.
27568 However, the use of this changed alignment directly violates the SPARC
27569 ABI@.  Thus, it's intended only for use on targets where the developer
27570 acknowledges that their resulting code is not directly in line with
27571 the rules of the ABI@.
27573 @item -mstd-struct-return
27574 @itemx -mno-std-struct-return
27575 @opindex mstd-struct-return
27576 @opindex mno-std-struct-return
27577 With @option{-mstd-struct-return}, the compiler generates checking code
27578 in functions returning structures or unions to detect size mismatches
27579 between the two sides of function calls, as per the 32-bit ABI@.
27581 The default is @option{-mno-std-struct-return}.  This option has no effect
27582 in 64-bit mode.
27584 @item -mlra
27585 @itemx -mno-lra
27586 @opindex mlra
27587 @opindex mno-lra
27588 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
27589 so @option{-mno-lra} needs to be passed to get old Reload.
27591 @item -mcpu=@var{cpu_type}
27592 @opindex mcpu
27593 Set the instruction set, register set, and instruction scheduling parameters
27594 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
27595 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
27596 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
27597 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
27598 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
27599 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
27601 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
27602 which selects the best architecture option for the host processor.
27603 @option{-mcpu=native} has no effect if GCC does not recognize
27604 the processor.
27606 Default instruction scheduling parameters are used for values that select
27607 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
27608 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
27610 Here is a list of each supported architecture and their supported
27611 implementations.
27613 @table @asis
27614 @item v7
27615 cypress, leon3v7
27617 @item v8
27618 supersparc, hypersparc, leon, leon3
27620 @item sparclite
27621 f930, f934, sparclite86x
27623 @item sparclet
27624 tsc701
27626 @item v9
27627 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27628 niagara7, m8
27629 @end table
27631 By default (unless configured otherwise), GCC generates code for the V7
27632 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
27633 additionally optimizes it for the Cypress CY7C602 chip, as used in the
27634 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
27635 SPARCStation 1, 2, IPX etc.
27637 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
27638 architecture.  The only difference from V7 code is that the compiler emits
27639 the integer multiply and integer divide instructions which exist in SPARC-V8
27640 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
27641 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
27642 2000 series.
27644 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
27645 the SPARC architecture.  This adds the integer multiply, integer divide step
27646 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
27647 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
27648 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
27649 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
27650 MB86934 chip, which is the more recent SPARClite with FPU@.
27652 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
27653 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
27654 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
27655 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
27656 optimizes it for the TEMIC SPARClet chip.
27658 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
27659 architecture.  This adds 64-bit integer and floating-point move instructions,
27660 3 additional floating-point condition code registers and conditional move
27661 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
27662 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
27663 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
27664 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
27665 @option{-mcpu=niagara}, the compiler additionally optimizes it for
27666 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
27667 additionally optimizes it for Sun UltraSPARC T2 chips. With
27668 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
27669 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
27670 additionally optimizes it for Sun UltraSPARC T4 chips.  With
27671 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
27672 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
27673 additionally optimizes it for Oracle M8 chips.
27675 @item -mtune=@var{cpu_type}
27676 @opindex mtune
27677 Set the instruction scheduling parameters for machine type
27678 @var{cpu_type}, but do not set the instruction set or register set that the
27679 option @option{-mcpu=@var{cpu_type}} does.
27681 The same values for @option{-mcpu=@var{cpu_type}} can be used for
27682 @option{-mtune=@var{cpu_type}}, but the only useful values are those
27683 that select a particular CPU implementation.  Those are
27684 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
27685 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
27686 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
27687 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
27688 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
27689 and GNU/Linux toolchains, @samp{native} can also be used.
27691 @item -mv8plus
27692 @itemx -mno-v8plus
27693 @opindex mv8plus
27694 @opindex mno-v8plus
27695 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
27696 difference from the V8 ABI is that the global and out registers are
27697 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
27698 mode for all SPARC-V9 processors.
27700 @item -mvis
27701 @itemx -mno-vis
27702 @opindex mvis
27703 @opindex mno-vis
27704 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
27705 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
27707 @item -mvis2
27708 @itemx -mno-vis2
27709 @opindex mvis2
27710 @opindex mno-vis2
27711 With @option{-mvis2}, GCC generates code that takes advantage of
27712 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
27713 default is @option{-mvis2} when targeting a cpu that supports such
27714 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
27715 also sets @option{-mvis}.
27717 @item -mvis3
27718 @itemx -mno-vis3
27719 @opindex mvis3
27720 @opindex mno-vis3
27721 With @option{-mvis3}, GCC generates code that takes advantage of
27722 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
27723 default is @option{-mvis3} when targeting a cpu that supports such
27724 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
27725 also sets @option{-mvis2} and @option{-mvis}.
27727 @item -mvis4
27728 @itemx -mno-vis4
27729 @opindex mvis4
27730 @opindex mno-vis4
27731 With @option{-mvis4}, GCC generates code that takes advantage of
27732 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
27733 default is @option{-mvis4} when targeting a cpu that supports such
27734 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
27735 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
27737 @item -mvis4b
27738 @itemx -mno-vis4b
27739 @opindex mvis4b
27740 @opindex mno-vis4b
27741 With @option{-mvis4b}, GCC generates code that takes advantage of
27742 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
27743 the additional VIS instructions introduced in the Oracle SPARC
27744 Architecture 2017.  The default is @option{-mvis4b} when targeting a
27745 cpu that supports such instructions, such as m8 and later.  Setting
27746 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
27747 @option{-mvis2} and @option{-mvis}.
27749 @item -mcbcond
27750 @itemx -mno-cbcond
27751 @opindex mcbcond
27752 @opindex mno-cbcond
27753 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
27754 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
27755 when targeting a CPU that supports such instructions, such as Niagara-4 and
27756 later.
27758 @item -mfmaf
27759 @itemx -mno-fmaf
27760 @opindex mfmaf
27761 @opindex mno-fmaf
27762 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
27763 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
27764 when targeting a CPU that supports such instructions, such as Niagara-3 and
27765 later.
27767 @item -mfsmuld
27768 @itemx -mno-fsmuld
27769 @opindex mfsmuld
27770 @opindex mno-fsmuld
27771 With @option{-mfsmuld}, GCC generates code that takes advantage of the
27772 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
27773 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
27774 or V9 with FPU except @option{-mcpu=leon}.
27776 @item -mpopc
27777 @itemx -mno-popc
27778 @opindex mpopc
27779 @opindex mno-popc
27780 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
27781 Population Count instruction.  The default is @option{-mpopc}
27782 when targeting a CPU that supports such an instruction, such as Niagara-2 and
27783 later.
27785 @item -msubxc
27786 @itemx -mno-subxc
27787 @opindex msubxc
27788 @opindex mno-subxc
27789 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
27790 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
27791 when targeting a CPU that supports such an instruction, such as Niagara-7 and
27792 later.
27794 @item -mfix-at697f
27795 @opindex mfix-at697f
27796 Enable the documented workaround for the single erratum of the Atmel AT697F
27797 processor (which corresponds to erratum #13 of the AT697E processor).
27799 @item -mfix-ut699
27800 @opindex mfix-ut699
27801 Enable the documented workarounds for the floating-point errata and the data
27802 cache nullify errata of the UT699 processor.
27804 @item -mfix-ut700
27805 @opindex mfix-ut700
27806 Enable the documented workaround for the back-to-back store errata of
27807 the UT699E/UT700 processor.
27809 @item -mfix-gr712rc
27810 @opindex mfix-gr712rc
27811 Enable the documented workaround for the back-to-back store errata of
27812 the GR712RC processor.
27813 @end table
27815 These @samp{-m} options are supported in addition to the above
27816 on SPARC-V9 processors in 64-bit environments:
27818 @table @gcctabopt
27819 @item -m32
27820 @itemx -m64
27821 @opindex m32
27822 @opindex m64
27823 Generate code for a 32-bit or 64-bit environment.
27824 The 32-bit environment sets int, long and pointer to 32 bits.
27825 The 64-bit environment sets int to 32 bits and long and pointer
27826 to 64 bits.
27828 @item -mcmodel=@var{which}
27829 @opindex mcmodel
27830 Set the code model to one of
27832 @table @samp
27833 @item medlow
27834 The Medium/Low code model: 64-bit addresses, programs
27835 must be linked in the low 32 bits of memory.  Programs can be statically
27836 or dynamically linked.
27838 @item medmid
27839 The Medium/Middle code model: 64-bit addresses, programs
27840 must be linked in the low 44 bits of memory, the text and data segments must
27841 be less than 2GB in size and the data segment must be located within 2GB of
27842 the text segment.
27844 @item medany
27845 The Medium/Anywhere code model: 64-bit addresses, programs
27846 may be linked anywhere in memory, the text and data segments must be less
27847 than 2GB in size and the data segment must be located within 2GB of the
27848 text segment.
27850 @item embmedany
27851 The Medium/Anywhere code model for embedded systems:
27852 64-bit addresses, the text and data segments must be less than 2GB in
27853 size, both starting anywhere in memory (determined at link time).  The
27854 global register %g4 points to the base of the data segment.  Programs
27855 are statically linked and PIC is not supported.
27856 @end table
27858 @item -mmemory-model=@var{mem-model}
27859 @opindex mmemory-model
27860 Set the memory model in force on the processor to one of
27862 @table @samp
27863 @item default
27864 The default memory model for the processor and operating system.
27866 @item rmo
27867 Relaxed Memory Order
27869 @item pso
27870 Partial Store Order
27872 @item tso
27873 Total Store Order
27875 @item sc
27876 Sequential Consistency
27877 @end table
27879 These memory models are formally defined in Appendix D of the SPARC-V9
27880 architecture manual, as set in the processor's @code{PSTATE.MM} field.
27882 @item -mstack-bias
27883 @itemx -mno-stack-bias
27884 @opindex mstack-bias
27885 @opindex mno-stack-bias
27886 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
27887 frame pointer if present, are offset by @minus{}2047 which must be added back
27888 when making stack frame references.  This is the default in 64-bit mode.
27889 Otherwise, assume no such offset is present.
27890 @end table
27892 @node System V Options
27893 @subsection Options for System V
27895 These additional options are available on System V Release 4 for
27896 compatibility with other compilers on those systems:
27898 @table @gcctabopt
27899 @item -G
27900 @opindex G
27901 Create a shared object.
27902 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27904 @item -Qy
27905 @opindex Qy
27906 Identify the versions of each tool used by the compiler, in a
27907 @code{.ident} assembler directive in the output.
27909 @item -Qn
27910 @opindex Qn
27911 Refrain from adding @code{.ident} directives to the output file (this is
27912 the default).
27914 @item -YP,@var{dirs}
27915 @opindex YP
27916 Search the directories @var{dirs}, and no others, for libraries
27917 specified with @option{-l}.
27919 @item -Ym,@var{dir}
27920 @opindex Ym
27921 Look in the directory @var{dir} to find the M4 preprocessor.
27922 The assembler uses this option.
27923 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27924 @c the generic assembler that comes with Solaris takes just -Ym.
27925 @end table
27927 @node TILE-Gx Options
27928 @subsection TILE-Gx Options
27929 @cindex TILE-Gx options
27931 These @samp{-m} options are supported on the TILE-Gx:
27933 @table @gcctabopt
27934 @item -mcmodel=small
27935 @opindex mcmodel=small
27936 Generate code for the small model.  The distance for direct calls is
27937 limited to 500M in either direction.  PC-relative addresses are 32
27938 bits.  Absolute addresses support the full address range.
27940 @item -mcmodel=large
27941 @opindex mcmodel=large
27942 Generate code for the large model.  There is no limitation on call
27943 distance, pc-relative addresses, or absolute addresses.
27945 @item -mcpu=@var{name}
27946 @opindex mcpu
27947 Selects the type of CPU to be targeted.  Currently the only supported
27948 type is @samp{tilegx}.
27950 @item -m32
27951 @itemx -m64
27952 @opindex m32
27953 @opindex m64
27954 Generate code for a 32-bit or 64-bit environment.  The 32-bit
27955 environment sets int, long, and pointer to 32 bits.  The 64-bit
27956 environment sets int to 32 bits and long and pointer to 64 bits.
27958 @item -mbig-endian
27959 @itemx -mlittle-endian
27960 @opindex mbig-endian
27961 @opindex mlittle-endian
27962 Generate code in big/little endian mode, respectively.
27963 @end table
27965 @node TILEPro Options
27966 @subsection TILEPro Options
27967 @cindex TILEPro options
27969 These @samp{-m} options are supported on the TILEPro:
27971 @table @gcctabopt
27972 @item -mcpu=@var{name}
27973 @opindex mcpu
27974 Selects the type of CPU to be targeted.  Currently the only supported
27975 type is @samp{tilepro}.
27977 @item -m32
27978 @opindex m32
27979 Generate code for a 32-bit environment, which sets int, long, and
27980 pointer to 32 bits.  This is the only supported behavior so the flag
27981 is essentially ignored.
27982 @end table
27984 @node V850 Options
27985 @subsection V850 Options
27986 @cindex V850 Options
27988 These @samp{-m} options are defined for V850 implementations:
27990 @table @gcctabopt
27991 @item -mlong-calls
27992 @itemx -mno-long-calls
27993 @opindex mlong-calls
27994 @opindex mno-long-calls
27995 Treat all calls as being far away (near).  If calls are assumed to be
27996 far away, the compiler always loads the function's address into a
27997 register, and calls indirect through the pointer.
27999 @item -mno-ep
28000 @itemx -mep
28001 @opindex mno-ep
28002 @opindex mep
28003 Do not optimize (do optimize) basic blocks that use the same index
28004 pointer 4 or more times to copy pointer into the @code{ep} register, and
28005 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
28006 option is on by default if you optimize.
28008 @item -mno-prolog-function
28009 @itemx -mprolog-function
28010 @opindex mno-prolog-function
28011 @opindex mprolog-function
28012 Do not use (do use) external functions to save and restore registers
28013 at the prologue and epilogue of a function.  The external functions
28014 are slower, but use less code space if more than one function saves
28015 the same number of registers.  The @option{-mprolog-function} option
28016 is on by default if you optimize.
28018 @item -mspace
28019 @opindex mspace
28020 Try to make the code as small as possible.  At present, this just turns
28021 on the @option{-mep} and @option{-mprolog-function} options.
28023 @item -mtda=@var{n}
28024 @opindex mtda
28025 Put static or global variables whose size is @var{n} bytes or less into
28026 the tiny data area that register @code{ep} points to.  The tiny data
28027 area can hold up to 256 bytes in total (128 bytes for byte references).
28029 @item -msda=@var{n}
28030 @opindex msda
28031 Put static or global variables whose size is @var{n} bytes or less into
28032 the small data area that register @code{gp} points to.  The small data
28033 area can hold up to 64 kilobytes.
28035 @item -mzda=@var{n}
28036 @opindex mzda
28037 Put static or global variables whose size is @var{n} bytes or less into
28038 the first 32 kilobytes of memory.
28040 @item -mv850
28041 @opindex mv850
28042 Specify that the target processor is the V850.
28044 @item -mv850e3v5
28045 @opindex mv850e3v5
28046 Specify that the target processor is the V850E3V5.  The preprocessor
28047 constant @code{__v850e3v5__} is defined if this option is used.
28049 @item -mv850e2v4
28050 @opindex mv850e2v4
28051 Specify that the target processor is the V850E3V5.  This is an alias for
28052 the @option{-mv850e3v5} option.
28054 @item -mv850e2v3
28055 @opindex mv850e2v3
28056 Specify that the target processor is the V850E2V3.  The preprocessor
28057 constant @code{__v850e2v3__} is defined if this option is used.
28059 @item -mv850e2
28060 @opindex mv850e2
28061 Specify that the target processor is the V850E2.  The preprocessor
28062 constant @code{__v850e2__} is defined if this option is used.
28064 @item -mv850e1
28065 @opindex mv850e1
28066 Specify that the target processor is the V850E1.  The preprocessor
28067 constants @code{__v850e1__} and @code{__v850e__} are defined if
28068 this option is used.
28070 @item -mv850es
28071 @opindex mv850es
28072 Specify that the target processor is the V850ES.  This is an alias for
28073 the @option{-mv850e1} option.
28075 @item -mv850e
28076 @opindex mv850e
28077 Specify that the target processor is the V850E@.  The preprocessor
28078 constant @code{__v850e__} is defined if this option is used.
28080 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28081 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28082 are defined then a default target processor is chosen and the
28083 relevant @samp{__v850*__} preprocessor constant is defined.
28085 The preprocessor constants @code{__v850} and @code{__v851__} are always
28086 defined, regardless of which processor variant is the target.
28088 @item -mdisable-callt
28089 @itemx -mno-disable-callt
28090 @opindex mdisable-callt
28091 @opindex mno-disable-callt
28092 This option suppresses generation of the @code{CALLT} instruction for the
28093 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28094 architecture.
28096 This option is enabled by default when the RH850 ABI is
28097 in use (see @option{-mrh850-abi}), and disabled by default when the
28098 GCC ABI is in use.  If @code{CALLT} instructions are being generated
28099 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28101 @item -mrelax
28102 @itemx -mno-relax
28103 @opindex mrelax
28104 @opindex mno-relax
28105 Pass on (or do not pass on) the @option{-mrelax} command-line option
28106 to the assembler.
28108 @item -mlong-jumps
28109 @itemx -mno-long-jumps
28110 @opindex mlong-jumps
28111 @opindex mno-long-jumps
28112 Disable (or re-enable) the generation of PC-relative jump instructions.
28114 @item -msoft-float
28115 @itemx -mhard-float
28116 @opindex msoft-float
28117 @opindex mhard-float
28118 Disable (or re-enable) the generation of hardware floating point
28119 instructions.  This option is only significant when the target
28120 architecture is @samp{V850E2V3} or higher.  If hardware floating point
28121 instructions are being generated then the C preprocessor symbol
28122 @code{__FPU_OK__} is defined, otherwise the symbol
28123 @code{__NO_FPU__} is defined.
28125 @item -mloop
28126 @opindex mloop
28127 Enables the use of the e3v5 LOOP instruction.  The use of this
28128 instruction is not enabled by default when the e3v5 architecture is
28129 selected because its use is still experimental.
28131 @item -mrh850-abi
28132 @itemx -mghs
28133 @opindex mrh850-abi
28134 @opindex mghs
28135 Enables support for the RH850 version of the V850 ABI.  This is the
28136 default.  With this version of the ABI the following rules apply:
28138 @itemize
28139 @item
28140 Integer sized structures and unions are returned via a memory pointer
28141 rather than a register.
28143 @item
28144 Large structures and unions (more than 8 bytes in size) are passed by
28145 value.
28147 @item
28148 Functions are aligned to 16-bit boundaries.
28150 @item
28151 The @option{-m8byte-align} command-line option is supported.
28153 @item
28154 The @option{-mdisable-callt} command-line option is enabled by
28155 default.  The @option{-mno-disable-callt} command-line option is not
28156 supported.
28157 @end itemize
28159 When this version of the ABI is enabled the C preprocessor symbol
28160 @code{__V850_RH850_ABI__} is defined.
28162 @item -mgcc-abi
28163 @opindex mgcc-abi
28164 Enables support for the old GCC version of the V850 ABI.  With this
28165 version of the ABI the following rules apply:
28167 @itemize
28168 @item
28169 Integer sized structures and unions are returned in register @code{r10}.
28171 @item
28172 Large structures and unions (more than 8 bytes in size) are passed by
28173 reference.
28175 @item
28176 Functions are aligned to 32-bit boundaries, unless optimizing for
28177 size.
28179 @item
28180 The @option{-m8byte-align} command-line option is not supported.
28182 @item
28183 The @option{-mdisable-callt} command-line option is supported but not
28184 enabled by default.
28185 @end itemize
28187 When this version of the ABI is enabled the C preprocessor symbol
28188 @code{__V850_GCC_ABI__} is defined.
28190 @item -m8byte-align
28191 @itemx -mno-8byte-align
28192 @opindex m8byte-align
28193 @opindex mno-8byte-align
28194 Enables support for @code{double} and @code{long long} types to be
28195 aligned on 8-byte boundaries.  The default is to restrict the
28196 alignment of all objects to at most 4-bytes.  When
28197 @option{-m8byte-align} is in effect the C preprocessor symbol
28198 @code{__V850_8BYTE_ALIGN__} is defined.
28200 @item -mbig-switch
28201 @opindex mbig-switch
28202 Generate code suitable for big switch tables.  Use this option only if
28203 the assembler/linker complain about out of range branches within a switch
28204 table.
28206 @item -mapp-regs
28207 @opindex mapp-regs
28208 This option causes r2 and r5 to be used in the code generated by
28209 the compiler.  This setting is the default.
28211 @item -mno-app-regs
28212 @opindex mno-app-regs
28213 This option causes r2 and r5 to be treated as fixed registers.
28215 @end table
28217 @node VAX Options
28218 @subsection VAX Options
28219 @cindex VAX options
28221 These @samp{-m} options are defined for the VAX:
28223 @table @gcctabopt
28224 @item -munix
28225 @opindex munix
28226 Do not output certain jump instructions (@code{aobleq} and so on)
28227 that the Unix assembler for the VAX cannot handle across long
28228 ranges.
28230 @item -mgnu
28231 @opindex mgnu
28232 Do output those jump instructions, on the assumption that the
28233 GNU assembler is being used.
28235 @item -mg
28236 @opindex mg
28237 Output code for G-format floating-point numbers instead of D-format.
28238 @end table
28240 @node Visium Options
28241 @subsection Visium Options
28242 @cindex Visium options
28244 @table @gcctabopt
28246 @item -mdebug
28247 @opindex mdebug
28248 A program which performs file I/O and is destined to run on an MCM target
28249 should be linked with this option.  It causes the libraries libc.a and
28250 libdebug.a to be linked.  The program should be run on the target under
28251 the control of the GDB remote debugging stub.
28253 @item -msim
28254 @opindex msim
28255 A program which performs file I/O and is destined to run on the simulator
28256 should be linked with option.  This causes libraries libc.a and libsim.a to
28257 be linked.
28259 @item -mfpu
28260 @itemx -mhard-float
28261 @opindex mfpu
28262 @opindex mhard-float
28263 Generate code containing floating-point instructions.  This is the
28264 default.
28266 @item -mno-fpu
28267 @itemx -msoft-float
28268 @opindex mno-fpu
28269 @opindex msoft-float
28270 Generate code containing library calls for floating-point.
28272 @option{-msoft-float} changes the calling convention in the output file;
28273 therefore, it is only useful if you compile @emph{all} of a program with
28274 this option.  In particular, you need to compile @file{libgcc.a}, the
28275 library that comes with GCC, with @option{-msoft-float} in order for
28276 this to work.
28278 @item -mcpu=@var{cpu_type}
28279 @opindex mcpu
28280 Set the instruction set, register set, and instruction scheduling parameters
28281 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
28282 @samp{mcm}, @samp{gr5} and @samp{gr6}.
28284 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28286 By default (unless configured otherwise), GCC generates code for the GR5
28287 variant of the Visium architecture.  
28289 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28290 architecture.  The only difference from GR5 code is that the compiler will
28291 generate block move instructions.
28293 @item -mtune=@var{cpu_type}
28294 @opindex mtune
28295 Set the instruction scheduling parameters for machine type @var{cpu_type},
28296 but do not set the instruction set or register set that the option
28297 @option{-mcpu=@var{cpu_type}} would.
28299 @item -msv-mode
28300 @opindex msv-mode
28301 Generate code for the supervisor mode, where there are no restrictions on
28302 the access to general registers.  This is the default.
28304 @item -muser-mode
28305 @opindex muser-mode
28306 Generate code for the user mode, where the access to some general registers
28307 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28308 mode; on the GR6, only registers r29 to r31 are affected.
28309 @end table
28311 @node VMS Options
28312 @subsection VMS Options
28314 These @samp{-m} options are defined for the VMS implementations:
28316 @table @gcctabopt
28317 @item -mvms-return-codes
28318 @opindex mvms-return-codes
28319 Return VMS condition codes from @code{main}. The default is to return POSIX-style
28320 condition (e.g.@: error) codes.
28322 @item -mdebug-main=@var{prefix}
28323 @opindex mdebug-main=@var{prefix}
28324 Flag the first routine whose name starts with @var{prefix} as the main
28325 routine for the debugger.
28327 @item -mmalloc64
28328 @opindex mmalloc64
28329 Default to 64-bit memory allocation routines.
28331 @item -mpointer-size=@var{size}
28332 @opindex mpointer-size=@var{size}
28333 Set the default size of pointers. Possible options for @var{size} are
28334 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28335 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28336 The later option disables @code{pragma pointer_size}.
28337 @end table
28339 @node VxWorks Options
28340 @subsection VxWorks Options
28341 @cindex VxWorks Options
28343 The options in this section are defined for all VxWorks targets.
28344 Options specific to the target hardware are listed with the other
28345 options for that target.
28347 @table @gcctabopt
28348 @item -mrtp
28349 @opindex mrtp
28350 GCC can generate code for both VxWorks kernels and real time processes
28351 (RTPs).  This option switches from the former to the latter.  It also
28352 defines the preprocessor macro @code{__RTP__}.
28354 @item -non-static
28355 @opindex non-static
28356 Link an RTP executable against shared libraries rather than static
28357 libraries.  The options @option{-static} and @option{-shared} can
28358 also be used for RTPs (@pxref{Link Options}); @option{-static}
28359 is the default.
28361 @item -Bstatic
28362 @itemx -Bdynamic
28363 @opindex Bstatic
28364 @opindex Bdynamic
28365 These options are passed down to the linker.  They are defined for
28366 compatibility with Diab.
28368 @item -Xbind-lazy
28369 @opindex Xbind-lazy
28370 Enable lazy binding of function calls.  This option is equivalent to
28371 @option{-Wl,-z,now} and is defined for compatibility with Diab.
28373 @item -Xbind-now
28374 @opindex Xbind-now
28375 Disable lazy binding of function calls.  This option is the default and
28376 is defined for compatibility with Diab.
28377 @end table
28379 @node x86 Options
28380 @subsection x86 Options
28381 @cindex x86 Options
28383 These @samp{-m} options are defined for the x86 family of computers.
28385 @table @gcctabopt
28387 @item -march=@var{cpu-type}
28388 @opindex march
28389 Generate instructions for the machine type @var{cpu-type}.  In contrast to
28390 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
28391 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28392 to generate code that may not run at all on processors other than the one
28393 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
28394 @option{-mtune=@var{cpu-type}}.
28396 The choices for @var{cpu-type} are:
28398 @table @samp
28399 @item native
28400 This selects the CPU to generate code for at compilation time by determining
28401 the processor type of the compiling machine.  Using @option{-march=native}
28402 enables all instruction subsets supported by the local machine (hence
28403 the result might not run on different machines).  Using @option{-mtune=native}
28404 produces code optimized for the local machine under the constraints
28405 of the selected instruction set.  
28407 @item x86-64
28408 A generic CPU with 64-bit extensions.
28410 @item i386
28411 Original Intel i386 CPU@.
28413 @item i486
28414 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
28416 @item i586
28417 @itemx pentium
28418 Intel Pentium CPU with no MMX support.
28420 @item lakemont
28421 Intel Lakemont MCU, based on Intel Pentium CPU.
28423 @item pentium-mmx
28424 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28426 @item pentiumpro
28427 Intel Pentium Pro CPU@.
28429 @item i686
28430 When used with @option{-march}, the Pentium Pro
28431 instruction set is used, so the code runs on all i686 family chips.
28432 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28434 @item pentium2
28435 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28436 support.
28438 @item pentium3
28439 @itemx pentium3m
28440 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28441 set support.
28443 @item pentium-m
28444 Intel Pentium M; low-power version of Intel Pentium III CPU
28445 with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
28447 @item pentium4
28448 @itemx pentium4m
28449 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28451 @item prescott
28452 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28453 set support.
28455 @item nocona
28456 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28457 SSE2 and SSE3 instruction set support.
28459 @item core2
28460 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28461 instruction set support.
28463 @item nehalem
28464 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28465 SSE4.1, SSE4.2 and POPCNT instruction set support.
28467 @item westmere
28468 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28469 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28471 @item sandybridge
28472 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28473 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28475 @item ivybridge
28476 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28477 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28478 instruction set support.
28480 @item haswell
28481 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28482 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28483 BMI, BMI2 and F16C instruction set support.
28485 @item broadwell
28486 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28487 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28488 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
28490 @item skylake
28491 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28492 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28493 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
28494 XSAVES instruction set support.
28496 @item bonnell
28497 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28498 instruction set support.
28500 @item silvermont
28501 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28502 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
28504 @item goldmont
28505 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28506 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
28507 instruction set support.
28509 @item goldmont-plus
28510 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28511 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
28512 PTWRITE, RDPID, SGX and UMIP instruction set support.
28514 @item tremont
28515 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28516 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
28517 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
28519 @item knl
28520 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28521 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28522 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
28523 AVX512CD instruction set support.
28525 @item knm
28526 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28527 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28528 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28529 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
28531 @item skylake-avx512
28532 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28533 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28534 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28535 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
28537 @item cannonlake
28538 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28539 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28540 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28541 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28542 AVX512IFMA, SHA and UMIP instruction set support.
28544 @item icelake-client
28545 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28546 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28547 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28548 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28549 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28550 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
28552 @item icelake-server
28553 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28554 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28555 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28556 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28557 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28558 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
28559 set support.
28561 @item cascadelake
28562 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28563 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28564 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28565 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
28567 @item cooperlake
28568 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28569 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28570 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28571 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
28572 set support.
28574 @item tigerlake
28575 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28576 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28577 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28578 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
28579 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
28580 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and  AVX512VP2INTERSECT instruction
28581 set support.
28583 @item k6
28584 AMD K6 CPU with MMX instruction set support.
28586 @item k6-2
28587 @itemx k6-3
28588 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
28590 @item athlon
28591 @itemx athlon-tbird
28592 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
28593 support.
28595 @item athlon-4
28596 @itemx athlon-xp
28597 @itemx athlon-mp
28598 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
28599 instruction set support.
28601 @item k8
28602 @itemx opteron
28603 @itemx athlon64
28604 @itemx athlon-fx
28605 Processors based on the AMD K8 core with x86-64 instruction set support,
28606 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
28607 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
28608 instruction set extensions.)
28610 @item k8-sse3
28611 @itemx opteron-sse3
28612 @itemx athlon64-sse3
28613 Improved versions of AMD K8 cores with SSE3 instruction set support.
28615 @item amdfam10
28616 @itemx barcelona
28617 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
28618 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
28619 instruction set extensions.)
28621 @item bdver1
28622 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
28623 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28624 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28626 @item bdver2
28627 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28628 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
28629 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
28630 extensions.)
28632 @item bdver3
28633 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28634 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
28635 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
28636 64-bit instruction set extensions.)
28638 @item bdver4
28639 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28640 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
28641 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28642 SSE4.2, ABM and 64-bit instruction set extensions.)
28644 @item znver1
28645 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
28646 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
28647 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28648 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
28649 instruction set extensions.)
28651 @item znver2
28652 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28653 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28654 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28655 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28656 WBNOINVD, and 64-bit instruction set extensions.)
28658 @item btver1
28659 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
28660 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
28661 instruction set extensions.)
28663 @item btver2
28664 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
28665 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
28666 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
28668 @item winchip-c6
28669 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
28670 set support.
28672 @item winchip2
28673 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
28674 instruction set support.
28676 @item c3
28677 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
28678 (No scheduling is implemented for this chip.)
28680 @item c3-2
28681 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
28682 (No scheduling is implemented for this chip.)
28684 @item c7
28685 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28686 (No scheduling is implemented for this chip.)
28688 @item samuel-2
28689 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
28690 (No scheduling is implemented for this chip.)
28692 @item nehemiah
28693 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28694 (No scheduling is implemented for this chip.)
28696 @item esther
28697 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28698 (No scheduling is implemented for this chip.)
28700 @item eden-x2
28701 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
28702 (No scheduling is implemented for this chip.)
28704 @item eden-x4
28705 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
28706 AVX and AVX2 instruction set support.
28707 (No scheduling is implemented for this chip.)
28709 @item nano
28710 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28711 instruction set support.
28712 (No scheduling is implemented for this chip.)
28714 @item nano-1000
28715 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28716 instruction set support.
28717 (No scheduling is implemented for this chip.)
28719 @item nano-2000
28720 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28721 instruction set support.
28722 (No scheduling is implemented for this chip.)
28724 @item nano-3000
28725 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28726 instruction set support.
28727 (No scheduling is implemented for this chip.)
28729 @item nano-x2
28730 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28731 instruction set support.
28732 (No scheduling is implemented for this chip.)
28734 @item nano-x4
28735 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28736 instruction set support.
28737 (No scheduling is implemented for this chip.)
28739 @item geode
28740 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
28741 @end table
28743 @item -mtune=@var{cpu-type}
28744 @opindex mtune
28745 Tune to @var{cpu-type} everything applicable about the generated code, except
28746 for the ABI and the set of available instructions.  
28747 While picking a specific @var{cpu-type} schedules things appropriately
28748 for that particular chip, the compiler does not generate any code that
28749 cannot run on the default machine type unless you use a
28750 @option{-march=@var{cpu-type}} option.
28751 For example, if GCC is configured for i686-pc-linux-gnu
28752 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
28753 but still runs on i686 machines.
28755 The choices for @var{cpu-type} are the same as for @option{-march}.
28756 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
28758 @table @samp
28759 @item generic
28760 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
28761 If you know the CPU on which your code will run, then you should use
28762 the corresponding @option{-mtune} or @option{-march} option instead of
28763 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
28764 of your application will have, then you should use this option.
28766 As new processors are deployed in the marketplace, the behavior of this
28767 option will change.  Therefore, if you upgrade to a newer version of
28768 GCC, code generation controlled by this option will change to reflect
28769 the processors
28770 that are most common at the time that version of GCC is released.
28772 There is no @option{-march=generic} option because @option{-march}
28773 indicates the instruction set the compiler can use, and there is no
28774 generic instruction set applicable to all processors.  In contrast,
28775 @option{-mtune} indicates the processor (or, in this case, collection of
28776 processors) for which the code is optimized.
28778 @item intel
28779 Produce code optimized for the most current Intel processors, which are
28780 Haswell and Silvermont for this version of GCC.  If you know the CPU
28781 on which your code will run, then you should use the corresponding
28782 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
28783 But, if you want your application performs better on both Haswell and
28784 Silvermont, then you should use this option.
28786 As new Intel processors are deployed in the marketplace, the behavior of
28787 this option will change.  Therefore, if you upgrade to a newer version of
28788 GCC, code generation controlled by this option will change to reflect
28789 the most current Intel processors at the time that version of GCC is
28790 released.
28792 There is no @option{-march=intel} option because @option{-march} indicates
28793 the instruction set the compiler can use, and there is no common
28794 instruction set applicable to all processors.  In contrast,
28795 @option{-mtune} indicates the processor (or, in this case, collection of
28796 processors) for which the code is optimized.
28797 @end table
28799 @item -mcpu=@var{cpu-type}
28800 @opindex mcpu
28801 A deprecated synonym for @option{-mtune}.
28803 @item -mfpmath=@var{unit}
28804 @opindex mfpmath
28805 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
28806 for @var{unit} are:
28808 @table @samp
28809 @item 387
28810 Use the standard 387 floating-point coprocessor present on the majority of chips and
28811 emulated otherwise.  Code compiled with this option runs almost everywhere.
28812 The temporary results are computed in 80-bit precision instead of the precision
28813 specified by the type, resulting in slightly different results compared to most
28814 of other chips.  See @option{-ffloat-store} for more detailed description.
28816 This is the default choice for non-Darwin x86-32 targets.
28818 @item sse
28819 Use scalar floating-point instructions present in the SSE instruction set.
28820 This instruction set is supported by Pentium III and newer chips,
28821 and in the AMD line
28822 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
28823 instruction set supports only single-precision arithmetic, thus the double and
28824 extended-precision arithmetic are still done using 387.  A later version, present
28825 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28826 arithmetic too.
28828 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28829 or @option{-msse2} switches to enable SSE extensions and make this option
28830 effective.  For the x86-64 compiler, these extensions are enabled by default.
28832 The resulting code should be considerably faster in the majority of cases and avoid
28833 the numerical instability problems of 387 code, but may break some existing
28834 code that expects temporaries to be 80 bits.
28836 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28837 and the default choice for x86-32 targets with the SSE2 instruction set
28838 when @option{-ffast-math} is enabled.
28840 @item sse,387
28841 @itemx sse+387
28842 @itemx both
28843 Attempt to utilize both instruction sets at once.  This effectively doubles the
28844 amount of available registers, and on chips with separate execution units for
28845 387 and SSE the execution resources too.  Use this option with care, as it is
28846 still experimental, because the GCC register allocator does not model separate
28847 functional units well, resulting in unstable performance.
28848 @end table
28850 @item -masm=@var{dialect}
28851 @opindex masm=@var{dialect}
28852 Output assembly instructions using selected @var{dialect}.  Also affects
28853 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
28854 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
28855 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
28856 not support @samp{intel}.
28858 @item -mieee-fp
28859 @itemx -mno-ieee-fp
28860 @opindex mieee-fp
28861 @opindex mno-ieee-fp
28862 Control whether or not the compiler uses IEEE floating-point
28863 comparisons.  These correctly handle the case where the result of a
28864 comparison is unordered.
28866 @item -m80387
28867 @itemx -mhard-float
28868 @opindex 80387
28869 @opindex mhard-float
28870 Generate output containing 80387 instructions for floating point.
28872 @item -mno-80387
28873 @itemx -msoft-float
28874 @opindex no-80387
28875 @opindex msoft-float
28876 Generate output containing library calls for floating point.
28878 @strong{Warning:} the requisite libraries are not part of GCC@.
28879 Normally the facilities of the machine's usual C compiler are used, but
28880 this cannot be done directly in cross-compilation.  You must make your
28881 own arrangements to provide suitable library functions for
28882 cross-compilation.
28884 On machines where a function returns floating-point results in the 80387
28885 register stack, some floating-point opcodes may be emitted even if
28886 @option{-msoft-float} is used.
28888 @item -mno-fp-ret-in-387
28889 @opindex mno-fp-ret-in-387
28890 @opindex mfp-ret-in-387
28891 Do not use the FPU registers for return values of functions.
28893 The usual calling convention has functions return values of types
28894 @code{float} and @code{double} in an FPU register, even if there
28895 is no FPU@.  The idea is that the operating system should emulate
28896 an FPU@.
28898 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28899 in ordinary CPU registers instead.
28901 @item -mno-fancy-math-387
28902 @opindex mno-fancy-math-387
28903 @opindex mfancy-math-387
28904 Some 387 emulators do not support the @code{sin}, @code{cos} and
28905 @code{sqrt} instructions for the 387.  Specify this option to avoid
28906 generating those instructions.
28907 This option is overridden when @option{-march}
28908 indicates that the target CPU always has an FPU and so the
28909 instruction does not need emulation.  These
28910 instructions are not generated unless you also use the
28911 @option{-funsafe-math-optimizations} switch.
28913 @item -malign-double
28914 @itemx -mno-align-double
28915 @opindex malign-double
28916 @opindex mno-align-double
28917 Control whether GCC aligns @code{double}, @code{long double}, and
28918 @code{long long} variables on a two-word boundary or a one-word
28919 boundary.  Aligning @code{double} variables on a two-word boundary
28920 produces code that runs somewhat faster on a Pentium at the
28921 expense of more memory.
28923 On x86-64, @option{-malign-double} is enabled by default.
28925 @strong{Warning:} if you use the @option{-malign-double} switch,
28926 structures containing the above types are aligned differently than
28927 the published application binary interface specifications for the x86-32
28928 and are not binary compatible with structures in code compiled
28929 without that switch.
28931 @item -m96bit-long-double
28932 @itemx -m128bit-long-double
28933 @opindex m96bit-long-double
28934 @opindex m128bit-long-double
28935 These switches control the size of @code{long double} type.  The x86-32
28936 application binary interface specifies the size to be 96 bits,
28937 so @option{-m96bit-long-double} is the default in 32-bit mode.
28939 Modern architectures (Pentium and newer) prefer @code{long double}
28940 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
28941 conforming to the ABI, this is not possible.  So specifying
28942 @option{-m128bit-long-double} aligns @code{long double}
28943 to a 16-byte boundary by padding the @code{long double} with an additional
28944 32-bit zero.
28946 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28947 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28949 Notice that neither of these options enable any extra precision over the x87
28950 standard of 80 bits for a @code{long double}.
28952 @strong{Warning:} if you override the default value for your target ABI, this
28953 changes the size of 
28954 structures and arrays containing @code{long double} variables,
28955 as well as modifying the function calling convention for functions taking
28956 @code{long double}.  Hence they are not binary-compatible
28957 with code compiled without that switch.
28959 @item -mlong-double-64
28960 @itemx -mlong-double-80
28961 @itemx -mlong-double-128
28962 @opindex mlong-double-64
28963 @opindex mlong-double-80
28964 @opindex mlong-double-128
28965 These switches control the size of @code{long double} type. A size
28966 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28967 type. This is the default for 32-bit Bionic C library.  A size
28968 of 128 bits makes the @code{long double} type equivalent to the
28969 @code{__float128} type. This is the default for 64-bit Bionic C library.
28971 @strong{Warning:} if you override the default value for your target ABI, this
28972 changes the size of
28973 structures and arrays containing @code{long double} variables,
28974 as well as modifying the function calling convention for functions taking
28975 @code{long double}.  Hence they are not binary-compatible
28976 with code compiled without that switch.
28978 @item -malign-data=@var{type}
28979 @opindex malign-data
28980 Control how GCC aligns variables.  Supported values for @var{type} are
28981 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28982 and earlier, @samp{abi} uses alignment value as specified by the
28983 psABI, and @samp{cacheline} uses increased alignment value to match
28984 the cache line size.  @samp{compat} is the default.
28986 @item -mlarge-data-threshold=@var{threshold}
28987 @opindex mlarge-data-threshold
28988 When @option{-mcmodel=medium} is specified, data objects larger than
28989 @var{threshold} are placed in the large data section.  This value must be the
28990 same across all objects linked into the binary, and defaults to 65535.
28992 @item -mrtd
28993 @opindex mrtd
28994 Use a different function-calling convention, in which functions that
28995 take a fixed number of arguments return with the @code{ret @var{num}}
28996 instruction, which pops their arguments while returning.  This saves one
28997 instruction in the caller since there is no need to pop the arguments
28998 there.
29000 You can specify that an individual function is called with this calling
29001 sequence with the function attribute @code{stdcall}.  You can also
29002 override the @option{-mrtd} option by using the function attribute
29003 @code{cdecl}.  @xref{Function Attributes}.
29005 @strong{Warning:} this calling convention is incompatible with the one
29006 normally used on Unix, so you cannot use it if you need to call
29007 libraries compiled with the Unix compiler.
29009 Also, you must provide function prototypes for all functions that
29010 take variable numbers of arguments (including @code{printf});
29011 otherwise incorrect code is generated for calls to those
29012 functions.
29014 In addition, seriously incorrect code results if you call a
29015 function with too many arguments.  (Normally, extra arguments are
29016 harmlessly ignored.)
29018 @item -mregparm=@var{num}
29019 @opindex mregparm
29020 Control how many registers are used to pass integer arguments.  By
29021 default, no registers are used to pass arguments, and at most 3
29022 registers can be used.  You can control this behavior for a specific
29023 function by using the function attribute @code{regparm}.
29024 @xref{Function Attributes}.
29026 @strong{Warning:} if you use this switch, and
29027 @var{num} is nonzero, then you must build all modules with the same
29028 value, including any libraries.  This includes the system libraries and
29029 startup modules.
29031 @item -msseregparm
29032 @opindex msseregparm
29033 Use SSE register passing conventions for float and double arguments
29034 and return values.  You can control this behavior for a specific
29035 function by using the function attribute @code{sseregparm}.
29036 @xref{Function Attributes}.
29038 @strong{Warning:} if you use this switch then you must build all
29039 modules with the same value, including any libraries.  This includes
29040 the system libraries and startup modules.
29042 @item -mvect8-ret-in-mem
29043 @opindex mvect8-ret-in-mem
29044 Return 8-byte vectors in memory instead of MMX registers.  This is the
29045 default on VxWorks to match the ABI of the Sun Studio compilers until
29046 version 12.  @emph{Only} use this option if you need to remain
29047 compatible with existing code produced by those previous compiler
29048 versions or older versions of GCC@.
29050 @item -mpc32
29051 @itemx -mpc64
29052 @itemx -mpc80
29053 @opindex mpc32
29054 @opindex mpc64
29055 @opindex mpc80
29057 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
29058 is specified, the significands of results of floating-point operations are
29059 rounded to 24 bits (single precision); @option{-mpc64} rounds the
29060 significands of results of floating-point operations to 53 bits (double
29061 precision) and @option{-mpc80} rounds the significands of results of
29062 floating-point operations to 64 bits (extended double precision), which is
29063 the default.  When this option is used, floating-point operations in higher
29064 precisions are not available to the programmer without setting the FPU
29065 control word explicitly.
29067 Setting the rounding of floating-point operations to less than the default
29068 80 bits can speed some programs by 2% or more.  Note that some mathematical
29069 libraries assume that extended-precision (80-bit) floating-point operations
29070 are enabled by default; routines in such libraries could suffer significant
29071 loss of accuracy, typically through so-called ``catastrophic cancellation'',
29072 when this option is used to set the precision to less than extended precision.
29074 @item -mstackrealign
29075 @opindex mstackrealign
29076 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
29077 option generates an alternate prologue and epilogue that realigns the
29078 run-time stack if necessary.  This supports mixing legacy codes that keep
29079 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
29080 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
29081 applicable to individual functions.
29083 @item -mpreferred-stack-boundary=@var{num}
29084 @opindex mpreferred-stack-boundary
29085 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29086 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29087 the default is 4 (16 bytes or 128 bits).
29089 @strong{Warning:} When generating code for the x86-64 architecture with
29090 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29091 used to keep the stack boundary aligned to 8 byte boundary.  Since
29092 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29093 intended to be used in controlled environment where stack space is
29094 important limitation.  This option leads to wrong code when functions
29095 compiled with 16 byte stack alignment (such as functions from a standard
29096 library) are called with misaligned stack.  In this case, SSE
29097 instructions may lead to misaligned memory access traps.  In addition,
29098 variable arguments are handled incorrectly for 16 byte aligned
29099 objects (including x87 long double and __int128), leading to wrong
29100 results.  You must build all modules with
29101 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
29102 includes the system libraries and startup modules.
29104 @item -mincoming-stack-boundary=@var{num}
29105 @opindex mincoming-stack-boundary
29106 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29107 boundary.  If @option{-mincoming-stack-boundary} is not specified,
29108 the one specified by @option{-mpreferred-stack-boundary} is used.
29110 On Pentium and Pentium Pro, @code{double} and @code{long double} values
29111 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29112 suffer significant run time performance penalties.  On Pentium III, the
29113 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29114 properly if it is not 16-byte aligned.
29116 To ensure proper alignment of this values on the stack, the stack boundary
29117 must be as aligned as that required by any value stored on the stack.
29118 Further, every function must be generated such that it keeps the stack
29119 aligned.  Thus calling a function compiled with a higher preferred
29120 stack boundary from a function compiled with a lower preferred stack
29121 boundary most likely misaligns the stack.  It is recommended that
29122 libraries that use callbacks always use the default setting.
29124 This extra alignment does consume extra stack space, and generally
29125 increases code size.  Code that is sensitive to stack space usage, such
29126 as embedded systems and operating system kernels, may want to reduce the
29127 preferred alignment to @option{-mpreferred-stack-boundary=2}.
29129 @need 200
29130 @item -mmmx
29131 @opindex mmmx
29132 @need 200
29133 @itemx -msse
29134 @opindex msse
29135 @need 200
29136 @itemx -msse2
29137 @opindex msse2
29138 @need 200
29139 @itemx -msse3
29140 @opindex msse3
29141 @need 200
29142 @itemx -mssse3
29143 @opindex mssse3
29144 @need 200
29145 @itemx -msse4
29146 @opindex msse4
29147 @need 200
29148 @itemx -msse4a
29149 @opindex msse4a
29150 @need 200
29151 @itemx -msse4.1
29152 @opindex msse4.1
29153 @need 200
29154 @itemx -msse4.2
29155 @opindex msse4.2
29156 @need 200
29157 @itemx -mavx
29158 @opindex mavx
29159 @need 200
29160 @itemx -mavx2
29161 @opindex mavx2
29162 @need 200
29163 @itemx -mavx512f
29164 @opindex mavx512f
29165 @need 200
29166 @itemx -mavx512pf
29167 @opindex mavx512pf
29168 @need 200
29169 @itemx -mavx512er
29170 @opindex mavx512er
29171 @need 200
29172 @itemx -mavx512cd
29173 @opindex mavx512cd
29174 @need 200
29175 @itemx -mavx512vl
29176 @opindex mavx512vl
29177 @need 200
29178 @itemx -mavx512bw
29179 @opindex mavx512bw
29180 @need 200
29181 @itemx -mavx512dq
29182 @opindex mavx512dq
29183 @need 200
29184 @itemx -mavx512ifma
29185 @opindex mavx512ifma
29186 @need 200
29187 @itemx -mavx512vbmi
29188 @opindex mavx512vbmi
29189 @need 200
29190 @itemx -msha
29191 @opindex msha
29192 @need 200
29193 @itemx -maes
29194 @opindex maes
29195 @need 200
29196 @itemx -mpclmul
29197 @opindex mpclmul
29198 @need 200
29199 @itemx -mclflushopt
29200 @opindex mclflushopt
29201 @need 200
29202 @itemx -mclwb
29203 @opindex mclwb
29204 @need 200
29205 @itemx -mfsgsbase
29206 @opindex mfsgsbase
29207 @need 200
29208 @itemx -mptwrite
29209 @opindex mptwrite
29210 @need 200
29211 @itemx -mrdrnd
29212 @opindex mrdrnd
29213 @need 200
29214 @itemx -mf16c
29215 @opindex mf16c
29216 @need 200
29217 @itemx -mfma
29218 @opindex mfma
29219 @need 200
29220 @itemx -mpconfig
29221 @opindex mpconfig
29222 @need 200
29223 @itemx -mwbnoinvd
29224 @opindex mwbnoinvd
29225 @need 200
29226 @itemx -mfma4
29227 @opindex mfma4
29228 @need 200
29229 @itemx -mprfchw
29230 @opindex mprfchw
29231 @need 200
29232 @itemx -mrdpid
29233 @opindex mrdpid
29234 @need 200
29235 @itemx -mprefetchwt1
29236 @opindex mprefetchwt1
29237 @need 200
29238 @itemx -mrdseed
29239 @opindex mrdseed
29240 @need 200
29241 @itemx -msgx
29242 @opindex msgx
29243 @need 200
29244 @itemx -mxop
29245 @opindex mxop
29246 @need 200
29247 @itemx -mlwp
29248 @opindex mlwp
29249 @need 200
29250 @itemx -m3dnow
29251 @opindex m3dnow
29252 @need 200
29253 @itemx -m3dnowa
29254 @opindex m3dnowa
29255 @need 200
29256 @itemx -mpopcnt
29257 @opindex mpopcnt
29258 @need 200
29259 @itemx -mabm
29260 @opindex mabm
29261 @need 200
29262 @itemx -madx
29263 @opindex madx
29264 @need 200
29265 @itemx -mbmi
29266 @opindex mbmi
29267 @need 200
29268 @itemx -mbmi2
29269 @opindex mbmi2
29270 @need 200
29271 @itemx -mlzcnt
29272 @opindex mlzcnt
29273 @need 200
29274 @itemx -mfxsr
29275 @opindex mfxsr
29276 @need 200
29277 @itemx -mxsave
29278 @opindex mxsave
29279 @need 200
29280 @itemx -mxsaveopt
29281 @opindex mxsaveopt
29282 @need 200
29283 @itemx -mxsavec
29284 @opindex mxsavec
29285 @need 200
29286 @itemx -mxsaves
29287 @opindex mxsaves
29288 @need 200
29289 @itemx -mrtm
29290 @opindex mrtm
29291 @need 200
29292 @itemx -mhle
29293 @opindex mhle
29294 @need 200
29295 @itemx -mtbm
29296 @opindex mtbm
29297 @need 200
29298 @itemx -mmwaitx
29299 @opindex mmwaitx
29300 @need 200
29301 @itemx -mclzero
29302 @opindex mclzero
29303 @need 200
29304 @itemx -mpku
29305 @opindex mpku
29306 @need 200
29307 @itemx -mavx512vbmi2
29308 @opindex mavx512vbmi2
29309 @need 200
29310 @itemx -mavx512bf16
29311 @opindex mavx512bf16
29312 @need 200
29313 @itemx -mgfni
29314 @opindex mgfni
29315 @need 200
29316 @itemx -mvaes
29317 @opindex mvaes
29318 @need 200
29319 @itemx -mwaitpkg
29320 @opindex mwaitpkg
29321 @need 200
29322 @itemx -mvpclmulqdq
29323 @opindex mvpclmulqdq
29324 @need 200
29325 @itemx -mavx512bitalg
29326 @opindex mavx512bitalg
29327 @need 200
29328 @itemx -mmovdiri
29329 @opindex mmovdiri
29330 @need 200
29331 @itemx -mmovdir64b
29332 @opindex mmovdir64b
29333 @need 200
29334 @itemx -menqcmd
29335 @opindex menqcmd
29336 @need 200
29337 @itemx -mavx512vpopcntdq
29338 @opindex mavx512vpopcntdq
29339 @need 200
29340 @itemx -mavx512vp2intersect
29341 @opindex mavx512vp2intersect
29342 @need 200
29343 @itemx -mavx5124fmaps
29344 @opindex mavx5124fmaps
29345 @need 200
29346 @itemx -mavx512vnni
29347 @opindex mavx512vnni
29348 @need 200
29349 @itemx -mavx5124vnniw
29350 @opindex mavx5124vnniw
29351 @need 200
29352 @itemx -mcldemote
29353 @opindex mcldemote
29354 These switches enable the use of instructions in the MMX, SSE,
29355 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29356 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29357 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29358 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
29359 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29360 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29361 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29362 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
29363 extended instruction sets.  Each has a corresponding @option{-mno-} option to
29364 disable use of these instructions.
29366 These extensions are also available as built-in functions: see
29367 @ref{x86 Built-in Functions}, for details of the functions enabled and
29368 disabled by these switches.
29370 To generate SSE/SSE2 instructions automatically from floating-point
29371 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29373 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29374 generates new AVX instructions or AVX equivalence for all SSEx instructions
29375 when needed.
29377 These options enable GCC to use these extended instructions in
29378 generated code, even without @option{-mfpmath=sse}.  Applications that
29379 perform run-time CPU detection must compile separate files for each
29380 supported architecture, using the appropriate flags.  In particular,
29381 the file containing the CPU detection code should be compiled without
29382 these options.
29384 @item -mdump-tune-features
29385 @opindex mdump-tune-features
29386 This option instructs GCC to dump the names of the x86 performance 
29387 tuning features and default settings. The names can be used in 
29388 @option{-mtune-ctrl=@var{feature-list}}.
29390 @item -mtune-ctrl=@var{feature-list}
29391 @opindex mtune-ctrl=@var{feature-list}
29392 This option is used to do fine grain control of x86 code generation features.
29393 @var{feature-list} is a comma separated list of @var{feature} names. See also
29394 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
29395 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
29396 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29397 developers. Using it may lead to code paths not covered by testing and can
29398 potentially result in compiler ICEs or runtime errors.
29400 @item -mno-default
29401 @opindex mno-default
29402 This option instructs GCC to turn off all tunable features. See also 
29403 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29405 @item -mcld
29406 @opindex mcld
29407 This option instructs GCC to emit a @code{cld} instruction in the prologue
29408 of functions that use string instructions.  String instructions depend on
29409 the DF flag to select between autoincrement or autodecrement mode.  While the
29410 ABI specifies the DF flag to be cleared on function entry, some operating
29411 systems violate this specification by not clearing the DF flag in their
29412 exception dispatchers.  The exception handler can be invoked with the DF flag
29413 set, which leads to wrong direction mode when string instructions are used.
29414 This option can be enabled by default on 32-bit x86 targets by configuring
29415 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
29416 instructions can be suppressed with the @option{-mno-cld} compiler option
29417 in this case.
29419 @item -mvzeroupper
29420 @opindex mvzeroupper
29421 This option instructs GCC to emit a @code{vzeroupper} instruction
29422 before a transfer of control flow out of the function to minimize
29423 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29424 intrinsics.
29426 @item -mprefer-avx128
29427 @opindex mprefer-avx128
29428 This option instructs GCC to use 128-bit AVX instructions instead of
29429 256-bit AVX instructions in the auto-vectorizer.
29431 @item -mprefer-vector-width=@var{opt}
29432 @opindex mprefer-vector-width
29433 This option instructs GCC to use @var{opt}-bit vector width in instructions
29434 instead of default on the selected platform.
29436 @table @samp
29437 @item none
29438 No extra limitations applied to GCC other than defined by the selected platform.
29440 @item 128
29441 Prefer 128-bit vector width for instructions.
29443 @item 256
29444 Prefer 256-bit vector width for instructions.
29446 @item 512
29447 Prefer 512-bit vector width for instructions.
29448 @end table
29450 @item -mcx16
29451 @opindex mcx16
29452 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29453 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29454 objects.  This is useful for atomic updates of data structures exceeding one
29455 machine word in size.  The compiler uses this instruction to implement
29456 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
29457 128-bit integers, a library call is always used.
29459 @item -msahf
29460 @opindex msahf
29461 This option enables generation of @code{SAHF} instructions in 64-bit code.
29462 Early Intel Pentium 4 CPUs with Intel 64 support,
29463 prior to the introduction of Pentium 4 G1 step in December 2005,
29464 lacked the @code{LAHF} and @code{SAHF} instructions
29465 which are supported by AMD64.
29466 These are load and store instructions, respectively, for certain status flags.
29467 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29468 @code{drem}, and @code{remainder} built-in functions;
29469 see @ref{Other Builtins} for details.
29471 @item -mmovbe
29472 @opindex mmovbe
29473 This option enables use of the @code{movbe} instruction to implement
29474 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
29476 @item -mshstk
29477 @opindex mshstk
29478 The @option{-mshstk} option enables shadow stack built-in functions
29479 from x86 Control-flow Enforcement Technology (CET).
29481 @item -mcrc32
29482 @opindex mcrc32
29483 This option enables built-in functions @code{__builtin_ia32_crc32qi},
29484 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29485 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29487 @item -mrecip
29488 @opindex mrecip
29489 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29490 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29491 with an additional Newton-Raphson step
29492 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29493 (and their vectorized
29494 variants) for single-precision floating-point arguments.  These instructions
29495 are generated only when @option{-funsafe-math-optimizations} is enabled
29496 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29497 Note that while the throughput of the sequence is higher than the throughput
29498 of the non-reciprocal instruction, the precision of the sequence can be
29499 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29501 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29502 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29503 combination), and doesn't need @option{-mrecip}.
29505 Also note that GCC emits the above sequence with additional Newton-Raphson step
29506 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
29507 already with @option{-ffast-math} (or the above option combination), and
29508 doesn't need @option{-mrecip}.
29510 @item -mrecip=@var{opt}
29511 @opindex mrecip=opt
29512 This option controls which reciprocal estimate instructions
29513 may be used.  @var{opt} is a comma-separated list of options, which may
29514 be preceded by a @samp{!} to invert the option:
29516 @table @samp
29517 @item all
29518 Enable all estimate instructions.
29520 @item default
29521 Enable the default instructions, equivalent to @option{-mrecip}.
29523 @item none
29524 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29526 @item div
29527 Enable the approximation for scalar division.
29529 @item vec-div
29530 Enable the approximation for vectorized division.
29532 @item sqrt
29533 Enable the approximation for scalar square root.
29535 @item vec-sqrt
29536 Enable the approximation for vectorized square root.
29537 @end table
29539 So, for example, @option{-mrecip=all,!sqrt} enables
29540 all of the reciprocal approximations, except for square root.
29542 @item -mveclibabi=@var{type}
29543 @opindex mveclibabi
29544 Specifies the ABI type to use for vectorizing intrinsics using an
29545 external library.  Supported values for @var{type} are @samp{svml} 
29546 for the Intel short
29547 vector math library and @samp{acml} for the AMD math core library.
29548 To use this option, both @option{-ftree-vectorize} and
29549 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
29550 ABI-compatible library must be specified at link time.
29552 GCC currently emits calls to @code{vmldExp2},
29553 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
29554 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
29555 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
29556 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
29557 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
29558 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
29559 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
29560 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
29561 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
29562 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
29563 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
29564 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
29565 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
29566 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
29567 when @option{-mveclibabi=acml} is used.  
29569 @item -mabi=@var{name}
29570 @opindex mabi
29571 Generate code for the specified calling convention.  Permissible values
29572 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
29573 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
29574 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
29575 You can control this behavior for specific functions by
29576 using the function attributes @code{ms_abi} and @code{sysv_abi}.
29577 @xref{Function Attributes}.
29579 @item -mforce-indirect-call
29580 @opindex mforce-indirect-call
29581 Force all calls to functions to be indirect. This is useful
29582 when using Intel Processor Trace where it generates more precise timing
29583 information for function calls.
29585 @item -mmanual-endbr
29586 @opindex mmanual-endbr
29587 Insert ENDBR instruction at function entry only via the @code{cf_check}
29588 function attribute. This is useful when used with the option
29589 @option{-fcf-protection=branch} to control ENDBR insertion at the
29590 function entry.
29592 @item -mcall-ms2sysv-xlogues
29593 @opindex mcall-ms2sysv-xlogues
29594 @opindex mno-call-ms2sysv-xlogues
29595 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
29596 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
29597 default, the code for saving and restoring these registers is emitted inline,
29598 resulting in fairly lengthy prologues and epilogues.  Using
29599 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
29600 use stubs in the static portion of libgcc to perform these saves and restores,
29601 thus reducing function size at the cost of a few extra instructions.
29603 @item -mtls-dialect=@var{type}
29604 @opindex mtls-dialect
29605 Generate code to access thread-local storage using the @samp{gnu} or
29606 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
29607 @samp{gnu2} is more efficient, but it may add compile- and run-time
29608 requirements that cannot be satisfied on all systems.
29610 @item -mpush-args
29611 @itemx -mno-push-args
29612 @opindex mpush-args
29613 @opindex mno-push-args
29614 Use PUSH operations to store outgoing parameters.  This method is shorter
29615 and usually equally fast as method using SUB/MOV operations and is enabled
29616 by default.  In some cases disabling it may improve performance because of
29617 improved scheduling and reduced dependencies.
29619 @item -maccumulate-outgoing-args
29620 @opindex maccumulate-outgoing-args
29621 If enabled, the maximum amount of space required for outgoing arguments is
29622 computed in the function prologue.  This is faster on most modern CPUs
29623 because of reduced dependencies, improved scheduling and reduced stack usage
29624 when the preferred stack boundary is not equal to 2.  The drawback is a notable
29625 increase in code size.  This switch implies @option{-mno-push-args}.
29627 @item -mthreads
29628 @opindex mthreads
29629 Support thread-safe exception handling on MinGW.  Programs that rely
29630 on thread-safe exception handling must compile and link all code with the
29631 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
29632 @option{-D_MT}; when linking, it links in a special thread helper library
29633 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
29635 @item -mms-bitfields
29636 @itemx -mno-ms-bitfields
29637 @opindex mms-bitfields
29638 @opindex mno-ms-bitfields
29640 Enable/disable bit-field layout compatible with the native Microsoft
29641 Windows compiler.  
29643 If @code{packed} is used on a structure, or if bit-fields are used,
29644 it may be that the Microsoft ABI lays out the structure differently
29645 than the way GCC normally does.  Particularly when moving packed
29646 data between functions compiled with GCC and the native Microsoft compiler
29647 (either via function call or as data in a file), it may be necessary to access
29648 either format.
29650 This option is enabled by default for Microsoft Windows
29651 targets.  This behavior can also be controlled locally by use of variable
29652 or type attributes.  For more information, see @ref{x86 Variable Attributes}
29653 and @ref{x86 Type Attributes}.
29655 The Microsoft structure layout algorithm is fairly simple with the exception
29656 of the bit-field packing.  
29657 The padding and alignment of members of structures and whether a bit-field 
29658 can straddle a storage-unit boundary are determine by these rules:
29660 @enumerate
29661 @item Structure members are stored sequentially in the order in which they are
29662 declared: the first member has the lowest memory address and the last member
29663 the highest.
29665 @item Every data object has an alignment requirement.  The alignment requirement
29666 for all data except structures, unions, and arrays is either the size of the
29667 object or the current packing size (specified with either the
29668 @code{aligned} attribute or the @code{pack} pragma),
29669 whichever is less.  For structures, unions, and arrays,
29670 the alignment requirement is the largest alignment requirement of its members.
29671 Every object is allocated an offset so that:
29673 @smallexample
29674 offset % alignment_requirement == 0
29675 @end smallexample
29677 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
29678 unit if the integral types are the same size and if the next bit-field fits
29679 into the current allocation unit without crossing the boundary imposed by the
29680 common alignment requirements of the bit-fields.
29681 @end enumerate
29683 MSVC interprets zero-length bit-fields in the following ways:
29685 @enumerate
29686 @item If a zero-length bit-field is inserted between two bit-fields that
29687 are normally coalesced, the bit-fields are not coalesced.
29689 For example:
29691 @smallexample
29692 struct
29693  @{
29694    unsigned long bf_1 : 12;
29695    unsigned long : 0;
29696    unsigned long bf_2 : 12;
29697  @} t1;
29698 @end smallexample
29700 @noindent
29701 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
29702 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
29704 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
29705 alignment of the zero-length bit-field is greater than the member that follows it,
29706 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
29708 For example:
29710 @smallexample
29711 struct
29712  @{
29713    char foo : 4;
29714    short : 0;
29715    char bar;
29716  @} t2;
29718 struct
29719  @{
29720    char foo : 4;
29721    short : 0;
29722    double bar;
29723  @} t3;
29724 @end smallexample
29726 @noindent
29727 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
29728 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
29729 bit-field does not affect the alignment of @code{bar} or, as a result, the size
29730 of the structure.
29732 Taking this into account, it is important to note the following:
29734 @enumerate
29735 @item If a zero-length bit-field follows a normal bit-field, the type of the
29736 zero-length bit-field may affect the alignment of the structure as whole. For
29737 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
29738 normal bit-field, and is of type short.
29740 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
29741 still affect the alignment of the structure:
29743 @smallexample
29744 struct
29745  @{
29746    char foo : 6;
29747    long : 0;
29748  @} t4;
29749 @end smallexample
29751 @noindent
29752 Here, @code{t4} takes up 4 bytes.
29753 @end enumerate
29755 @item Zero-length bit-fields following non-bit-field members are ignored:
29757 @smallexample
29758 struct
29759  @{
29760    char foo;
29761    long : 0;
29762    char bar;
29763  @} t5;
29764 @end smallexample
29766 @noindent
29767 Here, @code{t5} takes up 2 bytes.
29768 @end enumerate
29771 @item -mno-align-stringops
29772 @opindex mno-align-stringops
29773 @opindex malign-stringops
29774 Do not align the destination of inlined string operations.  This switch reduces
29775 code size and improves performance in case the destination is already aligned,
29776 but GCC doesn't know about it.
29778 @item -minline-all-stringops
29779 @opindex minline-all-stringops
29780 By default GCC inlines string operations only when the destination is 
29781 known to be aligned to least a 4-byte boundary.  
29782 This enables more inlining and increases code
29783 size, but may improve performance of code that depends on fast
29784 @code{memcpy} and @code{memset} for short lengths.
29785 The option enables inline expansion of @code{strlen} for all
29786 pointer alignments.
29788 @item -minline-stringops-dynamically
29789 @opindex minline-stringops-dynamically
29790 For string operations of unknown size, use run-time checks with
29791 inline code for small blocks and a library call for large blocks.
29793 @item -mstringop-strategy=@var{alg}
29794 @opindex mstringop-strategy=@var{alg}
29795 Override the internal decision heuristic for the particular algorithm to use
29796 for inlining string operations.  The allowed values for @var{alg} are:
29798 @table @samp
29799 @item rep_byte
29800 @itemx rep_4byte
29801 @itemx rep_8byte
29802 Expand using i386 @code{rep} prefix of the specified size.
29804 @item byte_loop
29805 @itemx loop
29806 @itemx unrolled_loop
29807 Expand into an inline loop.
29809 @item libcall
29810 Always use a library call.
29811 @end table
29813 @item -mmemcpy-strategy=@var{strategy}
29814 @opindex mmemcpy-strategy=@var{strategy}
29815 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
29816 should be inlined and what inline algorithm to use when the expected size
29817 of the copy operation is known. @var{strategy} 
29818 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
29819 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
29820 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
29821 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
29822 in the list must be specified in increasing order.  The minimal byte size for 
29823 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
29824 preceding range.
29826 @item -mmemset-strategy=@var{strategy}
29827 @opindex mmemset-strategy=@var{strategy}
29828 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
29829 @code{__builtin_memset} expansion.
29831 @item -momit-leaf-frame-pointer
29832 @opindex momit-leaf-frame-pointer
29833 Don't keep the frame pointer in a register for leaf functions.  This
29834 avoids the instructions to save, set up, and restore frame pointers and
29835 makes an extra register available in leaf functions.  The option
29836 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
29837 which might make debugging harder.
29839 @item -mtls-direct-seg-refs
29840 @itemx -mno-tls-direct-seg-refs
29841 @opindex mtls-direct-seg-refs
29842 Controls whether TLS variables may be accessed with offsets from the
29843 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
29844 or whether the thread base pointer must be added.  Whether or not this
29845 is valid depends on the operating system, and whether it maps the
29846 segment to cover the entire TLS area.
29848 For systems that use the GNU C Library, the default is on.
29850 @item -msse2avx
29851 @itemx -mno-sse2avx
29852 @opindex msse2avx
29853 Specify that the assembler should encode SSE instructions with VEX
29854 prefix.  The option @option{-mavx} turns this on by default.
29856 @item -mfentry
29857 @itemx -mno-fentry
29858 @opindex mfentry
29859 If profiling is active (@option{-pg}), put the profiling
29860 counter call before the prologue.
29861 Note: On x86 architectures the attribute @code{ms_hook_prologue}
29862 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
29864 @item -mrecord-mcount
29865 @itemx -mno-record-mcount
29866 @opindex mrecord-mcount
29867 If profiling is active (@option{-pg}), generate a __mcount_loc section
29868 that contains pointers to each profiling call. This is useful for
29869 automatically patching and out calls.
29871 @item -mnop-mcount
29872 @itemx -mno-nop-mcount
29873 @opindex mnop-mcount
29874 If profiling is active (@option{-pg}), generate the calls to
29875 the profiling functions as NOPs. This is useful when they
29876 should be patched in later dynamically. This is likely only
29877 useful together with @option{-mrecord-mcount}.
29879 @item -minstrument-return=@var{type}
29880 @opindex minstrument-return
29881 Instrument function exit in -pg -mfentry instrumented functions with
29882 call to specified function. This only instruments true returns ending
29883 with ret, but not sibling calls ending with jump. Valid types
29884 are @var{none} to not instrument, @var{call} to generate a call to __return__,
29885 or @var{nop5} to generate a 5 byte nop.
29887 @item -mrecord-return
29888 @itemx -mno-record-return
29889 @opindex mrecord-return
29890 Generate a __return_loc section pointing to all return instrumentation code.
29892 @item -mfentry-name=@var{name}
29893 @opindex mfentry-name
29894 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
29896 @item -mfentry-section=@var{name}
29897 @opindex mfentry-section
29898 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
29900 @item -mskip-rax-setup
29901 @itemx -mno-skip-rax-setup
29902 @opindex mskip-rax-setup
29903 When generating code for the x86-64 architecture with SSE extensions
29904 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29905 register when there are no variable arguments passed in vector registers.
29907 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29908 saving vector registers on stack when passing variable arguments, the
29909 impacts of this option are callees may waste some stack space,
29910 misbehave or jump to a random location.  GCC 4.4 or newer don't have
29911 those issues, regardless the RAX register value.
29913 @item -m8bit-idiv
29914 @itemx -mno-8bit-idiv
29915 @opindex m8bit-idiv
29916 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29917 much faster than 32-bit/64-bit integer divide.  This option generates a
29918 run-time check.  If both dividend and divisor are within range of 0
29919 to 255, 8-bit unsigned integer divide is used instead of
29920 32-bit/64-bit integer divide.
29922 @item -mavx256-split-unaligned-load
29923 @itemx -mavx256-split-unaligned-store
29924 @opindex mavx256-split-unaligned-load
29925 @opindex mavx256-split-unaligned-store
29926 Split 32-byte AVX unaligned load and store.
29928 @item -mstack-protector-guard=@var{guard}
29929 @itemx -mstack-protector-guard-reg=@var{reg}
29930 @itemx -mstack-protector-guard-offset=@var{offset}
29931 @opindex mstack-protector-guard
29932 @opindex mstack-protector-guard-reg
29933 @opindex mstack-protector-guard-offset
29934 Generate stack protection code using canary at @var{guard}.  Supported
29935 locations are @samp{global} for global canary or @samp{tls} for per-thread
29936 canary in the TLS block (the default).  This option has effect only when
29937 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29939 With the latter choice the options
29940 @option{-mstack-protector-guard-reg=@var{reg}} and
29941 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29942 which segment register (@code{%fs} or @code{%gs}) to use as base register
29943 for reading the canary, and from what offset from that base register.
29944 The default for those is as specified in the relevant ABI.
29946 @item -mgeneral-regs-only
29947 @opindex mgeneral-regs-only
29948 Generate code that uses only the general-purpose registers.  This
29949 prevents the compiler from using floating-point, vector, mask and bound
29950 registers.
29952 @item -mindirect-branch=@var{choice}
29953 @opindex mindirect-branch
29954 Convert indirect call and jump with @var{choice}.  The default is
29955 @samp{keep}, which keeps indirect call and jump unmodified.
29956 @samp{thunk} converts indirect call and jump to call and return thunk.
29957 @samp{thunk-inline} converts indirect call and jump to inlined call
29958 and return thunk.  @samp{thunk-extern} converts indirect call and jump
29959 to external call and return thunk provided in a separate object file.
29960 You can control this behavior for a specific function by using the
29961 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
29963 Note that @option{-mcmodel=large} is incompatible with
29964 @option{-mindirect-branch=thunk} and
29965 @option{-mindirect-branch=thunk-extern} since the thunk function may
29966 not be reachable in the large code model.
29968 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29969 @option{-fcf-protection=branch} since the external thunk cannot be modified
29970 to disable control-flow check.
29972 @item -mfunction-return=@var{choice}
29973 @opindex mfunction-return
29974 Convert function return with @var{choice}.  The default is @samp{keep},
29975 which keeps function return unmodified.  @samp{thunk} converts function
29976 return to call and return thunk.  @samp{thunk-inline} converts function
29977 return to inlined call and return thunk.  @samp{thunk-extern} converts
29978 function return to external call and return thunk provided in a separate
29979 object file.  You can control this behavior for a specific function by
29980 using the function attribute @code{function_return}.
29981 @xref{Function Attributes}.
29983 Note that @option{-mcmodel=large} is incompatible with
29984 @option{-mfunction-return=thunk} and
29985 @option{-mfunction-return=thunk-extern} since the thunk function may
29986 not be reachable in the large code model.
29989 @item -mindirect-branch-register
29990 @opindex mindirect-branch-register
29991 Force indirect call and jump via register.
29993 @end table
29995 These @samp{-m} switches are supported in addition to the above
29996 on x86-64 processors in 64-bit environments.
29998 @table @gcctabopt
29999 @item -m32
30000 @itemx -m64
30001 @itemx -mx32
30002 @itemx -m16
30003 @itemx -miamcu
30004 @opindex m32
30005 @opindex m64
30006 @opindex mx32
30007 @opindex m16
30008 @opindex miamcu
30009 Generate code for a 16-bit, 32-bit or 64-bit environment.
30010 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30011 to 32 bits, and
30012 generates code that runs on any i386 system.
30014 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30015 types to 64 bits, and generates code for the x86-64 architecture.
30016 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30017 and @option{-mdynamic-no-pic} options.
30019 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30020 to 32 bits, and
30021 generates code for the x86-64 architecture.
30023 The @option{-m16} option is the same as @option{-m32}, except for that
30024 it outputs the @code{.code16gcc} assembly directive at the beginning of
30025 the assembly output so that the binary can run in 16-bit mode.
30027 The @option{-miamcu} option generates code which conforms to Intel MCU
30028 psABI.  It requires the @option{-m32} option to be turned on.
30030 @item -mno-red-zone
30031 @opindex mno-red-zone
30032 @opindex mred-zone
30033 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
30034 by the x86-64 ABI; it is a 128-byte area beyond the location of the
30035 stack pointer that is not modified by signal or interrupt handlers
30036 and therefore can be used for temporary data without adjusting the stack
30037 pointer.  The flag @option{-mno-red-zone} disables this red zone.
30039 @item -mcmodel=small
30040 @opindex mcmodel=small
30041 Generate code for the small code model: the program and its symbols must
30042 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
30043 Programs can be statically or dynamically linked.  This is the default
30044 code model.
30046 @item -mcmodel=kernel
30047 @opindex mcmodel=kernel
30048 Generate code for the kernel code model.  The kernel runs in the
30049 negative 2 GB of the address space.
30050 This model has to be used for Linux kernel code.
30052 @item -mcmodel=medium
30053 @opindex mcmodel=medium
30054 Generate code for the medium model: the program is linked in the lower 2
30055 GB of the address space.  Small symbols are also placed there.  Symbols
30056 with sizes larger than @option{-mlarge-data-threshold} are put into
30057 large data or BSS sections and can be located above 2GB.  Programs can
30058 be statically or dynamically linked.
30060 @item -mcmodel=large
30061 @opindex mcmodel=large
30062 Generate code for the large model.  This model makes no assumptions
30063 about addresses and sizes of sections.
30065 @item -maddress-mode=long
30066 @opindex maddress-mode=long
30067 Generate code for long address mode.  This is only supported for 64-bit
30068 and x32 environments.  It is the default address mode for 64-bit
30069 environments.
30071 @item -maddress-mode=short
30072 @opindex maddress-mode=short
30073 Generate code for short address mode.  This is only supported for 32-bit
30074 and x32 environments.  It is the default address mode for 32-bit and
30075 x32 environments.
30076 @end table
30078 @node x86 Windows Options
30079 @subsection x86 Windows Options
30080 @cindex x86 Windows Options
30081 @cindex Windows Options for x86
30083 These additional options are available for Microsoft Windows targets:
30085 @table @gcctabopt
30086 @item -mconsole
30087 @opindex mconsole
30088 This option
30089 specifies that a console application is to be generated, by
30090 instructing the linker to set the PE header subsystem type
30091 required for console applications.
30092 This option is available for Cygwin and MinGW targets and is
30093 enabled by default on those targets.
30095 @item -mdll
30096 @opindex mdll
30097 This option is available for Cygwin and MinGW targets.  It
30098 specifies that a DLL---a dynamic link library---is to be
30099 generated, enabling the selection of the required runtime
30100 startup object and entry point.
30102 @item -mnop-fun-dllimport
30103 @opindex mnop-fun-dllimport
30104 This option is available for Cygwin and MinGW targets.  It
30105 specifies that the @code{dllimport} attribute should be ignored.
30107 @item -mthread
30108 @opindex mthread
30109 This option is available for MinGW targets. It specifies
30110 that MinGW-specific thread support is to be used.
30112 @item -municode
30113 @opindex municode
30114 This option is available for MinGW-w64 targets.  It causes
30115 the @code{UNICODE} preprocessor macro to be predefined, and
30116 chooses Unicode-capable runtime startup code.
30118 @item -mwin32
30119 @opindex mwin32
30120 This option is available for Cygwin and MinGW targets.  It
30121 specifies that the typical Microsoft Windows predefined macros are to
30122 be set in the pre-processor, but does not influence the choice
30123 of runtime library/startup code.
30125 @item -mwindows
30126 @opindex mwindows
30127 This option is available for Cygwin and MinGW targets.  It
30128 specifies that a GUI application is to be generated by
30129 instructing the linker to set the PE header subsystem type
30130 appropriately.
30132 @item -fno-set-stack-executable
30133 @opindex fno-set-stack-executable
30134 @opindex fset-stack-executable
30135 This option is available for MinGW targets. It specifies that
30136 the executable flag for the stack used by nested functions isn't
30137 set. This is necessary for binaries running in kernel mode of
30138 Microsoft Windows, as there the User32 API, which is used to set executable
30139 privileges, isn't available.
30141 @item -fwritable-relocated-rdata
30142 @opindex fno-writable-relocated-rdata
30143 @opindex fwritable-relocated-rdata
30144 This option is available for MinGW and Cygwin targets.  It specifies
30145 that relocated-data in read-only section is put into the @code{.data}
30146 section.  This is a necessary for older runtimes not supporting
30147 modification of @code{.rdata} sections for pseudo-relocation.
30149 @item -mpe-aligned-commons
30150 @opindex mpe-aligned-commons
30151 This option is available for Cygwin and MinGW targets.  It
30152 specifies that the GNU extension to the PE file format that
30153 permits the correct alignment of COMMON variables should be
30154 used when generating code.  It is enabled by default if
30155 GCC detects that the target assembler found during configuration
30156 supports the feature.
30157 @end table
30159 See also under @ref{x86 Options} for standard options.
30161 @node Xstormy16 Options
30162 @subsection Xstormy16 Options
30163 @cindex Xstormy16 Options
30165 These options are defined for Xstormy16:
30167 @table @gcctabopt
30168 @item -msim
30169 @opindex msim
30170 Choose startup files and linker script suitable for the simulator.
30171 @end table
30173 @node Xtensa Options
30174 @subsection Xtensa Options
30175 @cindex Xtensa Options
30177 These options are supported for Xtensa targets:
30179 @table @gcctabopt
30180 @item -mconst16
30181 @itemx -mno-const16
30182 @opindex mconst16
30183 @opindex mno-const16
30184 Enable or disable use of @code{CONST16} instructions for loading
30185 constant values.  The @code{CONST16} instruction is currently not a
30186 standard option from Tensilica.  When enabled, @code{CONST16}
30187 instructions are always used in place of the standard @code{L32R}
30188 instructions.  The use of @code{CONST16} is enabled by default only if
30189 the @code{L32R} instruction is not available.
30191 @item -mfused-madd
30192 @itemx -mno-fused-madd
30193 @opindex mfused-madd
30194 @opindex mno-fused-madd
30195 Enable or disable use of fused multiply/add and multiply/subtract
30196 instructions in the floating-point option.  This has no effect if the
30197 floating-point option is not also enabled.  Disabling fused multiply/add
30198 and multiply/subtract instructions forces the compiler to use separate
30199 instructions for the multiply and add/subtract operations.  This may be
30200 desirable in some cases where strict IEEE 754-compliant results are
30201 required: the fused multiply add/subtract instructions do not round the
30202 intermediate result, thereby producing results with @emph{more} bits of
30203 precision than specified by the IEEE standard.  Disabling fused multiply
30204 add/subtract instructions also ensures that the program output is not
30205 sensitive to the compiler's ability to combine multiply and add/subtract
30206 operations.
30208 @item -mserialize-volatile
30209 @itemx -mno-serialize-volatile
30210 @opindex mserialize-volatile
30211 @opindex mno-serialize-volatile
30212 When this option is enabled, GCC inserts @code{MEMW} instructions before
30213 @code{volatile} memory references to guarantee sequential consistency.
30214 The default is @option{-mserialize-volatile}.  Use
30215 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30217 @item -mforce-no-pic
30218 @opindex mforce-no-pic
30219 For targets, like GNU/Linux, where all user-mode Xtensa code must be
30220 position-independent code (PIC), this option disables PIC for compiling
30221 kernel code.
30223 @item -mtext-section-literals
30224 @itemx -mno-text-section-literals
30225 @opindex mtext-section-literals
30226 @opindex mno-text-section-literals
30227 These options control the treatment of literal pools.  The default is
30228 @option{-mno-text-section-literals}, which places literals in a separate
30229 section in the output file.  This allows the literal pool to be placed
30230 in a data RAM/ROM, and it also allows the linker to combine literal
30231 pools from separate object files to remove redundant literals and
30232 improve code size.  With @option{-mtext-section-literals}, the literals
30233 are interspersed in the text section in order to keep them as close as
30234 possible to their references.  This may be necessary for large assembly
30235 files.  Literals for each function are placed right before that function.
30237 @item -mauto-litpools
30238 @itemx -mno-auto-litpools
30239 @opindex mauto-litpools
30240 @opindex mno-auto-litpools
30241 These options control the treatment of literal pools.  The default is
30242 @option{-mno-auto-litpools}, which places literals in a separate
30243 section in the output file unless @option{-mtext-section-literals} is
30244 used.  With @option{-mauto-litpools} the literals are interspersed in
30245 the text section by the assembler.  Compiler does not produce explicit
30246 @code{.literal} directives and loads literals into registers with
30247 @code{MOVI} instructions instead of @code{L32R} to let the assembler
30248 do relaxation and place literals as necessary.  This option allows
30249 assembler to create several literal pools per function and assemble
30250 very big functions, which may not be possible with
30251 @option{-mtext-section-literals}.
30253 @item -mtarget-align
30254 @itemx -mno-target-align
30255 @opindex mtarget-align
30256 @opindex mno-target-align
30257 When this option is enabled, GCC instructs the assembler to
30258 automatically align instructions to reduce branch penalties at the
30259 expense of some code density.  The assembler attempts to widen density
30260 instructions to align branch targets and the instructions following call
30261 instructions.  If there are not enough preceding safe density
30262 instructions to align a target, no widening is performed.  The
30263 default is @option{-mtarget-align}.  These options do not affect the
30264 treatment of auto-aligned instructions like @code{LOOP}, which the
30265 assembler always aligns, either by widening density instructions or
30266 by inserting NOP instructions.
30268 @item -mlongcalls
30269 @itemx -mno-longcalls
30270 @opindex mlongcalls
30271 @opindex mno-longcalls
30272 When this option is enabled, GCC instructs the assembler to translate
30273 direct calls to indirect calls unless it can determine that the target
30274 of a direct call is in the range allowed by the call instruction.  This
30275 translation typically occurs for calls to functions in other source
30276 files.  Specifically, the assembler translates a direct @code{CALL}
30277 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30278 The default is @option{-mno-longcalls}.  This option should be used in
30279 programs where the call target can potentially be out of range.  This
30280 option is implemented in the assembler, not the compiler, so the
30281 assembly code generated by GCC still shows direct call
30282 instructions---look at the disassembled object code to see the actual
30283 instructions.  Note that the assembler uses an indirect call for
30284 every cross-file call, not just those that really are out of range.
30285 @end table
30287 @node zSeries Options
30288 @subsection zSeries Options
30289 @cindex zSeries options
30291 These are listed under @xref{S/390 and zSeries Options}.
30294 @c man end
30296 @node Spec Files
30297 @section Specifying Subprocesses and the Switches to Pass to Them
30298 @cindex Spec Files
30300 @command{gcc} is a driver program.  It performs its job by invoking a
30301 sequence of other programs to do the work of compiling, assembling and
30302 linking.  GCC interprets its command-line parameters and uses these to
30303 deduce which programs it should invoke, and which command-line options
30304 it ought to place on their command lines.  This behavior is controlled
30305 by @dfn{spec strings}.  In most cases there is one spec string for each
30306 program that GCC can invoke, but a few programs have multiple spec
30307 strings to control their behavior.  The spec strings built into GCC can
30308 be overridden by using the @option{-specs=} command-line switch to specify
30309 a spec file.
30311 @dfn{Spec files} are plain-text files that are used to construct spec
30312 strings.  They consist of a sequence of directives separated by blank
30313 lines.  The type of directive is determined by the first non-whitespace
30314 character on the line, which can be one of the following:
30316 @table @code
30317 @item %@var{command}
30318 Issues a @var{command} to the spec file processor.  The commands that can
30319 appear here are:
30321 @table @code
30322 @item %include <@var{file}>
30323 @cindex @code{%include}
30324 Search for @var{file} and insert its text at the current point in the
30325 specs file.
30327 @item %include_noerr <@var{file}>
30328 @cindex @code{%include_noerr}
30329 Just like @samp{%include}, but do not generate an error message if the include
30330 file cannot be found.
30332 @item %rename @var{old_name} @var{new_name}
30333 @cindex @code{%rename}
30334 Rename the spec string @var{old_name} to @var{new_name}.
30336 @end table
30338 @item *[@var{spec_name}]:
30339 This tells the compiler to create, override or delete the named spec
30340 string.  All lines after this directive up to the next directive or
30341 blank line are considered to be the text for the spec string.  If this
30342 results in an empty string then the spec is deleted.  (Or, if the
30343 spec did not exist, then nothing happens.)  Otherwise, if the spec
30344 does not currently exist a new spec is created.  If the spec does
30345 exist then its contents are overridden by the text of this
30346 directive, unless the first character of that text is the @samp{+}
30347 character, in which case the text is appended to the spec.
30349 @item [@var{suffix}]:
30350 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
30351 and up to the next directive or blank line are considered to make up the
30352 spec string for the indicated suffix.  When the compiler encounters an
30353 input file with the named suffix, it processes the spec string in
30354 order to work out how to compile that file.  For example:
30356 @smallexample
30357 .ZZ:
30358 z-compile -input %i
30359 @end smallexample
30361 This says that any input file whose name ends in @samp{.ZZ} should be
30362 passed to the program @samp{z-compile}, which should be invoked with the
30363 command-line switch @option{-input} and with the result of performing the
30364 @samp{%i} substitution.  (See below.)
30366 As an alternative to providing a spec string, the text following a
30367 suffix directive can be one of the following:
30369 @table @code
30370 @item @@@var{language}
30371 This says that the suffix is an alias for a known @var{language}.  This is
30372 similar to using the @option{-x} command-line switch to GCC to specify a
30373 language explicitly.  For example:
30375 @smallexample
30376 .ZZ:
30377 @@c++
30378 @end smallexample
30380 Says that .ZZ files are, in fact, C++ source files.
30382 @item #@var{name}
30383 This causes an error messages saying:
30385 @smallexample
30386 @var{name} compiler not installed on this system.
30387 @end smallexample
30388 @end table
30390 GCC already has an extensive list of suffixes built into it.
30391 This directive adds an entry to the end of the list of suffixes, but
30392 since the list is searched from the end backwards, it is effectively
30393 possible to override earlier entries using this technique.
30395 @end table
30397 GCC has the following spec strings built into it.  Spec files can
30398 override these strings or create their own.  Note that individual
30399 targets can also add their own spec strings to this list.
30401 @smallexample
30402 asm          Options to pass to the assembler
30403 asm_final    Options to pass to the assembler post-processor
30404 cpp          Options to pass to the C preprocessor
30405 cc1          Options to pass to the C compiler
30406 cc1plus      Options to pass to the C++ compiler
30407 endfile      Object files to include at the end of the link
30408 link         Options to pass to the linker
30409 lib          Libraries to include on the command line to the linker
30410 libgcc       Decides which GCC support library to pass to the linker
30411 linker       Sets the name of the linker
30412 predefines   Defines to be passed to the C preprocessor
30413 signed_char  Defines to pass to CPP to say whether @code{char} is signed
30414              by default
30415 startfile    Object files to include at the start of the link
30416 @end smallexample
30418 Here is a small example of a spec file:
30420 @smallexample
30421 %rename lib                 old_lib
30423 *lib:
30424 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
30425 @end smallexample
30427 This example renames the spec called @samp{lib} to @samp{old_lib} and
30428 then overrides the previous definition of @samp{lib} with a new one.
30429 The new definition adds in some extra command-line options before
30430 including the text of the old definition.
30432 @dfn{Spec strings} are a list of command-line options to be passed to their
30433 corresponding program.  In addition, the spec strings can contain
30434 @samp{%}-prefixed sequences to substitute variable text or to
30435 conditionally insert text into the command line.  Using these constructs
30436 it is possible to generate quite complex command lines.
30438 Here is a table of all defined @samp{%}-sequences for spec
30439 strings.  Note that spaces are not generated automatically around the
30440 results of expanding these sequences.  Therefore you can concatenate them
30441 together or combine them with constant text in a single argument.
30443 @table @code
30444 @item %%
30445 Substitute one @samp{%} into the program name or argument.
30447 @item %i
30448 Substitute the name of the input file being processed.
30450 @item %b
30451 Substitute the basename of the input file being processed.
30452 This is the substring up to (and not including) the last period
30453 and not including the directory.
30455 @item %B
30456 This is the same as @samp{%b}, but include the file suffix (text after
30457 the last period).
30459 @item %d
30460 Marks the argument containing or following the @samp{%d} as a
30461 temporary file name, so that that file is deleted if GCC exits
30462 successfully.  Unlike @samp{%g}, this contributes no text to the
30463 argument.
30465 @item %g@var{suffix}
30466 Substitute a file name that has suffix @var{suffix} and is chosen
30467 once per compilation, and mark the argument in the same way as
30468 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
30469 name is now chosen in a way that is hard to predict even when previously
30470 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30471 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
30472 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30473 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
30474 was simply substituted with a file name chosen once per compilation,
30475 without regard to any appended suffix (which was therefore treated
30476 just like ordinary text), making such attacks more likely to succeed.
30478 @item %u@var{suffix}
30479 Like @samp{%g}, but generates a new temporary file name
30480 each time it appears instead of once per compilation.
30482 @item %U@var{suffix}
30483 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30484 new one if there is no such last file name.  In the absence of any
30485 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30486 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30487 involves the generation of two distinct file names, one
30488 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
30489 simply substituted with a file name chosen for the previous @samp{%u},
30490 without regard to any appended suffix.
30492 @item %j@var{suffix}
30493 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30494 writable, and if @option{-save-temps} is not used; 
30495 otherwise, substitute the name
30496 of a temporary file, just like @samp{%u}.  This temporary file is not
30497 meant for communication between processes, but rather as a junk
30498 disposal mechanism.
30500 @item %|@var{suffix}
30501 @itemx %m@var{suffix}
30502 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
30503 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
30504 all.  These are the two most common ways to instruct a program that it
30505 should read from standard input or write to standard output.  If you
30506 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
30507 construct: see for example @file{gcc/fortran/lang-specs.h}.
30509 @item %.@var{SUFFIX}
30510 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
30511 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
30512 terminated by the next space or %.
30514 @item %w
30515 Marks the argument containing or following the @samp{%w} as the
30516 designated output file of this compilation.  This puts the argument
30517 into the sequence of arguments that @samp{%o} substitutes.
30519 @item %o
30520 Substitutes the names of all the output files, with spaces
30521 automatically placed around them.  You should write spaces
30522 around the @samp{%o} as well or the results are undefined.
30523 @samp{%o} is for use in the specs for running the linker.
30524 Input files whose names have no recognized suffix are not compiled
30525 at all, but they are included among the output files, so they are
30526 linked.
30528 @item %O
30529 Substitutes the suffix for object files.  Note that this is
30530 handled specially when it immediately follows @samp{%g, %u, or %U},
30531 because of the need for those to form complete file names.  The
30532 handling is such that @samp{%O} is treated exactly as if it had already
30533 been substituted, except that @samp{%g, %u, and %U} do not currently
30534 support additional @var{suffix} characters following @samp{%O} as they do
30535 following, for example, @samp{.o}.
30537 @item %p
30538 Substitutes the standard macro predefinitions for the
30539 current target machine.  Use this when running @command{cpp}.
30541 @item %P
30542 Like @samp{%p}, but puts @samp{__} before and after the name of each
30543 predefined macro, except for macros that start with @samp{__} or with
30544 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
30547 @item %I
30548 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
30549 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
30550 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
30551 and @option{-imultilib} as necessary.
30553 @item %s
30554 Current argument is the name of a library or startup file of some sort.
30555 Search for that file in a standard list of directories and substitute
30556 the full name found.  The current working directory is included in the
30557 list of directories scanned.
30559 @item %T
30560 Current argument is the name of a linker script.  Search for that file
30561 in the current list of directories to scan for libraries. If the file
30562 is located insert a @option{--script} option into the command line
30563 followed by the full path name found.  If the file is not found then
30564 generate an error message.  Note: the current working directory is not
30565 searched.
30567 @item %e@var{str}
30568 Print @var{str} as an error message.  @var{str} is terminated by a newline.
30569 Use this when inconsistent options are detected.
30571 @item %(@var{name})
30572 Substitute the contents of spec string @var{name} at this point.
30574 @item %x@{@var{option}@}
30575 Accumulate an option for @samp{%X}.
30577 @item %X
30578 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
30579 spec string.
30581 @item %Y
30582 Output the accumulated assembler options specified by @option{-Wa}.
30584 @item %Z
30585 Output the accumulated preprocessor options specified by @option{-Wp}.
30587 @item %a
30588 Process the @code{asm} spec.  This is used to compute the
30589 switches to be passed to the assembler.
30591 @item %A
30592 Process the @code{asm_final} spec.  This is a spec string for
30593 passing switches to an assembler post-processor, if such a program is
30594 needed.
30596 @item %l
30597 Process the @code{link} spec.  This is the spec for computing the
30598 command line passed to the linker.  Typically it makes use of the
30599 @samp{%L %G %S %D and %E} sequences.
30601 @item %D
30602 Dump out a @option{-L} option for each directory that GCC believes might
30603 contain startup files.  If the target supports multilibs then the
30604 current multilib directory is prepended to each of these paths.
30606 @item %L
30607 Process the @code{lib} spec.  This is a spec string for deciding which
30608 libraries are included on the command line to the linker.
30610 @item %G
30611 Process the @code{libgcc} spec.  This is a spec string for deciding
30612 which GCC support library is included on the command line to the linker.
30614 @item %S
30615 Process the @code{startfile} spec.  This is a spec for deciding which
30616 object files are the first ones passed to the linker.  Typically
30617 this might be a file named @file{crt0.o}.
30619 @item %E
30620 Process the @code{endfile} spec.  This is a spec string that specifies
30621 the last object files that are passed to the linker.
30623 @item %C
30624 Process the @code{cpp} spec.  This is used to construct the arguments
30625 to be passed to the C preprocessor.
30627 @item %1
30628 Process the @code{cc1} spec.  This is used to construct the options to be
30629 passed to the actual C compiler (@command{cc1}).
30631 @item %2
30632 Process the @code{cc1plus} spec.  This is used to construct the options to be
30633 passed to the actual C++ compiler (@command{cc1plus}).
30635 @item %*
30636 Substitute the variable part of a matched option.  See below.
30637 Note that each comma in the substituted string is replaced by
30638 a single space.
30640 @item %<S
30641 Remove all occurrences of @code{-S} from the command line.  Note---this
30642 command is position dependent.  @samp{%} commands in the spec string
30643 before this one see @code{-S}, @samp{%} commands in the spec string
30644 after this one do not.
30646 @item %:@var{function}(@var{args})
30647 Call the named function @var{function}, passing it @var{args}.
30648 @var{args} is first processed as a nested spec string, then split
30649 into an argument vector in the usual fashion.  The function returns
30650 a string which is processed as if it had appeared literally as part
30651 of the current spec.
30653 The following built-in spec functions are provided:
30655 @table @code
30656 @item @code{getenv}
30657 The @code{getenv} spec function takes two arguments: an environment
30658 variable name and a string.  If the environment variable is not
30659 defined, a fatal error is issued.  Otherwise, the return value is the
30660 value of the environment variable concatenated with the string.  For
30661 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
30663 @smallexample
30664 %:getenv(TOPDIR /include)
30665 @end smallexample
30667 expands to @file{/path/to/top/include}.
30669 @item @code{if-exists}
30670 The @code{if-exists} spec function takes one argument, an absolute
30671 pathname to a file.  If the file exists, @code{if-exists} returns the
30672 pathname.  Here is a small example of its usage:
30674 @smallexample
30675 *startfile:
30676 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
30677 @end smallexample
30679 @item @code{if-exists-else}
30680 The @code{if-exists-else} spec function is similar to the @code{if-exists}
30681 spec function, except that it takes two arguments.  The first argument is
30682 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
30683 returns the pathname.  If it does not exist, it returns the second argument.
30684 This way, @code{if-exists-else} can be used to select one file or another,
30685 based on the existence of the first.  Here is a small example of its usage:
30687 @smallexample
30688 *startfile:
30689 crt0%O%s %:if-exists(crti%O%s) \
30690 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
30691 @end smallexample
30693 @item @code{replace-outfile}
30694 The @code{replace-outfile} spec function takes two arguments.  It looks for the
30695 first argument in the outfiles array and replaces it with the second argument.  Here
30696 is a small example of its usage:
30698 @smallexample
30699 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
30700 @end smallexample
30702 @item @code{remove-outfile}
30703 The @code{remove-outfile} spec function takes one argument.  It looks for the
30704 first argument in the outfiles array and removes it.  Here is a small example
30705 its usage:
30707 @smallexample
30708 %:remove-outfile(-lm)
30709 @end smallexample
30711 @item @code{pass-through-libs}
30712 The @code{pass-through-libs} spec function takes any number of arguments.  It
30713 finds any @option{-l} options and any non-options ending in @file{.a} (which it
30714 assumes are the names of linker input library archive files) and returns a
30715 result containing all the found arguments each prepended by
30716 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
30717 intended to be passed to the LTO linker plugin.
30719 @smallexample
30720 %:pass-through-libs(%G %L %G)
30721 @end smallexample
30723 @item @code{print-asm-header}
30724 The @code{print-asm-header} function takes no arguments and simply
30725 prints a banner like:
30727 @smallexample
30728 Assembler options
30729 =================
30731 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
30732 @end smallexample
30734 It is used to separate compiler options from assembler options
30735 in the @option{--target-help} output.
30736 @end table
30738 @item %@{S@}
30739 Substitutes the @code{-S} switch, if that switch is given to GCC@.
30740 If that switch is not specified, this substitutes nothing.  Note that
30741 the leading dash is omitted when specifying this option, and it is
30742 automatically inserted if the substitution is performed.  Thus the spec
30743 string @samp{%@{foo@}} matches the command-line option @option{-foo}
30744 and outputs the command-line option @option{-foo}.
30746 @item %W@{S@}
30747 Like %@{@code{S}@} but mark last argument supplied within as a file to be
30748 deleted on failure.
30750 @item %@{S*@}
30751 Substitutes all the switches specified to GCC whose names start
30752 with @code{-S}, but which also take an argument.  This is used for
30753 switches like @option{-o}, @option{-D}, @option{-I}, etc.
30754 GCC considers @option{-o foo} as being
30755 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
30756 text, including the space.  Thus two arguments are generated.
30758 @item %@{S*&T*@}
30759 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
30760 (the order of @code{S} and @code{T} in the spec is not significant).
30761 There can be any number of ampersand-separated variables; for each the
30762 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
30764 @item %@{S:X@}
30765 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
30767 @item %@{!S:X@}
30768 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
30770 @item %@{S*:X@}
30771 Substitutes @code{X} if one or more switches whose names start with
30772 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
30773 once, no matter how many such switches appeared.  However, if @code{%*}
30774 appears somewhere in @code{X}, then @code{X} is substituted once
30775 for each matching switch, with the @code{%*} replaced by the part of
30776 that switch matching the @code{*}.
30778 If @code{%*} appears as the last part of a spec sequence then a space
30779 is added after the end of the last substitution.  If there is more
30780 text in the sequence, however, then a space is not generated.  This
30781 allows the @code{%*} substitution to be used as part of a larger
30782 string.  For example, a spec string like this:
30784 @smallexample
30785 %@{mcu=*:--script=%*/memory.ld@}
30786 @end smallexample
30788 @noindent
30789 when matching an option like @option{-mcu=newchip} produces:
30791 @smallexample
30792 --script=newchip/memory.ld
30793 @end smallexample
30795 @item %@{.S:X@}
30796 Substitutes @code{X}, if processing a file with suffix @code{S}.
30798 @item %@{!.S:X@}
30799 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
30801 @item %@{,S:X@}
30802 Substitutes @code{X}, if processing a file for language @code{S}.
30804 @item %@{!,S:X@}
30805 Substitutes @code{X}, if not processing a file for language @code{S}.
30807 @item %@{S|P:X@}
30808 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
30809 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
30810 @code{*} sequences as well, although they have a stronger binding than
30811 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
30812 alternatives must be starred, and only the first matching alternative
30813 is substituted.
30815 For example, a spec string like this:
30817 @smallexample
30818 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
30819 @end smallexample
30821 @noindent
30822 outputs the following command-line options from the following input
30823 command-line options:
30825 @smallexample
30826 fred.c        -foo -baz
30827 jim.d         -bar -boggle
30828 -d fred.c     -foo -baz -boggle
30829 -d jim.d      -bar -baz -boggle
30830 @end smallexample
30832 @item %@{S:X; T:Y; :D@}
30834 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
30835 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
30836 be as many clauses as you need.  This may be combined with @code{.},
30837 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
30840 @end table
30842 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
30843 or similar construct can use a backslash to ignore the special meaning
30844 of the character following it, thus allowing literal matching of a
30845 character that is otherwise specially treated.  For example,
30846 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
30847 @option{-std=iso9899:1999} option is given.
30849 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
30850 construct may contain other nested @samp{%} constructs or spaces, or
30851 even newlines.  They are processed as usual, as described above.
30852 Trailing white space in @code{X} is ignored.  White space may also
30853 appear anywhere on the left side of the colon in these constructs,
30854 except between @code{.} or @code{*} and the corresponding word.
30856 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
30857 handled specifically in these constructs.  If another value of
30858 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
30859 @option{-W} switch is found later in the command line, the earlier
30860 switch value is ignored, except with @{@code{S}*@} where @code{S} is
30861 just one letter, which passes all matching options.
30863 The character @samp{|} at the beginning of the predicate text is used to
30864 indicate that a command should be piped to the following command, but
30865 only if @option{-pipe} is specified.
30867 It is built into GCC which switches take arguments and which do not.
30868 (You might think it would be useful to generalize this to allow each
30869 compiler's spec to say which switches take arguments.  But this cannot
30870 be done in a consistent fashion.  GCC cannot even decide which input
30871 files have been specified without knowing which switches take arguments,
30872 and it must know which input files to compile in order to tell which
30873 compilers to run).
30875 GCC also knows implicitly that arguments starting in @option{-l} are to be
30876 treated as compiler output files, and passed to the linker in their
30877 proper position among the other output files.
30879 @node Environment Variables
30880 @section Environment Variables Affecting GCC
30881 @cindex environment variables
30883 @c man begin ENVIRONMENT
30884 This section describes several environment variables that affect how GCC
30885 operates.  Some of them work by specifying directories or prefixes to use
30886 when searching for various kinds of files.  Some are used to specify other
30887 aspects of the compilation environment.
30889 Note that you can also specify places to search using options such as
30890 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
30891 take precedence over places specified using environment variables, which
30892 in turn take precedence over those specified by the configuration of GCC@.
30893 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30894 GNU Compiler Collection (GCC) Internals}.
30896 @table @env
30897 @item LANG
30898 @itemx LC_CTYPE
30899 @c @itemx LC_COLLATE
30900 @itemx LC_MESSAGES
30901 @c @itemx LC_MONETARY
30902 @c @itemx LC_NUMERIC
30903 @c @itemx LC_TIME
30904 @itemx LC_ALL
30905 @findex LANG
30906 @findex LC_CTYPE
30907 @c @findex LC_COLLATE
30908 @findex LC_MESSAGES
30909 @c @findex LC_MONETARY
30910 @c @findex LC_NUMERIC
30911 @c @findex LC_TIME
30912 @findex LC_ALL
30913 @cindex locale
30914 These environment variables control the way that GCC uses
30915 localization information which allows GCC to work with different
30916 national conventions.  GCC inspects the locale categories
30917 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30918 so.  These locale categories can be set to any value supported by your
30919 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
30920 Kingdom encoded in UTF-8.
30922 The @env{LC_CTYPE} environment variable specifies character
30923 classification.  GCC uses it to determine the character boundaries in
30924 a string; this is needed for some multibyte encodings that contain quote
30925 and escape characters that are otherwise interpreted as a string
30926 end or escape.
30928 The @env{LC_MESSAGES} environment variable specifies the language to
30929 use in diagnostic messages.
30931 If the @env{LC_ALL} environment variable is set, it overrides the value
30932 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30933 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30934 environment variable.  If none of these variables are set, GCC
30935 defaults to traditional C English behavior.
30937 @item TMPDIR
30938 @findex TMPDIR
30939 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30940 files.  GCC uses temporary files to hold the output of one stage of
30941 compilation which is to be used as input to the next stage: for example,
30942 the output of the preprocessor, which is the input to the compiler
30943 proper.
30945 @item GCC_COMPARE_DEBUG
30946 @findex GCC_COMPARE_DEBUG
30947 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30948 @option{-fcompare-debug} to the compiler driver.  See the documentation
30949 of this option for more details.
30951 @item GCC_EXEC_PREFIX
30952 @findex GCC_EXEC_PREFIX
30953 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30954 names of the subprograms executed by the compiler.  No slash is added
30955 when this prefix is combined with the name of a subprogram, but you can
30956 specify a prefix that ends with a slash if you wish.
30958 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30959 an appropriate prefix to use based on the pathname it is invoked with.
30961 If GCC cannot find the subprogram using the specified prefix, it
30962 tries looking in the usual places for the subprogram.
30964 The default value of @env{GCC_EXEC_PREFIX} is
30965 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30966 the installed compiler. In many cases @var{prefix} is the value
30967 of @code{prefix} when you ran the @file{configure} script.
30969 Other prefixes specified with @option{-B} take precedence over this prefix.
30971 This prefix is also used for finding files such as @file{crt0.o} that are
30972 used for linking.
30974 In addition, the prefix is used in an unusual way in finding the
30975 directories to search for header files.  For each of the standard
30976 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30977 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30978 replacing that beginning with the specified prefix to produce an
30979 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
30980 @file{foo/bar} just before it searches the standard directory 
30981 @file{/usr/local/lib/bar}.
30982 If a standard directory begins with the configured
30983 @var{prefix} then the value of @var{prefix} is replaced by
30984 @env{GCC_EXEC_PREFIX} when looking for header files.
30986 @item COMPILER_PATH
30987 @findex COMPILER_PATH
30988 The value of @env{COMPILER_PATH} is a colon-separated list of
30989 directories, much like @env{PATH}.  GCC tries the directories thus
30990 specified when searching for subprograms, if it cannot find the
30991 subprograms using @env{GCC_EXEC_PREFIX}.
30993 @item LIBRARY_PATH
30994 @findex LIBRARY_PATH
30995 The value of @env{LIBRARY_PATH} is a colon-separated list of
30996 directories, much like @env{PATH}.  When configured as a native compiler,
30997 GCC tries the directories thus specified when searching for special
30998 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
30999 using GCC also uses these directories when searching for ordinary
31000 libraries for the @option{-l} option (but directories specified with
31001 @option{-L} come first).
31003 @item LANG
31004 @findex LANG
31005 @cindex locale definition
31006 This variable is used to pass locale information to the compiler.  One way in
31007 which this information is used is to determine the character set to be used
31008 when character literals, string literals and comments are parsed in C and C++.
31009 When the compiler is configured to allow multibyte characters,
31010 the following values for @env{LANG} are recognized:
31012 @table @samp
31013 @item C-JIS
31014 Recognize JIS characters.
31015 @item C-SJIS
31016 Recognize SJIS characters.
31017 @item C-EUCJP
31018 Recognize EUCJP characters.
31019 @end table
31021 If @env{LANG} is not defined, or if it has some other value, then the
31022 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31023 recognize and translate multibyte characters.
31024 @end table
31026 @noindent
31027 Some additional environment variables affect the behavior of the
31028 preprocessor.
31030 @include cppenv.texi
31032 @c man end
31034 @node Precompiled Headers
31035 @section Using Precompiled Headers
31036 @cindex precompiled headers
31037 @cindex speed of compilation
31039 Often large projects have many header files that are included in every
31040 source file.  The time the compiler takes to process these header files
31041 over and over again can account for nearly all of the time required to
31042 build the project.  To make builds faster, GCC allows you to
31043 @dfn{precompile} a header file.
31045 To create a precompiled header file, simply compile it as you would any
31046 other file, if necessary using the @option{-x} option to make the driver
31047 treat it as a C or C++ header file.  You may want to use a
31048 tool like @command{make} to keep the precompiled header up-to-date when
31049 the headers it contains change.
31051 A precompiled header file is searched for when @code{#include} is
31052 seen in the compilation.  As it searches for the included file
31053 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31054 compiler looks for a precompiled header in each directory just before it
31055 looks for the include file in that directory.  The name searched for is
31056 the name specified in the @code{#include} with @samp{.gch} appended.  If
31057 the precompiled header file cannot be used, it is ignored.
31059 For instance, if you have @code{#include "all.h"}, and you have
31060 @file{all.h.gch} in the same directory as @file{all.h}, then the
31061 precompiled header file is used if possible, and the original
31062 header is used otherwise.
31064 Alternatively, you might decide to put the precompiled header file in a
31065 directory and use @option{-I} to ensure that directory is searched
31066 before (or instead of) the directory containing the original header.
31067 Then, if you want to check that the precompiled header file is always
31068 used, you can put a file of the same name as the original header in this
31069 directory containing an @code{#error} command.
31071 This also works with @option{-include}.  So yet another way to use
31072 precompiled headers, good for projects not designed with precompiled
31073 header files in mind, is to simply take most of the header files used by
31074 a project, include them from another header file, precompile that header
31075 file, and @option{-include} the precompiled header.  If the header files
31076 have guards against multiple inclusion, they are skipped because
31077 they've already been included (in the precompiled header).
31079 If you need to precompile the same header file for different
31080 languages, targets, or compiler options, you can instead make a
31081 @emph{directory} named like @file{all.h.gch}, and put each precompiled
31082 header in the directory, perhaps using @option{-o}.  It doesn't matter
31083 what you call the files in the directory; every precompiled header in
31084 the directory is considered.  The first precompiled header
31085 encountered in the directory that is valid for this compilation is
31086 used; they're searched in no particular order.
31088 There are many other possibilities, limited only by your imagination,
31089 good sense, and the constraints of your build system.
31091 A precompiled header file can be used only when these conditions apply:
31093 @itemize
31094 @item
31095 Only one precompiled header can be used in a particular compilation.
31097 @item
31098 A precompiled header cannot be used once the first C token is seen.  You
31099 can have preprocessor directives before a precompiled header; you cannot
31100 include a precompiled header from inside another header.
31102 @item
31103 The precompiled header file must be produced for the same language as
31104 the current compilation.  You cannot use a C precompiled header for a C++
31105 compilation.
31107 @item
31108 The precompiled header file must have been produced by the same compiler
31109 binary as the current compilation is using.
31111 @item
31112 Any macros defined before the precompiled header is included must
31113 either be defined in the same way as when the precompiled header was
31114 generated, or must not affect the precompiled header, which usually
31115 means that they don't appear in the precompiled header at all.
31117 The @option{-D} option is one way to define a macro before a
31118 precompiled header is included; using a @code{#define} can also do it.
31119 There are also some options that define macros implicitly, like
31120 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31121 defined this way.
31123 @item If debugging information is output when using the precompiled
31124 header, using @option{-g} or similar, the same kind of debugging information
31125 must have been output when building the precompiled header.  However,
31126 a precompiled header built using @option{-g} can be used in a compilation
31127 when no debugging information is being output.
31129 @item The same @option{-m} options must generally be used when building
31130 and using the precompiled header.  @xref{Submodel Options},
31131 for any cases where this rule is relaxed.
31133 @item Each of the following options must be the same when building and using
31134 the precompiled header:
31136 @gccoptlist{-fexceptions}
31138 @item
31139 Some other command-line options starting with @option{-f},
31140 @option{-p}, or @option{-O} must be defined in the same way as when
31141 the precompiled header was generated.  At present, it's not clear
31142 which options are safe to change and which are not; the safest choice
31143 is to use exactly the same options when generating and using the
31144 precompiled header.  The following are known to be safe:
31146 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
31147 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
31148 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
31149 -pedantic-errors}
31151 @item Address space layout randomization (ASLR) can lead to not binary identical
31152 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
31153 PCH files.
31155 @end itemize
31157 For all of these except the last, the compiler automatically
31158 ignores the precompiled header if the conditions aren't met.  If you
31159 find an option combination that doesn't work and doesn't cause the
31160 precompiled header to be ignored, please consider filing a bug report,
31161 see @ref{Bugs}.
31163 If you do use differing options when generating and using the
31164 precompiled header, the actual behavior is a mixture of the
31165 behavior for the options.  For instance, if you use @option{-g} to
31166 generate the precompiled header but not when using it, you may or may
31167 not get debugging information for routines in the precompiled header.