1@c Copyright (C) 1988-2020 Free Software Foundation, Inc.
2@c This is part of the GCC manual.
3@c For copying conditions, see the file gcc.texi.
4
5@ignore
6@c man begin INCLUDE
7@include gcc-vers.texi
8@c man end
9
10@c man begin COPYRIGHT
11Copyright @copyright{} 1988-2020 Free Software Foundation, Inc.
12
13Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.3 or
15any later version published by the Free Software Foundation; with the
16Invariant Sections being ``GNU General Public License'' and ``Funding
17Free Software'', the Front-Cover texts being (a) (see below), and with
18the Back-Cover Texts being (b) (see below).  A copy of the license is
19included in the gfdl(7) man page.
20
21(a) The FSF's Front-Cover Text is:
22
23     A GNU Manual
24
25(b) The FSF's Back-Cover Text is:
26
27     You have freedom to copy and modify this GNU Manual, like GNU
28     software.  Copies published by the Free Software Foundation raise
29     funds for GNU development.
30@c man end
31@c Set file name and title for the man page.
32@setfilename gcc
33@settitle GNU project C and C++ compiler
34@c man begin SYNOPSIS
35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36    [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37    [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38    [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39    [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40    [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41    [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43Only the most useful options are listed here; see below for the
44remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45@c man end
46@c man begin SEEALSO
47gpl(7), gfdl(7), fsf-funding(7),
48cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49and 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
53For instructions on reporting bugs, see
54@w{@value{BUGURL}}.
55@c man end
56@c man begin AUTHOR
57See the Info entry for @command{gcc}, or
58@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59for contributors to GCC@.
60@c man end
61@end ignore
62
63@node Invoking GCC
64@chapter GCC Command Options
65@cindex GCC command options
66@cindex command options
67@cindex options, GCC command
68
69@c man begin DESCRIPTION
70When you invoke GCC, it normally does preprocessing, compilation,
71assembly and linking.  The ``overall options'' allow you to stop this
72process at an intermediate stage.  For example, the @option{-c} option
73says not to run the linker.  Then the output consists of object files
74output by the assembler.
75@xref{Overall Options,,Options Controlling the Kind of Output}.
76
77Other options are passed on to one or more stages of processing.  Some options
78control the preprocessor and others the compiler itself.  Yet other
79options control the assembler and linker; most of these are not
80documented here, since you rarely need to use any of them.
81
82@cindex C compilation options
83Most of the command-line options that you can use with GCC are useful
84for C programs; when an option is only useful with another language
85(usually C++), the explanation says so explicitly.  If the description
86for a particular option does not mention a source language, you can use
87that option with all supported languages.
88
89@cindex cross compiling
90@cindex specifying machine version
91@cindex specifying compiler version and target machine
92@cindex compiler version, specifying
93@cindex target machine, specifying
94The 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.
97When you compile C++ programs, you should invoke GCC as @command{g++}
98instead.  @xref{Invoking G++,,Compiling C++ Programs},
99for information about the differences in behavior between @command{gcc}
100and @code{g++} when compiling C++ programs.
101
102@cindex grouping options
103@cindex options, grouping
104The @command{gcc} program accepts options and file names as operands.  Many
105options have multi-letter names; therefore multiple single-letter options
106may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107-v}}.
108
109@cindex order of options
110@cindex options, order
111You can mix options and other arguments.  For the most part, the order
112you use doesn't matter.  Order does matter when you use several
113options of the same kind; for example, if you specify @option{-L} more
114than once, the directories are searched in the order specified.  Also,
115the placement of the @option{-l} option is significant.
116
117Many 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
120these have both positive and negative forms; the negative form of
121@option{-ffoo} is @option{-fno-foo}.  This manual documents
122only one of these two forms, whichever one is not the default.
123
124Some options take one or more arguments typically separated either
125by a space or by the equals sign (@samp{=}) from the option name.
126Unless documented otherwise, an argument can be either numeric or
127a string.  Numeric arguments must typically be small unsigned decimal
128or hexadecimal integers.  Hexadecimal arguments must begin with
129the @samp{0x} prefix.  Arguments to options that specify a size
130threshold of some sort may be arbitrarily large decimal or hexadecimal
131integers followed by a byte size suffix designating a multiple of bytes
132such 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
135designated by @var{byte-size} in the following text.  Refer to the NIST,
136IEC, and other relevant national and international standards for the full
137listing and explanation of the binary and decimal byte size prefixes.
138
139@c man end
140
141@xref{Option Index}, for an index to GCC's options.
142
143@menu
144* Option Summary::      Brief list of all options, without explanations.
145* Overall Options::     Controlling the kind of output:
146                        an executable, object files, assembler files,
147                        or preprocessed source.
148* Invoking G++::        Compiling C++ programs.
149* C Dialect Options::   Controlling the variant of C language compiled.
150* C++ Dialect Options:: Variations on C++.
151* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                        and Objective-C++.
153* Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                        be formatted.
155* Warning Options::     How picky should the compiler be?
156* Static Analyzer Options:: More expensive warnings.
157* Debugging Options::   Producing debuggable code.
158* Optimize Options::    How much optimization?
159* Instrumentation Options:: Enabling profiling and extra run-time error checking.
160* Preprocessor Options:: Controlling header files and macro definitions.
161                         Also, getting dependency information for Make.
162* Assembler Options::   Passing options to the assembler.
163* Link Options::        Specifying libraries and so on.
164* Directory Options::   Where to find header files and libraries.
165                        Where to find the compiler executable files.
166* Code Gen Options::    Specifying conventions for function calls, data layout
167                        and register usage.
168* Developer Options::   Printing GCC configuration info, statistics, and
169                        debugging dumps.
170* Submodel Options::    Target-specific options, such as compiling for a
171                        specific processor variant.
172* Spec Files::          How to pass switches to sub-processes.
173* Environment Variables:: Env vars that affect GCC.
174* Precompiled Headers:: Compiling a header once, and using it many times.
175@end menu
176
177@c man begin OPTIONS
178
179@node Option Summary
180@section Option Summary
181
182Here is a summary of all the options, grouped by type.  Explanations are
183in the following sections.
184
185@table @emph
186@item Overall Options
187@xref{Overall Options,,Options Controlling the Kind of Output}.
188@gccoptlist{-c  -S  -E  -o @var{file}  -x @var{language}  @gol
189-v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version @gol
190-pass-exit-codes  -pipe  -specs=@var{file}  -wrapper  @gol
191@@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  @gol
192-fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}  @gol
193-fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
194
195@item C Language Options
196@xref{C Dialect Options,,Options Controlling C Dialect}.
197@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
198-fpermitted-flt-eval-methods=@var{standard} @gol
199-aux-info @var{filename}  -fallow-parameterless-variadic-functions @gol
200-fno-asm  -fno-builtin  -fno-builtin-@var{function}  -fgimple@gol
201-fhosted  -ffreestanding @gol
202-fopenacc  -fopenacc-dim=@var{geom} @gol
203-fopenmp  -fopenmp-simd @gol
204-fms-extensions  -fplan9-extensions  -fsso-struct=@var{endianness} @gol
205-fallow-single-precision  -fcond-mismatch  -flax-vector-conversions @gol
206-fsigned-bitfields  -fsigned-char @gol
207-funsigned-bitfields  -funsigned-char}
208
209@item C++ Language Options
210@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
211@gccoptlist{-fabi-version=@var{n}  -fno-access-control @gol
212-faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new @gol
213-fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n} @gol
214-fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n} @gol
215-fno-elide-constructors @gol
216-fno-enforce-eh-specs @gol
217-fno-gnu-keywords @gol
218-fno-implicit-templates @gol
219-fno-implicit-inline-templates @gol
220-fno-implement-inlines  -fms-extensions @gol
221-fnew-inheriting-ctors @gol
222-fnew-ttp-matching @gol
223-fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
224-fno-optional-diags  -fpermissive @gol
225-fno-pretty-templates @gol
226-fno-rtti  -fsized-deallocation @gol
227-ftemplate-backtrace-limit=@var{n} @gol
228-ftemplate-depth=@var{n} @gol
229-fno-threadsafe-statics  -fuse-cxa-atexit @gol
230-fno-weak  -nostdinc++ @gol
231-fvisibility-inlines-hidden @gol
232-fvisibility-ms-compat @gol
233-fext-numeric-literals @gol
234-Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n} @gol
235-Wno-class-conversion  -Wclass-memaccess @gol
236-Wcomma-subscript  -Wconditionally-supported @gol
237-Wno-conversion-null  -Wctor-dtor-privacy  -Wno-delete-incomplete @gol
238-Wdelete-non-virtual-dtor  -Wdeprecated-copy  -Wdeprecated-copy-dtor @gol
239-Weffc++  -Wextra-semi  -Wno-inaccessible-base @gol
240-Wno-inherited-variadic-ctor  -Wno-init-list-lifetime @gol
241-Wno-invalid-offsetof  -Wno-literal-suffix  -Wmismatched-tags @gol
242-Wmultiple-inheritance  -Wnamespaces  -Wnarrowing @gol
243-Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor @gol
244-Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n} @gol
245-Wredundant-move -Wredundant-tags @gol
246-Wreorder  -Wregister @gol
247-Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates @gol
248-Wno-non-template-friend  -Wold-style-cast @gol
249-Woverloaded-virtual  -Wno-pmf-conversions -Wsign-promo @gol
250-Wsized-deallocation  -Wsuggest-final-methods @gol
251-Wsuggest-final-types  -Wsuggest-override  @gol
252-Wno-terminate  -Wuseless-cast  -Wvirtual-inheritance  @gol
253-Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
254
255@item Objective-C and Objective-C++ Language Options
256@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
257Objective-C and Objective-C++ Dialects}.
258@gccoptlist{-fconstant-string-class=@var{class-name} @gol
259-fgnu-runtime  -fnext-runtime @gol
260-fno-nil-receivers @gol
261-fobjc-abi-version=@var{n} @gol
262-fobjc-call-cxx-cdtors @gol
263-fobjc-direct-dispatch @gol
264-fobjc-exceptions @gol
265-fobjc-gc @gol
266-fobjc-nilcheck @gol
267-fobjc-std=objc1 @gol
268-fno-local-ivars @gol
269-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
270-freplace-objc-classes @gol
271-fzero-link @gol
272-gen-decls @gol
273-Wassign-intercept  -Wno-property-assign-default @gol
274-Wno-protocol  -Wselector @gol
275-Wstrict-selector-match @gol
276-Wundeclared-selector}
277
278@item Diagnostic Message Formatting Options
279@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
280@gccoptlist{-fmessage-length=@var{n}  @gol
281-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
282-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
283-fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
284-fdiagnostics-format=@r{[}text@r{|}json@r{]}  @gol
285-fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
286-fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
287-fno-diagnostics-show-cwe  @gol
288-fdiagnostics-minimum-margin-width=@var{width} @gol
289-fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
290-fdiagnostics-show-template-tree  -fno-elide-type @gol
291-fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
292-fdiagnostics-show-path-depths @gol
293-fno-show-column}
294
295@item Warning Options
296@xref{Warning Options,,Options to Request or Suppress Warnings}.
297@gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
298-pedantic-errors @gol
299-w  -Wextra  -Wall  -Wabi=@var{n} @gol
300-Waddress  -Wno-address-of-packed-member  -Waggregate-return @gol
301-Walloc-size-larger-than=@var{byte-size}  -Walloc-zero @gol
302-Walloca  -Walloca-larger-than=@var{byte-size} @gol
303-Wno-aggressive-loop-optimizations @gol
304-Warith-conversion @gol
305-Warray-bounds  -Warray-bounds=@var{n} @gol
306-Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
307-Wno-attribute-warning  -Wbool-compare  -Wbool-operation @gol
308-Wno-builtin-declaration-mismatch @gol
309-Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
310-Wc11-c2x-compat @gol
311-Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
312-Wc++20-compat  @gol
313-Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
314-Wchar-subscripts @gol
315-Wclobbered  -Wcomment @gol
316-Wconversion  -Wno-coverage-mismatch  -Wno-cpp @gol
317-Wdangling-else  -Wdate-time @gol
318-Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
319-Wdisabled-optimization @gol
320-Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers @gol
321-Wno-div-by-zero  -Wdouble-promotion @gol
322-Wduplicated-branches  -Wduplicated-cond @gol
323-Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion @gol
324-Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors @gol
325-Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2 @gol
326-Wno-format-contains-nul  -Wno-format-extra-args  @gol
327-Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
328-Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
329-Wformat-y2k  -Wframe-address @gol
330-Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
331-Wno-hsa  -Wno-if-not-aligned  -Wno-ignored-attributes @gol
332-Wignored-qualifiers  -Wno-incompatible-pointer-types @gol
333-Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
334-Wno-implicit-function-declaration  -Wno-implicit-int @gol
335-Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
336-Wno-int-to-pointer-cast  -Wno-invalid-memory-model @gol
337-Winvalid-pch  -Wjump-misses-init  -Wlarger-than=@var{byte-size} @gol
338-Wlogical-not-parentheses  -Wlogical-op  -Wlong-long @gol
339-Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized @gol
340-Wmemset-elt-size  -Wmemset-transposed-args @gol
341-Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
342-Wmissing-field-initializers  -Wmissing-format-attribute @gol
343-Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile @gol
344-Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
345-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
346-Wnull-dereference  -Wno-odr  -Wopenmp-simd  @gol
347-Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects @gol
348-Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded @gol
349-Wparentheses  -Wno-pedantic-ms-format @gol
350-Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast @gol
351-Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
352-Wrestrict  -Wno-return-local-addr  -Wreturn-type @gol
353-Wno-scalar-storage-order  -Wsequence-point @gol
354-Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local @gol
355-Wno-shadow-ivar @gol
356-Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value @gol
357-Wno-shift-overflow  -Wshift-overflow=@var{n} @gol
358-Wsign-compare  -Wsign-conversion @gol
359-Wno-sizeof-array-argument @gol
360-Wsizeof-pointer-div  -Wsizeof-pointer-memaccess @gol
361-Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
362-Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
363-Wstring-compare @gol
364-Wstringop-overflow=@var{n}  -Wno-stringop-truncation @gol
365-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
366-Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum @gol
367-Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand @gol
368-Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
369-Wtype-limits  -Wundef @gol
370-Wuninitialized  -Wunknown-pragmas @gol
371-Wunsuffixed-float-constants  -Wunused @gol
372-Wunused-but-set-parameter  -Wunused-but-set-variable @gol
373-Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
374-Wunused-function  -Wunused-label  -Wunused-local-typedefs @gol
375-Wunused-macros @gol
376-Wunused-parameter  -Wno-unused-result @gol
377-Wunused-value  -Wunused-variable @gol
378-Wno-varargs  -Wvariadic-macros @gol
379-Wvector-operation-performance @gol
380-Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than @gol
381-Wvolatile-register-var  -Wwrite-strings @gol
382-Wzero-length-bounds}
383
384@item Static Analyzer Options
385@gccoptlist{
386-fanalyzer @gol
387-fanalyzer-call-summaries @gol
388-fanalyzer-checker=@var{name} @gol
389-fanalyzer-fine-grained @gol
390-fanalyzer-state-merge @gol
391-fanalyzer-state-purge @gol
392-fanalyzer-transitivity @gol
393-fanalyzer-verbose-edges @gol
394-fanalyzer-verbose-state-changes @gol
395-fanalyzer-verbosity=@var{level} @gol
396-fdump-analyzer @gol
397-fdump-analyzer-stderr @gol
398-fdump-analyzer-callgraph @gol
399-fdump-analyzer-exploded-graph @gol
400-fdump-analyzer-exploded-nodes @gol
401-fdump-analyzer-exploded-nodes-2 @gol
402-fdump-analyzer-exploded-nodes-3 @gol
403-fdump-analyzer-state-purge @gol
404-fdump-analyzer-supergraph @gol
405-Wno-analyzer-double-fclose @gol
406-Wno-analyzer-double-free @gol
407-Wno-analyzer-exposure-through-output-file @gol
408-Wno-analyzer-file-leak @gol
409-Wno-analyzer-free-of-non-heap @gol
410-Wno-analyzer-malloc-leak @gol
411-Wno-analyzer-null-argument @gol
412-Wno-analyzer-null-dereference @gol
413-Wno-analyzer-possible-null-argument @gol
414-Wno-analyzer-possible-null-dereference @gol
415-Wno-analyzer-stale-setjmp-buffer @gol
416-Wno-analyzer-tainted-array-index @gol
417-Wanalyzer-too-complex @gol
418-Wno-analyzer-unsafe-call-within-signal-handler @gol
419-Wno-analyzer-use-after-free @gol
420-Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
421-Wno-analyzer-use-of-uninitialized-value @gol
422}
423
424@item C and Objective-C-only Warning Options
425@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
426-Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
427-Wold-style-declaration  -Wold-style-definition @gol
428-Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
429-Wdeclaration-after-statement  -Wpointer-sign}
430
431@item Debugging Options
432@xref{Debugging Options,,Options for Debugging Your Program}.
433@gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
434-ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
435-gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
436-gas-loc-support  -gno-as-loc-support @gol
437-gas-locview-support  -gno-as-locview-support @gol
438-gcolumn-info  -gno-column-info @gol
439-gstatement-frontiers  -gno-statement-frontiers @gol
440-gvariable-location-views  -gno-variable-location-views @gol
441-ginternal-reset-location-views  -gno-internal-reset-location-views @gol
442-ginline-points  -gno-inline-points @gol
443-gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
444-gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
445-fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
446-fno-eliminate-unused-debug-types @gol
447-femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
448-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
449-fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
450-fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
451-fvar-tracking  -fvar-tracking-assignments}
452
453@item Optimization Options
454@xref{Optimize Options,,Options that Control Optimization}.
455@gccoptlist{-faggressive-loop-optimizations @gol
456-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
457-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
458-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
459-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
460-fno-allocation-dce -fallow-store-data-races @gol
461-fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
462-fauto-inc-dec  -fbranch-probabilities @gol
463-fcaller-saves @gol
464-fcombine-stack-adjustments  -fconserve-stack @gol
465-fcompare-elim  -fcprop-registers  -fcrossjumping @gol
466-fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
467-fcx-limited-range @gol
468-fdata-sections  -fdce  -fdelayed-branch @gol
469-fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
470-fdevirtualize-at-ltrans  -fdse @gol
471-fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
472-ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
473-ffinite-loops @gol
474-fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
475-fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
476-fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
477-fif-conversion2  -findirect-inlining @gol
478-finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
479-finline-small-functions  -fipa-cp  -fipa-cp-clone @gol
480-fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
481-fipa-reference  -fipa-reference-addressable @gol
482-fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
483-flive-patching=@var{level} @gol
484-fira-region=@var{region}  -fira-hoist-pressure @gol
485-fira-loop-pressure  -fno-ira-share-save-slots @gol
486-fno-ira-share-spill-slots @gol
487-fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
488-fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
489-fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
490-floop-block  -floop-interchange  -floop-strip-mine @gol
491-floop-unroll-and-jam  -floop-nest-optimize @gol
492-floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
493-flto-partition=@var{alg}  -fmerge-all-constants @gol
494-fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
495-fmove-loop-invariants  -fno-branch-count-reg @gol
496-fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
497-fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
498-fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
499-fno-sched-spec  -fno-signed-zeros @gol
500-fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
501-fomit-frame-pointer  -foptimize-sibling-calls @gol
502-fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
503-fprefetch-loop-arrays @gol
504-fprofile-correction @gol
505-fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training @gol
506-fprofile-values -fprofile-reorder-functions @gol
507-freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
508-freorder-blocks-algorithm=@var{algorithm} @gol
509-freorder-blocks-and-partition  -freorder-functions @gol
510-frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
511-frounding-math  -fsave-optimization-record @gol
512-fsched2-use-superblocks  -fsched-pressure @gol
513-fsched-spec-load  -fsched-spec-load-dangerous @gol
514-fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
515-fsched-group-heuristic  -fsched-critical-path-heuristic @gol
516-fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
517-fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
518-fschedule-fusion @gol
519-fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
520-fselective-scheduling  -fselective-scheduling2 @gol
521-fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
522-fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
523-fsignaling-nans @gol
524-fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
525-fsplit-paths @gol
526-fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
527-fstdarg-opt  -fstore-merging  -fstrict-aliasing @gol
528-fthread-jumps  -ftracer  -ftree-bit-ccp @gol
529-ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
530-ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
531-ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
532-ftree-loop-if-convert  -ftree-loop-im @gol
533-ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
534-ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
535-ftree-loop-vectorize @gol
536-ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
537-ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
538-ftree-switch-conversion  -ftree-tail-merge @gol
539-ftree-ter  -ftree-vectorize  -ftree-vrp  -funconstrained-commons @gol
540-funit-at-a-time  -funroll-all-loops  -funroll-loops @gol
541-funsafe-math-optimizations  -funswitch-loops @gol
542-fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
543-fweb  -fwhole-program  -fwpa  -fuse-linker-plugin @gol
544--param @var{name}=@var{value}
545-O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og}
546
547@item Program Instrumentation Options
548@xref{Instrumentation Options,,Program Instrumentation Options}.
549@gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
550-fprofile-abs-path @gol
551-fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
552-fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
553-fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
554-fprofile-exclude-files=@var{regex} @gol
555-fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
556-fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
557-fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
558-fsanitize-undefined-trap-on-error  -fbounds-check @gol
559-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
560-fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
561-fstack-protector-explicit  -fstack-check @gol
562-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
563-fno-stack-limit  -fsplit-stack @gol
564-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
565-fvtv-counts  -fvtv-debug @gol
566-finstrument-functions @gol
567-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
568-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
569
570@item Preprocessor Options
571@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
572@gccoptlist{-A@var{question}=@var{answer} @gol
573-A-@var{question}@r{[}=@var{answer}@r{]} @gol
574-C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
575-dD  -dI  -dM  -dN  -dU @gol
576-fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
577-fexec-charset=@var{charset}  -fextended-identifiers  @gol
578-finput-charset=@var{charset}  -fmacro-prefix-map=@var{old}=@var{new}  @gol
579-fmax-include-depth=@var{depth} @gol
580-fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
581-fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
582-fwide-exec-charset=@var{charset}  -fworking-directory @gol
583-H  -imacros @var{file}  -include @var{file} @gol
584-M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT @gol
585-no-integrated-cpp  -P  -pthread  -remap @gol
586-traditional  -traditional-cpp  -trigraphs @gol
587-U@var{macro}  -undef  @gol
588-Wp,@var{option}  -Xpreprocessor @var{option}}
589
590@item Assembler Options
591@xref{Assembler Options,,Passing Options to the Assembler}.
592@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
593
594@item Linker Options
595@xref{Link Options,,Options for Linking}.
596@gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
597-nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
598-e @var{entry}  --entry=@var{entry} @gol
599-pie  -pthread  -r  -rdynamic @gol
600-s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
601-static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
602-shared  -shared-libgcc  -symbolic @gol
603-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
604-u @var{symbol}  -z @var{keyword}}
605
606@item Directory Options
607@xref{Directory Options,,Options for Directory Search}.
608@gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
609-idirafter @var{dir} @gol
610-imacros @var{file}  -imultilib @var{dir} @gol
611-iplugindir=@var{dir}  -iprefix @var{file} @gol
612-iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
613-iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
614-L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
615-nostdinc  -nostdinc++  --sysroot=@var{dir}}
616
617@item Code Generation Options
618@xref{Code Gen Options,,Options for Code Generation Conventions}.
619@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
620-ffixed-@var{reg}  -fexceptions @gol
621-fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
622-fasynchronous-unwind-tables @gol
623-fno-gnu-unique @gol
624-finhibit-size-directive  -fcommon  -fno-ident @gol
625-fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
626-fno-jump-tables @gol
627-frecord-gcc-switches @gol
628-freg-struct-return  -fshort-enums  -fshort-wchar @gol
629-fverbose-asm  -fpack-struct[=@var{n}]  @gol
630-fleading-underscore  -ftls-model=@var{model} @gol
631-fstack-reuse=@var{reuse_level} @gol
632-ftrampolines  -ftrapv  -fwrapv @gol
633-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
634-fstrict-volatile-bitfields  -fsync-libcalls}
635
636@item Developer Options
637@xref{Developer Options,,GCC Developer Options}.
638@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
639-dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
640-fchecking  -fchecking=@var{n}
641-fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
642-fdisable-ipa-@var{pass_name} @gol
643-fdisable-rtl-@var{pass_name} @gol
644-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
645-fdisable-tree-@var{pass_name} @gol
646-fdisable-tree-@var{pass-name}=@var{range-list} @gol
647-fdump-debug  -fdump-earlydebug @gol
648-fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
649-fdump-final-insns@r{[}=@var{file}@r{]} @gol
650-fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
651-fdump-lang-all @gol
652-fdump-lang-@var{switch} @gol
653-fdump-lang-@var{switch}-@var{options} @gol
654-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
655-fdump-passes @gol
656-fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
657-fdump-statistics @gol
658-fdump-tree-all @gol
659-fdump-tree-@var{switch} @gol
660-fdump-tree-@var{switch}-@var{options} @gol
661-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
662-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
663-fenable-@var{kind}-@var{pass} @gol
664-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
665-fira-verbose=@var{n} @gol
666-flto-report  -flto-report-wpa  -fmem-report-wpa @gol
667-fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
668-fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
669-fprofile-report @gol
670-frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
671-fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
672-fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
673-fvar-tracking-assignments-toggle  -gtoggle @gol
674-print-file-name=@var{library}  -print-libgcc-file-name @gol
675-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
676-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
677-print-sysroot  -print-sysroot-headers-suffix @gol
678-save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
679
680@item Machine-Dependent Options
681@xref{Submodel Options,,Machine-Dependent Options}.
682@c This list is ordered alphanumerically by subsection name.
683@c Try and put the significant identifier (CPU or system) first,
684@c so users have a clue at guessing where the ones they want will be.
685
686@emph{AArch64 Options}
687@gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
688-mgeneral-regs-only @gol
689-mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
690-mstrict-align  -mno-strict-align @gol
691-momit-leaf-frame-pointer @gol
692-mtls-dialect=desc  -mtls-dialect=traditional @gol
693-mtls-size=@var{size} @gol
694-mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
695-mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
696-mpc-relative-literal-loads @gol
697-msign-return-address=@var{scope} @gol
698-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
699+@var{b-key}]|@var{bti} @gol
700-mharden-sls=@var{opts} @gol
701-march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
702-moverride=@var{string}  -mverbose-cost-dump @gol
703-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
704-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
705-moutline-atomics }
706
707@emph{Adapteva Epiphany Options}
708@gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
709-mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
710-msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
711-mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
712-mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
713-msplit-vecmove-early  -m1reg-@var{reg}}
714
715@emph{AMD GCN Options}
716@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
717
718@emph{ARC Options}
719@gccoptlist{-mbarrel-shifter  -mjli-always @gol
720-mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
721-mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
722-mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
723-mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
724-mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
725-mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
726-mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
727-mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
728-mvolatile-cache  -mtp-regno=@var{regno} @gol
729-malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
730-mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
731-mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
732-mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
733-mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
734-mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
735-munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
736-mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
737
738@emph{ARM Options}
739@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
740-mabi=@var{name} @gol
741-mapcs-stack-check  -mno-apcs-stack-check @gol
742-mapcs-reentrant  -mno-apcs-reentrant @gol
743-mgeneral-regs-only @gol
744-msched-prolog  -mno-sched-prolog @gol
745-mlittle-endian  -mbig-endian @gol
746-mbe8  -mbe32 @gol
747-mfloat-abi=@var{name} @gol
748-mfp16-format=@var{name}
749-mthumb-interwork  -mno-thumb-interwork @gol
750-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
751-mtune=@var{name}  -mprint-tune-info @gol
752-mstructure-size-boundary=@var{n} @gol
753-mabort-on-noreturn @gol
754-mlong-calls  -mno-long-calls @gol
755-msingle-pic-base  -mno-single-pic-base @gol
756-mpic-register=@var{reg} @gol
757-mnop-fun-dllimport @gol
758-mpoke-function-name @gol
759-mthumb  -marm  -mflip-thumb @gol
760-mtpcs-frame  -mtpcs-leaf-frame @gol
761-mcaller-super-interworking  -mcallee-super-interworking @gol
762-mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
763-mword-relocations @gol
764-mfix-cortex-m3-ldrd @gol
765-munaligned-access @gol
766-mneon-for-64bits @gol
767-mslow-flash-data @gol
768-masm-syntax-unified @gol
769-mrestrict-it @gol
770-mverbose-cost-dump @gol
771-mpure-code @gol
772-mcmse @gol
773-mfix-cmse-cve-2021-35465 @gol
774-mfdpic}
775
776@emph{AVR Options}
777@gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
778-mbranch-cost=@var{cost} @gol
779-mcall-prologues  -mgas-isr-prologues  -mint8 @gol
780-mdouble=@var{bits} -mlong-double=@var{bits} @gol
781-mn_flash=@var{size}  -mno-interrupts @gol
782-mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
783-mfract-convert-truncate @gol
784-mshort-calls  -nodevicelib  -nodevicespecs @gol
785-Waddr-space-convert  -Wmisspelled-isr}
786
787@emph{Blackfin Options}
788@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
789-msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
790-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
791-mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
792-mno-id-shared-library  -mshared-library-id=@var{n} @gol
793-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
794-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
795-mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
796-micplb}
797
798@emph{C6X Options}
799@gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
800-msim  -msdata=@var{sdata-type}}
801
802@emph{CRIS Options}
803@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
804-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
805-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
806-mstack-align  -mdata-align  -mconst-align @gol
807-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
808-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
809-mmul-bug-workaround  -mno-mul-bug-workaround}
810
811@emph{CR16 Options}
812@gccoptlist{-mmac @gol
813-mcr16cplus  -mcr16c @gol
814-msim  -mint32  -mbit-ops
815-mdata-model=@var{model}}
816
817@emph{C-SKY Options}
818@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
819-mbig-endian  -EB  -mlittle-endian  -EL @gol
820-mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
821-melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
822-mdsp  -medsp  -mvdsp @gol
823-mdiv  -msmart  -mhigh-registers  -manchor @gol
824-mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
825-mbranch-cost=@var{n}  -mcse-cc  -msched-prolog}
826
827@emph{Darwin Options}
828@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
829-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
830-client_name  -compatibility_version  -current_version @gol
831-dead_strip @gol
832-dependency-file  -dylib_file  -dylinker_install_name @gol
833-dynamic  -dynamiclib  -exported_symbols_list @gol
834-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
835-force_flat_namespace  -headerpad_max_install_names @gol
836-iframework @gol
837-image_base  -init  -install_name  -keep_private_externs @gol
838-multi_module  -multiply_defined  -multiply_defined_unused @gol
839-noall_load   -no_dead_strip_inits_and_terms @gol
840-nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
841-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
842-private_bundle  -read_only_relocs  -sectalign @gol
843-sectobjectsymbols  -whyload  -seg1addr @gol
844-sectcreate  -sectobjectsymbols  -sectorder @gol
845-segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
846-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
847-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
848-single_module  -static  -sub_library  -sub_umbrella @gol
849-twolevel_namespace  -umbrella  -undefined @gol
850-unexported_symbols_list  -weak_reference_mismatches @gol
851-whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
852-mkernel  -mone-byte-bool}
853
854@emph{DEC Alpha Options}
855@gccoptlist{-mno-fp-regs  -msoft-float @gol
856-mieee  -mieee-with-inexact  -mieee-conformant @gol
857-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
858-mtrap-precision=@var{mode}  -mbuild-constants @gol
859-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
860-mbwx  -mmax  -mfix  -mcix @gol
861-mfloat-vax  -mfloat-ieee @gol
862-mexplicit-relocs  -msmall-data  -mlarge-data @gol
863-msmall-text  -mlarge-text @gol
864-mmemory-latency=@var{time}}
865
866@emph{eBPF Options}
867@gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
868-mframe-limit=@var{bytes} -mxbpf}
869
870@emph{FR30 Options}
871@gccoptlist{-msmall-model  -mno-lsim}
872
873@emph{FT32 Options}
874@gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
875
876@emph{FRV Options}
877@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
878-mhard-float  -msoft-float @gol
879-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
880-mdouble  -mno-double @gol
881-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
882-mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
883-mlinked-fp  -mlong-calls  -malign-labels @gol
884-mlibrary-pic  -macc-4  -macc-8 @gol
885-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
886-moptimize-membar  -mno-optimize-membar @gol
887-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
888-mvliw-branch  -mno-vliw-branch @gol
889-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
890-mno-nested-cond-exec  -mtomcat-stats @gol
891-mTLS  -mtls @gol
892-mcpu=@var{cpu}}
893
894@emph{GNU/Linux Options}
895@gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
896-tno-android-cc  -tno-android-ld}
897
898@emph{H8/300 Options}
899@gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
900
901@emph{HPPA Options}
902@gccoptlist{-march=@var{architecture-type} @gol
903-mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
904-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
905-mfixed-range=@var{register-range} @gol
906-mjump-in-delay  -mlinker-opt  -mlong-calls @gol
907-mlong-load-store  -mno-disable-fpregs @gol
908-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
909-mno-jump-in-delay  -mno-long-load-store @gol
910-mno-portable-runtime  -mno-soft-float @gol
911-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
912-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
913-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
914-munix=@var{unix-std}  -nolibdld  -static  -threads}
915
916@emph{IA-64 Options}
917@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
918-mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
919-mconstant-gp  -mauto-pic  -mfused-madd @gol
920-minline-float-divide-min-latency @gol
921-minline-float-divide-max-throughput @gol
922-mno-inline-float-divide @gol
923-minline-int-divide-min-latency @gol
924-minline-int-divide-max-throughput  @gol
925-mno-inline-int-divide @gol
926-minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
927-mno-inline-sqrt @gol
928-mdwarf2-asm  -mearly-stop-bits @gol
929-mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
930-mtune=@var{cpu-type}  -milp32  -mlp64 @gol
931-msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
932-msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
933-msched-spec-ldc  -msched-spec-control-ldc @gol
934-msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
935-msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
936-msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
937-msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
938
939@emph{LM32 Options}
940@gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
941-msign-extend-enabled  -muser-enabled}
942
943@emph{M32R/D Options}
944@gccoptlist{-m32r2  -m32rx  -m32r @gol
945-mdebug @gol
946-malign-loops  -mno-align-loops @gol
947-missue-rate=@var{number} @gol
948-mbranch-cost=@var{number} @gol
949-mmodel=@var{code-size-model-type} @gol
950-msdata=@var{sdata-type} @gol
951-mno-flush-func  -mflush-func=@var{name} @gol
952-mno-flush-trap  -mflush-trap=@var{number} @gol
953-G @var{num}}
954
955@emph{M32C Options}
956@gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
957
958@emph{M680x0 Options}
959@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
960-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
961-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
962-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
963-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
964-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
965-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
966-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
967-mxgot  -mno-xgot  -mlong-jump-table-offsets}
968
969@emph{MCore Options}
970@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
971-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
972-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
973-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
974-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
975
976@emph{MeP Options}
977@gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
978-mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
979-mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
980-mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
981-mtiny=@var{n}}
982
983@emph{MicroBlaze Options}
984@gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
985-mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
986-mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
987-mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
988-mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
989-mpic-data-is-text-relative}
990
991@emph{MIPS Options}
992@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
993-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
994-mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
995-mips16  -mno-mips16  -mflip-mips16 @gol
996-minterlink-compressed  -mno-interlink-compressed @gol
997-minterlink-mips16  -mno-interlink-mips16 @gol
998-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
999-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1000-mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1001-mno-float  -msingle-float  -mdouble-float @gol
1002-modd-spreg  -mno-odd-spreg @gol
1003-mabs=@var{mode}  -mnan=@var{encoding} @gol
1004-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1005-mmcu  -mmno-mcu @gol
1006-meva  -mno-eva @gol
1007-mvirt  -mno-virt @gol
1008-mxpa  -mno-xpa @gol
1009-mcrc  -mno-crc @gol
1010-mginv  -mno-ginv @gol
1011-mmicromips  -mno-micromips @gol
1012-mmsa  -mno-msa @gol
1013-mloongson-mmi  -mno-loongson-mmi @gol
1014-mloongson-ext  -mno-loongson-ext @gol
1015-mloongson-ext2  -mno-loongson-ext2 @gol
1016-mfpu=@var{fpu-type} @gol
1017-msmartmips  -mno-smartmips @gol
1018-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1019-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1020-mlong64  -mlong32  -msym32  -mno-sym32 @gol
1021-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1022-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1023-membedded-data  -mno-embedded-data @gol
1024-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1025-mcode-readable=@var{setting} @gol
1026-msplit-addresses  -mno-split-addresses @gol
1027-mexplicit-relocs  -mno-explicit-relocs @gol
1028-mcheck-zero-division  -mno-check-zero-division @gol
1029-mdivide-traps  -mdivide-breaks @gol
1030-mload-store-pairs  -mno-load-store-pairs @gol
1031-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1032-mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1033-mfix-24k  -mno-fix-24k @gol
1034-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1035-mfix-r5900  -mno-fix-r5900 @gol
1036-mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1037-mfix-vr4120  -mno-fix-vr4120 @gol
1038-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1039-mflush-func=@var{func}  -mno-flush-func @gol
1040-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1041-mcompact-branches=@var{policy} @gol
1042-mfp-exceptions  -mno-fp-exceptions @gol
1043-mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1044-mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1045-mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1046-mframe-header-opt  -mno-frame-header-opt}
1047
1048@emph{MMIX Options}
1049@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1050-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1051-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1052-mno-base-addresses  -msingle-exit  -mno-single-exit}
1053
1054@emph{MN10300 Options}
1055@gccoptlist{-mmult-bug  -mno-mult-bug @gol
1056-mno-am33  -mam33  -mam33-2  -mam34 @gol
1057-mtune=@var{cpu-type} @gol
1058-mreturn-pointer-on-d0 @gol
1059-mno-crt0  -mrelax  -mliw  -msetlb}
1060
1061@emph{Moxie Options}
1062@gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1063
1064@emph{MSP430 Options}
1065@gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1066-mwarn-mcu @gol
1067-mcode-region=  -mdata-region= @gol
1068-msilicon-errata=  -msilicon-errata-warn= @gol
1069-mhwmult=  -minrt  -mtiny-printf}
1070
1071@emph{NDS32 Options}
1072@gccoptlist{-mbig-endian  -mlittle-endian @gol
1073-mreduced-regs  -mfull-regs @gol
1074-mcmov  -mno-cmov @gol
1075-mext-perf  -mno-ext-perf @gol
1076-mext-perf2  -mno-ext-perf2 @gol
1077-mext-string  -mno-ext-string @gol
1078-mv3push  -mno-v3push @gol
1079-m16bit  -mno-16bit @gol
1080-misr-vector-size=@var{num} @gol
1081-mcache-block-size=@var{num} @gol
1082-march=@var{arch} @gol
1083-mcmodel=@var{code-model} @gol
1084-mctor-dtor  -mrelax}
1085
1086@emph{Nios II Options}
1087@gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1088-mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1089-mel  -meb @gol
1090-mno-bypass-cache  -mbypass-cache @gol
1091-mno-cache-volatile  -mcache-volatile @gol
1092-mno-fast-sw-div  -mfast-sw-div @gol
1093-mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1094-mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1095-mcustom-fpu-cfg=@var{name} @gol
1096-mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1097-march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1098
1099@emph{Nvidia PTX Options}
1100@gccoptlist{-m32  -m64  -mmainkernel  -moptimize}
1101
1102@emph{OpenRISC Options}
1103@gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1104-msoft-mul  -msoft-div @gol
1105-msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1106-mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
1107
1108@emph{PDP-11 Options}
1109@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1110-mint32  -mno-int16  -mint16  -mno-int32 @gol
1111-msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1112
1113@emph{picoChip Options}
1114@gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1115-msymbol-as-address  -mno-inefficient-warnings}
1116
1117@emph{PowerPC Options}
1118See RS/6000 and PowerPC Options.
1119
1120@emph{PRU Options}
1121@gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1122-mabi=@var{variant} @gol}
1123
1124@emph{RISC-V Options}
1125@gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1126-mplt  -mno-plt @gol
1127-mabi=@var{ABI-string} @gol
1128-mfdiv  -mno-fdiv @gol
1129-mdiv  -mno-div @gol
1130-march=@var{ISA-string} @gol
1131-mtune=@var{processor-string} @gol
1132-mpreferred-stack-boundary=@var{num} @gol
1133-msmall-data-limit=@var{N-bytes} @gol
1134-msave-restore  -mno-save-restore @gol
1135-mstrict-align  -mno-strict-align @gol
1136-mcmodel=medlow  -mcmodel=medany @gol
1137-mexplicit-relocs  -mno-explicit-relocs @gol
1138-mrelax  -mno-relax @gol
1139-mriscv-attribute  -mmo-riscv-attribute @gol
1140-malign-data=@var{type}}
1141
1142@emph{RL78 Options}
1143@gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1144-mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1145-m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1146
1147@emph{RS/6000 and PowerPC Options}
1148@gccoptlist{-mcpu=@var{cpu-type} @gol
1149-mtune=@var{cpu-type} @gol
1150-mcmodel=@var{code-model} @gol
1151-mpowerpc64 @gol
1152-maltivec  -mno-altivec @gol
1153-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1154-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1155-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1156-mfprnd  -mno-fprnd @gol
1157-mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1158-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1159-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1160-malign-power  -malign-natural @gol
1161-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1162-mupdate  -mno-update @gol
1163-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1164-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1165-mstrict-align  -mno-strict-align  -mrelocatable @gol
1166-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1167-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1168-mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1169-mprioritize-restricted-insns=@var{priority} @gol
1170-msched-costly-dep=@var{dependence_type} @gol
1171-minsert-sched-nops=@var{scheme} @gol
1172-mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1173-mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1174-mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1175-mtraceback=@var{traceback_type} @gol
1176-maix-struct-return  -msvr4-struct-return @gol
1177-mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1178-mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1179-mblock-move-inline-limit=@var{num} @gol
1180-mblock-compare-inline-limit=@var{num} @gol
1181-mblock-compare-inline-loop-limit=@var{num} @gol
1182-mstring-compare-inline-limit=@var{num} @gol
1183-misel  -mno-isel @gol
1184-mvrsave  -mno-vrsave @gol
1185-mmulhw  -mno-mulhw @gol
1186-mdlmzb  -mno-dlmzb @gol
1187-mprototype  -mno-prototype @gol
1188-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1189-msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1190-mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1191-mno-recip-precision @gol
1192-mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1193-mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1194-msave-toc-indirect  -mno-save-toc-indirect @gol
1195-mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1196-mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1197-mquad-memory  -mno-quad-memory @gol
1198-mquad-memory-atomic  -mno-quad-memory-atomic @gol
1199-mcompat-align-parm  -mno-compat-align-parm @gol
1200-mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1201-mgnu-attribute  -mno-gnu-attribute @gol
1202-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1203-mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1204-mpcrel -mno-pcrel -mmma -mno-mmma}
1205
1206@emph{RX Options}
1207@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1208-mcpu=@gol
1209-mbig-endian-data  -mlittle-endian-data @gol
1210-msmall-data @gol
1211-msim  -mno-sim@gol
1212-mas100-syntax  -mno-as100-syntax@gol
1213-mrelax@gol
1214-mmax-constant-size=@gol
1215-mint-register=@gol
1216-mpid@gol
1217-mallow-string-insns  -mno-allow-string-insns@gol
1218-mjsr@gol
1219-mno-warn-multiple-fast-interrupts@gol
1220-msave-acc-in-interrupts}
1221
1222@emph{S/390 and zSeries Options}
1223@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1224-mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1225-mlong-double-64  -mlong-double-128 @gol
1226-mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1227-msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1228-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1229-mhtm  -mvx  -mzvector @gol
1230-mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip @gol
1231-mfused-madd  -mno-fused-madd @gol
1232-mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1233-mhotpatch=@var{halfwords},@var{halfwords}}
1234
1235@emph{Score Options}
1236@gccoptlist{-meb  -mel @gol
1237-mnhwloop @gol
1238-muls @gol
1239-mmac @gol
1240-mscore5  -mscore5u  -mscore7  -mscore7d}
1241
1242@emph{SH Options}
1243@gccoptlist{-m1  -m2  -m2e @gol
1244-m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1245-m3  -m3e @gol
1246-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1247-m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1248-mb  -ml  -mdalign  -mrelax @gol
1249-mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1250-mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1251-mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1252-mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1253-maccumulate-outgoing-args @gol
1254-matomic-model=@var{atomic-model} @gol
1255-mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1256-mcbranch-force-delay-slot @gol
1257-mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1258-mpretend-cmove  -mtas}
1259
1260@emph{Solaris 2 Options}
1261@gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1262-pthreads}
1263
1264@emph{SPARC Options}
1265@gccoptlist{-mcpu=@var{cpu-type} @gol
1266-mtune=@var{cpu-type} @gol
1267-mcmodel=@var{code-model} @gol
1268-mmemory-model=@var{mem-model} @gol
1269-m32  -m64  -mapp-regs  -mno-app-regs @gol
1270-mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1271-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1272-mhard-quad-float  -msoft-quad-float @gol
1273-mstack-bias  -mno-stack-bias @gol
1274-mstd-struct-return  -mno-std-struct-return @gol
1275-munaligned-doubles  -mno-unaligned-doubles @gol
1276-muser-mode  -mno-user-mode @gol
1277-mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1278-mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1279-mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1280-mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1281-mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1282-mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1283-mlra  -mno-lra}
1284
1285@emph{System V Options}
1286@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1287
1288@emph{TILE-Gx Options}
1289@gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1290-mcmodel=@var{code-model}}
1291
1292@emph{TILEPro Options}
1293@gccoptlist{-mcpu=@var{cpu}  -m32}
1294
1295@emph{V850 Options}
1296@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1297-mprolog-function  -mno-prolog-function  -mspace @gol
1298-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1299-mapp-regs  -mno-app-regs @gol
1300-mdisable-callt  -mno-disable-callt @gol
1301-mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1302-mv850e  -mv850  -mv850e3v5 @gol
1303-mloop @gol
1304-mrelax @gol
1305-mlong-jumps @gol
1306-msoft-float @gol
1307-mhard-float @gol
1308-mgcc-abi @gol
1309-mrh850-abi @gol
1310-mbig-switch}
1311
1312@emph{VAX Options}
1313@gccoptlist{-mg  -mgnu  -munix}
1314
1315@emph{Visium Options}
1316@gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1317-mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1318
1319@emph{VMS Options}
1320@gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1321-mpointer-size=@var{size}}
1322
1323@emph{VxWorks Options}
1324@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1325-Xbind-lazy  -Xbind-now}
1326
1327@emph{x86 Options}
1328@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1329-mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1330-mfpmath=@var{unit} @gol
1331-masm=@var{dialect}  -mno-fancy-math-387 @gol
1332-mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1333-mno-wide-multiply  -mrtd  -malign-double @gol
1334-mpreferred-stack-boundary=@var{num} @gol
1335-mincoming-stack-boundary=@var{num} @gol
1336-mcld  -mcx16  -msahf  -mmovbe  -mcrc32 @gol
1337-mrecip  -mrecip=@var{opt} @gol
1338-mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1339-mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1340-mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1341-mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1342-mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1343-mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1344-msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1345-madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1346-mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1347-mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1348-mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1349-mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1350-mrdseed  -msgx -mavx512vp2intersect@gol
1351-mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1352-minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1353-mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1354-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1355-m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1356-mregparm=@var{num}  -msseregparm @gol
1357-mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1358-mpc32  -mpc64  -mpc80  -mstackrealign @gol
1359-momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1360-mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1361-m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1362-msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1363-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1364-mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1365-malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1366-mstack-protector-guard-reg=@var{reg} @gol
1367-mstack-protector-guard-offset=@var{offset} @gol
1368-mstack-protector-guard-symbol=@var{symbol} @gol
1369-mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1370-mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1371-mindirect-branch-register}
1372
1373@emph{x86 Windows Options}
1374@gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1375-mnop-fun-dllimport  -mthread @gol
1376-municode  -mwin32  -mwindows  -fno-set-stack-executable}
1377
1378@emph{Xstormy16 Options}
1379@gccoptlist{-msim}
1380
1381@emph{Xtensa Options}
1382@gccoptlist{-mconst16  -mno-const16 @gol
1383-mfused-madd  -mno-fused-madd @gol
1384-mforce-no-pic @gol
1385-mserialize-volatile  -mno-serialize-volatile @gol
1386-mtext-section-literals  -mno-text-section-literals @gol
1387-mauto-litpools  -mno-auto-litpools @gol
1388-mtarget-align  -mno-target-align @gol
1389-mlongcalls  -mno-longcalls}
1390
1391@emph{zSeries Options}
1392See S/390 and zSeries Options.
1393@end table
1394
1395
1396@node Overall Options
1397@section Options Controlling the Kind of Output
1398
1399Compilation can involve up to four stages: preprocessing, compilation
1400proper, assembly and linking, always in that order.  GCC is capable of
1401preprocessing and compiling several files either into several
1402assembler input files, or into one assembler input file; then each
1403assembler input file produces an object file, and linking combines all
1404the object files (those newly compiled, and those specified as input)
1405into an executable file.
1406
1407@cindex file name suffix
1408For any given input file, the file name suffix determines what kind of
1409compilation is done:
1410
1411@table @gcctabopt
1412@item @var{file}.c
1413C source code that must be preprocessed.
1414
1415@item @var{file}.i
1416C source code that should not be preprocessed.
1417
1418@item @var{file}.ii
1419C++ source code that should not be preprocessed.
1420
1421@item @var{file}.m
1422Objective-C source code.  Note that you must link with the @file{libobjc}
1423library to make an Objective-C program work.
1424
1425@item @var{file}.mi
1426Objective-C source code that should not be preprocessed.
1427
1428@item @var{file}.mm
1429@itemx @var{file}.M
1430Objective-C++ source code.  Note that you must link with the @file{libobjc}
1431library to make an Objective-C++ program work.  Note that @samp{.M} refers
1432to a literal capital M@.
1433
1434@item @var{file}.mii
1435Objective-C++ source code that should not be preprocessed.
1436
1437@item @var{file}.h
1438C, C++, Objective-C or Objective-C++ header file to be turned into a
1439precompiled header (default), or C, C++ header file to be turned into an
1440Ada spec (via the @option{-fdump-ada-spec} switch).
1441
1442@item @var{file}.cc
1443@itemx @var{file}.cp
1444@itemx @var{file}.cxx
1445@itemx @var{file}.cpp
1446@itemx @var{file}.CPP
1447@itemx @var{file}.c++
1448@itemx @var{file}.C
1449C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1450the last two letters must both be literally @samp{x}.  Likewise,
1451@samp{.C} refers to a literal capital C@.
1452
1453@item @var{file}.mm
1454@itemx @var{file}.M
1455Objective-C++ source code that must be preprocessed.
1456
1457@item @var{file}.mii
1458Objective-C++ source code that should not be preprocessed.
1459
1460@item @var{file}.hh
1461@itemx @var{file}.H
1462@itemx @var{file}.hp
1463@itemx @var{file}.hxx
1464@itemx @var{file}.hpp
1465@itemx @var{file}.HPP
1466@itemx @var{file}.h++
1467@itemx @var{file}.tcc
1468C++ header file to be turned into a precompiled header or Ada spec.
1469
1470@item @var{file}.f
1471@itemx @var{file}.for
1472@itemx @var{file}.ftn
1473Fixed form Fortran source code that should not be preprocessed.
1474
1475@item @var{file}.F
1476@itemx @var{file}.FOR
1477@itemx @var{file}.fpp
1478@itemx @var{file}.FPP
1479@itemx @var{file}.FTN
1480Fixed form Fortran source code that must be preprocessed (with the traditional
1481preprocessor).
1482
1483@item @var{file}.f90
1484@itemx @var{file}.f95
1485@itemx @var{file}.f03
1486@itemx @var{file}.f08
1487Free form Fortran source code that should not be preprocessed.
1488
1489@item @var{file}.F90
1490@itemx @var{file}.F95
1491@itemx @var{file}.F03
1492@itemx @var{file}.F08
1493Free form Fortran source code that must be preprocessed (with the
1494traditional preprocessor).
1495
1496@item @var{file}.go
1497Go source code.
1498
1499@item @var{file}.brig
1500BRIG files (binary representation of HSAIL).
1501
1502@item @var{file}.d
1503D source code.
1504
1505@item @var{file}.di
1506D interface file.
1507
1508@item @var{file}.dd
1509D documentation code (Ddoc).
1510
1511@item @var{file}.ads
1512Ada source code file that contains a library unit declaration (a
1513declaration of a package, subprogram, or generic, or a generic
1514instantiation), or a library unit renaming declaration (a package,
1515generic, or subprogram renaming declaration).  Such files are also
1516called @dfn{specs}.
1517
1518@item @var{file}.adb
1519Ada source code file containing a library unit body (a subprogram or
1520package body).  Such files are also called @dfn{bodies}.
1521
1522@c GCC also knows about some suffixes for languages not yet included:
1523@c Ratfor:
1524@c @var{file}.r
1525
1526@item @var{file}.s
1527Assembler code.
1528
1529@item @var{file}.S
1530@itemx @var{file}.sx
1531Assembler code that must be preprocessed.
1532
1533@item @var{other}
1534An object file to be fed straight into linking.
1535Any file name with no recognized suffix is treated this way.
1536@end table
1537
1538@opindex x
1539You can specify the input language explicitly with the @option{-x} option:
1540
1541@table @gcctabopt
1542@item -x @var{language}
1543Specify explicitly the @var{language} for the following input files
1544(rather than letting the compiler choose a default based on the file
1545name suffix).  This option applies to all following input files until
1546the next @option{-x} option.  Possible values for @var{language} are:
1547@smallexample
1548c  c-header  cpp-output
1549c++  c++-header  c++-cpp-output
1550objective-c  objective-c-header  objective-c-cpp-output
1551objective-c++ objective-c++-header objective-c++-cpp-output
1552assembler  assembler-with-cpp
1553ada
1554d
1555f77  f77-cpp-input f95  f95-cpp-input
1556go
1557brig
1558@end smallexample
1559
1560@item -x none
1561Turn off any specification of a language, so that subsequent files are
1562handled according to their file name suffixes (as they are if @option{-x}
1563has not been used at all).
1564@end table
1565
1566If you only want some of the stages of compilation, you can use
1567@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1568one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1569@command{gcc} is to stop.  Note that some combinations (for example,
1570@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1571
1572@table @gcctabopt
1573@item -c
1574@opindex c
1575Compile or assemble the source files, but do not link.  The linking
1576stage simply is not done.  The ultimate output is in the form of an
1577object file for each source file.
1578
1579By default, the object file name for a source file is made by replacing
1580the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1581
1582Unrecognized input files, not requiring compilation or assembly, are
1583ignored.
1584
1585@item -S
1586@opindex S
1587Stop after the stage of compilation proper; do not assemble.  The output
1588is in the form of an assembler code file for each non-assembler input
1589file specified.
1590
1591By default, the assembler file name for a source file is made by
1592replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1593
1594Input files that don't require compilation are ignored.
1595
1596@item -E
1597@opindex E
1598Stop after the preprocessing stage; do not run the compiler proper.  The
1599output is in the form of preprocessed source code, which is sent to the
1600standard output.
1601
1602Input files that don't require preprocessing are ignored.
1603
1604@cindex output file option
1605@item -o @var{file}
1606@opindex o
1607Place output in file @var{file}.  This applies to whatever
1608sort of output is being produced, whether it be an executable file,
1609an object file, an assembler file or preprocessed C code.
1610
1611If @option{-o} is not specified, the default is to put an executable
1612file in @file{a.out}, the object file for
1613@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1614assembler file in @file{@var{source}.s}, a precompiled header file in
1615@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1616standard output.
1617
1618@item -v
1619@opindex v
1620Print (on standard error output) the commands executed to run the stages
1621of compilation.  Also print the version number of the compiler driver
1622program and of the preprocessor and the compiler proper.
1623
1624@item -###
1625@opindex ###
1626Like @option{-v} except the commands are not executed and arguments
1627are quoted unless they contain only alphanumeric characters or @code{./-_}.
1628This is useful for shell scripts to capture the driver-generated command lines.
1629
1630@item --help
1631@opindex help
1632Print (on the standard output) a description of the command-line options
1633understood by @command{gcc}.  If the @option{-v} option is also specified
1634then @option{--help} is also passed on to the various processes
1635invoked by @command{gcc}, so that they can display the command-line options
1636they accept.  If the @option{-Wextra} option has also been specified
1637(prior to the @option{--help} option), then command-line options that
1638have no documentation associated with them are also displayed.
1639
1640@item --target-help
1641@opindex target-help
1642Print (on the standard output) a description of target-specific command-line
1643options for each tool.  For some targets extra target-specific
1644information may also be printed.
1645
1646@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1647Print (on the standard output) a description of the command-line
1648options understood by the compiler that fit into all specified classes
1649and qualifiers.  These are the supported classes:
1650
1651@table @asis
1652@item @samp{optimizers}
1653Display all of the optimization options supported by the
1654compiler.
1655
1656@item @samp{warnings}
1657Display all of the options controlling warning messages
1658produced by the compiler.
1659
1660@item @samp{target}
1661Display target-specific options.  Unlike the
1662@option{--target-help} option however, target-specific options of the
1663linker and assembler are not displayed.  This is because those
1664tools do not currently support the extended @option{--help=} syntax.
1665
1666@item @samp{params}
1667Display the values recognized by the @option{--param}
1668option.
1669
1670@item @var{language}
1671Display the options supported for @var{language}, where
1672@var{language} is the name of one of the languages supported in this
1673version of GCC@.  If an option is supported by all languages, one needs
1674to select @samp{common} class.
1675
1676@item @samp{common}
1677Display the options that are common to all languages.
1678@end table
1679
1680These are the supported qualifiers:
1681
1682@table @asis
1683@item @samp{undocumented}
1684Display only those options that are undocumented.
1685
1686@item @samp{joined}
1687Display options taking an argument that appears after an equal
1688sign in the same continuous piece of text, such as:
1689@samp{--help=target}.
1690
1691@item @samp{separate}
1692Display options taking an argument that appears as a separate word
1693following the original option, such as: @samp{-o output-file}.
1694@end table
1695
1696Thus for example to display all the undocumented target-specific
1697switches supported by the compiler, use:
1698
1699@smallexample
1700--help=target,undocumented
1701@end smallexample
1702
1703The sense of a qualifier can be inverted by prefixing it with the
1704@samp{^} character, so for example to display all binary warning
1705options (i.e., ones that are either on or off and that do not take an
1706argument) that have a description, use:
1707
1708@smallexample
1709--help=warnings,^joined,^undocumented
1710@end smallexample
1711
1712The argument to @option{--help=} should not consist solely of inverted
1713qualifiers.
1714
1715Combining several classes is possible, although this usually
1716restricts the output so much that there is nothing to display.  One
1717case where it does work, however, is when one of the classes is
1718@var{target}.  For example, to display all the target-specific
1719optimization options, use:
1720
1721@smallexample
1722--help=target,optimizers
1723@end smallexample
1724
1725The @option{--help=} option can be repeated on the command line.  Each
1726successive use displays its requested class of options, skipping
1727those that have already been displayed.  If @option{--help} is also
1728specified anywhere on the command line then this takes precedence
1729over any @option{--help=} option.
1730
1731If the @option{-Q} option appears on the command line before the
1732@option{--help=} option, then the descriptive text displayed by
1733@option{--help=} is changed.  Instead of describing the displayed
1734options, an indication is given as to whether the option is enabled,
1735disabled or set to a specific value (assuming that the compiler
1736knows this at the point where the @option{--help=} option is used).
1737
1738Here is a truncated example from the ARM port of @command{gcc}:
1739
1740@smallexample
1741  % gcc -Q -mabi=2 --help=target -c
1742  The following options are target specific:
1743  -mabi=                                2
1744  -mabort-on-noreturn                   [disabled]
1745  -mapcs                                [disabled]
1746@end smallexample
1747
1748The output is sensitive to the effects of previous command-line
1749options, so for example it is possible to find out which optimizations
1750are enabled at @option{-O2} by using:
1751
1752@smallexample
1753-Q -O2 --help=optimizers
1754@end smallexample
1755
1756Alternatively you can discover which binary optimizations are enabled
1757by @option{-O3} by using:
1758
1759@smallexample
1760gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1761gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1762diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1763@end smallexample
1764
1765@item --version
1766@opindex version
1767Display the version number and copyrights of the invoked GCC@.
1768
1769@item -pass-exit-codes
1770@opindex pass-exit-codes
1771Normally the @command{gcc} program exits with the code of 1 if any
1772phase of the compiler returns a non-success return code.  If you specify
1773@option{-pass-exit-codes}, the @command{gcc} program instead returns with
1774the numerically highest error produced by any phase returning an error
1775indication.  The C, C++, and Fortran front ends return 4 if an internal
1776compiler error is encountered.
1777
1778@item -pipe
1779@opindex pipe
1780Use pipes rather than temporary files for communication between the
1781various stages of compilation.  This fails to work on some systems where
1782the assembler is unable to read from a pipe; but the GNU assembler has
1783no trouble.
1784
1785@item -specs=@var{file}
1786@opindex specs
1787Process @var{file} after the compiler reads in the standard @file{specs}
1788file, in order to override the defaults which the @command{gcc} driver
1789program uses when determining what switches to pass to @command{cc1},
1790@command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
1791@option{-specs=@var{file}} can be specified on the command line, and they
1792are processed in order, from left to right.  @xref{Spec Files}, for
1793information about the format of the @var{file}.
1794
1795@item -wrapper
1796@opindex wrapper
1797Invoke all subcommands under a wrapper program.  The name of the
1798wrapper program and its parameters are passed as a comma separated
1799list.
1800
1801@smallexample
1802gcc -c t.c -wrapper gdb,--args
1803@end smallexample
1804
1805@noindent
1806This invokes all subprograms of @command{gcc} under
1807@samp{gdb --args}, thus the invocation of @command{cc1} is
1808@samp{gdb --args cc1 @dots{}}.
1809
1810@item -ffile-prefix-map=@var{old}=@var{new}
1811@opindex ffile-prefix-map
1812When compiling files residing in directory @file{@var{old}}, record
1813any references to them in the result of the compilation as if the
1814files resided in directory @file{@var{new}} instead.  Specifying this
1815option is equivalent to specifying all the individual
1816@option{-f*-prefix-map} options.  This can be used to make reproducible
1817builds that are location independent.  See also
1818@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1819
1820@item -fplugin=@var{name}.so
1821@opindex fplugin
1822Load the plugin code in file @var{name}.so, assumed to be a
1823shared object to be dlopen'd by the compiler.  The base name of
1824the shared object file is used to identify the plugin for the
1825purposes of argument parsing (See
1826@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1827Each plugin should define the callback functions specified in the
1828Plugins API.
1829
1830@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1831@opindex fplugin-arg
1832Define an argument called @var{key} with a value of @var{value}
1833for the plugin called @var{name}.
1834
1835@item -fdump-ada-spec@r{[}-slim@r{]}
1836@opindex fdump-ada-spec
1837For C and C++ source and include files, generate corresponding Ada specs.
1838@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1839GNAT User's Guide}, which provides detailed documentation on this feature.
1840
1841@item -fada-spec-parent=@var{unit}
1842@opindex fada-spec-parent
1843In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1844Ada specs as child units of parent @var{unit}.
1845
1846@item -fdump-go-spec=@var{file}
1847@opindex fdump-go-spec
1848For input files in any language, generate corresponding Go
1849declarations in @var{file}.  This generates Go @code{const},
1850@code{type}, @code{var}, and @code{func} declarations which may be a
1851useful way to start writing a Go interface to code written in some
1852other language.
1853
1854@include @value{srcdir}/../libiberty/at-file.texi
1855@end table
1856
1857@node Invoking G++
1858@section Compiling C++ Programs
1859
1860@cindex suffixes for C++ source
1861@cindex C++ source file suffixes
1862C++ source files conventionally use one of the suffixes @samp{.C},
1863@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1864@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1865@samp{.H}, or (for shared template code) @samp{.tcc}; and
1866preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1867files with these names and compiles them as C++ programs even if you
1868call the compiler the same way as for compiling C programs (usually
1869with the name @command{gcc}).
1870
1871@findex g++
1872@findex c++
1873However, the use of @command{gcc} does not add the C++ library.
1874@command{g++} is a program that calls GCC and automatically specifies linking
1875against the C++ library.  It treats @samp{.c},
1876@samp{.h} and @samp{.i} files as C++ source files instead of C source
1877files unless @option{-x} is used.  This program is also useful when
1878precompiling a C header file with a @samp{.h} extension for use in C++
1879compilations.  On many systems, @command{g++} is also installed with
1880the name @command{c++}.
1881
1882@cindex invoking @command{g++}
1883When you compile C++ programs, you may specify many of the same
1884command-line options that you use for compiling programs in any
1885language; or command-line options meaningful for C and related
1886languages; or options that are meaningful only for C++ programs.
1887@xref{C Dialect Options,,Options Controlling C Dialect}, for
1888explanations of options for languages related to C@.
1889@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1890explanations of options that are meaningful only for C++ programs.
1891
1892@node C Dialect Options
1893@section Options Controlling C Dialect
1894@cindex dialect options
1895@cindex language dialect options
1896@cindex options, dialect
1897
1898The following options control the dialect of C (or languages derived
1899from C, such as C++, Objective-C and Objective-C++) that the compiler
1900accepts:
1901
1902@table @gcctabopt
1903@cindex ANSI support
1904@cindex ISO support
1905@item -ansi
1906@opindex ansi
1907In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1908equivalent to @option{-std=c++98}.
1909
1910This turns off certain features of GCC that are incompatible with ISO
1911C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1912such as the @code{asm} and @code{typeof} keywords, and
1913predefined macros such as @code{unix} and @code{vax} that identify the
1914type of system you are using.  It also enables the undesirable and
1915rarely used ISO trigraph feature.  For the C compiler,
1916it disables recognition of C++ style @samp{//} comments as well as
1917the @code{inline} keyword.
1918
1919The alternate keywords @code{__asm__}, @code{__extension__},
1920@code{__inline__} and @code{__typeof__} continue to work despite
1921@option{-ansi}.  You would not want to use them in an ISO C program, of
1922course, but it is useful to put them in header files that might be included
1923in compilations done with @option{-ansi}.  Alternate predefined macros
1924such as @code{__unix__} and @code{__vax__} are also available, with or
1925without @option{-ansi}.
1926
1927The @option{-ansi} option does not cause non-ISO programs to be
1928rejected gratuitously.  For that, @option{-Wpedantic} is required in
1929addition to @option{-ansi}.  @xref{Warning Options}.
1930
1931The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1932option is used.  Some header files may notice this macro and refrain
1933from declaring certain functions or defining certain macros that the
1934ISO standard doesn't call for; this is to avoid interfering with any
1935programs that might use these names for other things.
1936
1937Functions that are normally built in but do not have semantics
1938defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1939functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1940built-in functions provided by GCC}, for details of the functions
1941affected.
1942
1943@item -std=
1944@opindex std
1945Determine the language standard. @xref{Standards,,Language Standards
1946Supported by GCC}, for details of these standard versions.  This option
1947is currently only supported when compiling C or C++.
1948
1949The compiler can accept several base standards, such as @samp{c90} or
1950@samp{c++98}, and GNU dialects of those standards, such as
1951@samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1952compiler accepts all programs following that standard plus those
1953using GNU extensions that do not contradict it.  For example,
1954@option{-std=c90} turns off certain features of GCC that are
1955incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1956keywords, but not other GNU extensions that do not have a meaning in
1957ISO C90, such as omitting the middle term of a @code{?:}
1958expression. On the other hand, when a GNU dialect of a standard is
1959specified, all features supported by the compiler are enabled, even when
1960those features change the meaning of the base standard.  As a result, some
1961strict-conforming programs may be rejected.  The particular standard
1962is used by @option{-Wpedantic} to identify which features are GNU
1963extensions given that version of the standard. For example
1964@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1965comments, while @option{-std=gnu99 -Wpedantic} does not.
1966
1967A value for this option must be provided; possible values are
1968
1969@table @samp
1970@item c90
1971@itemx c89
1972@itemx iso9899:1990
1973Support all ISO C90 programs (certain GNU extensions that conflict
1974with ISO C90 are disabled). Same as @option{-ansi} for C code.
1975
1976@item iso9899:199409
1977ISO C90 as modified in amendment 1.
1978
1979@item c99
1980@itemx c9x
1981@itemx iso9899:1999
1982@itemx iso9899:199x
1983ISO C99.  This standard is substantially completely supported, modulo
1984bugs and floating-point issues
1985(mainly but not entirely relating to optional C99 features from
1986Annexes F and G).  See
1987@w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1988names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1989
1990@item c11
1991@itemx c1x
1992@itemx iso9899:2011
1993ISO C11, the 2011 revision of the ISO C standard.  This standard is
1994substantially completely supported, modulo bugs, floating-point issues
1995(mainly but not entirely relating to optional C11 features from
1996Annexes F and G) and the optional Annexes K (Bounds-checking
1997interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
1998
1999@item c17
2000@itemx c18
2001@itemx iso9899:2017
2002@itemx iso9899:2018
2003ISO C17, the 2017 revision of the ISO C standard
2004(published in 2018).  This standard is
2005same as C11 except for corrections of defects (all of which are also
2006applied with @option{-std=c11}) and a new value of
2007@code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2008
2009@item c2x
2010The next version of the ISO C standard, still under development.  The
2011support for this version is experimental and incomplete.
2012
2013@item gnu90
2014@itemx gnu89
2015GNU dialect of ISO C90 (including some C99 features).
2016
2017@item gnu99
2018@itemx gnu9x
2019GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2020
2021@item gnu11
2022@itemx gnu1x
2023GNU dialect of ISO C11.
2024The name @samp{gnu1x} is deprecated.
2025
2026@item gnu17
2027@itemx gnu18
2028GNU dialect of ISO C17.  This is the default for C code.
2029
2030@item gnu2x
2031The next version of the ISO C standard, still under development, plus
2032GNU extensions.  The support for this version is experimental and
2033incomplete.
2034
2035@item c++98
2036@itemx c++03
2037The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2038additional defect reports. Same as @option{-ansi} for C++ code.
2039
2040@item gnu++98
2041@itemx gnu++03
2042GNU dialect of @option{-std=c++98}.
2043
2044@item c++11
2045@itemx c++0x
2046The 2011 ISO C++ standard plus amendments.
2047The name @samp{c++0x} is deprecated.
2048
2049@item gnu++11
2050@itemx gnu++0x
2051GNU dialect of @option{-std=c++11}.
2052The name @samp{gnu++0x} is deprecated.
2053
2054@item c++14
2055@itemx c++1y
2056The 2014 ISO C++ standard plus amendments.
2057The name @samp{c++1y} is deprecated.
2058
2059@item gnu++14
2060@itemx gnu++1y
2061GNU dialect of @option{-std=c++14}.
2062This is the default for C++ code.
2063The name @samp{gnu++1y} is deprecated.
2064
2065@item c++17
2066@itemx c++1z
2067The 2017 ISO C++ standard plus amendments.
2068The name @samp{c++1z} is deprecated.
2069
2070@item gnu++17
2071@itemx gnu++1z
2072GNU dialect of @option{-std=c++17}.
2073The name @samp{gnu++1z} is deprecated.
2074
2075@item c++20
2076@itemx c++2a
2077The next revision of the ISO C++ standard, planned for
20782020.  Support is highly experimental, and will almost certainly
2079change in incompatible ways in future releases.
2080
2081@item gnu++20
2082@itemx gnu++2a
2083GNU dialect of @option{-std=c++20}.  Support is highly experimental,
2084and will almost certainly change in incompatible ways in future
2085releases.
2086@end table
2087
2088@item -fgnu89-inline
2089@opindex fgnu89-inline
2090The option @option{-fgnu89-inline} tells GCC to use the traditional
2091GNU semantics for @code{inline} functions when in C99 mode.
2092@xref{Inline,,An Inline Function is As Fast As a Macro}.
2093Using this option is roughly equivalent to adding the
2094@code{gnu_inline} function attribute to all inline functions
2095(@pxref{Function Attributes}).
2096
2097The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2098C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2099specifies the default behavior).
2100This option is not supported in @option{-std=c90} or
2101@option{-std=gnu90} mode.
2102
2103The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2104@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2105in effect for @code{inline} functions.  @xref{Common Predefined
2106Macros,,,cpp,The C Preprocessor}.
2107
2108@item -fpermitted-flt-eval-methods=@var{style}
2109@opindex fpermitted-flt-eval-methods
2110@opindex fpermitted-flt-eval-methods=c11
2111@opindex fpermitted-flt-eval-methods=ts-18661-3
2112ISO/IEC TS 18661-3 defines new permissible values for
2113@code{FLT_EVAL_METHOD} that indicate that operations and constants with
2114a semantic type that is an interchange or extended format should be
2115evaluated to the precision and range of that type.  These new values are
2116a superset of those permitted under C99/C11, which does not specify the
2117meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2118conforming to C11 may not have been written expecting the possibility of
2119the new values.
2120
2121@option{-fpermitted-flt-eval-methods} specifies whether the compiler
2122should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2123or the extended set of values specified in ISO/IEC TS 18661-3.
2124
2125@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2126
2127The default when in a standards compliant mode (@option{-std=c11} or similar)
2128is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2129dialect (@option{-std=gnu11} or similar) is
2130@option{-fpermitted-flt-eval-methods=ts-18661-3}.
2131
2132@item -aux-info @var{filename}
2133@opindex aux-info
2134Output to the given filename prototyped declarations for all functions
2135declared and/or defined in a translation unit, including those in header
2136files.  This option is silently ignored in any language other than C@.
2137
2138Besides declarations, the file indicates, in comments, the origin of
2139each declaration (source file and line), whether the declaration was
2140implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2141@samp{O} for old, respectively, in the first character after the line
2142number and the colon), and whether it came from a declaration or a
2143definition (@samp{C} or @samp{F}, respectively, in the following
2144character).  In the case of function definitions, a K&R-style list of
2145arguments followed by their declarations is also provided, inside
2146comments, after the declaration.
2147
2148@item -fallow-parameterless-variadic-functions
2149@opindex fallow-parameterless-variadic-functions
2150Accept variadic functions without named parameters.
2151
2152Although it is possible to define such a function, this is not very
2153useful as it is not possible to read the arguments.  This is only
2154supported for C as this construct is allowed by C++.
2155
2156@item -fno-asm
2157@opindex fno-asm
2158@opindex fasm
2159Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2160keyword, so that code can use these words as identifiers.  You can use
2161the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2162instead.  @option{-ansi} implies @option{-fno-asm}.
2163
2164In C++, this switch only affects the @code{typeof} keyword, since
2165@code{asm} and @code{inline} are standard keywords.  You may want to
2166use the @option{-fno-gnu-keywords} flag instead, which has the same
2167effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2168switch only affects the @code{asm} and @code{typeof} keywords, since
2169@code{inline} is a standard keyword in ISO C99.
2170
2171@item -fno-builtin
2172@itemx -fno-builtin-@var{function}
2173@opindex fno-builtin
2174@opindex fbuiltin
2175@cindex built-in functions
2176Don't recognize built-in functions that do not begin with
2177@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2178functions provided by GCC}, for details of the functions affected,
2179including those which are not built-in functions when @option{-ansi} or
2180@option{-std} options for strict ISO C conformance are used because they
2181do not have an ISO standard meaning.
2182
2183GCC normally generates special code to handle certain built-in functions
2184more efficiently; for instance, calls to @code{alloca} may become single
2185instructions which adjust the stack directly, and calls to @code{memcpy}
2186may become inline copy loops.  The resulting code is often both smaller
2187and faster, but since the function calls no longer appear as such, you
2188cannot set a breakpoint on those calls, nor can you change the behavior
2189of the functions by linking with a different library.  In addition,
2190when a function is recognized as a built-in function, GCC may use
2191information about that function to warn about problems with calls to
2192that function, or to generate more efficient code, even if the
2193resulting code still contains calls to that function.  For example,
2194warnings are given with @option{-Wformat} for bad calls to
2195@code{printf} when @code{printf} is built in and @code{strlen} is
2196known not to modify global memory.
2197
2198With the @option{-fno-builtin-@var{function}} option
2199only the built-in function @var{function} is
2200disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2201function is named that is not built-in in this version of GCC, this
2202option is ignored.  There is no corresponding
2203@option{-fbuiltin-@var{function}} option; if you wish to enable
2204built-in functions selectively when using @option{-fno-builtin} or
2205@option{-ffreestanding}, you may define macros such as:
2206
2207@smallexample
2208#define abs(n)          __builtin_abs ((n))
2209#define strcpy(d, s)    __builtin_strcpy ((d), (s))
2210@end smallexample
2211
2212@item -fgimple
2213@opindex fgimple
2214
2215Enable parsing of function definitions marked with @code{__GIMPLE}.
2216This is an experimental feature that allows unit testing of GIMPLE
2217passes.
2218
2219@item -fhosted
2220@opindex fhosted
2221@cindex hosted environment
2222
2223Assert that compilation targets a hosted environment.  This implies
2224@option{-fbuiltin}.  A hosted environment is one in which the
2225entire standard library is available, and in which @code{main} has a return
2226type of @code{int}.  Examples are nearly everything except a kernel.
2227This is equivalent to @option{-fno-freestanding}.
2228
2229@item -ffreestanding
2230@opindex ffreestanding
2231@cindex hosted environment
2232
2233Assert that compilation targets a freestanding environment.  This
2234implies @option{-fno-builtin}.  A freestanding environment
2235is one in which the standard library may not exist, and program startup may
2236not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2237This is equivalent to @option{-fno-hosted}.
2238
2239@xref{Standards,,Language Standards Supported by GCC}, for details of
2240freestanding and hosted environments.
2241
2242@item -fopenacc
2243@opindex fopenacc
2244@cindex OpenACC accelerator programming
2245Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2246@code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2247compiler generates accelerated code according to the OpenACC Application
2248Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2249implies @option{-pthread}, and thus is only supported on targets that
2250have support for @option{-pthread}.
2251
2252@item -fopenacc-dim=@var{geom}
2253@opindex fopenacc-dim
2254@cindex OpenACC accelerator programming
2255Specify default compute dimensions for parallel offload regions that do
2256not explicitly specify.  The @var{geom} value is a triple of
2257':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2258can be omitted, to use a target-specific default value.
2259
2260@item -fopenmp
2261@opindex fopenmp
2262@cindex OpenMP parallel
2263Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2264@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2265compiler generates parallel code according to the OpenMP Application
2266Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2267implies @option{-pthread}, and thus is only supported on targets that
2268have support for @option{-pthread}. @option{-fopenmp} implies
2269@option{-fopenmp-simd}.
2270
2271@item -fopenmp-simd
2272@opindex fopenmp-simd
2273@cindex OpenMP SIMD
2274@cindex SIMD
2275Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2276in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2277are ignored.
2278
2279@item -fgnu-tm
2280@opindex fgnu-tm
2281When the option @option{-fgnu-tm} is specified, the compiler
2282generates code for the Linux variant of Intel's current Transactional
2283Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2284an experimental feature whose interface may change in future versions
2285of GCC, as the official specification changes.  Please note that not
2286all architectures are supported for this feature.
2287
2288For more information on GCC's support for transactional memory,
2289@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2290Transactional Memory Library}.
2291
2292Note that the transactional memory feature is not supported with
2293non-call exceptions (@option{-fnon-call-exceptions}).
2294
2295@item -fms-extensions
2296@opindex fms-extensions
2297Accept some non-standard constructs used in Microsoft header files.
2298
2299In C++ code, this allows member names in structures to be similar
2300to previous types declarations.
2301
2302@smallexample
2303typedef int UOW;
2304struct ABC @{
2305  UOW UOW;
2306@};
2307@end smallexample
2308
2309Some cases of unnamed fields in structures and unions are only
2310accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2311fields within structs/unions}, for details.
2312
2313Note that this option is off for all targets except for x86
2314targets using ms-abi.
2315
2316@item -fplan9-extensions
2317@opindex fplan9-extensions
2318Accept some non-standard constructs used in Plan 9 code.
2319
2320This enables @option{-fms-extensions}, permits passing pointers to
2321structures with anonymous fields to functions that expect pointers to
2322elements of the type of the field, and permits referring to anonymous
2323fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2324struct/union fields within structs/unions}, for details.  This is only
2325supported for C, not C++.
2326
2327@item -fcond-mismatch
2328@opindex fcond-mismatch
2329Allow conditional expressions with mismatched types in the second and
2330third arguments.  The value of such an expression is void.  This option
2331is not supported for C++.
2332
2333@item -flax-vector-conversions
2334@opindex flax-vector-conversions
2335Allow implicit conversions between vectors with differing numbers of
2336elements and/or incompatible element types.  This option should not be
2337used for new code.
2338
2339@item -funsigned-char
2340@opindex funsigned-char
2341Let the type @code{char} be unsigned, like @code{unsigned char}.
2342
2343Each kind of machine has a default for what @code{char} should
2344be.  It is either like @code{unsigned char} by default or like
2345@code{signed char} by default.
2346
2347Ideally, a portable program should always use @code{signed char} or
2348@code{unsigned char} when it depends on the signedness of an object.
2349But many programs have been written to use plain @code{char} and
2350expect it to be signed, or expect it to be unsigned, depending on the
2351machines they were written for.  This option, and its inverse, let you
2352make such a program work with the opposite default.
2353
2354The type @code{char} is always a distinct type from each of
2355@code{signed char} or @code{unsigned char}, even though its behavior
2356is always just like one of those two.
2357
2358@item -fsigned-char
2359@opindex fsigned-char
2360Let the type @code{char} be signed, like @code{signed char}.
2361
2362Note that this is equivalent to @option{-fno-unsigned-char}, which is
2363the negative form of @option{-funsigned-char}.  Likewise, the option
2364@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2365
2366@item -fsigned-bitfields
2367@itemx -funsigned-bitfields
2368@itemx -fno-signed-bitfields
2369@itemx -fno-unsigned-bitfields
2370@opindex fsigned-bitfields
2371@opindex funsigned-bitfields
2372@opindex fno-signed-bitfields
2373@opindex fno-unsigned-bitfields
2374These options control whether a bit-field is signed or unsigned, when the
2375declaration does not use either @code{signed} or @code{unsigned}.  By
2376default, such a bit-field is signed, because this is consistent: the
2377basic integer types such as @code{int} are signed types.
2378
2379@item -fsso-struct=@var{endianness}
2380@opindex fsso-struct
2381Set the default scalar storage order of structures and unions to the
2382specified endianness.  The accepted values are @samp{big-endian},
2383@samp{little-endian} and @samp{native} for the native endianness of
2384the target (the default).  This option is not supported for C++.
2385
2386@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2387code that is not binary compatible with code generated without it if the
2388specified endianness is not the native endianness of the target.
2389@end table
2390
2391@node C++ Dialect Options
2392@section Options Controlling C++ Dialect
2393
2394@cindex compiler options, C++
2395@cindex C++ options, command-line
2396@cindex options, C++
2397This section describes the command-line options that are only meaningful
2398for C++ programs.  You can also use most of the GNU compiler options
2399regardless of what language your program is in.  For example, you
2400might compile a file @file{firstClass.C} like this:
2401
2402@smallexample
2403g++ -g -fstrict-enums -O -c firstClass.C
2404@end smallexample
2405
2406@noindent
2407In this example, only @option{-fstrict-enums} is an option meant
2408only for C++ programs; you can use the other options with any
2409language supported by GCC@.
2410
2411Some options for compiling C programs, such as @option{-std}, are also
2412relevant for C++ programs.
2413@xref{C Dialect Options,,Options Controlling C Dialect}.
2414
2415Here is a list of options that are @emph{only} for compiling C++ programs:
2416
2417@table @gcctabopt
2418
2419@item -fabi-version=@var{n}
2420@opindex fabi-version
2421Use version @var{n} of the C++ ABI@.  The default is version 0.
2422
2423Version 0 refers to the version conforming most closely to
2424the C++ ABI specification.  Therefore, the ABI obtained using version 0
2425will change in different versions of G++ as ABI bugs are fixed.
2426
2427Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2428
2429Version 2 is the version of the C++ ABI that first appeared in G++
24303.4, and was the default through G++ 4.9.
2431
2432Version 3 corrects an error in mangling a constant address as a
2433template argument.
2434
2435Version 4, which first appeared in G++ 4.5, implements a standard
2436mangling for vector types.
2437
2438Version 5, which first appeared in G++ 4.6, corrects the mangling of
2439attribute const/volatile on function pointer types, decltype of a
2440plain decl, and use of a function parameter in the declaration of
2441another parameter.
2442
2443Version 6, which first appeared in G++ 4.7, corrects the promotion
2444behavior of C++11 scoped enums and the mangling of template argument
2445packs, const/static_cast, prefix ++ and --, and a class scope function
2446used as a template argument.
2447
2448Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2449builtin type and corrects the mangling of lambdas in default argument
2450scope.
2451
2452Version 8, which first appeared in G++ 4.9, corrects the substitution
2453behavior of function types with function-cv-qualifiers.
2454
2455Version 9, which first appeared in G++ 5.2, corrects the alignment of
2456@code{nullptr_t}.
2457
2458Version 10, which first appeared in G++ 6.1, adds mangling of
2459attributes that affect type identity, such as ia32 calling convention
2460attributes (e.g.@: @samp{stdcall}).
2461
2462Version 11, which first appeared in G++ 7, corrects the mangling of
2463sizeof... expressions and operator names.  For multiple entities with
2464the same name within a function, that are declared in different scopes,
2465the mangling now changes starting with the twelfth occurrence.  It also
2466implies @option{-fnew-inheriting-ctors}.
2467
2468Version 12, which first appeared in G++ 8, corrects the calling
2469conventions for empty classes on the x86_64 target and for classes
2470with only deleted copy/move constructors.  It accidentally changes the
2471calling convention for classes with a deleted copy constructor and a
2472trivial move constructor.
2473
2474Version 13, which first appeared in G++ 8.2, fixes the accidental
2475change in version 12.
2476
2477Version 14, which first appeared in G++ 10, corrects the mangling of
2478the nullptr expression.
2479
2480See also @option{-Wabi}.
2481
2482@item -fabi-compat-version=@var{n}
2483@opindex fabi-compat-version
2484On targets that support strong aliases, G++
2485works around mangling changes by creating an alias with the correct
2486mangled name when defining a symbol with an incorrect mangled name.
2487This switch specifies which ABI version to use for the alias.
2488
2489With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2490compatibility).  If another ABI version is explicitly selected, this
2491defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2492use @option{-fabi-compat-version=2}.
2493
2494If this option is not provided but @option{-Wabi=@var{n}} is, that
2495version is used for compatibility aliases.  If this option is provided
2496along with @option{-Wabi} (without the version), the version from this
2497option is used for the warning.
2498
2499@item -fno-access-control
2500@opindex fno-access-control
2501@opindex faccess-control
2502Turn off all access checking.  This switch is mainly useful for working
2503around bugs in the access control code.
2504
2505@item -faligned-new
2506@opindex faligned-new
2507Enable support for C++17 @code{new} of types that require more
2508alignment than @code{void* ::operator new(std::size_t)} provides.  A
2509numeric argument such as @code{-faligned-new=32} can be used to
2510specify how much alignment (in bytes) is provided by that function,
2511but few users will need to override the default of
2512@code{alignof(std::max_align_t)}.
2513
2514This flag is enabled by default for @option{-std=c++17}.
2515
2516@item -fchar8_t
2517@itemx -fno-char8_t
2518@opindex fchar8_t
2519@opindex fno-char8_t
2520Enable support for @code{char8_t} as adopted for C++2a.  This includes
2521the addition of a new @code{char8_t} fundamental type, changes to the
2522types of UTF-8 string and character literals, new signatures for
2523user-defined literals, associated standard library updates, and new
2524@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2525
2526This option enables functions to be overloaded for ordinary and UTF-8
2527strings:
2528
2529@smallexample
2530int f(const char *);    // #1
2531int f(const char8_t *); // #2
2532int v1 = f("text");     // Calls #1
2533int v2 = f(u8"text");   // Calls #2
2534@end smallexample
2535
2536@noindent
2537and introduces new signatures for user-defined literals:
2538
2539@smallexample
2540int operator""_udl1(char8_t);
2541int v3 = u8'x'_udl1;
2542int operator""_udl2(const char8_t*, std::size_t);
2543int v4 = u8"text"_udl2;
2544template<typename T, T...> int operator""_udl3();
2545int v5 = u8"text"_udl3;
2546@end smallexample
2547
2548@noindent
2549The change to the types of UTF-8 string and character literals introduces
2550incompatibilities with ISO C++11 and later standards.  For example, the
2551following code is well-formed under ISO C++11, but is ill-formed when
2552@option{-fchar8_t} is specified.
2553
2554@smallexample
2555char ca[] = u8"xx";     // error: char-array initialized from wide
2556                        //        string
2557const char *cp = u8"xx";// error: invalid conversion from
2558                        //        `const char8_t*' to `const char*'
2559int f(const char*);
2560auto v = f(u8"xx");     // error: invalid conversion from
2561                        //        `const char8_t*' to `const char*'
2562std::string s@{u8"xx"@};  // error: no matching function for call to
2563                        //        `std::basic_string<char>::basic_string()'
2564using namespace std::literals;
2565s = u8"xx"s;            // error: conversion from
2566                        //        `basic_string<char8_t>' to non-scalar
2567                        //        type `basic_string<char>' requested
2568@end smallexample
2569
2570@item -fcheck-new
2571@opindex fcheck-new
2572Check that the pointer returned by @code{operator new} is non-null
2573before attempting to modify the storage allocated.  This check is
2574normally unnecessary because the C++ standard specifies that
2575@code{operator new} only returns @code{0} if it is declared
2576@code{throw()}, in which case the compiler always checks the
2577return value even without this option.  In all other cases, when
2578@code{operator new} has a non-empty exception specification, memory
2579exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2580@samp{new (nothrow)}.
2581
2582@item -fconcepts
2583@itemx -fconcepts-ts
2584@opindex fconcepts
2585@opindex fconcepts-ts
2586Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2587C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2588
2589With @option{-std=c++2a} and above, Concepts are part of the language
2590standard, so @option{-fconcepts} defaults to on.  But the standard
2591specification of Concepts differs significantly from the TS, so some
2592constructs that were allowed in the TS but didn't make it into the
2593standard can still be enabled by @option{-fconcepts-ts}.
2594
2595@item -fconstexpr-depth=@var{n}
2596@opindex fconstexpr-depth
2597Set the maximum nested evaluation depth for C++11 constexpr functions
2598to @var{n}.  A limit is needed to detect endless recursion during
2599constant expression evaluation.  The minimum specified by the standard
2600is 512.
2601
2602@item -fconstexpr-cache-depth=@var{n}
2603@opindex fconstexpr-cache-depth
2604Set the maximum level of nested evaluation depth for C++11 constexpr
2605functions that will be cached to @var{n}.  This is a heuristic that
2606trades off compilation speed (when the cache avoids repeated
2607calculations) against memory consumption (when the cache grows very
2608large from highly recursive evaluations).  The default is 8.  Very few
2609users are likely to want to adjust it, but if your code does heavy
2610constexpr calculations you might want to experiment to find which
2611value works best for you.
2612
2613@item -fconstexpr-loop-limit=@var{n}
2614@opindex fconstexpr-loop-limit
2615Set the maximum number of iterations for a loop in C++14 constexpr functions
2616to @var{n}.  A limit is needed to detect infinite loops during
2617constant expression evaluation.  The default is 262144 (1<<18).
2618
2619@item -fconstexpr-ops-limit=@var{n}
2620@opindex fconstexpr-ops-limit
2621Set the maximum number of operations during a single constexpr evaluation.
2622Even when number of iterations of a single loop is limited with the above limit,
2623if there are several nested loops and each of them has many iterations but still
2624smaller than the above limit, or if in a body of some loop or even outside
2625of a loop too many expressions need to be evaluated, the resulting constexpr
2626evaluation might take too long.
2627The default is 33554432 (1<<25).
2628
2629@item -fcoroutines
2630@opindex fcoroutines
2631Enable support for the C++ coroutines extension (experimental).
2632
2633@item -fno-elide-constructors
2634@opindex fno-elide-constructors
2635@opindex felide-constructors
2636The C++ standard allows an implementation to omit creating a temporary
2637that is only used to initialize another object of the same type.
2638Specifying this option disables that optimization, and forces G++ to
2639call the copy constructor in all cases.  This option also causes G++
2640to call trivial member functions which otherwise would be expanded inline.
2641
2642In C++17, the compiler is required to omit these temporaries, but this
2643option still affects trivial member functions.
2644
2645@item -fno-enforce-eh-specs
2646@opindex fno-enforce-eh-specs
2647@opindex fenforce-eh-specs
2648Don't generate code to check for violation of exception specifications
2649at run time.  This option violates the C++ standard, but may be useful
2650for reducing code size in production builds, much like defining
2651@code{NDEBUG}.  This does not give user code permission to throw
2652exceptions in violation of the exception specifications; the compiler
2653still optimizes based on the specifications, so throwing an
2654unexpected exception results in undefined behavior at run time.
2655
2656@item -fextern-tls-init
2657@itemx -fno-extern-tls-init
2658@opindex fextern-tls-init
2659@opindex fno-extern-tls-init
2660The C++11 and OpenMP standards allow @code{thread_local} and
2661@code{threadprivate} variables to have dynamic (runtime)
2662initialization.  To support this, any use of such a variable goes
2663through a wrapper function that performs any necessary initialization.
2664When the use and definition of the variable are in the same
2665translation unit, this overhead can be optimized away, but when the
2666use is in a different translation unit there is significant overhead
2667even if the variable doesn't actually need dynamic initialization.  If
2668the programmer can be sure that no use of the variable in a
2669non-defining TU needs to trigger dynamic initialization (either
2670because the variable is statically initialized, or a use of the
2671variable in the defining TU will be executed before any uses in
2672another TU), they can avoid this overhead with the
2673@option{-fno-extern-tls-init} option.
2674
2675On targets that support symbol aliases, the default is
2676@option{-fextern-tls-init}.  On targets that do not support symbol
2677aliases, the default is @option{-fno-extern-tls-init}.
2678
2679@item -fno-gnu-keywords
2680@opindex fno-gnu-keywords
2681@opindex fgnu-keywords
2682Do not recognize @code{typeof} as a keyword, so that code can use this
2683word as an identifier.  You can use the keyword @code{__typeof__} instead.
2684This option is implied by the strict ISO C++ dialects: @option{-ansi},
2685@option{-std=c++98}, @option{-std=c++11}, etc.
2686
2687@item -fno-implicit-templates
2688@opindex fno-implicit-templates
2689@opindex fimplicit-templates
2690Never emit code for non-inline templates that are instantiated
2691implicitly (i.e.@: by use); only emit code for explicit instantiations.
2692If you use this option, you must take care to structure your code to
2693include all the necessary explicit instantiations to avoid getting
2694undefined symbols at link time.
2695@xref{Template Instantiation}, for more information.
2696
2697@item -fno-implicit-inline-templates
2698@opindex fno-implicit-inline-templates
2699@opindex fimplicit-inline-templates
2700Don't emit code for implicit instantiations of inline templates, either.
2701The default is to handle inlines differently so that compiles with and
2702without optimization need the same set of explicit instantiations.
2703
2704@item -fno-implement-inlines
2705@opindex fno-implement-inlines
2706@opindex fimplement-inlines
2707To save space, do not emit out-of-line copies of inline functions
2708controlled by @code{#pragma implementation}.  This causes linker
2709errors if these functions are not inlined everywhere they are called.
2710
2711@item -fms-extensions
2712@opindex fms-extensions
2713Disable Wpedantic warnings about constructs used in MFC, such as implicit
2714int and getting a pointer to member function via non-standard syntax.
2715
2716@item -fnew-inheriting-ctors
2717@opindex fnew-inheriting-ctors
2718Enable the P0136 adjustment to the semantics of C++11 constructor
2719inheritance.  This is part of C++17 but also considered to be a Defect
2720Report against C++11 and C++14.  This flag is enabled by default
2721unless @option{-fabi-version=10} or lower is specified.
2722
2723@item -fnew-ttp-matching
2724@opindex fnew-ttp-matching
2725Enable the P0522 resolution to Core issue 150, template template
2726parameters and default arguments: this allows a template with default
2727template arguments as an argument for a template template parameter
2728with fewer template parameters.  This flag is enabled by default for
2729@option{-std=c++17}.
2730
2731@item -fno-nonansi-builtins
2732@opindex fno-nonansi-builtins
2733@opindex fnonansi-builtins
2734Disable built-in declarations of functions that are not mandated by
2735ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2736@code{index}, @code{bzero}, @code{conjf}, and other related functions.
2737
2738@item -fnothrow-opt
2739@opindex fnothrow-opt
2740Treat a @code{throw()} exception specification as if it were a
2741@code{noexcept} specification to reduce or eliminate the text size
2742overhead relative to a function with no exception specification.  If
2743the function has local variables of types with non-trivial
2744destructors, the exception specification actually makes the
2745function smaller because the EH cleanups for those variables can be
2746optimized away.  The semantic effect is that an exception thrown out of
2747a function with such an exception specification results in a call
2748to @code{terminate} rather than @code{unexpected}.
2749
2750@item -fno-operator-names
2751@opindex fno-operator-names
2752@opindex foperator-names
2753Do not treat the operator name keywords @code{and}, @code{bitand},
2754@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2755synonyms as keywords.
2756
2757@item -fno-optional-diags
2758@opindex fno-optional-diags
2759@opindex foptional-diags
2760Disable diagnostics that the standard says a compiler does not need to
2761issue.  Currently, the only such diagnostic issued by G++ is the one for
2762a name having multiple meanings within a class.
2763
2764@item -fpermissive
2765@opindex fpermissive
2766Downgrade some diagnostics about nonconformant code from errors to
2767warnings.  Thus, using @option{-fpermissive} allows some
2768nonconforming code to compile.
2769
2770@item -fno-pretty-templates
2771@opindex fno-pretty-templates
2772@opindex fpretty-templates
2773When an error message refers to a specialization of a function
2774template, the compiler normally prints the signature of the
2775template followed by the template arguments and any typedefs or
2776typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2777rather than @code{void f(int)}) so that it's clear which template is
2778involved.  When an error message refers to a specialization of a class
2779template, the compiler omits any template arguments that match
2780the default template arguments for that template.  If either of these
2781behaviors make it harder to understand the error message rather than
2782easier, you can use @option{-fno-pretty-templates} to disable them.
2783
2784@item -fno-rtti
2785@opindex fno-rtti
2786@opindex frtti
2787Disable generation of information about every class with virtual
2788functions for use by the C++ run-time type identification features
2789(@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
2790of the language, you can save some space by using this flag.  Note that
2791exception handling uses the same information, but G++ generates it as
2792needed. The @code{dynamic_cast} operator can still be used for casts that
2793do not require run-time type information, i.e.@: casts to @code{void *} or to
2794unambiguous base classes.
2795
2796Mixing code compiled with @option{-frtti} with that compiled with
2797@option{-fno-rtti} may not work.  For example, programs may
2798fail to link if a class compiled with @option{-fno-rtti} is used as a base
2799for a class compiled with @option{-frtti}.
2800
2801@item -fsized-deallocation
2802@opindex fsized-deallocation
2803Enable the built-in global declarations
2804@smallexample
2805void operator delete (void *, std::size_t) noexcept;
2806void operator delete[] (void *, std::size_t) noexcept;
2807@end smallexample
2808as introduced in C++14.  This is useful for user-defined replacement
2809deallocation functions that, for example, use the size of the object
2810to make deallocation faster.  Enabled by default under
2811@option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
2812warns about places that might want to add a definition.
2813
2814@item -fstrict-enums
2815@opindex fstrict-enums
2816Allow the compiler to optimize using the assumption that a value of
2817enumerated type can only be one of the values of the enumeration (as
2818defined in the C++ standard; basically, a value that can be
2819represented in the minimum number of bits needed to represent all the
2820enumerators).  This assumption may not be valid if the program uses a
2821cast to convert an arbitrary integer value to the enumerated type.
2822
2823@item -fstrong-eval-order
2824@opindex fstrong-eval-order
2825Evaluate member access, array subscripting, and shift expressions in
2826left-to-right order, and evaluate assignment in right-to-left order,
2827as adopted for C++17.  Enabled by default with @option{-std=c++17}.
2828@option{-fstrong-eval-order=some} enables just the ordering of member
2829access and shift expressions, and is the default without
2830@option{-std=c++17}.
2831
2832@item -ftemplate-backtrace-limit=@var{n}
2833@opindex ftemplate-backtrace-limit
2834Set the maximum number of template instantiation notes for a single
2835warning or error to @var{n}.  The default value is 10.
2836
2837@item -ftemplate-depth=@var{n}
2838@opindex ftemplate-depth
2839Set the maximum instantiation depth for template classes to @var{n}.
2840A limit on the template instantiation depth is needed to detect
2841endless recursions during template class instantiation.  ANSI/ISO C++
2842conforming programs must not rely on a maximum depth greater than 17
2843(changed to 1024 in C++11).  The default value is 900, as the compiler
2844can run out of stack space before hitting 1024 in some situations.
2845
2846@item -fno-threadsafe-statics
2847@opindex fno-threadsafe-statics
2848@opindex fthreadsafe-statics
2849Do not emit the extra code to use the routines specified in the C++
2850ABI for thread-safe initialization of local statics.  You can use this
2851option to reduce code size slightly in code that doesn't need to be
2852thread-safe.
2853
2854@item -fuse-cxa-atexit
2855@opindex fuse-cxa-atexit
2856Register destructors for objects with static storage duration with the
2857@code{__cxa_atexit} function rather than the @code{atexit} function.
2858This option is required for fully standards-compliant handling of static
2859destructors, but only works if your C library supports
2860@code{__cxa_atexit}.
2861
2862@item -fno-use-cxa-get-exception-ptr
2863@opindex fno-use-cxa-get-exception-ptr
2864@opindex fuse-cxa-get-exception-ptr
2865Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2866causes @code{std::uncaught_exception} to be incorrect, but is necessary
2867if the runtime routine is not available.
2868
2869@item -fvisibility-inlines-hidden
2870@opindex fvisibility-inlines-hidden
2871This switch declares that the user does not attempt to compare
2872pointers to inline functions or methods where the addresses of the two functions
2873are taken in different shared objects.
2874
2875The effect of this is that GCC may, effectively, mark inline methods with
2876@code{__attribute__ ((visibility ("hidden")))} so that they do not
2877appear in the export table of a DSO and do not require a PLT indirection
2878when used within the DSO@.  Enabling this option can have a dramatic effect
2879on load and link times of a DSO as it massively reduces the size of the
2880dynamic export table when the library makes heavy use of templates.
2881
2882The behavior of this switch is not quite the same as marking the
2883methods as hidden directly, because it does not affect static variables
2884local to the function or cause the compiler to deduce that
2885the function is defined in only one shared object.
2886
2887You may mark a method as having a visibility explicitly to negate the
2888effect of the switch for that method.  For example, if you do want to
2889compare pointers to a particular inline method, you might mark it as
2890having default visibility.  Marking the enclosing class with explicit
2891visibility has no effect.
2892
2893Explicitly instantiated inline methods are unaffected by this option
2894as their linkage might otherwise cross a shared library boundary.
2895@xref{Template Instantiation}.
2896
2897@item -fvisibility-ms-compat
2898@opindex fvisibility-ms-compat
2899This flag attempts to use visibility settings to make GCC's C++
2900linkage model compatible with that of Microsoft Visual Studio.
2901
2902The flag makes these changes to GCC's linkage model:
2903
2904@enumerate
2905@item
2906It sets the default visibility to @code{hidden}, like
2907@option{-fvisibility=hidden}.
2908
2909@item
2910Types, but not their members, are not hidden by default.
2911
2912@item
2913The One Definition Rule is relaxed for types without explicit
2914visibility specifications that are defined in more than one
2915shared object: those declarations are permitted if they are
2916permitted when this option is not used.
2917@end enumerate
2918
2919In new code it is better to use @option{-fvisibility=hidden} and
2920export those classes that are intended to be externally visible.
2921Unfortunately it is possible for code to rely, perhaps accidentally,
2922on the Visual Studio behavior.
2923
2924Among the consequences of these changes are that static data members
2925of the same type with the same name but defined in different shared
2926objects are different, so changing one does not change the other;
2927and that pointers to function members defined in different shared
2928objects may not compare equal.  When this flag is given, it is a
2929violation of the ODR to define types with the same name differently.
2930
2931@item -fno-weak
2932@opindex fno-weak
2933@opindex fweak
2934Do not use weak symbol support, even if it is provided by the linker.
2935By default, G++ uses weak symbols if they are available.  This
2936option exists only for testing, and should not be used by end-users;
2937it results in inferior code and has no benefits.  This option may
2938be removed in a future release of G++.
2939
2940@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2941@opindex fext-numeric-literals
2942@opindex fno-ext-numeric-literals
2943Accept imaginary, fixed-point, or machine-defined
2944literal number suffixes as GNU extensions.
2945When this option is turned off these suffixes are treated
2946as C++11 user-defined literal numeric suffixes.
2947This is on by default for all pre-C++11 dialects and all GNU dialects:
2948@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2949@option{-std=gnu++14}.
2950This option is off by default
2951for ISO C++11 onwards (@option{-std=c++11}, ...).
2952
2953@item -nostdinc++
2954@opindex nostdinc++
2955Do not search for header files in the standard directories specific to
2956C++, but do still search the other standard directories.  (This option
2957is used when building the C++ library.)
2958@end table
2959
2960In addition, these warning options have meanings only for C++ programs:
2961
2962@table @gcctabopt
2963@item -Wabi-tag @r{(C++ and Objective-C++ only)}
2964@opindex Wabi-tag
2965@opindex Wabi-tag
2966Warn when a type with an ABI tag is used in a context that does not
2967have that ABI tag.  See @ref{C++ Attributes} for more information
2968about ABI tags.
2969
2970@item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
2971@opindex Wcomma-subscript
2972@opindex Wno-comma-subscript
2973Warn about uses of a comma expression within a subscripting expression.
2974This usage was deprecated in C++2a.  However, a comma expression wrapped
2975in @code{( )} is not deprecated.  Example:
2976
2977@smallexample
2978@group
2979void f(int *a, int b, int c) @{
2980    a[b,c];     // deprecated
2981    a[(b,c)];   // OK
2982@}
2983@end group
2984@end smallexample
2985
2986Enabled by default with @option{-std=c++2a}.
2987
2988@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2989@opindex Wctor-dtor-privacy
2990@opindex Wno-ctor-dtor-privacy
2991Warn when a class seems unusable because all the constructors or
2992destructors in that class are private, and it has neither friends nor
2993public static member functions.  Also warn if there are no non-private
2994methods, and there's at least one private member function that isn't
2995a constructor or destructor.
2996
2997@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2998@opindex Wdelete-non-virtual-dtor
2999@opindex Wno-delete-non-virtual-dtor
3000Warn when @code{delete} is used to destroy an instance of a class that
3001has virtual functions and non-virtual destructor. It is unsafe to delete
3002an instance of a derived class through a pointer to a base class if the
3003base class does not have a virtual destructor.  This warning is enabled
3004by @option{-Wall}.
3005
3006@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3007@opindex Wdeprecated-copy
3008@opindex Wno-deprecated-copy
3009Warn that the implicit declaration of a copy constructor or copy
3010assignment operator is deprecated if the class has a user-provided
3011copy constructor or copy assignment operator, in C++11 and up.  This
3012warning is enabled by @option{-Wextra}.  With
3013@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3014user-provided destructor.
3015
3016@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3017@opindex Winit-list-lifetime
3018@opindex Wno-init-list-lifetime
3019Do not warn about uses of @code{std::initializer_list} that are likely
3020to result in dangling pointers.  Since the underlying array for an
3021@code{initializer_list} is handled like a normal C++ temporary object,
3022it is easy to inadvertently keep a pointer to the array past the end
3023of the array's lifetime.  For example:
3024
3025@itemize @bullet
3026@item
3027If a function returns a temporary @code{initializer_list}, or a local
3028@code{initializer_list} variable, the array's lifetime ends at the end
3029of the return statement, so the value returned has a dangling pointer.
3030
3031@item
3032If a new-expression creates an @code{initializer_list}, the array only
3033lives until the end of the enclosing full-expression, so the
3034@code{initializer_list} in the heap has a dangling pointer.
3035
3036@item
3037When an @code{initializer_list} variable is assigned from a
3038brace-enclosed initializer list, the temporary array created for the
3039right side of the assignment only lives until the end of the
3040full-expression, so at the next statement the @code{initializer_list}
3041variable has a dangling pointer.
3042
3043@smallexample
3044// li's initial underlying array lives as long as li
3045std::initializer_list<int> li = @{ 1,2,3 @};
3046// assignment changes li to point to a temporary array
3047li = @{ 4, 5 @};
3048// now the temporary is gone and li has a dangling pointer
3049int i = li.begin()[0] // undefined behavior
3050@end smallexample
3051
3052@item
3053When a list constructor stores the @code{begin} pointer from the
3054@code{initializer_list} argument, this doesn't extend the lifetime of
3055the array, so if a class variable is constructed from a temporary
3056@code{initializer_list}, the pointer is left dangling by the end of
3057the variable declaration statement.
3058
3059@end itemize
3060
3061@item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3062@opindex Wliteral-suffix
3063@opindex Wno-literal-suffix
3064Do not warn when a string or character literal is followed by a
3065ud-suffix which does not begin with an underscore.  As a conforming
3066extension, GCC treats such suffixes as separate preprocessing tokens
3067in order to maintain backwards compatibility with code that uses
3068formatting macros from @code{<inttypes.h>}.  For example:
3069
3070@smallexample
3071#define __STDC_FORMAT_MACROS
3072#include <inttypes.h>
3073#include <stdio.h>
3074
3075int main() @{
3076  int64_t i64 = 123;
3077  printf("My int64: %" PRId64"\n", i64);
3078@}
3079@end smallexample
3080
3081In this case, @code{PRId64} is treated as a separate preprocessing token.
3082
3083This option also controls warnings when a user-defined literal
3084operator is declared with a literal suffix identifier that doesn't
3085begin with an underscore. Literal suffix identifiers that don't begin
3086with an underscore are reserved for future standardization.
3087
3088These warnings are enabled by default.
3089
3090@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3091@opindex Wnarrowing
3092@opindex Wno-narrowing
3093For C++11 and later standards, narrowing conversions are diagnosed by default,
3094as required by the standard.  A narrowing conversion from a constant produces
3095an error, and a narrowing conversion from a non-constant produces a warning,
3096but @option{-Wno-narrowing} suppresses the diagnostic.
3097Note that this does not affect the meaning of well-formed code;
3098narrowing conversions are still considered ill-formed in SFINAE contexts.
3099
3100With @option{-Wnarrowing} in C++98, warn when a narrowing
3101conversion prohibited by C++11 occurs within
3102@samp{@{ @}}, e.g.
3103
3104@smallexample
3105int i = @{ 2.2 @}; // error: narrowing from double to int
3106@end smallexample
3107
3108This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3109
3110@item -Wnoexcept @r{(C++ and Objective-C++ only)}
3111@opindex Wnoexcept
3112@opindex Wno-noexcept
3113Warn when a noexcept-expression evaluates to false because of a call
3114to a function that does not have a non-throwing exception
3115specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3116the compiler to never throw an exception.
3117
3118@item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3119@opindex Wnoexcept-type
3120@opindex Wno-noexcept-type
3121Warn if the C++17 feature making @code{noexcept} part of a function
3122type changes the mangled name of a symbol relative to C++14.  Enabled
3123by @option{-Wabi} and @option{-Wc++17-compat}.
3124
3125As an example:
3126
3127@smallexample
3128template <class T> void f(T t) @{ t(); @};
3129void g() noexcept;
3130void h() @{ f(g); @}
3131@end smallexample
3132
3133@noindent
3134In C++14, @code{f} calls @code{f<void(*)()>}, but in
3135C++17 it calls @code{f<void(*)()noexcept>}.
3136
3137@item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3138@opindex Wclass-memaccess
3139@opindex Wno-class-memaccess
3140Warn when the destination of a call to a raw memory function such as
3141@code{memset} or @code{memcpy} is an object of class type, and when writing
3142into such an object might bypass the class non-trivial or deleted constructor
3143or copy assignment, violate const-correctness or encapsulation, or corrupt
3144virtual table pointers.  Modifying the representation of such objects may
3145violate invariants maintained by member functions of the class.  For example,
3146the call to @code{memset} below is undefined because it modifies a non-trivial
3147class object and is, therefore, diagnosed.  The safe way to either initialize
3148or clear the storage of objects of such types is by using the appropriate
3149constructor or assignment operator, if one is available.
3150@smallexample
3151std::string str = "abc";
3152memset (&str, 0, sizeof str);
3153@end smallexample
3154The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3155Explicitly casting the pointer to the class object to @code{void *} or
3156to a type that can be safely accessed by the raw memory function suppresses
3157the warning.
3158
3159@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3160@opindex Wnon-virtual-dtor
3161@opindex Wno-non-virtual-dtor
3162Warn when a class has virtual functions and an accessible non-virtual
3163destructor itself or in an accessible polymorphic base class, in which
3164case it is possible but unsafe to delete an instance of a derived
3165class through a pointer to the class itself or base class.  This
3166warning is automatically enabled if @option{-Weffc++} is specified.
3167
3168@item -Wregister @r{(C++ and Objective-C++ only)}
3169@opindex Wregister
3170@opindex Wno-register
3171Warn on uses of the @code{register} storage class specifier, except
3172when it is part of the GNU @ref{Explicit Register Variables} extension.
3173The use of the @code{register} keyword as storage class specifier has
3174been deprecated in C++11 and removed in C++17.
3175Enabled by default with @option{-std=c++17}.
3176
3177@item -Wreorder @r{(C++ and Objective-C++ only)}
3178@opindex Wreorder
3179@opindex Wno-reorder
3180@cindex reordering, warning
3181@cindex warning for reordering of member initializers
3182Warn when the order of member initializers given in the code does not
3183match the order in which they must be executed.  For instance:
3184
3185@smallexample
3186struct A @{
3187  int i;
3188  int j;
3189  A(): j (0), i (1) @{ @}
3190@};
3191@end smallexample
3192
3193@noindent
3194The compiler rearranges the member initializers for @code{i}
3195and @code{j} to match the declaration order of the members, emitting
3196a warning to that effect.  This warning is enabled by @option{-Wall}.
3197
3198@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3199@opindex Wpessimizing-move
3200@opindex Wno-pessimizing-move
3201This warning warns when a call to @code{std::move} prevents copy
3202elision.  A typical scenario when copy elision can occur is when returning in
3203a function with a class return type, when the expression being returned is the
3204name of a non-volatile automatic object, and is not a function parameter, and
3205has the same type as the function return type.
3206
3207@smallexample
3208struct T @{
3209@dots{}
3210@};
3211T fn()
3212@{
3213  T t;
3214  @dots{}
3215  return std::move (t);
3216@}
3217@end smallexample
3218
3219But in this example, the @code{std::move} call prevents copy elision.
3220
3221This warning is enabled by @option{-Wall}.
3222
3223@item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3224@opindex Wredundant-move
3225@opindex Wno-redundant-move
3226This warning warns about redundant calls to @code{std::move}; that is, when
3227a move operation would have been performed even without the @code{std::move}
3228call.  This happens because the compiler is forced to treat the object as if
3229it were an rvalue in certain situations such as returning a local variable,
3230where copy elision isn't applicable.  Consider:
3231
3232@smallexample
3233struct T @{
3234@dots{}
3235@};
3236T fn(T t)
3237@{
3238  @dots{}
3239  return std::move (t);
3240@}
3241@end smallexample
3242
3243Here, the @code{std::move} call is redundant.  Because G++ implements Core
3244Issue 1579, another example is:
3245
3246@smallexample
3247struct T @{ // convertible to U
3248@dots{}
3249@};
3250struct U @{
3251@dots{}
3252@};
3253U fn()
3254@{
3255  T t;
3256  @dots{}
3257  return std::move (t);
3258@}
3259@end smallexample
3260In this example, copy elision isn't applicable because the type of the
3261expression being returned and the function return type differ, yet G++
3262treats the return value as if it were designated by an rvalue.
3263
3264This warning is enabled by @option{-Wextra}.
3265
3266@item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3267@opindex Wredundant-tags
3268@opindex Wno-redundant-tags
3269Warn about redundant class-key and enum-key in references to class types
3270and enumerated types in contexts where the key can be eliminated without
3271causing an ambiguity.  For example:
3272
3273@smallexample
3274struct foo;
3275struct foo *p;   // warn that keyword struct can be eliminated
3276@end smallexample
3277
3278@noindent
3279On the other hand, in this example there is no warning:
3280
3281@smallexample
3282struct foo;
3283void foo ();   // "hides" struct foo
3284void bar (struct foo&);  // no warning, keyword struct is necessary
3285@end smallexample
3286
3287@item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3288@opindex Wsubobject-linkage
3289@opindex Wno-subobject-linkage
3290Do not warn
3291if a class type has a base or a field whose type uses the anonymous
3292namespace or depends on a type with no linkage.  If a type A depends on
3293a type B with no or internal linkage, defining it in multiple
3294translation units would be an ODR violation because the meaning of B
3295is different in each translation unit.  If A only appears in a single
3296translation unit, the best way to silence the warning is to give it
3297internal linkage by putting it in an anonymous namespace as well.  The
3298compiler doesn't give this warning for types defined in the main .C
3299file, as those are unlikely to have multiple definitions.
3300@option{-Wsubobject-linkage} is enabled by default.
3301
3302@item -Weffc++ @r{(C++ and Objective-C++ only)}
3303@opindex Weffc++
3304@opindex Wno-effc++
3305Warn about violations of the following style guidelines from Scott Meyers'
3306@cite{Effective C++} series of books:
3307
3308@itemize @bullet
3309@item
3310Define a copy constructor and an assignment operator for classes
3311with dynamically-allocated memory.
3312
3313@item
3314Prefer initialization to assignment in constructors.
3315
3316@item
3317Have @code{operator=} return a reference to @code{*this}.
3318
3319@item
3320Don't try to return a reference when you must return an object.
3321
3322@item
3323Distinguish between prefix and postfix forms of increment and
3324decrement operators.
3325
3326@item
3327Never overload @code{&&}, @code{||}, or @code{,}.
3328
3329@end itemize
3330
3331This option also enables @option{-Wnon-virtual-dtor}, which is also
3332one of the effective C++ recommendations.  However, the check is
3333extended to warn about the lack of virtual destructor in accessible
3334non-polymorphic bases classes too.
3335
3336When selecting this option, be aware that the standard library
3337headers do not obey all of these guidelines; use @samp{grep -v}
3338to filter out those warnings.
3339
3340@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3341@opindex Wstrict-null-sentinel
3342@opindex Wno-strict-null-sentinel
3343Warn about the use of an uncasted @code{NULL} as sentinel.  When
3344compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3345to @code{__null}.  Although it is a null pointer constant rather than a
3346null pointer, it is guaranteed to be of the same size as a pointer.
3347But this use is not portable across different compilers.
3348
3349@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3350@opindex Wno-non-template-friend
3351@opindex Wnon-template-friend
3352Disable warnings when non-template friend functions are declared
3353within a template.  In very old versions of GCC that predate implementation
3354of the ISO standard, declarations such as
3355@samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3356could be interpreted as a particular specialization of a template
3357function; the warning exists to diagnose compatibility problems,
3358and is enabled by default.
3359
3360@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3361@opindex Wold-style-cast
3362@opindex Wno-old-style-cast
3363Warn if an old-style (C-style) cast to a non-void type is used within
3364a C++ program.  The new-style casts (@code{dynamic_cast},
3365@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3366less vulnerable to unintended effects and much easier to search for.
3367
3368@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3369@opindex Woverloaded-virtual
3370@opindex Wno-overloaded-virtual
3371@cindex overloaded virtual function, warning
3372@cindex warning for overloaded virtual function
3373Warn when a function declaration hides virtual functions from a
3374base class.  For example, in:
3375
3376@smallexample
3377struct A @{
3378  virtual void f();
3379@};
3380
3381struct B: public A @{
3382  void f(int);
3383@};
3384@end smallexample
3385
3386the @code{A} class version of @code{f} is hidden in @code{B}, and code
3387like:
3388
3389@smallexample
3390B* b;
3391b->f();
3392@end smallexample
3393
3394@noindent
3395fails to compile.
3396
3397@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3398@opindex Wno-pmf-conversions
3399@opindex Wpmf-conversions
3400Disable the diagnostic for converting a bound pointer to member function
3401to a plain pointer.
3402
3403@item -Wsign-promo @r{(C++ and Objective-C++ only)}
3404@opindex Wsign-promo
3405@opindex Wno-sign-promo
3406Warn when overload resolution chooses a promotion from unsigned or
3407enumerated type to a signed type, over a conversion to an unsigned type of
3408the same size.  Previous versions of G++ tried to preserve
3409unsignedness, but the standard mandates the current behavior.
3410
3411@item -Wtemplates @r{(C++ and Objective-C++ only)}
3412@opindex Wtemplates
3413@opindex Wno-templates
3414Warn when a primary template declaration is encountered.  Some coding
3415rules disallow templates, and this may be used to enforce that rule.
3416The warning is inactive inside a system header file, such as the STL, so
3417one can still use the STL.  One may also instantiate or specialize
3418templates.
3419
3420@item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3421@opindex Wmismatched-tags
3422@opindex Wno-mismatched-tags
3423Warn for declarations of structs, classes, and class templates and their
3424specializations with a class-key that does not match either the definition
3425or the first declaration if no definition is provided.
3426
3427For example, the declaration of @code{struct Object} in the argument list
3428of @code{draw} triggers the warning.  To avoid it, either remove the redundant
3429class-key @code{struct} or replace it with @code{class} to match its definition.
3430@smallexample
3431class Object @{
3432public:
3433  virtual ~Object () = 0;
3434@};
3435void draw (struct Object*);
3436@end smallexample
3437
3438It is not wrong to declare a class with the class-key @code{struct} as
3439the example above shows.  The @option{-Wmismatched-tags} option is intended
3440to help achieve a consistent style of class declarations.  In code that is
3441intended to be portable to Windows-based compilers the warning helps prevent
3442unresolved references due to the difference in the mangling of symbols
3443declared with different class-keys.  The option can be used either on its
3444own or in conjunction with @option{-Wredundant-tags}.
3445
3446@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3447@opindex Wmultiple-inheritance
3448@opindex Wno-multiple-inheritance
3449Warn when a class is defined with multiple direct base classes.  Some
3450coding rules disallow multiple inheritance, and this may be used to
3451enforce that rule.  The warning is inactive inside a system header file,
3452such as the STL, so one can still use the STL.  One may also define
3453classes that indirectly use multiple inheritance.
3454
3455@item -Wvirtual-inheritance
3456@opindex Wvirtual-inheritance
3457@opindex Wno-virtual-inheritance
3458Warn when a class is defined with a virtual direct base class.  Some
3459coding rules disallow multiple inheritance, and this may be used to
3460enforce that rule.  The warning is inactive inside a system header file,
3461such as the STL, so one can still use the STL.  One may also define
3462classes that indirectly use virtual inheritance.
3463
3464@item -Wno-virtual-move-assign
3465@opindex Wvirtual-move-assign
3466@opindex Wno-virtual-move-assign
3467Suppress warnings about inheriting from a virtual base with a
3468non-trivial C++11 move assignment operator.  This is dangerous because
3469if the virtual base is reachable along more than one path, it is
3470moved multiple times, which can mean both objects end up in the
3471moved-from state.  If the move assignment operator is written to avoid
3472moving from a moved-from object, this warning can be disabled.
3473
3474@item -Wnamespaces
3475@opindex Wnamespaces
3476@opindex Wno-namespaces
3477Warn when a namespace definition is opened.  Some coding rules disallow
3478namespaces, and this may be used to enforce that rule.  The warning is
3479inactive inside a system header file, such as the STL, so one can still
3480use the STL.  One may also use using directives and qualified names.
3481
3482@item -Wno-terminate @r{(C++ and Objective-C++ only)}
3483@opindex Wterminate
3484@opindex Wno-terminate
3485Disable the warning about a throw-expression that will immediately
3486result in a call to @code{terminate}.
3487
3488@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3489@opindex Wno-class-conversion
3490@opindex Wclass-conversion
3491Do not warn when a conversion function converts an
3492object to the same type, to a base class of that type, or to void; such
3493a conversion function will never be called.
3494
3495@item -Wvolatile @r{(C++ and Objective-C++ only)}
3496@opindex Wvolatile
3497@opindex Wno-volatile
3498Warn about deprecated uses of the @code{volatile} qualifier.  This includes
3499postfix and prefix @code{++} and @code{--} expressions of
3500@code{volatile}-qualified types, using simple assignments where the left
3501operand is a @code{volatile}-qualified non-class type for their value,
3502compound assignments where the left operand is a @code{volatile}-qualified
3503non-class type, @code{volatile}-qualified function return type,
3504@code{volatile}-qualified parameter type, and structured bindings of a
3505@code{volatile}-qualified type.  This usage was deprecated in C++20.
3506
3507Enabled by default with @option{-std=c++2a}.
3508
3509@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3510@opindex Wzero-as-null-pointer-constant
3511@opindex Wno-zero-as-null-pointer-constant
3512Warn when a literal @samp{0} is used as null pointer constant.  This can
3513be useful to facilitate the conversion to @code{nullptr} in C++11.
3514
3515@item -Waligned-new
3516@opindex Waligned-new
3517@opindex Wno-aligned-new
3518Warn about a new-expression of a type that requires greater alignment
3519than the @code{alignof(std::max_align_t)} but uses an allocation
3520function without an explicit alignment parameter. This option is
3521enabled by @option{-Wall}.
3522
3523Normally this only warns about global allocation functions, but
3524@option{-Waligned-new=all} also warns about class member allocation
3525functions.
3526
3527@item -Wno-placement-new
3528@itemx -Wplacement-new=@var{n}
3529@opindex Wplacement-new
3530@opindex Wno-placement-new
3531Warn about placement new expressions with undefined behavior, such as
3532constructing an object in a buffer that is smaller than the type of
3533the object.  For example, the placement new expression below is diagnosed
3534because it attempts to construct an array of 64 integers in a buffer only
353564 bytes large.
3536@smallexample
3537char buf [64];
3538new (buf) int[64];
3539@end smallexample
3540This warning is enabled by default.
3541
3542@table @gcctabopt
3543@item -Wplacement-new=1
3544This is the default warning level of @option{-Wplacement-new}.  At this
3545level the warning is not issued for some strictly undefined constructs that
3546GCC allows as extensions for compatibility with legacy code.  For example,
3547the following @code{new} expression is not diagnosed at this level even
3548though it has undefined behavior according to the C++ standard because
3549it writes past the end of the one-element array.
3550@smallexample
3551struct S @{ int n, a[1]; @};
3552S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3553new (s->a)int [32]();
3554@end smallexample
3555
3556@item -Wplacement-new=2
3557At this level, in addition to diagnosing all the same constructs as at level
35581, a diagnostic is also issued for placement new expressions that construct
3559an object in the last member of structure whose type is an array of a single
3560element and whose size is less than the size of the object being constructed.
3561While the previous example would be diagnosed, the following construct makes
3562use of the flexible member array extension to avoid the warning at level 2.
3563@smallexample
3564struct S @{ int n, a[]; @};
3565S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3566new (s->a)int [32]();
3567@end smallexample
3568
3569@end table
3570
3571@item -Wcatch-value
3572@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3573@opindex Wcatch-value
3574@opindex Wno-catch-value
3575Warn about catch handlers that do not catch via reference.
3576With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3577warn about polymorphic class types that are caught by value.
3578With @option{-Wcatch-value=2} warn about all class types that are caught
3579by value. With @option{-Wcatch-value=3} warn about all types that are
3580not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3581
3582@item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3583@opindex Wconditionally-supported
3584@opindex Wno-conditionally-supported
3585Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3586
3587@item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3588@opindex Wdelete-incomplete
3589@opindex Wno-delete-incomplete
3590Do not warn when deleting a pointer to incomplete type, which may cause
3591undefined behavior at runtime.  This warning is enabled by default.
3592
3593@item -Wextra-semi @r{(C++, Objective-C++ only)}
3594@opindex Wextra-semi
3595@opindex Wno-extra-semi
3596Warn about redundant semicolons after in-class function definitions.
3597
3598@item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3599@opindex Winaccessible-base
3600@opindex Wno-inaccessible-base
3601This option controls warnings
3602when a base class is inaccessible in a class derived from it due to
3603ambiguity.  The warning is enabled by default.
3604Note that the warning for ambiguous virtual
3605bases is enabled by the @option{-Wextra} option.
3606@smallexample
3607@group
3608struct A @{ int a; @};
3609
3610struct B : A @{ @};
3611
3612struct C : B, A @{ @};
3613@end group
3614@end smallexample
3615
3616@item -Wno-inherited-variadic-ctor
3617@opindex Winherited-variadic-ctor
3618@opindex Wno-inherited-variadic-ctor
3619Suppress warnings about use of C++11 inheriting constructors when the
3620base class inherited from has a C variadic constructor; the warning is
3621on by default because the ellipsis is not inherited.
3622
3623@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3624@opindex Wno-invalid-offsetof
3625@opindex Winvalid-offsetof
3626Suppress warnings from applying the @code{offsetof} macro to a non-POD
3627type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
3628to a non-standard-layout type is undefined.  In existing C++ implementations,
3629however, @code{offsetof} typically gives meaningful results.
3630This flag is for users who are aware that they are
3631writing nonportable code and who have deliberately chosen to ignore the
3632warning about it.
3633
3634The restrictions on @code{offsetof} may be relaxed in a future version
3635of the C++ standard.
3636
3637@item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3638@opindex Wsized-deallocation
3639@opindex Wno-sized-deallocation
3640Warn about a definition of an unsized deallocation function
3641@smallexample
3642void operator delete (void *) noexcept;
3643void operator delete[] (void *) noexcept;
3644@end smallexample
3645without a definition of the corresponding sized deallocation function
3646@smallexample
3647void operator delete (void *, std::size_t) noexcept;
3648void operator delete[] (void *, std::size_t) noexcept;
3649@end smallexample
3650or vice versa.  Enabled by @option{-Wextra} along with
3651@option{-fsized-deallocation}.
3652
3653@item -Wsuggest-final-types
3654@opindex Wno-suggest-final-types
3655@opindex Wsuggest-final-types
3656Warn about types with virtual methods where code quality would be improved
3657if the type were declared with the C++11 @code{final} specifier,
3658or, if possible,
3659declared in an anonymous namespace. This allows GCC to more aggressively
3660devirtualize the polymorphic calls. This warning is more effective with
3661link-time optimization,
3662where the information about the class hierarchy graph is
3663more complete.
3664
3665@item -Wsuggest-final-methods
3666@opindex Wno-suggest-final-methods
3667@opindex Wsuggest-final-methods
3668Warn about virtual methods where code quality would be improved if the method
3669were declared with the C++11 @code{final} specifier,
3670or, if possible, its type were
3671declared in an anonymous namespace or with the @code{final} specifier.
3672This warning is
3673more effective with link-time optimization, where the information about the
3674class hierarchy graph is more complete. It is recommended to first consider
3675suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3676annotations.
3677
3678@item -Wsuggest-override
3679@opindex Wsuggest-override
3680@opindex Wno-suggest-override
3681Warn about overriding virtual functions that are not marked with the
3682@code{override} keyword.
3683
3684@item -Wuseless-cast @r{(C++ and Objective-C++ only)}
3685@opindex Wuseless-cast
3686@opindex Wno-useless-cast
3687Warn when an expression is casted to its own type.
3688
3689@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3690@opindex Wconversion-null
3691@opindex Wno-conversion-null
3692Do not warn for conversions between @code{NULL} and non-pointer
3693types. @option{-Wconversion-null} is enabled by default.
3694
3695@end table
3696
3697@node Objective-C and Objective-C++ Dialect Options
3698@section Options Controlling Objective-C and Objective-C++ Dialects
3699
3700@cindex compiler options, Objective-C and Objective-C++
3701@cindex Objective-C and Objective-C++ options, command-line
3702@cindex options, Objective-C and Objective-C++
3703(NOTE: This manual does not describe the Objective-C and Objective-C++
3704languages themselves.  @xref{Standards,,Language Standards
3705Supported by GCC}, for references.)
3706
3707This section describes the command-line options that are only meaningful
3708for Objective-C and Objective-C++ programs.  You can also use most of
3709the language-independent GNU compiler options.
3710For example, you might compile a file @file{some_class.m} like this:
3711
3712@smallexample
3713gcc -g -fgnu-runtime -O -c some_class.m
3714@end smallexample
3715
3716@noindent
3717In this example, @option{-fgnu-runtime} is an option meant only for
3718Objective-C and Objective-C++ programs; you can use the other options with
3719any language supported by GCC@.
3720
3721Note that since Objective-C is an extension of the C language, Objective-C
3722compilations may also use options specific to the C front-end (e.g.,
3723@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
3724C++-specific options (e.g., @option{-Wabi}).
3725
3726Here is a list of options that are @emph{only} for compiling Objective-C
3727and Objective-C++ programs:
3728
3729@table @gcctabopt
3730@item -fconstant-string-class=@var{class-name}
3731@opindex fconstant-string-class
3732Use @var{class-name} as the name of the class to instantiate for each
3733literal string specified with the syntax @code{@@"@dots{}"}.  The default
3734class name is @code{NXConstantString} if the GNU runtime is being used, and
3735@code{NSConstantString} if the NeXT runtime is being used (see below).  The
3736@option{-fconstant-cfstrings} option, if also present, overrides the
3737@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3738to be laid out as constant CoreFoundation strings.
3739
3740@item -fgnu-runtime
3741@opindex fgnu-runtime
3742Generate object code compatible with the standard GNU Objective-C
3743runtime.  This is the default for most types of systems.
3744
3745@item -fnext-runtime
3746@opindex fnext-runtime
3747Generate output compatible with the NeXT runtime.  This is the default
3748for NeXT-based systems, including Darwin and Mac OS X@.  The macro
3749@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3750used.
3751
3752@item -fno-nil-receivers
3753@opindex fno-nil-receivers
3754@opindex fnil-receivers
3755Assume that all Objective-C message dispatches (@code{[receiver
3756message:arg]}) in this translation unit ensure that the receiver is
3757not @code{nil}.  This allows for more efficient entry points in the
3758runtime to be used.  This option is only available in conjunction with
3759the NeXT runtime and ABI version 0 or 1.
3760
3761@item -fobjc-abi-version=@var{n}
3762@opindex fobjc-abi-version
3763Use version @var{n} of the Objective-C ABI for the selected runtime.
3764This option is currently supported only for the NeXT runtime.  In that
3765case, Version 0 is the traditional (32-bit) ABI without support for
3766properties and other Objective-C 2.0 additions.  Version 1 is the
3767traditional (32-bit) ABI with support for properties and other
3768Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
3769nothing is specified, the default is Version 0 on 32-bit target
3770machines, and Version 2 on 64-bit target machines.
3771
3772@item -fobjc-call-cxx-cdtors
3773@opindex fobjc-call-cxx-cdtors
3774For each Objective-C class, check if any of its instance variables is a
3775C++ object with a non-trivial default constructor.  If so, synthesize a
3776special @code{- (id) .cxx_construct} instance method which runs
3777non-trivial default constructors on any such instance variables, in order,
3778and then return @code{self}.  Similarly, check if any instance variable
3779is a C++ object with a non-trivial destructor, and if so, synthesize a
3780special @code{- (void) .cxx_destruct} method which runs
3781all such default destructors, in reverse order.
3782
3783The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3784methods thusly generated only operate on instance variables
3785declared in the current Objective-C class, and not those inherited
3786from superclasses.  It is the responsibility of the Objective-C
3787runtime to invoke all such methods in an object's inheritance
3788hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
3789by the runtime immediately after a new object instance is allocated;
3790the @code{- (void) .cxx_destruct} methods are invoked immediately
3791before the runtime deallocates an object instance.
3792
3793As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3794support for invoking the @code{- (id) .cxx_construct} and
3795@code{- (void) .cxx_destruct} methods.
3796
3797@item -fobjc-direct-dispatch
3798@opindex fobjc-direct-dispatch
3799Allow fast jumps to the message dispatcher.  On Darwin this is
3800accomplished via the comm page.
3801
3802@item -fobjc-exceptions
3803@opindex fobjc-exceptions
3804Enable syntactic support for structured exception handling in
3805Objective-C, similar to what is offered by C++.  This option
3806is required to use the Objective-C keywords @code{@@try},
3807@code{@@throw}, @code{@@catch}, @code{@@finally} and
3808@code{@@synchronized}.  This option is available with both the GNU
3809runtime and the NeXT runtime (but not available in conjunction with
3810the NeXT runtime on Mac OS X 10.2 and earlier).
3811
3812@item -fobjc-gc
3813@opindex fobjc-gc
3814Enable garbage collection (GC) in Objective-C and Objective-C++
3815programs.  This option is only available with the NeXT runtime; the
3816GNU runtime has a different garbage collection implementation that
3817does not require special compiler flags.
3818
3819@item -fobjc-nilcheck
3820@opindex fobjc-nilcheck
3821For the NeXT runtime with version 2 of the ABI, check for a nil
3822receiver in method invocations before doing the actual method call.
3823This is the default and can be disabled using
3824@option{-fno-objc-nilcheck}.  Class methods and super calls are never
3825checked for nil in this way no matter what this flag is set to.
3826Currently this flag does nothing when the GNU runtime, or an older
3827version of the NeXT runtime ABI, is used.
3828
3829@item -fobjc-std=objc1
3830@opindex fobjc-std
3831Conform to the language syntax of Objective-C 1.0, the language
3832recognized by GCC 4.0.  This only affects the Objective-C additions to
3833the C/C++ language; it does not affect conformance to C/C++ standards,
3834which is controlled by the separate C/C++ dialect option flags.  When
3835this option is used with the Objective-C or Objective-C++ compiler,
3836any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3837This is useful if you need to make sure that your Objective-C code can
3838be compiled with older versions of GCC@.
3839
3840@item -freplace-objc-classes
3841@opindex freplace-objc-classes
3842Emit a special marker instructing @command{ld(1)} not to statically link in
3843the resulting object file, and allow @command{dyld(1)} to load it in at
3844run time instead.  This is used in conjunction with the Fix-and-Continue
3845debugging mode, where the object file in question may be recompiled and
3846dynamically reloaded in the course of program execution, without the need
3847to restart the program itself.  Currently, Fix-and-Continue functionality
3848is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3849and later.
3850
3851@item -fzero-link
3852@opindex fzero-link
3853When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3854to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3855compile time) with static class references that get initialized at load time,
3856which improves run-time performance.  Specifying the @option{-fzero-link} flag
3857suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3858to be retained.  This is useful in Zero-Link debugging mode, since it allows
3859for individual class implementations to be modified during program execution.
3860The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3861regardless of command-line options.
3862
3863@item -fno-local-ivars
3864@opindex fno-local-ivars
3865@opindex flocal-ivars
3866By default instance variables in Objective-C can be accessed as if
3867they were local variables from within the methods of the class they're
3868declared in.  This can lead to shadowing between instance variables
3869and other variables declared either locally inside a class method or
3870globally with the same name.  Specifying the @option{-fno-local-ivars}
3871flag disables this behavior thus avoiding variable shadowing issues.
3872
3873@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3874@opindex fivar-visibility
3875Set the default instance variable visibility to the specified option
3876so that instance variables declared outside the scope of any access
3877modifier directives default to the specified visibility.
3878
3879@item -gen-decls
3880@opindex gen-decls
3881Dump interface declarations for all classes seen in the source file to a
3882file named @file{@var{sourcename}.decl}.
3883
3884@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3885@opindex Wassign-intercept
3886@opindex Wno-assign-intercept
3887Warn whenever an Objective-C assignment is being intercepted by the
3888garbage collector.
3889
3890@item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
3891@opindex Wproperty-assign-default
3892@opindex Wno-property-assign-default
3893Do not warn if a property for an Objective-C object has no assign
3894semantics specified.
3895
3896@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3897@opindex Wno-protocol
3898@opindex Wprotocol
3899If a class is declared to implement a protocol, a warning is issued for
3900every method in the protocol that is not implemented by the class.  The
3901default behavior is to issue a warning for every method not explicitly
3902implemented in the class, even if a method implementation is inherited
3903from the superclass.  If you use the @option{-Wno-protocol} option, then
3904methods inherited from the superclass are considered to be implemented,
3905and no warning is issued for them.
3906
3907@item -Wselector @r{(Objective-C and Objective-C++ only)}
3908@opindex Wselector
3909@opindex Wno-selector
3910Warn if multiple methods of different types for the same selector are
3911found during compilation.  The check is performed on the list of methods
3912in the final stage of compilation.  Additionally, a check is performed
3913for each selector appearing in a @code{@@selector(@dots{})}
3914expression, and a corresponding method for that selector has been found
3915during compilation.  Because these checks scan the method table only at
3916the end of compilation, these warnings are not produced if the final
3917stage of compilation is not reached, for example because an error is
3918found during compilation, or because the @option{-fsyntax-only} option is
3919being used.
3920
3921@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3922@opindex Wstrict-selector-match
3923@opindex Wno-strict-selector-match
3924Warn if multiple methods with differing argument and/or return types are
3925found for a given selector when attempting to send a message using this
3926selector to a receiver of type @code{id} or @code{Class}.  When this flag
3927is off (which is the default behavior), the compiler omits such warnings
3928if any differences found are confined to types that share the same size
3929and alignment.
3930
3931@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3932@opindex Wundeclared-selector
3933@opindex Wno-undeclared-selector
3934Warn if a @code{@@selector(@dots{})} expression referring to an
3935undeclared selector is found.  A selector is considered undeclared if no
3936method with that name has been declared before the
3937@code{@@selector(@dots{})} expression, either explicitly in an
3938@code{@@interface} or @code{@@protocol} declaration, or implicitly in
3939an @code{@@implementation} section.  This option always performs its
3940checks as soon as a @code{@@selector(@dots{})} expression is found,
3941while @option{-Wselector} only performs its checks in the final stage of
3942compilation.  This also enforces the coding style convention
3943that methods and selectors must be declared before being used.
3944
3945@item -print-objc-runtime-info
3946@opindex print-objc-runtime-info
3947Generate C header describing the largest structure that is passed by
3948value, if any.
3949
3950@end table
3951
3952@node Diagnostic Message Formatting Options
3953@section Options to Control Diagnostic Messages Formatting
3954@cindex options to control diagnostics formatting
3955@cindex diagnostic messages
3956@cindex message formatting
3957
3958Traditionally, diagnostic messages have been formatted irrespective of
3959the output device's aspect (e.g.@: its width, @dots{}).  You can use the
3960options described below
3961to control the formatting algorithm for diagnostic messages,
3962e.g.@: how many characters per line, how often source location
3963information should be reported.  Note that some language front ends may not
3964honor these options.
3965
3966@table @gcctabopt
3967@item -fmessage-length=@var{n}
3968@opindex fmessage-length
3969Try to format error messages so that they fit on lines of about
3970@var{n} characters.  If @var{n} is zero, then no line-wrapping is
3971done; each error message appears on a single line.  This is the
3972default for all front ends.
3973
3974Note - this option also affects the display of the @samp{#error} and
3975@samp{#warning} pre-processor directives, and the @samp{deprecated}
3976function/type/variable attribute.  It does not however affect the
3977@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3978
3979@item -fdiagnostics-show-location=once
3980@opindex fdiagnostics-show-location
3981Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
3982reporter to emit source location information @emph{once}; that is, in
3983case the message is too long to fit on a single physical line and has to
3984be wrapped, the source location won't be emitted (as prefix) again,
3985over and over, in subsequent continuation lines.  This is the default
3986behavior.
3987
3988@item -fdiagnostics-show-location=every-line
3989Only meaningful in line-wrapping mode.  Instructs the diagnostic
3990messages reporter to emit the same source location information (as
3991prefix) for physical lines that result from the process of breaking
3992a message which is too long to fit on a single line.
3993
3994@item -fdiagnostics-color[=@var{WHEN}]
3995@itemx -fno-diagnostics-color
3996@opindex fdiagnostics-color
3997@cindex highlight, color
3998@vindex GCC_COLORS @r{environment variable}
3999Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
4000or @samp{auto}.  The default depends on how the compiler has been configured,
4001it can be any of the above @var{WHEN} options or also @samp{never}
4002if @env{GCC_COLORS} environment variable isn't present in the environment,
4003and @samp{auto} otherwise.
4004@samp{auto} makes GCC use color only when the standard error is a terminal,
4005and when not executing in an emacs shell.
4006The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4007aliases for @option{-fdiagnostics-color=always} and
4008@option{-fdiagnostics-color=never}, respectively.
4009
4010The colors are defined by the environment variable @env{GCC_COLORS}.
4011Its value is a colon-separated list of capabilities and Select Graphic
4012Rendition (SGR) substrings. SGR commands are interpreted by the
4013terminal or terminal emulator.  (See the section in the documentation
4014of your text terminal for permitted values and their meanings as
4015character attributes.)  These substring values are integers in decimal
4016representation and can be concatenated with semicolons.
4017Common values to concatenate include
4018@samp{1} for bold,
4019@samp{4} for underline,
4020@samp{5} for blink,
4021@samp{7} for inverse,
4022@samp{39} for default foreground color,
4023@samp{30} to @samp{37} for foreground colors,
4024@samp{90} to @samp{97} for 16-color mode foreground colors,
4025@samp{38;5;0} to @samp{38;5;255}
4026for 88-color and 256-color modes foreground colors,
4027@samp{49} for default background color,
4028@samp{40} to @samp{47} for background colors,
4029@samp{100} to @samp{107} for 16-color mode background colors,
4030and @samp{48;5;0} to @samp{48;5;255}
4031for 88-color and 256-color modes background colors.
4032
4033The default @env{GCC_COLORS} is
4034@smallexample
4035error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4036quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4037diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4038type-diff=01;32
4039@end smallexample
4040@noindent
4041where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4042@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4043@samp{01} is bold, and @samp{31} is red.
4044Setting @env{GCC_COLORS} to the empty string disables colors.
4045Supported capabilities are as follows.
4046
4047@table @code
4048@item error=
4049@vindex error GCC_COLORS @r{capability}
4050SGR substring for error: markers.
4051
4052@item warning=
4053@vindex warning GCC_COLORS @r{capability}
4054SGR substring for warning: markers.
4055
4056@item note=
4057@vindex note GCC_COLORS @r{capability}
4058SGR substring for note: markers.
4059
4060@item path=
4061@vindex path GCC_COLORS @r{capability}
4062SGR substring for colorizing paths of control-flow events as printed
4063via @option{-fdiagnostics-path-format=}, such as the identifiers of
4064individual events and lines indicating interprocedural calls and returns.
4065
4066@item range1=
4067@vindex range1 GCC_COLORS @r{capability}
4068SGR substring for first additional range.
4069
4070@item range2=
4071@vindex range2 GCC_COLORS @r{capability}
4072SGR substring for second additional range.
4073
4074@item locus=
4075@vindex locus GCC_COLORS @r{capability}
4076SGR substring for location information, @samp{file:line} or
4077@samp{file:line:column} etc.
4078
4079@item quote=
4080@vindex quote GCC_COLORS @r{capability}
4081SGR substring for information printed within quotes.
4082
4083@item fixit-insert=
4084@vindex fixit-insert GCC_COLORS @r{capability}
4085SGR substring for fix-it hints suggesting text to
4086be inserted or replaced.
4087
4088@item fixit-delete=
4089@vindex fixit-delete GCC_COLORS @r{capability}
4090SGR substring for fix-it hints suggesting text to
4091be deleted.
4092
4093@item diff-filename=
4094@vindex diff-filename GCC_COLORS @r{capability}
4095SGR substring for filename headers within generated patches.
4096
4097@item diff-hunk=
4098@vindex diff-hunk GCC_COLORS @r{capability}
4099SGR substring for the starts of hunks within generated patches.
4100
4101@item diff-delete=
4102@vindex diff-delete GCC_COLORS @r{capability}
4103SGR substring for deleted lines within generated patches.
4104
4105@item diff-insert=
4106@vindex diff-insert GCC_COLORS @r{capability}
4107SGR substring for inserted lines within generated patches.
4108
4109@item type-diff=
4110@vindex type-diff GCC_COLORS @r{capability}
4111SGR substring for highlighting mismatching types within template
4112arguments in the C++ frontend.
4113@end table
4114
4115@item -fdiagnostics-urls[=@var{WHEN}]
4116@opindex fdiagnostics-urls
4117@cindex urls
4118@vindex GCC_URLS @r{environment variable}
4119@vindex TERM_URLS @r{environment variable}
4120Use escape sequences to embed URLs in diagnostics.  For example, when
4121@option{-fdiagnostics-show-option} emits text showing the command-line
4122option controlling a diagnostic, embed a URL for documentation of that
4123option.
4124
4125@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4126@samp{auto} makes GCC use URL escape sequences only when the standard error
4127is a terminal, and when not executing in an emacs shell or any graphical
4128terminal which is known to be incompatible with this feature, see below.
4129
4130The default depends on how the compiler has been configured.
4131It can be any of the above @var{WHEN} options.
4132
4133GCC can also be configured (via the
4134@option{--with-diagnostics-urls=auto-if-env} configure-time option)
4135so that the default is affected by environment variables.
4136Under such a configuration, GCC defaults to using @samp{auto}
4137if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4138present and non-empty in the environment of the compiler, or @samp{never}
4139if neither are.
4140
4141However, even with @option{-fdiagnostics-urls=always} the behavior is
4142dependent on those environment variables:
4143If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4144diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
4145If set to @samp{bel}, the default, URLs use BEL escape sequences.
4146Any other non-empty value enables the feature.
4147If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4148Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4149BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4150
4151At this time GCC tries to detect also a few terminals that are known to
4152not implement the URL feature, and have bugs or at least had bugs in
4153some versions that are still in use, where the URL escapes are likely
4154to misbehave, i.e. print garbage on the screen.
4155That list is currently xfce4-terminal, certain known to be buggy
4156gnome-terminal versions, the linux console, and mingw.
4157This check can be skipped with the @option{-fdiagnostics-urls=always}.
4158
4159@item -fno-diagnostics-show-option
4160@opindex fno-diagnostics-show-option
4161@opindex fdiagnostics-show-option
4162By default, each diagnostic emitted includes text indicating the
4163command-line option that directly controls the diagnostic (if such an
4164option is known to the diagnostic machinery).  Specifying the
4165@option{-fno-diagnostics-show-option} flag suppresses that behavior.
4166
4167@item -fno-diagnostics-show-caret
4168@opindex fno-diagnostics-show-caret
4169@opindex fdiagnostics-show-caret
4170By default, each diagnostic emitted includes the original source line
4171and a caret @samp{^} indicating the column.  This option suppresses this
4172information.  The source line is truncated to @var{n} characters, if
4173the @option{-fmessage-length=n} option is given.  When the output is done
4174to the terminal, the width is limited to the width given by the
4175@env{COLUMNS} environment variable or, if not set, to the terminal width.
4176
4177@item -fno-diagnostics-show-labels
4178@opindex fno-diagnostics-show-labels
4179@opindex fdiagnostics-show-labels
4180By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4181diagnostics can label ranges of source code with pertinent information, such
4182as the types of expressions:
4183
4184@smallexample
4185    printf ("foo %s bar", long_i + long_j);
4186                 ~^       ~~~~~~~~~~~~~~~
4187                  |              |
4188                  char *         long int
4189@end smallexample
4190
4191This option suppresses the printing of these labels (in the example above,
4192the vertical bars and the ``char *'' and ``long int'' text).
4193
4194@item -fno-diagnostics-show-cwe
4195@opindex fno-diagnostics-show-cwe
4196@opindex fdiagnostics-show-cwe
4197Diagnostic messages can optionally have an associated
4198@url{https://cwe.mitre.org/index.html, CWE} identifier.
4199GCC itself only provides such metadata for some of the @option{-fanalyzer}
4200diagnostics.  GCC plugins may also provide diagnostics with such metadata.
4201By default, if this information is present, it will be printed with
4202the diagnostic.  This option suppresses the printing of this metadata.
4203
4204@item -fno-diagnostics-show-line-numbers
4205@opindex fno-diagnostics-show-line-numbers
4206@opindex fdiagnostics-show-line-numbers
4207By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4208a left margin is printed, showing line numbers.  This option suppresses this
4209left margin.
4210
4211@item -fdiagnostics-minimum-margin-width=@var{width}
4212@opindex fdiagnostics-minimum-margin-width
4213This option controls the minimum width of the left margin printed by
4214@option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
4215
4216@item -fdiagnostics-parseable-fixits
4217@opindex fdiagnostics-parseable-fixits
4218Emit fix-it hints in a machine-parseable format, suitable for consumption
4219by IDEs.  For each fix-it, a line will be printed after the relevant
4220diagnostic, starting with the string ``fix-it:''.  For example:
4221
4222@smallexample
4223fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4224@end smallexample
4225
4226The location is expressed as a half-open range, expressed as a count of
4227bytes, starting at byte 1 for the initial column.  In the above example,
4228bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4229given string:
4230
4231@smallexample
423200000000011111111112222222222
423312345678901234567890123456789
4234  gtk_widget_showall (dlg);
4235  ^^^^^^^^^^^^^^^^^^
4236  gtk_widget_show_all
4237@end smallexample
4238
4239The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4240newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4241(e.g. vertical tab as ``\013'').
4242
4243An empty replacement string indicates that the given range is to be removed.
4244An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4245be inserted at the given position.
4246
4247@item -fdiagnostics-generate-patch
4248@opindex fdiagnostics-generate-patch
4249Print fix-it hints to stderr in unified diff format, after any diagnostics
4250are printed.  For example:
4251
4252@smallexample
4253--- test.c
4254+++ test.c
4255@@ -42,5 +42,5 @@
4256
4257 void show_cb(GtkDialog *dlg)
4258 @{
4259-  gtk_widget_showall(dlg);
4260+  gtk_widget_show_all(dlg);
4261 @}
4262
4263@end smallexample
4264
4265The diff may or may not be colorized, following the same rules
4266as for diagnostics (see @option{-fdiagnostics-color}).
4267
4268@item -fdiagnostics-show-template-tree
4269@opindex fdiagnostics-show-template-tree
4270
4271In the C++ frontend, when printing diagnostics showing mismatching
4272template types, such as:
4273
4274@smallexample
4275  could not convert 'std::map<int, std::vector<double> >()'
4276    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4277@end smallexample
4278
4279the @option{-fdiagnostics-show-template-tree} flag enables printing a
4280tree-like structure showing the common and differing parts of the types,
4281such as:
4282
4283@smallexample
4284  map<
4285    [...],
4286    vector<
4287      [double != float]>>
4288@end smallexample
4289
4290The parts that differ are highlighted with color (``double'' and
4291``float'' in this case).
4292
4293@item -fno-elide-type
4294@opindex fno-elide-type
4295@opindex felide-type
4296By default when the C++ frontend prints diagnostics showing mismatching
4297template types, common parts of the types are printed as ``[...]'' to
4298simplify the error message.  For example:
4299
4300@smallexample
4301  could not convert 'std::map<int, std::vector<double> >()'
4302    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4303@end smallexample
4304
4305Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4306This flag also affects the output of the
4307@option{-fdiagnostics-show-template-tree} flag.
4308
4309@item -fdiagnostics-path-format=@var{KIND}
4310@opindex fdiagnostics-path-format
4311Specify how to print paths of control-flow events for diagnostics that
4312have such a path associated with them.
4313
4314@var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4315the default.
4316
4317@samp{none} means to not print diagnostic paths.
4318
4319@samp{separate-events} means to print a separate ``note'' diagnostic for
4320each event within the diagnostic.  For example:
4321
4322@smallexample
4323test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4324test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4325test.c:27:3: note: (2) when 'i < count'
4326test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4327@end smallexample
4328
4329@samp{inline-events} means to print the events ``inline'' within the source
4330code.  This view attempts to consolidate the events into runs of
4331sufficiently-close events, printing them as labelled ranges within the source.
4332
4333For example, the same events as above might be printed as:
4334
4335@smallexample
4336  'test': events 1-3
4337    |
4338    |   25 |   list = PyList_New(0);
4339    |      |          ^~~~~~~~~~~~~
4340    |      |          |
4341    |      |          (1) when 'PyList_New' fails, returning NULL
4342    |   26 |
4343    |   27 |   for (i = 0; i < count; i++) @{
4344    |      |   ~~~
4345    |      |   |
4346    |      |   (2) when 'i < count'
4347    |   28 |     item = PyLong_FromLong(random());
4348    |   29 |     PyList_Append(list, item);
4349    |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
4350    |      |     |
4351    |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4352    |
4353@end smallexample
4354
4355Interprocedural control flow is shown by grouping the events by stack frame,
4356and using indentation to show how stack frames are nested, pushed, and popped.
4357
4358For example:
4359
4360@smallexample
4361  'test': events 1-2
4362    |
4363    |  133 | @{
4364    |      | ^
4365    |      | |
4366    |      | (1) entering 'test'
4367    |  134 |   boxed_int *obj = make_boxed_int (i);
4368    |      |                    ~~~~~~~~~~~~~~~~~~
4369    |      |                    |
4370    |      |                    (2) calling 'make_boxed_int'
4371    |
4372    +--> 'make_boxed_int': events 3-4
4373           |
4374           |  120 | @{
4375           |      | ^
4376           |      | |
4377           |      | (3) entering 'make_boxed_int'
4378           |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4379           |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4380           |      |                                    |
4381           |      |                                    (4) calling 'wrapped_malloc'
4382           |
4383           +--> 'wrapped_malloc': events 5-6
4384                  |
4385                  |    7 | @{
4386                  |      | ^
4387                  |      | |
4388                  |      | (5) entering 'wrapped_malloc'
4389                  |    8 |   return malloc (size);
4390                  |      |          ~~~~~~~~~~~~~
4391                  |      |          |
4392                  |      |          (6) calling 'malloc'
4393                  |
4394    <-------------+
4395    |
4396 'test': event 7
4397    |
4398    |  138 |   free_boxed_int (obj);
4399    |      |   ^~~~~~~~~~~~~~~~~~~~
4400    |      |   |
4401    |      |   (7) calling 'free_boxed_int'
4402    |
4403(etc)
4404@end smallexample
4405
4406@item -fdiagnostics-show-path-depths
4407@opindex fdiagnostics-show-path-depths
4408This option provides additional information when printing control-flow paths
4409associated with a diagnostic.
4410
4411If this is option is provided then the stack depth will be printed for
4412each run of events within @option{-fdiagnostics-path-format=separate-events}.
4413
4414This is intended for use by GCC developers and plugin developers when
4415debugging diagnostics that report interprocedural control flow.
4416
4417@item -fno-show-column
4418@opindex fno-show-column
4419@opindex fshow-column
4420Do not print column numbers in diagnostics.  This may be necessary if
4421diagnostics are being scanned by a program that does not understand the
4422column numbers, such as @command{dejagnu}.
4423
4424@item -fdiagnostics-format=@var{FORMAT}
4425@opindex fdiagnostics-format
4426Select a different format for printing diagnostics.
4427@var{FORMAT} is @samp{text} or @samp{json}.
4428The default is @samp{text}.
4429
4430The @samp{json} format consists of a top-level JSON array containing JSON
4431objects representing the diagnostics.
4432
4433The JSON is emitted as one line, without formatting; the examples below
4434have been formatted for clarity.
4435
4436Diagnostics can have child diagnostics.  For example, this error and note:
4437
4438@smallexample
4439misleading-indentation.c:15:3: warning: this 'if' clause does not
4440  guard... [-Wmisleading-indentation]
4441   15 |   if (flag)
4442      |   ^~
4443misleading-indentation.c:17:5: note: ...this statement, but the latter
4444  is misleadingly indented as if it were guarded by the 'if'
4445   17 |     y = 2;
4446      |     ^
4447@end smallexample
4448
4449@noindent
4450might be printed in JSON form (after formatting) like this:
4451
4452@smallexample
4453[
4454    @{
4455        "kind": "warning",
4456        "locations": [
4457            @{
4458                "caret": @{
4459                    "column": 3,
4460                    "file": "misleading-indentation.c",
4461                    "line": 15
4462                @},
4463                "finish": @{
4464                    "column": 4,
4465                    "file": "misleading-indentation.c",
4466                    "line": 15
4467                @}
4468            @}
4469        ],
4470        "message": "this \u2018if\u2019 clause does not guard...",
4471        "option": "-Wmisleading-indentation",
4472        "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4473        "children": [
4474            @{
4475                "kind": "note",
4476                "locations": [
4477                    @{
4478                        "caret": @{
4479                            "column": 5,
4480                            "file": "misleading-indentation.c",
4481                            "line": 17
4482                        @}
4483                    @}
4484                ],
4485                "message": "...this statement, but the latter is @dots{}"
4486            @}
4487        ]
4488    @},
4489    @dots{}
4490]
4491@end smallexample
4492
4493@noindent
4494where the @code{note} is a child of the @code{warning}.
4495
4496A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
4497an @code{option} key describing the command-line option controlling the
4498warning.
4499
4500A diagnostic can contain zero or more locations.  Each location has up
4501to three positions within it: a @code{caret} position and optional
4502@code{start} and @code{finish} positions.  A location can also have
4503an optional @code{label} string.  For example, this error:
4504
4505@smallexample
4506bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4507   'struct s'@} and 'T' @{aka 'struct t'@})
4508   64 |   return callee_4a () + callee_4b ();
4509      |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4510      |          |              |
4511      |          |              T @{aka struct t@}
4512      |          S @{aka struct s@}
4513@end smallexample
4514
4515@noindent
4516has three locations.  Its primary location is at the ``+'' token at column
451723.  It has two secondary locations, describing the left and right-hand sides
4518of the expression, which have labels.  It might be printed in JSON form as:
4519
4520@smallexample
4521    @{
4522        "children": [],
4523        "kind": "error",
4524        "locations": [
4525            @{
4526                "caret": @{
4527                    "column": 23, "file": "bad-binary-ops.c", "line": 64
4528                @}
4529            @},
4530            @{
4531                "caret": @{
4532                    "column": 10, "file": "bad-binary-ops.c", "line": 64
4533                @},
4534                "finish": @{
4535                    "column": 21, "file": "bad-binary-ops.c", "line": 64
4536                @},
4537                "label": "S @{aka struct s@}"
4538            @},
4539            @{
4540                "caret": @{
4541                    "column": 25, "file": "bad-binary-ops.c", "line": 64
4542                @},
4543                "finish": @{
4544                    "column": 36, "file": "bad-binary-ops.c", "line": 64
4545                @},
4546                "label": "T @{aka struct t@}"
4547            @}
4548        ],
4549        "message": "invalid operands to binary + @dots{}"
4550    @}
4551@end smallexample
4552
4553If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4554consisting of half-open intervals, similar to the output of
4555@option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
4556with a replacement fix-it hint:
4557
4558@smallexample
4559demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4560  mean 'color'?
4561    8 |   return ptr->colour;
4562      |               ^~~~~~
4563      |               color
4564@end smallexample
4565
4566@noindent
4567might be printed in JSON form as:
4568
4569@smallexample
4570    @{
4571        "children": [],
4572        "fixits": [
4573            @{
4574                "next": @{
4575                    "column": 21,
4576                    "file": "demo.c",
4577                    "line": 8
4578                @},
4579                "start": @{
4580                    "column": 15,
4581                    "file": "demo.c",
4582                    "line": 8
4583                @},
4584                "string": "color"
4585            @}
4586        ],
4587        "kind": "error",
4588        "locations": [
4589            @{
4590                "caret": @{
4591                    "column": 15,
4592                    "file": "demo.c",
4593                    "line": 8
4594                @},
4595                "finish": @{
4596                    "column": 20,
4597                    "file": "demo.c",
4598                    "line": 8
4599                @}
4600            @}
4601        ],
4602        "message": "\u2018struct s\u2019 has no member named @dots{}"
4603    @}
4604@end smallexample
4605
4606@noindent
4607where the fix-it hint suggests replacing the text from @code{start} up
4608to but not including @code{next} with @code{string}'s value.  Deletions
4609are expressed via an empty value for @code{string}, insertions by
4610having @code{start} equal @code{next}.
4611
4612If the diagnostic has a path of control-flow events associated with it,
4613it has a @code{path} array of objects representing the events.  Each
4614event object has a @code{description} string, a @code{location} object,
4615along with a @code{function} string and a @code{depth} number for
4616representing interprocedural paths.  The @code{function} represents the
4617current function at that event, and the @code{depth} represents the
4618stack depth relative to some baseline: the higher, the more frames are
4619within the stack.
4620
4621For example, the intraprocedural example shown for
4622@option{-fdiagnostics-path-format=} might have this JSON for its path:
4623
4624@smallexample
4625    "path": [
4626        @{
4627            "depth": 0,
4628            "description": "when 'PyList_New' fails, returning NULL",
4629            "function": "test",
4630            "location": @{
4631                "column": 10,
4632                "file": "test.c",
4633                "line": 25
4634            @}
4635        @},
4636        @{
4637            "depth": 0,
4638            "description": "when 'i < count'",
4639            "function": "test",
4640            "location": @{
4641                "column": 3,
4642                "file": "test.c",
4643                "line": 27
4644            @}
4645        @},
4646        @{
4647            "depth": 0,
4648            "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4649            "function": "test",
4650            "location": @{
4651                "column": 5,
4652                "file": "test.c",
4653                "line": 29
4654            @}
4655        @}
4656    ]
4657@end smallexample
4658
4659@end table
4660
4661@node Warning Options
4662@section Options to Request or Suppress Warnings
4663@cindex options to control warnings
4664@cindex warning messages
4665@cindex messages, warning
4666@cindex suppressing warnings
4667
4668Warnings are diagnostic messages that report constructions that
4669are not inherently erroneous but that are risky or suggest there
4670may have been an error.
4671
4672The following language-independent options do not enable specific
4673warnings but control the kinds of diagnostics produced by GCC@.
4674
4675@table @gcctabopt
4676@cindex syntax checking
4677@item -fsyntax-only
4678@opindex fsyntax-only
4679Check the code for syntax errors, but don't do anything beyond that.
4680
4681@item -fmax-errors=@var{n}
4682@opindex fmax-errors
4683Limits the maximum number of error messages to @var{n}, at which point
4684GCC bails out rather than attempting to continue processing the source
4685code.  If @var{n} is 0 (the default), there is no limit on the number
4686of error messages produced.  If @option{-Wfatal-errors} is also
4687specified, then @option{-Wfatal-errors} takes precedence over this
4688option.
4689
4690@item -w
4691@opindex w
4692Inhibit all warning messages.
4693
4694@item -Werror
4695@opindex Werror
4696@opindex Wno-error
4697Make all warnings into errors.
4698
4699@item -Werror=
4700@opindex Werror=
4701@opindex Wno-error=
4702Make the specified warning into an error.  The specifier for a warning
4703is appended; for example @option{-Werror=switch} turns the warnings
4704controlled by @option{-Wswitch} into errors.  This switch takes a
4705negative form, to be used to negate @option{-Werror} for specific
4706warnings; for example @option{-Wno-error=switch} makes
4707@option{-Wswitch} warnings not be errors, even when @option{-Werror}
4708is in effect.
4709
4710The warning message for each controllable warning includes the
4711option that controls the warning.  That option can then be used with
4712@option{-Werror=} and @option{-Wno-error=} as described above.
4713(Printing of the option in the warning message can be disabled using the
4714@option{-fno-diagnostics-show-option} flag.)
4715
4716Note that specifying @option{-Werror=}@var{foo} automatically implies
4717@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
4718imply anything.
4719
4720@item -Wfatal-errors
4721@opindex Wfatal-errors
4722@opindex Wno-fatal-errors
4723This option causes the compiler to abort compilation on the first error
4724occurred rather than trying to keep going and printing further error
4725messages.
4726
4727@end table
4728
4729You can request many specific warnings with options beginning with
4730@samp{-W}, for example @option{-Wimplicit} to request warnings on
4731implicit declarations.  Each of these specific warning options also
4732has a negative form beginning @samp{-Wno-} to turn off warnings; for
4733example, @option{-Wno-implicit}.  This manual lists only one of the
4734two forms, whichever is not the default.  For further
4735language-specific options also refer to @ref{C++ Dialect Options} and
4736@ref{Objective-C and Objective-C++ Dialect Options}.
4737Additional warnings can be produced by enabling the static analyzer;
4738@xref{Static Analyzer Options}.
4739
4740Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4741options, such as @option{-Wunused}, which may turn on further options,
4742such as @option{-Wunused-value}. The combined effect of positive and
4743negative forms is that more specific options have priority over less
4744specific ones, independently of their position in the command-line. For
4745options of the same specificity, the last one takes effect. Options
4746enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4747as if they appeared at the end of the command-line.
4748
4749When an unrecognized warning option is requested (e.g.,
4750@option{-Wunknown-warning}), GCC emits a diagnostic stating
4751that the option is not recognized.  However, if the @option{-Wno-} form
4752is used, the behavior is slightly different: no diagnostic is
4753produced for @option{-Wno-unknown-warning} unless other diagnostics
4754are being produced.  This allows the use of new @option{-Wno-} options
4755with old compilers, but if something goes wrong, the compiler
4756warns that an unrecognized option is present.
4757
4758The effectiveness of some warnings depends on optimizations also being
4759enabled. For example @option{-Wsuggest-final-types} is more effective
4760with link-time optimization and @option{-Wmaybe-uninitialized} does not
4761warn at all unless optimization is enabled.
4762
4763@table @gcctabopt
4764@item -Wpedantic
4765@itemx -pedantic
4766@opindex pedantic
4767@opindex Wpedantic
4768@opindex Wno-pedantic
4769Issue all the warnings demanded by strict ISO C and ISO C++;
4770reject all programs that use forbidden extensions, and some other
4771programs that do not follow ISO C and ISO C++.  For ISO C, follows the
4772version of the ISO C standard specified by any @option{-std} option used.
4773
4774Valid ISO C and ISO C++ programs should compile properly with or without
4775this option (though a rare few require @option{-ansi} or a
4776@option{-std} option specifying the required version of ISO C)@.  However,
4777without this option, certain GNU extensions and traditional C and C++
4778features are supported as well.  With this option, they are rejected.
4779
4780@option{-Wpedantic} does not cause warning messages for use of the
4781alternate keywords whose names begin and end with @samp{__}.  This alternate
4782format can also be used to disable warnings for non-ISO @samp{__intN} types,
4783i.e. @samp{__intN__}.
4784Pedantic warnings are also disabled in the expression that follows
4785@code{__extension__}.  However, only system header files should use
4786these escape routes; application programs should avoid them.
4787@xref{Alternate Keywords}.
4788
4789Some users try to use @option{-Wpedantic} to check programs for strict ISO
4790C conformance.  They soon find that it does not do quite what they want:
4791it finds some non-ISO practices, but not all---only those for which
4792ISO C @emph{requires} a diagnostic, and some others for which
4793diagnostics have been added.
4794
4795A feature to report any failure to conform to ISO C might be useful in
4796some instances, but would require considerable additional work and would
4797be quite different from @option{-Wpedantic}.  We don't have plans to
4798support such a feature in the near future.
4799
4800Where the standard specified with @option{-std} represents a GNU
4801extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4802corresponding @dfn{base standard}, the version of ISO C on which the GNU
4803extended dialect is based.  Warnings from @option{-Wpedantic} are given
4804where they are required by the base standard.  (It does not make sense
4805for such warnings to be given only for features not in the specified GNU
4806C dialect, since by definition the GNU dialects of C include all
4807features the compiler supports with the given option, and there would be
4808nothing to warn about.)
4809
4810@item -pedantic-errors
4811@opindex pedantic-errors
4812Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4813requires a diagnostic, in some cases where there is undefined behavior
4814at compile-time and in some other cases that do not prevent compilation
4815of programs that are valid according to the standard. This is not
4816equivalent to @option{-Werror=pedantic}, since there are errors enabled
4817by this option and not enabled by the latter and vice versa.
4818
4819@item -Wall
4820@opindex Wall
4821@opindex Wno-all
4822This enables all the warnings about constructions that some users
4823consider questionable, and that are easy to avoid (or modify to
4824prevent the warning), even in conjunction with macros.  This also
4825enables some language-specific warnings described in @ref{C++ Dialect
4826Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4827
4828@option{-Wall} turns on the following warning flags:
4829
4830@gccoptlist{-Waddress   @gol
4831-Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
4832-Wbool-compare  @gol
4833-Wbool-operation  @gol
4834-Wc++11-compat  -Wc++14-compat  @gol
4835-Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
4836-Wchar-subscripts  @gol
4837-Wcomment  @gol
4838-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4839-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4840-Wenum-conversion @r{in C/ObjC;} @gol
4841-Wformat   @gol
4842-Wformat-overflow  @gol
4843-Wformat-truncation  @gol
4844-Wint-in-bool-context  @gol
4845-Wimplicit @r{(C and Objective-C only)} @gol
4846-Wimplicit-int @r{(C and Objective-C only)} @gol
4847-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4848-Winit-self @r{(only for C++)} @gol
4849-Wlogical-not-parentheses @gol
4850-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
4851-Wmaybe-uninitialized @gol
4852-Wmemset-elt-size @gol
4853-Wmemset-transposed-args @gol
4854-Wmisleading-indentation @r{(only for C/C++)} @gol
4855-Wmissing-attributes @gol
4856-Wmissing-braces @r{(only for C/ObjC)} @gol
4857-Wmultistatement-macros  @gol
4858-Wnarrowing @r{(only for C++)}  @gol
4859-Wnonnull  @gol
4860-Wnonnull-compare  @gol
4861-Wopenmp-simd @gol
4862-Wparentheses  @gol
4863-Wpessimizing-move @r{(only for C++)}  @gol
4864-Wpointer-sign  @gol
4865-Wreorder   @gol
4866-Wrestrict   @gol
4867-Wreturn-type  @gol
4868-Wsequence-point  @gol
4869-Wsign-compare @r{(only in C++)}  @gol
4870-Wsizeof-pointer-div @gol
4871-Wsizeof-pointer-memaccess @gol
4872-Wstrict-aliasing  @gol
4873-Wstrict-overflow=1  @gol
4874-Wswitch  @gol
4875-Wtautological-compare  @gol
4876-Wtrigraphs  @gol
4877-Wuninitialized  @gol
4878-Wunknown-pragmas  @gol
4879-Wunused-function  @gol
4880-Wunused-label     @gol
4881-Wunused-value     @gol
4882-Wunused-variable  @gol
4883-Wvolatile-register-var  @gol
4884-Wzero-length-bounds}
4885
4886Note that some warning flags are not implied by @option{-Wall}.  Some of
4887them warn about constructions that users generally do not consider
4888questionable, but which occasionally you might wish to check for;
4889others warn about constructions that are necessary or hard to avoid in
4890some cases, and there is no simple way to modify the code to suppress
4891the warning. Some of them are enabled by @option{-Wextra} but many of
4892them must be enabled individually.
4893
4894@item -Wextra
4895@opindex W
4896@opindex Wextra
4897@opindex Wno-extra
4898This enables some extra warning flags that are not enabled by
4899@option{-Wall}. (This option used to be called @option{-W}.  The older
4900name is still supported, but the newer name is more descriptive.)
4901
4902@gccoptlist{-Wclobbered  @gol
4903-Wcast-function-type  @gol
4904-Wdeprecated-copy @r{(C++ only)} @gol
4905-Wempty-body  @gol
4906-Wignored-qualifiers @gol
4907-Wimplicit-fallthrough=3 @gol
4908-Wmissing-field-initializers  @gol
4909-Wmissing-parameter-type @r{(C only)}  @gol
4910-Wold-style-declaration @r{(C only)}  @gol
4911-Woverride-init  @gol
4912-Wsign-compare @r{(C only)} @gol
4913-Wstring-compare @gol
4914-Wredundant-move @r{(only for C++)}  @gol
4915-Wtype-limits  @gol
4916-Wuninitialized  @gol
4917-Wshift-negative-value @r{(in C++03 and in C99 and newer)}  @gol
4918-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4919-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4920
4921
4922The option @option{-Wextra} also prints warning messages for the
4923following cases:
4924
4925@itemize @bullet
4926
4927@item
4928A pointer is compared against integer zero with @code{<}, @code{<=},
4929@code{>}, or @code{>=}.
4930
4931@item
4932(C++ only) An enumerator and a non-enumerator both appear in a
4933conditional expression.
4934
4935@item
4936(C++ only) Ambiguous virtual bases.
4937
4938@item
4939(C++ only) Subscripting an array that has been declared @code{register}.
4940
4941@item
4942(C++ only) Taking the address of a variable that has been declared
4943@code{register}.
4944
4945@item
4946(C++ only) A base class is not initialized in the copy constructor
4947of a derived class.
4948
4949@end itemize
4950
4951@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
4952@opindex Wabi
4953@opindex Wno-abi
4954
4955Warn about code affected by ABI changes.  This includes code that may
4956not be compatible with the vendor-neutral C++ ABI as well as the psABI
4957for the particular target.
4958
4959Since G++ now defaults to updating the ABI with each major release,
4960normally @option{-Wabi} warns only about C++ ABI compatibility
4961problems if there is a check added later in a release series for an
4962ABI issue discovered since the initial release.  @option{-Wabi} warns
4963about more things if an older ABI version is selected (with
4964@option{-fabi-version=@var{n}}).
4965
4966@option{-Wabi} can also be used with an explicit version number to
4967warn about C++ ABI compatibility with a particular @option{-fabi-version}
4968level, e.g.@: @option{-Wabi=2} to warn about changes relative to
4969@option{-fabi-version=2}.
4970
4971If an explicit version number is provided and
4972@option{-fabi-compat-version} is not specified, the version number
4973from this option is used for compatibility aliases.  If no explicit
4974version number is provided with this option, but
4975@option{-fabi-compat-version} is specified, that version number is
4976used for C++ ABI warnings.
4977
4978Although an effort has been made to warn about
4979all such cases, there are probably some cases that are not warned about,
4980even though G++ is generating incompatible code.  There may also be
4981cases where warnings are emitted even though the code that is generated
4982is compatible.
4983
4984You should rewrite your code to avoid these warnings if you are
4985concerned about the fact that code generated by G++ may not be binary
4986compatible with code generated by other compilers.
4987
4988Known incompatibilities in @option{-fabi-version=2} (which was the
4989default from GCC 3.4 to 4.9) include:
4990
4991@itemize @bullet
4992
4993@item
4994A template with a non-type template parameter of reference type was
4995mangled incorrectly:
4996@smallexample
4997extern int N;
4998template <int &> struct S @{@};
4999void n (S<N>) @{2@}
5000@end smallexample
5001
5002This was fixed in @option{-fabi-version=3}.
5003
5004@item
5005SIMD vector types declared using @code{__attribute ((vector_size))} were
5006mangled in a non-standard way that does not allow for overloading of
5007functions taking vectors of different sizes.
5008
5009The mangling was changed in @option{-fabi-version=4}.
5010
5011@item
5012@code{__attribute ((const))} and @code{noreturn} were mangled as type
5013qualifiers, and @code{decltype} of a plain declaration was folded away.
5014
5015These mangling issues were fixed in @option{-fabi-version=5}.
5016
5017@item
5018Scoped enumerators passed as arguments to a variadic function are
5019promoted like unscoped enumerators, causing @code{va_arg} to complain.
5020On most targets this does not actually affect the parameter passing
5021ABI, as there is no way to pass an argument smaller than @code{int}.
5022
5023Also, the ABI changed the mangling of template argument packs,
5024@code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5025a class scope function used as a template argument.
5026
5027These issues were corrected in @option{-fabi-version=6}.
5028
5029@item
5030Lambdas in default argument scope were mangled incorrectly, and the
5031ABI changed the mangling of @code{nullptr_t}.
5032
5033These issues were corrected in @option{-fabi-version=7}.
5034
5035@item
5036When mangling a function type with function-cv-qualifiers, the
5037un-qualified function type was incorrectly treated as a substitution
5038candidate.
5039
5040This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5041
5042@item
5043@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5044unaligned accesses.  Note that this did not affect the ABI of a
5045function with a @code{nullptr_t} parameter, as parameters have a
5046minimum alignment.
5047
5048This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5049
5050@item
5051Target-specific attributes that affect the identity of a type, such as
5052ia32 calling conventions on a function type (stdcall, regparm, etc.),
5053did not affect the mangled name, leading to name collisions when
5054function pointers were used as template arguments.
5055
5056This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5057
5058@end itemize
5059
5060This option also enables warnings about psABI-related changes.
5061The known psABI changes at this point include:
5062
5063@itemize @bullet
5064
5065@item
5066For SysV/x86-64, unions with @code{long double} members are
5067passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
5068the case.  For example:
5069
5070@smallexample
5071union U @{
5072  long double ld;
5073  int i;
5074@};
5075@end smallexample
5076
5077@noindent
5078@code{union U} is now always passed in memory.
5079
5080@end itemize
5081
5082@item -Wchar-subscripts
5083@opindex Wchar-subscripts
5084@opindex Wno-char-subscripts
5085Warn if an array subscript has type @code{char}.  This is a common cause
5086of error, as programmers often forget that this type is signed on some
5087machines.
5088This warning is enabled by @option{-Wall}.
5089
5090@item -Wno-coverage-mismatch
5091@opindex Wno-coverage-mismatch
5092@opindex Wcoverage-mismatch
5093Warn if feedback profiles do not match when using the
5094@option{-fprofile-use} option.
5095If a source file is changed between compiling with @option{-fprofile-generate}
5096and with @option{-fprofile-use}, the files with the profile feedback can fail
5097to match the source file and GCC cannot use the profile feedback
5098information.  By default, this warning is enabled and is treated as an
5099error.  @option{-Wno-coverage-mismatch} can be used to disable the
5100warning or @option{-Wno-error=coverage-mismatch} can be used to
5101disable the error.  Disabling the error for this warning can result in
5102poorly optimized code and is useful only in the
5103case of very minor changes such as bug fixes to an existing code-base.
5104Completely disabling the warning is not recommended.
5105
5106@item -Wno-cpp
5107@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5108@opindex Wno-cpp
5109@opindex Wcpp
5110Suppress warning messages emitted by @code{#warning} directives.
5111
5112@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5113@opindex Wdouble-promotion
5114@opindex Wno-double-promotion
5115Give a warning when a value of type @code{float} is implicitly
5116promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
5117floating-point unit implement @code{float} in hardware, but emulate
5118@code{double} in software.  On such a machine, doing computations
5119using @code{double} values is much more expensive because of the
5120overhead required for software emulation.
5121
5122It is easy to accidentally do computations with @code{double} because
5123floating-point literals are implicitly of type @code{double}.  For
5124example, in:
5125@smallexample
5126@group
5127float area(float radius)
5128@{
5129   return 3.14159 * radius * radius;
5130@}
5131@end group
5132@end smallexample
5133the compiler performs the entire computation with @code{double}
5134because the floating-point literal is a @code{double}.
5135
5136@item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5137@opindex Wduplicate-decl-specifier
5138@opindex Wno-duplicate-decl-specifier
5139Warn if a declaration has duplicate @code{const}, @code{volatile},
5140@code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
5141@option{-Wall}.
5142
5143@item -Wformat
5144@itemx -Wformat=@var{n}
5145@opindex Wformat
5146@opindex Wno-format
5147@opindex ffreestanding
5148@opindex fno-builtin
5149@opindex Wformat=
5150Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5151the arguments supplied have types appropriate to the format string
5152specified, and that the conversions specified in the format string make
5153sense.  This includes standard functions, and others specified by format
5154attributes (@pxref{Function Attributes}), in the @code{printf},
5155@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5156not in the C standard) families (or other target-specific families).
5157Which functions are checked without format attributes having been
5158specified depends on the standard version selected, and such checks of
5159functions without the attribute specified are disabled by
5160@option{-ffreestanding} or @option{-fno-builtin}.
5161
5162The formats are checked against the format features supported by GNU
5163libc version 2.2.  These include all ISO C90 and C99 features, as well
5164as features from the Single Unix Specification and some BSD and GNU
5165extensions.  Other library implementations may not support all these
5166features; GCC does not support warning about features that go beyond a
5167particular library's limitations.  However, if @option{-Wpedantic} is used
5168with @option{-Wformat}, warnings are given about format features not
5169in the selected standard version (but not for @code{strfmon} formats,
5170since those are not in any version of the C standard).  @xref{C Dialect
5171Options,,Options Controlling C Dialect}.
5172
5173@table @gcctabopt
5174@item -Wformat=1
5175@itemx -Wformat
5176@opindex Wformat
5177@opindex Wformat=1
5178Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5179@option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
5180@option{-Wformat} also checks for null format arguments for several
5181functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
5182aspects of this level of format checking can be disabled by the
5183options: @option{-Wno-format-contains-nul},
5184@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5185@option{-Wformat} is enabled by @option{-Wall}.
5186
5187@item -Wformat=2
5188@opindex Wformat=2
5189Enable @option{-Wformat} plus additional format checks.  Currently
5190equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5191-Wformat-y2k}.
5192@end table
5193
5194@item -Wno-format-contains-nul
5195@opindex Wno-format-contains-nul
5196@opindex Wformat-contains-nul
5197If @option{-Wformat} is specified, do not warn about format strings that
5198contain NUL bytes.
5199
5200@item -Wno-format-extra-args
5201@opindex Wno-format-extra-args
5202@opindex Wformat-extra-args
5203If @option{-Wformat} is specified, do not warn about excess arguments to a
5204@code{printf} or @code{scanf} format function.  The C standard specifies
5205that such arguments are ignored.
5206
5207Where the unused arguments lie between used arguments that are
5208specified with @samp{$} operand number specifications, normally
5209warnings are still given, since the implementation could not know what
5210type to pass to @code{va_arg} to skip the unused arguments.  However,
5211in the case of @code{scanf} formats, this option suppresses the
5212warning if the unused arguments are all pointers, since the Single
5213Unix Specification says that such unused arguments are allowed.
5214
5215@item -Wformat-overflow
5216@itemx -Wformat-overflow=@var{level}
5217@opindex Wformat-overflow
5218@opindex Wno-format-overflow
5219Warn about calls to formatted input/output functions such as @code{sprintf}
5220and @code{vsprintf} that might overflow the destination buffer.  When the
5221exact number of bytes written by a format directive cannot be determined
5222at compile-time it is estimated based on heuristics that depend on the
5223@var{level} argument and on optimization.  While enabling optimization
5224will in most cases improve the accuracy of the warning, it may also
5225result in false positives.
5226
5227@table @gcctabopt
5228@item -Wformat-overflow
5229@itemx -Wformat-overflow=1
5230@opindex Wformat-overflow
5231@opindex Wno-format-overflow
5232Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5233employs a conservative approach that warns only about calls that most
5234likely overflow the buffer.  At this level, numeric arguments to format
5235directives with unknown values are assumed to have the value of one, and
5236strings of unknown length to be empty.  Numeric arguments that are known
5237to be bounded to a subrange of their type, or string arguments whose output
5238is bounded either by their directive's precision or by a finite set of
5239string literals, are assumed to take on the value within the range that
5240results in the most bytes on output.  For example, the call to @code{sprintf}
5241below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5242the terminating NUL character (@code{'\0'}) appended by the function
5243to the destination buffer will be written past its end.  Increasing
5244the size of the buffer by a single byte is sufficient to avoid the
5245warning, though it may not be sufficient to avoid the overflow.
5246
5247@smallexample
5248void f (int a, int b)
5249@{
5250  char buf [13];
5251  sprintf (buf, "a = %i, b = %i\n", a, b);
5252@}
5253@end smallexample
5254
5255@item -Wformat-overflow=2
5256Level @var{2} warns also about calls that might overflow the destination
5257buffer given an argument of sufficient length or magnitude.  At level
5258@var{2}, unknown numeric arguments are assumed to have the minimum
5259representable value for signed types with a precision greater than 1, and
5260the maximum representable value otherwise.  Unknown string arguments whose
5261length cannot be assumed to be bounded either by the directive's precision,
5262or by a finite set of string literals they may evaluate to, or the character
5263array they may point to, are assumed to be 1 character long.
5264
5265At level @var{2}, the call in the example above is again diagnosed, but
5266this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5267@code{%i} directive will write some of its digits beyond the end of
5268the destination buffer.  To make the call safe regardless of the values
5269of the two variables, the size of the destination buffer must be increased
5270to at least 34 bytes.  GCC includes the minimum size of the buffer in
5271an informational note following the warning.
5272
5273An alternative to increasing the size of the destination buffer is to
5274constrain the range of formatted values.  The maximum length of string
5275arguments can be bounded by specifying the precision in the format
5276directive.  When numeric arguments of format directives can be assumed
5277to be bounded by less than the precision of their type, choosing
5278an appropriate length modifier to the format specifier will reduce
5279the required buffer size.  For example, if @var{a} and @var{b} in the
5280example above can be assumed to be within the precision of
5281the @code{short int} type then using either the @code{%hi} format
5282directive or casting the argument to @code{short} reduces the maximum
5283required size of the buffer to 24 bytes.
5284
5285@smallexample
5286void f (int a, int b)
5287@{
5288  char buf [23];
5289  sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5290@}
5291@end smallexample
5292@end table
5293
5294@item -Wno-format-zero-length
5295@opindex Wno-format-zero-length
5296@opindex Wformat-zero-length
5297If @option{-Wformat} is specified, do not warn about zero-length formats.
5298The C standard specifies that zero-length formats are allowed.
5299
5300@item -Wformat-nonliteral
5301@opindex Wformat-nonliteral
5302@opindex Wno-format-nonliteral
5303If @option{-Wformat} is specified, also warn if the format string is not a
5304string literal and so cannot be checked, unless the format function
5305takes its format arguments as a @code{va_list}.
5306
5307@item -Wformat-security
5308@opindex Wformat-security
5309@opindex Wno-format-security
5310If @option{-Wformat} is specified, also warn about uses of format
5311functions that represent possible security problems.  At present, this
5312warns about calls to @code{printf} and @code{scanf} functions where the
5313format string is not a string literal and there are no format arguments,
5314as in @code{printf (foo);}.  This may be a security hole if the format
5315string came from untrusted input and contains @samp{%n}.  (This is
5316currently a subset of what @option{-Wformat-nonliteral} warns about, but
5317in future warnings may be added to @option{-Wformat-security} that are not
5318included in @option{-Wformat-nonliteral}.)
5319
5320@item -Wformat-signedness
5321@opindex Wformat-signedness
5322@opindex Wno-format-signedness
5323If @option{-Wformat} is specified, also warn if the format string
5324requires an unsigned argument and the argument is signed and vice versa.
5325
5326@item -Wformat-truncation
5327@itemx -Wformat-truncation=@var{level}
5328@opindex Wformat-truncation
5329@opindex Wno-format-truncation
5330Warn about calls to formatted input/output functions such as @code{snprintf}
5331and @code{vsnprintf} that might result in output truncation.  When the exact
5332number of bytes written by a format directive cannot be determined at
5333compile-time it is estimated based on heuristics that depend on
5334the @var{level} argument and on optimization.  While enabling optimization
5335will in most cases improve the accuracy of the warning, it may also result
5336in false positives.  Except as noted otherwise, the option uses the same
5337logic @option{-Wformat-overflow}.
5338
5339@table @gcctabopt
5340@item -Wformat-truncation
5341@itemx -Wformat-truncation=1
5342@opindex Wformat-truncation
5343@opindex Wno-format-truncation
5344Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5345employs a conservative approach that warns only about calls to bounded
5346functions whose return value is unused and that will most likely result
5347in output truncation.
5348
5349@item -Wformat-truncation=2
5350Level @var{2} warns also about calls to bounded functions whose return
5351value is used and that might result in truncation given an argument of
5352sufficient length or magnitude.
5353@end table
5354
5355@item -Wformat-y2k
5356@opindex Wformat-y2k
5357@opindex Wno-format-y2k
5358If @option{-Wformat} is specified, also warn about @code{strftime}
5359formats that may yield only a two-digit year.
5360
5361@item -Wnonnull
5362@opindex Wnonnull
5363@opindex Wno-nonnull
5364Warn about passing a null pointer for arguments marked as
5365requiring a non-null value by the @code{nonnull} function attribute.
5366
5367@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
5368can be disabled with the @option{-Wno-nonnull} option.
5369
5370@item -Wnonnull-compare
5371@opindex Wnonnull-compare
5372@opindex Wno-nonnull-compare
5373Warn when comparing an argument marked with the @code{nonnull}
5374function attribute against null inside the function.
5375
5376@option{-Wnonnull-compare} is included in @option{-Wall}.  It
5377can be disabled with the @option{-Wno-nonnull-compare} option.
5378
5379@item -Wnull-dereference
5380@opindex Wnull-dereference
5381@opindex Wno-null-dereference
5382Warn if the compiler detects paths that trigger erroneous or
5383undefined behavior due to dereferencing a null pointer.  This option
5384is only active when @option{-fdelete-null-pointer-checks} is active,
5385which is enabled by optimizations in most targets.  The precision of
5386the warnings depends on the optimization options used.
5387
5388@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5389@opindex Winit-self
5390@opindex Wno-init-self
5391Warn about uninitialized variables that are initialized with themselves.
5392Note this option can only be used with the @option{-Wuninitialized} option.
5393
5394For example, GCC warns about @code{i} being uninitialized in the
5395following snippet only when @option{-Winit-self} has been specified:
5396@smallexample
5397@group
5398int f()
5399@{
5400  int i = i;
5401  return i;
5402@}
5403@end group
5404@end smallexample
5405
5406This warning is enabled by @option{-Wall} in C++.
5407
5408@item -Wno-implicit-int @r{(C and Objective-C only)}
5409@opindex Wimplicit-int
5410@opindex Wno-implicit-int
5411This option controls warnings when a declaration does not specify a type.
5412This warning is enabled by default in C99 and later dialects of C,
5413and also by @option{-Wall}.
5414
5415@item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5416@opindex Wimplicit-function-declaration
5417@opindex Wno-implicit-function-declaration
5418This option controls warnings when a function is used before being declared.
5419This warning is enabled by default in C99 and later dialects of C,
5420and also by @option{-Wall}.
5421The warning is made into an error by @option{-pedantic-errors}.
5422
5423@item -Wimplicit @r{(C and Objective-C only)}
5424@opindex Wimplicit
5425@opindex Wno-implicit
5426Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5427This warning is enabled by @option{-Wall}.
5428
5429@item -Wimplicit-fallthrough
5430@opindex Wimplicit-fallthrough
5431@opindex Wno-implicit-fallthrough
5432@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5433and @option{-Wno-implicit-fallthrough} is the same as
5434@option{-Wimplicit-fallthrough=0}.
5435
5436@item -Wimplicit-fallthrough=@var{n}
5437@opindex Wimplicit-fallthrough=
5438Warn when a switch case falls through.  For example:
5439
5440@smallexample
5441@group
5442switch (cond)
5443  @{
5444  case 1:
5445    a = 1;
5446    break;
5447  case 2:
5448    a = 2;
5449  case 3:
5450    a = 3;
5451    break;
5452  @}
5453@end group
5454@end smallexample
5455
5456This warning does not warn when the last statement of a case cannot
5457fall through, e.g. when there is a return statement or a call to function
5458declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
5459also takes into account control flow statements, such as ifs, and only
5460warns when appropriate.  E.g.@:
5461
5462@smallexample
5463@group
5464switch (cond)
5465  @{
5466  case 1:
5467    if (i > 3) @{
5468      bar (5);
5469      break;
5470    @} else if (i < 1) @{
5471      bar (0);
5472    @} else
5473      return;
5474  default:
5475    @dots{}
5476  @}
5477@end group
5478@end smallexample
5479
5480Since there are occasions where a switch case fall through is desirable,
5481GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5482to be used along with a null statement to suppress this warning that
5483would normally occur:
5484
5485@smallexample
5486@group
5487switch (cond)
5488  @{
5489  case 1:
5490    bar (0);
5491    __attribute__ ((fallthrough));
5492  default:
5493    @dots{}
5494  @}
5495@end group
5496@end smallexample
5497
5498C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5499warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
5500or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5501Instead of these attributes, it is also possible to add a fallthrough comment
5502to silence the warning.  The whole body of the C or C++ style comment should
5503match the given regular expressions listed below.  The option argument @var{n}
5504specifies what kind of comments are accepted:
5505
5506@itemize @bullet
5507
5508@item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5509
5510@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5511expression, any comment is used as fallthrough comment.
5512
5513@item @option{-Wimplicit-fallthrough=2} case insensitively matches
5514@code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5515
5516@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5517following regular expressions:
5518
5519@itemize @bullet
5520
5521@item @code{-fallthrough}
5522
5523@item @code{@@fallthrough@@}
5524
5525@item @code{lint -fallthrough[ \t]*}
5526
5527@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5528
5529@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5530
5531@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5532
5533@end itemize
5534
5535@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5536following regular expressions:
5537
5538@itemize @bullet
5539
5540@item @code{-fallthrough}
5541
5542@item @code{@@fallthrough@@}
5543
5544@item @code{lint -fallthrough[ \t]*}
5545
5546@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5547
5548@end itemize
5549
5550@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5551fallthrough comments, only attributes disable the warning.
5552
5553@end itemize
5554
5555The comment needs to be followed after optional whitespace and other comments
5556by @code{case} or @code{default} keywords or by a user label that precedes some
5557@code{case} or @code{default} label.
5558
5559@smallexample
5560@group
5561switch (cond)
5562  @{
5563  case 1:
5564    bar (0);
5565    /* FALLTHRU */
5566  default:
5567    @dots{}
5568  @}
5569@end group
5570@end smallexample
5571
5572The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5573
5574@item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5575@opindex Wif-not-aligned
5576@opindex Wno-if-not-aligned
5577Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5578should be issued.  These warnings are enabled by default.
5579
5580@item -Wignored-qualifiers @r{(C and C++ only)}
5581@opindex Wignored-qualifiers
5582@opindex Wno-ignored-qualifiers
5583Warn if the return type of a function has a type qualifier
5584such as @code{const}.  For ISO C such a type qualifier has no effect,
5585since the value returned by a function is not an lvalue.
5586For C++, the warning is only emitted for scalar types or @code{void}.
5587ISO C prohibits qualified @code{void} return types on function
5588definitions, so such return types always receive a warning
5589even without this option.
5590
5591This warning is also enabled by @option{-Wextra}.
5592
5593@item -Wno-ignored-attributes @r{(C and C++ only)}
5594@opindex Wignored-attributes
5595@opindex Wno-ignored-attributes
5596This option controls warnings when an attribute is ignored.
5597This is different from the
5598@option{-Wattributes} option in that it warns whenever the compiler decides
5599to drop an attribute, not that the attribute is either unknown, used in a
5600wrong place, etc.  This warning is enabled by default.
5601
5602@item -Wmain
5603@opindex Wmain
5604@opindex Wno-main
5605Warn if the type of @code{main} is suspicious.  @code{main} should be
5606a function with external linkage, returning int, taking either zero
5607arguments, two, or three arguments of appropriate types.  This warning
5608is enabled by default in C++ and is enabled by either @option{-Wall}
5609or @option{-Wpedantic}.
5610
5611@item -Wmisleading-indentation @r{(C and C++ only)}
5612@opindex Wmisleading-indentation
5613@opindex Wno-misleading-indentation
5614Warn when the indentation of the code does not reflect the block structure.
5615Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5616@code{for} clauses with a guarded statement that does not use braces,
5617followed by an unguarded statement with the same indentation.
5618
5619In the following example, the call to ``bar'' is misleadingly indented as
5620if it were guarded by the ``if'' conditional.
5621
5622@smallexample
5623  if (some_condition ())
5624    foo ();
5625    bar ();  /* Gotcha: this is not guarded by the "if".  */
5626@end smallexample
5627
5628In the case of mixed tabs and spaces, the warning uses the
5629@option{-ftabstop=} option to determine if the statements line up
5630(defaulting to 8).
5631
5632The warning is not issued for code involving multiline preprocessor logic
5633such as the following example.
5634
5635@smallexample
5636  if (flagA)
5637    foo (0);
5638#if SOME_CONDITION_THAT_DOES_NOT_HOLD
5639  if (flagB)
5640#endif
5641    foo (1);
5642@end smallexample
5643
5644The warning is not issued after a @code{#line} directive, since this
5645typically indicates autogenerated code, and no assumptions can be made
5646about the layout of the file that the directive references.
5647
5648This warning is enabled by @option{-Wall} in C and C++.
5649
5650@item -Wmissing-attributes
5651@opindex Wmissing-attributes
5652@opindex Wno-missing-attributes
5653Warn when a declaration of a function is missing one or more attributes
5654that a related function is declared with and whose absence may adversely
5655affect the correctness or efficiency of generated code.  For example,
5656the warning is issued for declarations of aliases that use attributes
5657to specify less restrictive requirements than those of their targets.
5658This typically represents a potential optimization opportunity.
5659By contrast, the @option{-Wattribute-alias=2} option controls warnings
5660issued when the alias is more restrictive than the target, which could
5661lead to incorrect code generation.
5662Attributes considered include @code{alloc_align}, @code{alloc_size},
5663@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5664@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5665@code{returns_nonnull}, and @code{returns_twice}.
5666
5667In C++, the warning is issued when an explicit specialization of a primary
5668template declared with attribute @code{alloc_align}, @code{alloc_size},
5669@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5670or @code{nonnull} is declared without it.  Attributes @code{deprecated},
5671@code{error}, and @code{warning} suppress the warning.
5672(@pxref{Function Attributes}).
5673
5674You can use the @code{copy} attribute to apply the same
5675set of attributes to a declaration as that on another declaration without
5676explicitly enumerating the attributes. This attribute can be applied
5677to declarations of functions (@pxref{Common Function Attributes}),
5678variables (@pxref{Common Variable Attributes}), or types
5679(@pxref{Common Type Attributes}).
5680
5681@option{-Wmissing-attributes} is enabled by @option{-Wall}.
5682
5683For example, since the declaration of the primary function template
5684below makes use of both attribute @code{malloc} and @code{alloc_size}
5685the declaration of the explicit specialization of the template is
5686diagnosed because it is missing one of the attributes.
5687
5688@smallexample
5689template <class T>
5690T* __attribute__ ((malloc, alloc_size (1)))
5691allocate (size_t);
5692
5693template <>
5694void* __attribute__ ((malloc))   // missing alloc_size
5695allocate<void> (size_t);
5696@end smallexample
5697
5698@item -Wmissing-braces
5699@opindex Wmissing-braces
5700@opindex Wno-missing-braces
5701Warn if an aggregate or union initializer is not fully bracketed.  In
5702the following example, the initializer for @code{a} is not fully
5703bracketed, but that for @code{b} is fully bracketed.
5704
5705@smallexample
5706int a[2][2] = @{ 0, 1, 2, 3 @};
5707int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5708@end smallexample
5709
5710This warning is enabled by @option{-Wall}.
5711
5712@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5713@opindex Wmissing-include-dirs
5714@opindex Wno-missing-include-dirs
5715Warn if a user-supplied include directory does not exist.
5716
5717@item -Wno-missing-profile
5718@opindex Wmissing-profile
5719@opindex Wno-missing-profile
5720This option controls warnings if feedback profiles are missing when using the
5721@option{-fprofile-use} option.
5722This option diagnoses those cases where a new function or a new file is added
5723between compiling with @option{-fprofile-generate} and with
5724@option{-fprofile-use}, without regenerating the profiles.
5725In these cases, the profile feedback data files do not contain any
5726profile feedback information for
5727the newly added function or file respectively.  Also, in the case when profile
5728count data (.gcda) files are removed, GCC cannot use any profile feedback
5729information.  In all these cases, warnings are issued to inform you that a
5730profile generation step is due.
5731Ignoring the warning can result in poorly optimized code.
5732@option{-Wno-missing-profile} can be used to
5733disable the warning, but this is not recommended and should be done only
5734when non-existent profile data is justified.
5735
5736@item -Wmultistatement-macros
5737@opindex Wmultistatement-macros
5738@opindex Wno-multistatement-macros
5739Warn about unsafe multiple statement macros that appear to be guarded
5740by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5741@code{while}, in which only the first statement is actually guarded after
5742the macro is expanded.
5743
5744For example:
5745
5746@smallexample
5747#define DOIT x++; y++
5748if (c)
5749  DOIT;
5750@end smallexample
5751
5752will increment @code{y} unconditionally, not just when @code{c} holds.
5753The can usually be fixed by wrapping the macro in a do-while loop:
5754@smallexample
5755#define DOIT do @{ x++; y++; @} while (0)
5756if (c)
5757  DOIT;
5758@end smallexample
5759
5760This warning is enabled by @option{-Wall} in C and C++.
5761
5762@item -Wparentheses
5763@opindex Wparentheses
5764@opindex Wno-parentheses
5765Warn if parentheses are omitted in certain contexts, such
5766as when there is an assignment in a context where a truth value
5767is expected, or when operators are nested whose precedence people
5768often get confused about.
5769
5770Also warn if a comparison like @code{x<=y<=z} appears; this is
5771equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5772interpretation from that of ordinary mathematical notation.
5773
5774Also warn for dangerous uses of the GNU extension to
5775@code{?:} with omitted middle operand. When the condition
5776in the @code{?}: operator is a boolean expression, the omitted value is
5777always 1.  Often programmers expect it to be a value computed
5778inside the conditional expression instead.
5779
5780For C++ this also warns for some cases of unnecessary parentheses in
5781declarations, which can indicate an attempt at a function call instead
5782of a declaration:
5783@smallexample
5784@{
5785  // Declares a local variable called mymutex.
5786  std::unique_lock<std::mutex> (mymutex);
5787  // User meant std::unique_lock<std::mutex> lock (mymutex);
5788@}
5789@end smallexample
5790
5791This warning is enabled by @option{-Wall}.
5792
5793@item -Wsequence-point
5794@opindex Wsequence-point
5795@opindex Wno-sequence-point
5796Warn about code that may have undefined semantics because of violations
5797of sequence point rules in the C and C++ standards.
5798
5799The C and C++ standards define the order in which expressions in a C/C++
5800program are evaluated in terms of @dfn{sequence points}, which represent
5801a partial ordering between the execution of parts of the program: those
5802executed before the sequence point, and those executed after it.  These
5803occur after the evaluation of a full expression (one which is not part
5804of a larger expression), after the evaluation of the first operand of a
5805@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5806function is called (but after the evaluation of its arguments and the
5807expression denoting the called function), and in certain other places.
5808Other than as expressed by the sequence point rules, the order of
5809evaluation of subexpressions of an expression is not specified.  All
5810these rules describe only a partial order rather than a total order,
5811since, for example, if two functions are called within one expression
5812with no sequence point between them, the order in which the functions
5813are called is not specified.  However, the standards committee have
5814ruled that function calls do not overlap.
5815
5816It is not specified when between sequence points modifications to the
5817values of objects take effect.  Programs whose behavior depends on this
5818have undefined behavior; the C and C++ standards specify that ``Between
5819the previous and next sequence point an object shall have its stored
5820value modified at most once by the evaluation of an expression.
5821Furthermore, the prior value shall be read only to determine the value
5822to be stored.''.  If a program breaks these rules, the results on any
5823particular implementation are entirely unpredictable.
5824
5825Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5826= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
5827diagnosed by this option, and it may give an occasional false positive
5828result, but in general it has been found fairly effective at detecting
5829this sort of problem in programs.
5830
5831The C++17 standard will define the order of evaluation of operands in
5832more cases: in particular it requires that the right-hand side of an
5833assignment be evaluated before the left-hand side, so the above
5834examples are no longer undefined.  But this option will still warn
5835about them, to help people avoid writing code that is undefined in C
5836and earlier revisions of C++.
5837
5838The standard is worded confusingly, therefore there is some debate
5839over the precise meaning of the sequence point rules in subtle cases.
5840Links to discussions of the problem, including proposed formal
5841definitions, may be found on the GCC readings page, at
5842@uref{http://gcc.gnu.org/@/readings.html}.
5843
5844This warning is enabled by @option{-Wall} for C and C++.
5845
5846@item -Wno-return-local-addr
5847@opindex Wno-return-local-addr
5848@opindex Wreturn-local-addr
5849Do not warn about returning a pointer (or in C++, a reference) to a
5850variable that goes out of scope after the function returns.
5851
5852@item -Wreturn-type
5853@opindex Wreturn-type
5854@opindex Wno-return-type
5855Warn whenever a function is defined with a return type that defaults
5856to @code{int}.  Also warn about any @code{return} statement with no
5857return value in a function whose return type is not @code{void}
5858(falling off the end of the function body is considered returning
5859without a value).
5860
5861For C only, warn about a @code{return} statement with an expression in a
5862function whose return type is @code{void}, unless the expression type is
5863also @code{void}.  As a GNU extension, the latter case is accepted
5864without a warning unless @option{-Wpedantic} is used.  Attempting
5865to use the return value of a non-@code{void} function other than @code{main}
5866that flows off the end by reaching the closing curly brace that terminates
5867the function is undefined.
5868
5869Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5870than @code{main} results in undefined behavior even when the value of
5871the function is not used.
5872
5873This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5874
5875@item -Wno-shift-count-negative
5876@opindex Wshift-count-negative
5877@opindex Wno-shift-count-negative
5878Controls warnings if a shift count is negative.
5879This warning is enabled by default.
5880
5881@item -Wno-shift-count-overflow
5882@opindex Wshift-count-overflow
5883@opindex Wno-shift-count-overflow
5884Controls warnings if a shift count is greater than or equal to the bit width
5885of the type.  This warning is enabled by default.
5886
5887@item -Wshift-negative-value
5888@opindex Wshift-negative-value
5889@opindex Wno-shift-negative-value
5890Warn if left shifting a negative value.  This warning is enabled by
5891@option{-Wextra} in C99 and C++11 modes (and newer).
5892
5893@item -Wno-shift-overflow
5894@itemx -Wshift-overflow=@var{n}
5895@opindex Wshift-overflow
5896@opindex Wno-shift-overflow
5897These options control warnings about left shift overflows.
5898
5899@table @gcctabopt
5900@item -Wshift-overflow=1
5901This is the warning level of @option{-Wshift-overflow} and is enabled
5902by default in C99 and C++11 modes (and newer).  This warning level does
5903not warn about left-shifting 1 into the sign bit.  (However, in C, such
5904an overflow is still rejected in contexts where an integer constant expression
5905is required.)  No warning is emitted in C++2A mode (and newer), as signed left
5906shifts always wrap.
5907
5908@item -Wshift-overflow=2
5909This warning level also warns about left-shifting 1 into the sign bit,
5910unless C++14 mode (or newer) is active.
5911@end table
5912
5913@item -Wswitch
5914@opindex Wswitch
5915@opindex Wno-switch
5916Warn whenever a @code{switch} statement has an index of enumerated type
5917and lacks a @code{case} for one or more of the named codes of that
5918enumeration.  (The presence of a @code{default} label prevents this
5919warning.)  @code{case} labels outside the enumeration range also
5920provoke warnings when this option is used (even if there is a
5921@code{default} label).
5922This warning is enabled by @option{-Wall}.
5923
5924@item -Wswitch-default
5925@opindex Wswitch-default
5926@opindex Wno-switch-default
5927Warn whenever a @code{switch} statement does not have a @code{default}
5928case.
5929
5930@item -Wswitch-enum
5931@opindex Wswitch-enum
5932@opindex Wno-switch-enum
5933Warn whenever a @code{switch} statement has an index of enumerated type
5934and lacks a @code{case} for one or more of the named codes of that
5935enumeration.  @code{case} labels outside the enumeration range also
5936provoke warnings when this option is used.  The only difference
5937between @option{-Wswitch} and this option is that this option gives a
5938warning about an omitted enumeration code even if there is a
5939@code{default} label.
5940
5941@item -Wno-switch-bool
5942@opindex Wswitch-bool
5943@opindex Wno-switch-bool
5944Do not warn when a @code{switch} statement has an index of boolean type
5945and the case values are outside the range of a boolean type.
5946It is possible to suppress this warning by casting the controlling
5947expression to a type other than @code{bool}.  For example:
5948@smallexample
5949@group
5950switch ((int) (a == 4))
5951  @{
5952  @dots{}
5953  @}
5954@end group
5955@end smallexample
5956This warning is enabled by default for C and C++ programs.
5957
5958@item -Wno-switch-outside-range
5959@opindex Wswitch-outside-range
5960@opindex Wno-switch-outside-range
5961This option controls warnings when a @code{switch} case has a value
5962that is outside of its
5963respective type range.  This warning is enabled by default for
5964C and C++ programs.
5965
5966@item -Wno-switch-unreachable
5967@opindex Wswitch-unreachable
5968@opindex Wno-switch-unreachable
5969Do not warn when a @code{switch} statement contains statements between the
5970controlling expression and the first case label, which will never be
5971executed.  For example:
5972@smallexample
5973@group
5974switch (cond)
5975  @{
5976   i = 15;
5977  @dots{}
5978   case 5:
5979  @dots{}
5980  @}
5981@end group
5982@end smallexample
5983@option{-Wswitch-unreachable} does not warn if the statement between the
5984controlling expression and the first case label is just a declaration:
5985@smallexample
5986@group
5987switch (cond)
5988  @{
5989   int i;
5990  @dots{}
5991   case 5:
5992   i = 5;
5993  @dots{}
5994  @}
5995@end group
5996@end smallexample
5997This warning is enabled by default for C and C++ programs.
5998
5999@item -Wsync-nand @r{(C and C++ only)}
6000@opindex Wsync-nand
6001@opindex Wno-sync-nand
6002Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6003built-in functions are used.  These functions changed semantics in GCC 4.4.
6004
6005@item -Wunused-but-set-parameter
6006@opindex Wunused-but-set-parameter
6007@opindex Wno-unused-but-set-parameter
6008Warn whenever a function parameter is assigned to, but otherwise unused
6009(aside from its declaration).
6010
6011To suppress this warning use the @code{unused} attribute
6012(@pxref{Variable Attributes}).
6013
6014This warning is also enabled by @option{-Wunused} together with
6015@option{-Wextra}.
6016
6017@item -Wunused-but-set-variable
6018@opindex Wunused-but-set-variable
6019@opindex Wno-unused-but-set-variable
6020Warn whenever a local variable is assigned to, but otherwise unused
6021(aside from its declaration).
6022This warning is enabled by @option{-Wall}.
6023
6024To suppress this warning use the @code{unused} attribute
6025(@pxref{Variable Attributes}).
6026
6027This warning is also enabled by @option{-Wunused}, which is enabled
6028by @option{-Wall}.
6029
6030@item -Wunused-function
6031@opindex Wunused-function
6032@opindex Wno-unused-function
6033Warn whenever a static function is declared but not defined or a
6034non-inline static function is unused.
6035This warning is enabled by @option{-Wall}.
6036
6037@item -Wunused-label
6038@opindex Wunused-label
6039@opindex Wno-unused-label
6040Warn whenever a label is declared but not used.
6041This warning is enabled by @option{-Wall}.
6042
6043To suppress this warning use the @code{unused} attribute
6044(@pxref{Variable Attributes}).
6045
6046@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6047@opindex Wunused-local-typedefs
6048@opindex Wno-unused-local-typedefs
6049Warn when a typedef locally defined in a function is not used.
6050This warning is enabled by @option{-Wall}.
6051
6052@item -Wunused-parameter
6053@opindex Wunused-parameter
6054@opindex Wno-unused-parameter
6055Warn whenever a function parameter is unused aside from its declaration.
6056
6057To suppress this warning use the @code{unused} attribute
6058(@pxref{Variable Attributes}).
6059
6060@item -Wno-unused-result
6061@opindex Wunused-result
6062@opindex Wno-unused-result
6063Do not warn if a caller of a function marked with attribute
6064@code{warn_unused_result} (@pxref{Function Attributes}) does not use
6065its return value. The default is @option{-Wunused-result}.
6066
6067@item -Wunused-variable
6068@opindex Wunused-variable
6069@opindex Wno-unused-variable
6070Warn whenever a local or static variable is unused aside from its
6071declaration. This option implies @option{-Wunused-const-variable=1} for C,
6072but not for C++. This warning is enabled by @option{-Wall}.
6073
6074To suppress this warning use the @code{unused} attribute
6075(@pxref{Variable Attributes}).
6076
6077@item -Wunused-const-variable
6078@itemx -Wunused-const-variable=@var{n}
6079@opindex Wunused-const-variable
6080@opindex Wno-unused-const-variable
6081Warn whenever a constant static variable is unused aside from its declaration.
6082@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6083for C, but not for C++. In C this declares variable storage, but in C++ this
6084is not an error since const variables take the place of @code{#define}s.
6085
6086To suppress this warning use the @code{unused} attribute
6087(@pxref{Variable Attributes}).
6088
6089@table @gcctabopt
6090@item -Wunused-const-variable=1
6091This is the warning level that is enabled by @option{-Wunused-variable} for
6092C.  It warns only about unused static const variables defined in the main
6093compilation unit, but not about static const variables declared in any
6094header included.
6095
6096@item -Wunused-const-variable=2
6097This warning level also warns for unused constant static variables in
6098headers (excluding system headers).  This is the warning level of
6099@option{-Wunused-const-variable} and must be explicitly requested since
6100in C++ this isn't an error and in C it might be harder to clean up all
6101headers included.
6102@end table
6103
6104@item -Wunused-value
6105@opindex Wunused-value
6106@opindex Wno-unused-value
6107Warn whenever a statement computes a result that is explicitly not
6108used. To suppress this warning cast the unused expression to
6109@code{void}. This includes an expression-statement or the left-hand
6110side of a comma expression that contains no side effects. For example,
6111an expression such as @code{x[i,j]} causes a warning, while
6112@code{x[(void)i,j]} does not.
6113
6114This warning is enabled by @option{-Wall}.
6115
6116@item -Wunused
6117@opindex Wunused
6118@opindex Wno-unused
6119All the above @option{-Wunused} options combined.
6120
6121In order to get a warning about an unused function parameter, you must
6122either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6123@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6124
6125@item -Wuninitialized
6126@opindex Wuninitialized
6127@opindex Wno-uninitialized
6128Warn if an automatic variable is used without first being initialized.
6129In C++, warn if a non-static reference or non-static @code{const}
6130member appears in a class without constructors.
6131
6132If you want to warn about code that uses the uninitialized value of the
6133variable in its own initializer, use the @option{-Winit-self} option.
6134
6135These warnings occur for individual uninitialized elements of
6136structure, union or array variables as well as for variables that are
6137uninitialized as a whole.  They do not occur for variables or elements
6138declared @code{volatile}.  Because these warnings depend on
6139optimization, the exact variables or elements for which there are
6140warnings depend on the precise optimization options and version of GCC
6141used.
6142
6143Note that there may be no warning about a variable that is used only
6144to compute a value that itself is never used, because such
6145computations may be deleted by data flow analysis before the warnings
6146are printed.
6147
6148@item -Wno-invalid-memory-model
6149@opindex Winvalid-memory-model
6150@opindex Wno-invalid-memory-model
6151This option controls warnings
6152for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6153and the C11 atomic generic functions with a memory consistency argument
6154that is either invalid for the operation or outside the range of values
6155of the @code{memory_order} enumeration.  For example, since the
6156@code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6157defined for the relaxed, release, and sequentially consistent memory
6158orders the following code is diagnosed:
6159
6160@smallexample
6161void store (int *i)
6162@{
6163  __atomic_store_n (i, 0, memory_order_consume);
6164@}
6165@end smallexample
6166
6167@option{-Winvalid-memory-model} is enabled by default.
6168
6169@item -Wmaybe-uninitialized
6170@opindex Wmaybe-uninitialized
6171@opindex Wno-maybe-uninitialized
6172For an automatic (i.e.@: local) variable, if there exists a path from the
6173function entry to a use of the variable that is initialized, but there exist
6174some other paths for which the variable is not initialized, the compiler
6175emits a warning if it cannot prove the uninitialized paths are not
6176executed at run time.
6177
6178These warnings are only possible in optimizing compilation, because otherwise
6179GCC does not keep track of the state of variables.
6180
6181These warnings are made optional because GCC may not be able to determine when
6182the code is correct in spite of appearing to have an error.  Here is one
6183example of how this can happen:
6184
6185@smallexample
6186@group
6187@{
6188  int x;
6189  switch (y)
6190    @{
6191    case 1: x = 1;
6192      break;
6193    case 2: x = 4;
6194      break;
6195    case 3: x = 5;
6196    @}
6197  foo (x);
6198@}
6199@end group
6200@end smallexample
6201
6202@noindent
6203If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6204always initialized, but GCC doesn't know this. To suppress the
6205warning, you need to provide a default case with assert(0) or
6206similar code.
6207
6208@cindex @code{longjmp} warnings
6209This option also warns when a non-volatile automatic variable might be
6210changed by a call to @code{longjmp}.
6211The compiler sees only the calls to @code{setjmp}.  It cannot know
6212where @code{longjmp} will be called; in fact, a signal handler could
6213call it at any point in the code.  As a result, you may get a warning
6214even when there is in fact no problem because @code{longjmp} cannot
6215in fact be called at the place that would cause a problem.
6216
6217Some spurious warnings can be avoided if you declare all the functions
6218you use that never return as @code{noreturn}.  @xref{Function
6219Attributes}.
6220
6221This warning is enabled by @option{-Wall} or @option{-Wextra}.
6222
6223@item -Wunknown-pragmas
6224@opindex Wunknown-pragmas
6225@opindex Wno-unknown-pragmas
6226@cindex warning for unknown pragmas
6227@cindex unknown pragmas, warning
6228@cindex pragmas, warning of unknown
6229Warn when a @code{#pragma} directive is encountered that is not understood by
6230GCC@.  If this command-line option is used, warnings are even issued
6231for unknown pragmas in system header files.  This is not the case if
6232the warnings are only enabled by the @option{-Wall} command-line option.
6233
6234@item -Wno-pragmas
6235@opindex Wno-pragmas
6236@opindex Wpragmas
6237Do not warn about misuses of pragmas, such as incorrect parameters,
6238invalid syntax, or conflicts between pragmas.  See also
6239@option{-Wunknown-pragmas}.
6240
6241@item -Wno-prio-ctor-dtor
6242@opindex Wno-prio-ctor-dtor
6243@opindex Wprio-ctor-dtor
6244Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6245The use of constructor and destructor attributes allow you to assign a
6246priority to the constructor/destructor to control its order of execution
6247before @code{main} is called or after it returns.  The priority values must be
6248greater than 100 as the compiler reserves priority values between 0--100 for
6249the implementation.
6250
6251@item -Wstrict-aliasing
6252@opindex Wstrict-aliasing
6253@opindex Wno-strict-aliasing
6254This option is only active when @option{-fstrict-aliasing} is active.
6255It warns about code that might break the strict aliasing rules that the
6256compiler is using for optimization.  The warning does not catch all
6257cases, but does attempt to catch the more common pitfalls.  It is
6258included in @option{-Wall}.
6259It is equivalent to @option{-Wstrict-aliasing=3}
6260
6261@item -Wstrict-aliasing=n
6262@opindex Wstrict-aliasing=n
6263This option is only active when @option{-fstrict-aliasing} is active.
6264It warns about code that might break the strict aliasing rules that the
6265compiler is using for optimization.
6266Higher levels correspond to higher accuracy (fewer false positives).
6267Higher levels also correspond to more effort, similar to the way @option{-O}
6268works.
6269@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6270
6271Level 1: Most aggressive, quick, least accurate.
6272Possibly useful when higher levels
6273do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6274false negatives.  However, it has many false positives.
6275Warns for all pointer conversions between possibly incompatible types,
6276even if never dereferenced.  Runs in the front end only.
6277
6278Level 2: Aggressive, quick, not too precise.
6279May still have many false positives (not as many as level 1 though),
6280and few false negatives (but possibly more than level 1).
6281Unlike level 1, it only warns when an address is taken.  Warns about
6282incomplete types.  Runs in the front end only.
6283
6284Level 3 (default for @option{-Wstrict-aliasing}):
6285Should have very few false positives and few false
6286negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
6287Takes care of the common pun+dereference pattern in the front end:
6288@code{*(int*)&some_float}.
6289If optimization is enabled, it also runs in the back end, where it deals
6290with multiple statement cases using flow-sensitive points-to information.
6291Only warns when the converted pointer is dereferenced.
6292Does not warn about incomplete types.
6293
6294@item -Wstrict-overflow
6295@itemx -Wstrict-overflow=@var{n}
6296@opindex Wstrict-overflow
6297@opindex Wno-strict-overflow
6298This option is only active when signed overflow is undefined.
6299It warns about cases where the compiler optimizes based on the
6300assumption that signed overflow does not occur.  Note that it does not
6301warn about all cases where the code might overflow: it only warns
6302about cases where the compiler implements some optimization.  Thus
6303this warning depends on the optimization level.
6304
6305An optimization that assumes that signed overflow does not occur is
6306perfectly safe if the values of the variables involved are such that
6307overflow never does, in fact, occur.  Therefore this warning can
6308easily give a false positive: a warning about code that is not
6309actually a problem.  To help focus on important issues, several
6310warning levels are defined.  No warnings are issued for the use of
6311undefined signed overflow when estimating how many iterations a loop
6312requires, in particular when determining whether a loop will be
6313executed at all.
6314
6315@table @gcctabopt
6316@item -Wstrict-overflow=1
6317Warn about cases that are both questionable and easy to avoid.  For
6318example the compiler simplifies
6319@code{x + 1 > x} to @code{1}.  This level of
6320@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6321are not, and must be explicitly requested.
6322
6323@item -Wstrict-overflow=2
6324Also warn about other cases where a comparison is simplified to a
6325constant.  For example: @code{abs (x) >= 0}.  This can only be
6326simplified when signed integer overflow is undefined, because
6327@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6328zero.  @option{-Wstrict-overflow} (with no level) is the same as
6329@option{-Wstrict-overflow=2}.
6330
6331@item -Wstrict-overflow=3
6332Also warn about other cases where a comparison is simplified.  For
6333example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6334
6335@item -Wstrict-overflow=4
6336Also warn about other simplifications not covered by the above cases.
6337For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6338
6339@item -Wstrict-overflow=5
6340Also warn about cases where the compiler reduces the magnitude of a
6341constant involved in a comparison.  For example: @code{x + 2 > y} is
6342simplified to @code{x + 1 >= y}.  This is reported only at the
6343highest warning level because this simplification applies to many
6344comparisons, so this warning level gives a very large number of
6345false positives.
6346@end table
6347
6348@item -Wstring-compare
6349@opindex Wstring-compare
6350@opindex Wno-string-compare
6351Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6352determined to be either zero or non-zero in tests for such equality
6353owing to the length of one argument being greater than the size of
6354the array the other argument is stored in (or the bound in the case
6355of @code{strncmp}).  Such calls could be mistakes.  For example,
6356the call to @code{strcmp} below is diagnosed because its result is
6357necessarily non-zero irrespective of the contents of the array @code{a}.
6358
6359@smallexample
6360extern char a[4];
6361void f (char *d)
6362@{
6363  strcpy (d, "string");
6364  @dots{}
6365  if (0 == strcmp (a, d))   // cannot be true
6366    puts ("a and d are the same");
6367@}
6368@end smallexample
6369
6370@option{-Wstring-compare} is enabled by @option{-Wextra}.
6371
6372@item -Wstringop-overflow
6373@itemx -Wstringop-overflow=@var{type}
6374@opindex Wstringop-overflow
6375@opindex Wno-stringop-overflow
6376Warn for calls to string manipulation functions such as @code{memcpy} and
6377@code{strcpy} that are determined to overflow the destination buffer.  The
6378optional argument is one greater than the type of Object Size Checking to
6379perform to determine the size of the destination.  @xref{Object Size Checking}.
6380The argument is meaningful only for functions that operate on character arrays
6381but not for raw memory functions like @code{memcpy} which always make use
6382of Object Size type-0.  The option also warns for calls that specify a size
6383in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6384The option produces the best results with optimization enabled but can detect
6385a small subset of simple buffer overflows even without optimization in
6386calls to the GCC built-in functions like @code{__builtin_memcpy} that
6387correspond to the standard functions.  In any case, the option warns about
6388just a subset of buffer overflows detected by the corresponding overflow
6389checking built-ins.  For example, the option issues a warning for
6390the @code{strcpy} call below because it copies at least 5 characters
6391(the string @code{"blue"} including the terminating NUL) into the buffer
6392of size 4.
6393
6394@smallexample
6395enum Color @{ blue, purple, yellow @};
6396const char* f (enum Color clr)
6397@{
6398  static char buf [4];
6399  const char *str;
6400  switch (clr)
6401    @{
6402      case blue: str = "blue"; break;
6403      case purple: str = "purple"; break;
6404      case yellow: str = "yellow"; break;
6405    @}
6406
6407  return strcpy (buf, str);   // warning here
6408@}
6409@end smallexample
6410
6411Option @option{-Wstringop-overflow=2} is enabled by default.
6412
6413@table @gcctabopt
6414@item -Wstringop-overflow
6415@itemx -Wstringop-overflow=1
6416@opindex Wstringop-overflow
6417@opindex Wno-stringop-overflow
6418The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6419to determine the sizes of destination objects.  This is the default setting
6420of the option.  At this setting the option does not warn for writes past
6421the end of subobjects of larger objects accessed by pointers unless the
6422size of the largest surrounding object is known.  When the destination may
6423be one of several objects it is assumed to be the largest one of them.  On
6424Linux systems, when optimization is enabled at this setting the option warns
6425for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6426a non-zero value.
6427
6428@item -Wstringop-overflow=2
6429The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6430to determine the sizes of destination objects.  At this setting the option
6431warna about overflows when writing to members of the largest complete
6432objects whose exact size is known.  However, it does not warn for excessive
6433writes to the same members of unknown objects referenced by pointers since
6434they may point to arrays containing unknown numbers of elements.
6435
6436@item -Wstringop-overflow=3
6437The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6438to determine the sizes of destination objects.  At this setting the option
6439warns about overflowing the smallest object or data member.  This is the
6440most restrictive setting of the option that may result in warnings for safe
6441code.
6442
6443@item -Wstringop-overflow=4
6444The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6445to determine the sizes of destination objects.  At this setting the option
6446warns about overflowing any data members, and when the destination is
6447one of several objects it uses the size of the largest of them to decide
6448whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
6449setting of the option may result in warnings for benign code.
6450@end table
6451
6452@item -Wno-stringop-truncation
6453@opindex Wstringop-truncation
6454@opindex Wno-stringop-truncation
6455Do not warn for calls to bounded string manipulation functions
6456such as @code{strncat},
6457@code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6458or leave the destination unchanged.
6459
6460In the following example, the call to @code{strncat} specifies a bound that
6461is less than the length of the source string.  As a result, the copy of
6462the source will be truncated and so the call is diagnosed.  To avoid the
6463warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6464
6465@smallexample
6466void append (char *buf, size_t bufsize)
6467@{
6468  strncat (buf, ".txt", 3);
6469@}
6470@end smallexample
6471
6472As another example, the following call to @code{strncpy} results in copying
6473to @code{d} just the characters preceding the terminating NUL, without
6474appending the NUL to the end.  Assuming the result of @code{strncpy} is
6475necessarily a NUL-terminated string is a common mistake, and so the call
6476is diagnosed.  To avoid the warning when the result is not expected to be
6477NUL-terminated, call @code{memcpy} instead.
6478
6479@smallexample
6480void copy (char *d, const char *s)
6481@{
6482  strncpy (d, s, strlen (s));
6483@}
6484@end smallexample
6485
6486In the following example, the call to @code{strncpy} specifies the size
6487of the destination buffer as the bound.  If the length of the source
6488string is equal to or greater than this size the result of the copy will
6489not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
6490the warning, specify @code{sizeof buf - 1} as the bound and set the last
6491element of the buffer to @code{NUL}.
6492
6493@smallexample
6494void copy (const char *s)
6495@{
6496  char buf[80];
6497  strncpy (buf, s, sizeof buf);
6498  @dots{}
6499@}
6500@end smallexample
6501
6502In situations where a character array is intended to store a sequence
6503of bytes with no terminating @code{NUL} such an array may be annotated
6504with attribute @code{nonstring} to avoid this warning.  Such arrays,
6505however, are not suitable arguments to functions that expect
6506@code{NUL}-terminated strings.  To help detect accidental misuses of
6507such arrays GCC issues warnings unless it can prove that the use is
6508safe.  @xref{Common Variable Attributes}.
6509
6510@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6511@opindex Wsuggest-attribute=
6512@opindex Wno-suggest-attribute=
6513Warn for cases where adding an attribute may be beneficial. The
6514attributes currently supported are listed below.
6515
6516@table @gcctabopt
6517@item -Wsuggest-attribute=pure
6518@itemx -Wsuggest-attribute=const
6519@itemx -Wsuggest-attribute=noreturn
6520@itemx -Wmissing-noreturn
6521@itemx -Wsuggest-attribute=malloc
6522@opindex Wsuggest-attribute=pure
6523@opindex Wno-suggest-attribute=pure
6524@opindex Wsuggest-attribute=const
6525@opindex Wno-suggest-attribute=const
6526@opindex Wsuggest-attribute=noreturn
6527@opindex Wno-suggest-attribute=noreturn
6528@opindex Wmissing-noreturn
6529@opindex Wno-missing-noreturn
6530@opindex Wsuggest-attribute=malloc
6531@opindex Wno-suggest-attribute=malloc
6532
6533Warn about functions that might be candidates for attributes
6534@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6535only warns for functions visible in other compilation units or (in the case of
6536@code{pure} and @code{const}) if it cannot prove that the function returns
6537normally. A function returns normally if it doesn't contain an infinite loop or
6538return abnormally by throwing, calling @code{abort} or trapping.  This analysis
6539requires option @option{-fipa-pure-const}, which is enabled by default at
6540@option{-O} and higher.  Higher optimization levels improve the accuracy
6541of the analysis.
6542
6543@item -Wsuggest-attribute=format
6544@itemx -Wmissing-format-attribute
6545@opindex Wsuggest-attribute=format
6546@opindex Wmissing-format-attribute
6547@opindex Wno-suggest-attribute=format
6548@opindex Wno-missing-format-attribute
6549@opindex Wformat
6550@opindex Wno-format
6551
6552Warn about function pointers that might be candidates for @code{format}
6553attributes.  Note these are only possible candidates, not absolute ones.
6554GCC guesses that function pointers with @code{format} attributes that
6555are used in assignment, initialization, parameter passing or return
6556statements should have a corresponding @code{format} attribute in the
6557resulting type.  I.e.@: the left-hand side of the assignment or
6558initialization, the type of the parameter variable, or the return type
6559of the containing function respectively should also have a @code{format}
6560attribute to avoid the warning.
6561
6562GCC also warns about function definitions that might be
6563candidates for @code{format} attributes.  Again, these are only
6564possible candidates.  GCC guesses that @code{format} attributes
6565might be appropriate for any function that calls a function like
6566@code{vprintf} or @code{vscanf}, but this might not always be the
6567case, and some functions for which @code{format} attributes are
6568appropriate may not be detected.
6569
6570@item -Wsuggest-attribute=cold
6571@opindex Wsuggest-attribute=cold
6572@opindex Wno-suggest-attribute=cold
6573
6574Warn about functions that might be candidates for @code{cold} attribute.  This
6575is based on static detection and generally only warns about functions which
6576always leads to a call to another @code{cold} function such as wrappers of
6577C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6578@end table
6579
6580@item -Walloc-zero
6581@opindex Wno-alloc-zero
6582@opindex Walloc-zero
6583Warn about calls to allocation functions decorated with attribute
6584@code{alloc_size} that specify zero bytes, including those to the built-in
6585forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6586@code{malloc}, and @code{realloc}.  Because the behavior of these functions
6587when called with a zero size differs among implementations (and in the case
6588of @code{realloc} has been deprecated) relying on it may result in subtle
6589portability bugs and should be avoided.
6590
6591@item -Walloc-size-larger-than=@var{byte-size}
6592@opindex Walloc-size-larger-than=
6593@opindex Wno-alloc-size-larger-than
6594Warn about calls to functions decorated with attribute @code{alloc_size}
6595that attempt to allocate objects larger than the specified number of bytes,
6596or where the result of the size computation in an integer type with infinite
6597precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6598@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6599Warnings controlled by the option can be disabled either by specifying
6600@var{byte-size} of @samp{SIZE_MAX} or more or by
6601@option{-Wno-alloc-size-larger-than}.
6602@xref{Function Attributes}.
6603
6604@item -Wno-alloc-size-larger-than
6605@opindex Wno-alloc-size-larger-than
6606Disable @option{-Walloc-size-larger-than=} warnings.  The option is
6607equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6608larger.
6609
6610@item -Walloca
6611@opindex Wno-alloca
6612@opindex Walloca
6613This option warns on all uses of @code{alloca} in the source.
6614
6615@item -Walloca-larger-than=@var{byte-size}
6616@opindex Walloca-larger-than=
6617@opindex Wno-alloca-larger-than
6618This option warns on calls to @code{alloca} with an integer argument whose
6619value is either zero, or that is not bounded by a controlling predicate
6620that limits its value to at most @var{byte-size}.  It also warns for calls
6621to @code{alloca} where the bound value is unknown.  Arguments of non-integer
6622types are considered unbounded even if they appear to be constrained to
6623the expected range.
6624
6625For example, a bounded case of @code{alloca} could be:
6626
6627@smallexample
6628void func (size_t n)
6629@{
6630  void *p;
6631  if (n <= 1000)
6632    p = alloca (n);
6633  else
6634    p = malloc (n);
6635  f (p);
6636@}
6637@end smallexample
6638
6639In the above example, passing @code{-Walloca-larger-than=1000} would not
6640issue a warning because the call to @code{alloca} is known to be at most
66411000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
6642the compiler would emit a warning.
6643
6644Unbounded uses, on the other hand, are uses of @code{alloca} with no
6645controlling predicate constraining its integer argument.  For example:
6646
6647@smallexample
6648void func ()
6649@{
6650  void *p = alloca (n);
6651  f (p);
6652@}
6653@end smallexample
6654
6655If @code{-Walloca-larger-than=500} were passed, the above would trigger
6656a warning, but this time because of the lack of bounds checking.
6657
6658Note, that even seemingly correct code involving signed integers could
6659cause a warning:
6660
6661@smallexample
6662void func (signed int n)
6663@{
6664  if (n < 500)
6665    @{
6666      p = alloca (n);
6667      f (p);
6668    @}
6669@}
6670@end smallexample
6671
6672In the above example, @var{n} could be negative, causing a larger than
6673expected argument to be implicitly cast into the @code{alloca} call.
6674
6675This option also warns when @code{alloca} is used in a loop.
6676
6677@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6678but is usually only effective  when @option{-ftree-vrp} is active (default
6679for @option{-O2} and above).
6680
6681See also @option{-Wvla-larger-than=}@samp{byte-size}.
6682
6683@item -Wno-alloca-larger-than
6684@opindex Wno-alloca-larger-than
6685Disable @option{-Walloca-larger-than=} warnings.  The option is
6686equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6687
6688@item -Warith-conversion
6689@opindex Warith-conversion
6690@opindex Wno-arith-conversion
6691Do warn about implicit conversions from arithmetic operations even
6692when conversion of the operands to the same type cannot change their
6693values.  This affects warnings from @option{-Wconversion},
6694@option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
6695
6696@smallexample
6697@group
6698void f (char c, int i)
6699@{
6700  c = c + i; // warns with @option{-Wconversion}
6701  c = c + 1; // only warns with @option{-Warith-conversion}
6702@}
6703@end group
6704@end smallexample
6705
6706@item -Warray-bounds
6707@itemx -Warray-bounds=@var{n}
6708@opindex Wno-array-bounds
6709@opindex Warray-bounds
6710This option is only active when @option{-ftree-vrp} is active
6711(default for @option{-O2} and above). It warns about subscripts to arrays
6712that are always out of bounds. This warning is enabled by @option{-Wall}.
6713
6714@table @gcctabopt
6715@item -Warray-bounds=1
6716This is the warning level of @option{-Warray-bounds} and is enabled
6717by @option{-Wall}; higher levels are not, and must be explicitly requested.
6718
6719@item -Warray-bounds=2
6720This warning level also warns about out of bounds access for
6721arrays at the end of a struct and for arrays accessed through
6722pointers. This warning level may give a larger number of
6723false positives and is deactivated by default.
6724@end table
6725
6726@item -Wattribute-alias=@var{n}
6727@itemx -Wno-attribute-alias
6728@opindex Wattribute-alias
6729@opindex Wno-attribute-alias
6730Warn about declarations using the @code{alias} and similar attributes whose
6731target is incompatible with the type of the alias.
6732@xref{Function Attributes,,Declaring Attributes of Functions}.
6733
6734@table @gcctabopt
6735@item -Wattribute-alias=1
6736The default warning level of the @option{-Wattribute-alias} option diagnoses
6737incompatibilities between the type of the alias declaration and that of its
6738target.  Such incompatibilities are typically indicative of bugs.
6739
6740@item -Wattribute-alias=2
6741
6742At this level @option{-Wattribute-alias} also diagnoses cases where
6743the attributes of the alias declaration are more restrictive than the
6744attributes applied to its target.  These mismatches can potentially
6745result in incorrect code generation.  In other cases they may be
6746benign and could be resolved simply by adding the missing attribute to
6747the target.  For comparison, see the @option{-Wmissing-attributes}
6748option, which controls diagnostics when the alias declaration is less
6749restrictive than the target, rather than more restrictive.
6750
6751Attributes considered include @code{alloc_align}, @code{alloc_size},
6752@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6753@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6754@code{returns_nonnull}, and @code{returns_twice}.
6755@end table
6756
6757@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6758This is the default.  You can disable these warnings with either
6759@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6760
6761@item -Wbool-compare
6762@opindex Wno-bool-compare
6763@opindex Wbool-compare
6764Warn about boolean expression compared with an integer value different from
6765@code{true}/@code{false}.  For instance, the following comparison is
6766always false:
6767@smallexample
6768int n = 5;
6769@dots{}
6770if ((n > 1) == 2) @{ @dots{} @}
6771@end smallexample
6772This warning is enabled by @option{-Wall}.
6773
6774@item -Wbool-operation
6775@opindex Wno-bool-operation
6776@opindex Wbool-operation
6777Warn about suspicious operations on expressions of a boolean type.  For
6778instance, bitwise negation of a boolean is very likely a bug in the program.
6779For C, this warning also warns about incrementing or decrementing a boolean,
6780which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
6781Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6782
6783This warning is enabled by @option{-Wall}.
6784
6785@item -Wduplicated-branches
6786@opindex Wno-duplicated-branches
6787@opindex Wduplicated-branches
6788Warn when an if-else has identical branches.  This warning detects cases like
6789@smallexample
6790if (p != NULL)
6791  return 0;
6792else
6793  return 0;
6794@end smallexample
6795It doesn't warn when both branches contain just a null statement.  This warning
6796also warn for conditional operators:
6797@smallexample
6798  int i = x ? *p : *p;
6799@end smallexample
6800
6801@item -Wduplicated-cond
6802@opindex Wno-duplicated-cond
6803@opindex Wduplicated-cond
6804Warn about duplicated conditions in an if-else-if chain.  For instance,
6805warn for the following code:
6806@smallexample
6807if (p->q != NULL) @{ @dots{} @}
6808else if (p->q != NULL) @{ @dots{} @}
6809@end smallexample
6810
6811@item -Wframe-address
6812@opindex Wno-frame-address
6813@opindex Wframe-address
6814Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6815is called with an argument greater than 0.  Such calls may return indeterminate
6816values or crash the program.  The warning is included in @option{-Wall}.
6817
6818@item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6819@opindex Wno-discarded-qualifiers
6820@opindex Wdiscarded-qualifiers
6821Do not warn if type qualifiers on pointers are being discarded.
6822Typically, the compiler warns if a @code{const char *} variable is
6823passed to a function that takes a @code{char *} parameter.  This option
6824can be used to suppress such a warning.
6825
6826@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6827@opindex Wno-discarded-array-qualifiers
6828@opindex Wdiscarded-array-qualifiers
6829Do not warn if type qualifiers on arrays which are pointer targets
6830are being discarded.  Typically, the compiler warns if a
6831@code{const int (*)[]} variable is passed to a function that
6832takes a @code{int (*)[]} parameter.  This option can be used to
6833suppress such a warning.
6834
6835@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6836@opindex Wno-incompatible-pointer-types
6837@opindex Wincompatible-pointer-types
6838Do not warn when there is a conversion between pointers that have incompatible
6839types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
6840which warns for pointer argument passing or assignment with different
6841signedness.
6842
6843@item -Wno-int-conversion @r{(C and Objective-C only)}
6844@opindex Wno-int-conversion
6845@opindex Wint-conversion
6846Do not warn about incompatible integer to pointer and pointer to integer
6847conversions.  This warning is about implicit conversions; for explicit
6848conversions the warnings @option{-Wno-int-to-pointer-cast} and
6849@option{-Wno-pointer-to-int-cast} may be used.
6850
6851@item -Wzero-length-bounds
6852@opindex Wzero-length-bounds
6853@opindex Wzero-length-bounds
6854Warn about accesses to elements of zero-length array members that might
6855overlap other members of the same object.  Declaring interior zero-length
6856arrays is discouraged because accesses to them are undefined.  See
6857@xref{Zero Length}.
6858
6859For example, the first two stores in function @code{bad} are diagnosed
6860because the array elements overlap the subsequent members @code{b} and
6861@code{c}.  The third store is diagnosed by @option{-Warray-bounds}
6862because it is beyond the bounds of the enclosing object.
6863
6864@smallexample
6865struct X @{ int a[0]; int b, c; @};
6866struct X x;
6867
6868void bad (void)
6869@{
6870  x.a[0] = 0;   // -Wzero-length-bounds
6871  x.a[1] = 1;   // -Wzero-length-bounds
6872  x.a[2] = 2;   // -Warray-bounds
6873@}
6874@end smallexample
6875
6876Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6877
6878@item -Wno-div-by-zero
6879@opindex Wno-div-by-zero
6880@opindex Wdiv-by-zero
6881Do not warn about compile-time integer division by zero.  Floating-point
6882division by zero is not warned about, as it can be a legitimate way of
6883obtaining infinities and NaNs.
6884
6885@item -Wsystem-headers
6886@opindex Wsystem-headers
6887@opindex Wno-system-headers
6888@cindex warnings from system headers
6889@cindex system headers, warnings from
6890Print warning messages for constructs found in system header files.
6891Warnings from system headers are normally suppressed, on the assumption
6892that they usually do not indicate real problems and would only make the
6893compiler output harder to read.  Using this command-line option tells
6894GCC to emit warnings from system headers as if they occurred in user
6895code.  However, note that using @option{-Wall} in conjunction with this
6896option does @emph{not} warn about unknown pragmas in system
6897headers---for that, @option{-Wunknown-pragmas} must also be used.
6898
6899@item -Wtautological-compare
6900@opindex Wtautological-compare
6901@opindex Wno-tautological-compare
6902Warn if a self-comparison always evaluates to true or false.  This
6903warning detects various mistakes such as:
6904@smallexample
6905int i = 1;
6906@dots{}
6907if (i > i) @{ @dots{} @}
6908@end smallexample
6909
6910This warning also warns about bitwise comparisons that always evaluate
6911to true or false, for instance:
6912@smallexample
6913if ((a & 16) == 10) @{ @dots{} @}
6914@end smallexample
6915will always be false.
6916
6917This warning is enabled by @option{-Wall}.
6918
6919@item -Wtrampolines
6920@opindex Wtrampolines
6921@opindex Wno-trampolines
6922Warn about trampolines generated for pointers to nested functions.
6923A trampoline is a small piece of data or code that is created at run
6924time on the stack when the address of a nested function is taken, and is
6925used to call the nested function indirectly.  For some targets, it is
6926made up of data only and thus requires no special treatment.  But, for
6927most targets, it is made up of code and thus requires the stack to be
6928made executable in order for the program to work properly.
6929
6930@item -Wfloat-equal
6931@opindex Wfloat-equal
6932@opindex Wno-float-equal
6933Warn if floating-point values are used in equality comparisons.
6934
6935The idea behind this is that sometimes it is convenient (for the
6936programmer) to consider floating-point values as approximations to
6937infinitely precise real numbers.  If you are doing this, then you need
6938to compute (by analyzing the code, or in some other way) the maximum or
6939likely maximum error that the computation introduces, and allow for it
6940when performing comparisons (and when producing output, but that's a
6941different problem).  In particular, instead of testing for equality, you
6942should check to see whether the two values have ranges that overlap; and
6943this is done with the relational operators, so equality comparisons are
6944probably mistaken.
6945
6946@item -Wtraditional @r{(C and Objective-C only)}
6947@opindex Wtraditional
6948@opindex Wno-traditional
6949Warn about certain constructs that behave differently in traditional and
6950ISO C@.  Also warn about ISO C constructs that have no traditional C
6951equivalent, and/or problematic constructs that should be avoided.
6952
6953@itemize @bullet
6954@item
6955Macro parameters that appear within string literals in the macro body.
6956In traditional C macro replacement takes place within string literals,
6957but in ISO C it does not.
6958
6959@item
6960In traditional C, some preprocessor directives did not exist.
6961Traditional preprocessors only considered a line to be a directive
6962if the @samp{#} appeared in column 1 on the line.  Therefore
6963@option{-Wtraditional} warns about directives that traditional C
6964understands but ignores because the @samp{#} does not appear as the
6965first character on the line.  It also suggests you hide directives like
6966@code{#pragma} not understood by traditional C by indenting them.  Some
6967traditional implementations do not recognize @code{#elif}, so this option
6968suggests avoiding it altogether.
6969
6970@item
6971A function-like macro that appears without arguments.
6972
6973@item
6974The unary plus operator.
6975
6976@item
6977The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6978constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
6979constants.)  Note, these suffixes appear in macros defined in the system
6980headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6981Use of these macros in user code might normally lead to spurious
6982warnings, however GCC's integrated preprocessor has enough context to
6983avoid warning in these cases.
6984
6985@item
6986A function declared external in one block and then used after the end of
6987the block.
6988
6989@item
6990A @code{switch} statement has an operand of type @code{long}.
6991
6992@item
6993A non-@code{static} function declaration follows a @code{static} one.
6994This construct is not accepted by some traditional C compilers.
6995
6996@item
6997The ISO type of an integer constant has a different width or
6998signedness from its traditional type.  This warning is only issued if
6999the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
7000typically represent bit patterns, are not warned about.
7001
7002@item
7003Usage of ISO string concatenation is detected.
7004
7005@item
7006Initialization of automatic aggregates.
7007
7008@item
7009Identifier conflicts with labels.  Traditional C lacks a separate
7010namespace for labels.
7011
7012@item
7013Initialization of unions.  If the initializer is zero, the warning is
7014omitted.  This is done under the assumption that the zero initializer in
7015user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7016initializer warnings and relies on default initialization to zero in the
7017traditional C case.
7018
7019@item
7020Conversions by prototypes between fixed/floating-point values and vice
7021versa.  The absence of these prototypes when compiling with traditional
7022C causes serious problems.  This is a subset of the possible
7023conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7024
7025@item
7026Use of ISO C style function definitions.  This warning intentionally is
7027@emph{not} issued for prototype declarations or variadic functions
7028because these ISO C features appear in your code when using
7029libiberty's traditional C compatibility macros, @code{PARAMS} and
7030@code{VPARAMS}.  This warning is also bypassed for nested functions
7031because that feature is already a GCC extension and thus not relevant to
7032traditional C compatibility.
7033@end itemize
7034
7035@item -Wtraditional-conversion @r{(C and Objective-C only)}
7036@opindex Wtraditional-conversion
7037@opindex Wno-traditional-conversion
7038Warn if a prototype causes a type conversion that is different from what
7039would happen to the same argument in the absence of a prototype.  This
7040includes conversions of fixed point to floating and vice versa, and
7041conversions changing the width or signedness of a fixed-point argument
7042except when the same as the default promotion.
7043
7044@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7045@opindex Wdeclaration-after-statement
7046@opindex Wno-declaration-after-statement
7047Warn when a declaration is found after a statement in a block.  This
7048construct, known from C++, was introduced with ISO C99 and is by default
7049allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Declarations}.
7050
7051@item -Wshadow
7052@opindex Wshadow
7053@opindex Wno-shadow
7054Warn whenever a local variable or type declaration shadows another
7055variable, parameter, type, class member (in C++), or instance variable
7056(in Objective-C) or whenever a built-in function is shadowed.  Note
7057that in C++, the compiler warns if a local variable shadows an
7058explicit typedef, but not if it shadows a struct/class/enum.
7059If this warning is enabled, it includes also all instances of
7060local shadowing.  This means that @option{-Wno-shadow=local}
7061and @option{-Wno-shadow=compatible-local} are ignored when
7062@option{-Wshadow} is used.
7063Same as @option{-Wshadow=global}.
7064
7065@item -Wno-shadow-ivar @r{(Objective-C only)}
7066@opindex Wno-shadow-ivar
7067@opindex Wshadow-ivar
7068Do not warn whenever a local variable shadows an instance variable in an
7069Objective-C method.
7070
7071@item -Wshadow=global
7072@opindex Wshadow=global
7073Warn for any shadowing.
7074Same as @option{-Wshadow}.
7075
7076@item -Wshadow=local
7077@opindex Wshadow=local
7078Warn when a local variable shadows another local variable or parameter.
7079
7080@item -Wshadow=compatible-local
7081@opindex Wshadow=compatible-local
7082Warn when a local variable shadows another local variable or parameter
7083whose type is compatible with that of the shadowing variable.  In C++,
7084type compatibility here means the type of the shadowing variable can be
7085converted to that of the shadowed variable.  The creation of this flag
7086(in addition to @option{-Wshadow=local}) is based on the idea that when
7087a local variable shadows another one of incompatible type, it is most
7088likely intentional, not a bug or typo, as shown in the following example:
7089
7090@smallexample
7091@group
7092for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7093@{
7094  for (int i = 0; i < N; ++i)
7095  @{
7096    ...
7097  @}
7098  ...
7099@}
7100@end group
7101@end smallexample
7102
7103Since the two variable @code{i} in the example above have incompatible types,
7104enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7105Because their types are incompatible, if a programmer accidentally uses one
7106in place of the other, type checking is expected to catch that and emit an
7107error or warning.  Use of this flag instead of @option{-Wshadow=local} can
7108possibly reduce the number of warnings triggered by intentional shadowing.
7109Note that this also means that shadowing @code{const char *i} by
7110@code{char *i} does not emit a warning.
7111
7112This warning is also enabled by @option{-Wshadow=local}.
7113
7114@item -Wlarger-than=@var{byte-size}
7115@opindex Wlarger-than=
7116@opindex Wlarger-than-@var{byte-size}
7117Warn whenever an object is defined whose size exceeds @var{byte-size}.
7118@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7119Warnings controlled by the option can be disabled either by specifying
7120@var{byte-size} of @samp{SIZE_MAX} or more or by
7121@option{-Wno-larger-than}.
7122
7123@item -Wno-larger-than
7124@opindex Wno-larger-than
7125Disable @option{-Wlarger-than=} warnings.  The option is equivalent
7126to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7127
7128@item -Wframe-larger-than=@var{byte-size}
7129@opindex Wframe-larger-than=
7130@opindex Wno-frame-larger-than
7131Warn if the size of a function frame exceeds @var{byte-size}.
7132The computation done to determine the stack frame size is approximate
7133and not conservative.
7134The actual requirements may be somewhat greater than @var{byte-size}
7135even if you do not get a warning.  In addition, any space allocated
7136via @code{alloca}, variable-length arrays, or related constructs
7137is not included by the compiler when determining
7138whether or not to issue a warning.
7139@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7140Warnings controlled by the option can be disabled either by specifying
7141@var{byte-size} of @samp{SIZE_MAX} or more or by
7142@option{-Wno-frame-larger-than}.
7143
7144@item -Wno-frame-larger-than
7145@opindex Wno-frame-larger-than
7146Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
7147to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7148
7149@item -Wno-free-nonheap-object
7150@opindex Wno-free-nonheap-object
7151@opindex Wfree-nonheap-object
7152Do not warn when attempting to free an object that was not allocated
7153on the heap.
7154
7155@item -Wstack-usage=@var{byte-size}
7156@opindex Wstack-usage
7157@opindex Wno-stack-usage
7158Warn if the stack usage of a function might exceed @var{byte-size}.
7159The computation done to determine the stack usage is conservative.
7160Any space allocated via @code{alloca}, variable-length arrays, or related
7161constructs is included by the compiler when determining whether or not to
7162issue a warning.
7163
7164The message is in keeping with the output of @option{-fstack-usage}.
7165
7166@itemize
7167@item
7168If the stack usage is fully static but exceeds the specified amount, it's:
7169
7170@smallexample
7171  warning: stack usage is 1120 bytes
7172@end smallexample
7173@item
7174If the stack usage is (partly) dynamic but bounded, it's:
7175
7176@smallexample
7177  warning: stack usage might be 1648 bytes
7178@end smallexample
7179@item
7180If the stack usage is (partly) dynamic and not bounded, it's:
7181
7182@smallexample
7183  warning: stack usage might be unbounded
7184@end smallexample
7185@end itemize
7186
7187@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7188Warnings controlled by the option can be disabled either by specifying
7189@var{byte-size} of @samp{SIZE_MAX} or more or by
7190@option{-Wno-stack-usage}.
7191
7192@item -Wno-stack-usage
7193@opindex Wno-stack-usage
7194Disable @option{-Wstack-usage=} warnings.  The option is equivalent
7195to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7196
7197@item -Wunsafe-loop-optimizations
7198@opindex Wunsafe-loop-optimizations
7199@opindex Wno-unsafe-loop-optimizations
7200Warn if the loop cannot be optimized because the compiler cannot
7201assume anything on the bounds of the loop indices.  With
7202@option{-funsafe-loop-optimizations} warn if the compiler makes
7203such assumptions.
7204
7205@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7206@opindex Wno-pedantic-ms-format
7207@opindex Wpedantic-ms-format
7208When used in combination with @option{-Wformat}
7209and @option{-pedantic} without GNU extensions, this option
7210disables the warnings about non-ISO @code{printf} / @code{scanf} format
7211width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7212which depend on the MS runtime.
7213
7214@item -Wpointer-arith
7215@opindex Wpointer-arith
7216@opindex Wno-pointer-arith
7217Warn about anything that depends on the ``size of'' a function type or
7218of @code{void}.  GNU C assigns these types a size of 1, for
7219convenience in calculations with @code{void *} pointers and pointers
7220to functions.  In C++, warn also when an arithmetic operation involves
7221@code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
7222
7223@item -Wno-pointer-compare
7224@opindex Wpointer-compare
7225@opindex Wno-pointer-compare
7226Do not warn if a pointer is compared with a zero character constant.
7227This usually
7228means that the pointer was meant to be dereferenced.  For example:
7229
7230@smallexample
7231const char *p = foo ();
7232if (p == '\0')
7233  return 42;
7234@end smallexample
7235
7236Note that the code above is invalid in C++11.
7237
7238This warning is enabled by default.
7239
7240@item -Wtype-limits
7241@opindex Wtype-limits
7242@opindex Wno-type-limits
7243Warn if a comparison is always true or always false due to the limited
7244range of the data type, but do not warn for constant expressions.  For
7245example, warn if an unsigned variable is compared against zero with
7246@code{<} or @code{>=}.  This warning is also enabled by
7247@option{-Wextra}.
7248
7249@item -Wabsolute-value @r{(C and Objective-C only)}
7250@opindex Wabsolute-value
7251@opindex Wno-absolute-value
7252Warn for calls to standard functions that compute the absolute value
7253of an argument when a more appropriate standard function is available.
7254For example, calling @code{abs(3.14)} triggers the warning because the
7255appropriate function to call to compute the absolute value of a double
7256argument is @code{fabs}.  The option also triggers warnings when the
7257argument in a call to such a function has an unsigned type.  This
7258warning can be suppressed with an explicit type cast and it is also
7259enabled by @option{-Wextra}.
7260
7261@include cppwarnopts.texi
7262
7263@item -Wbad-function-cast @r{(C and Objective-C only)}
7264@opindex Wbad-function-cast
7265@opindex Wno-bad-function-cast
7266Warn when a function call is cast to a non-matching type.
7267For example, warn if a call to a function returning an integer type
7268is cast to a pointer type.
7269
7270@item -Wc90-c99-compat @r{(C and Objective-C only)}
7271@opindex Wc90-c99-compat
7272@opindex Wno-c90-c99-compat
7273Warn about features not present in ISO C90, but present in ISO C99.
7274For instance, warn about use of variable length arrays, @code{long long}
7275type, @code{bool} type, compound literals, designated initializers, and so
7276on.  This option is independent of the standards mode.  Warnings are disabled
7277in the expression that follows @code{__extension__}.
7278
7279@item -Wc99-c11-compat @r{(C and Objective-C only)}
7280@opindex Wc99-c11-compat
7281@opindex Wno-c99-c11-compat
7282Warn about features not present in ISO C99, but present in ISO C11.
7283For instance, warn about use of anonymous structures and unions,
7284@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7285@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7286and so on.  This option is independent of the standards mode.  Warnings are
7287disabled in the expression that follows @code{__extension__}.
7288
7289@item -Wc11-c2x-compat @r{(C and Objective-C only)}
7290@opindex Wc11-c2x-compat
7291@opindex Wno-c11-c2x-compat
7292Warn about features not present in ISO C11, but present in ISO C2X.
7293For instance, warn about omitting the string in @code{_Static_assert},
7294use of @samp{[[]]} syntax for attributes, use of decimal
7295floating-point types, and so on.  This option is independent of the
7296standards mode.  Warnings are disabled in the expression that follows
7297@code{__extension__}.
7298
7299@item -Wc++-compat @r{(C and Objective-C only)}
7300@opindex Wc++-compat
7301@opindex Wno-c++-compat
7302Warn about ISO C constructs that are outside of the common subset of
7303ISO C and ISO C++, e.g.@: request for implicit conversion from
7304@code{void *} to a pointer to non-@code{void} type.
7305
7306@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7307@opindex Wc++11-compat
7308@opindex Wno-c++11-compat
7309Warn about C++ constructs whose meaning differs between ISO C++ 1998
7310and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7311in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
7312enabled by @option{-Wall}.
7313
7314@item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7315@opindex Wc++14-compat
7316@opindex Wno-c++14-compat
7317Warn about C++ constructs whose meaning differs between ISO C++ 2011
7318and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
7319
7320@item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7321@opindex Wc++17-compat
7322@opindex Wno-c++17-compat
7323Warn about C++ constructs whose meaning differs between ISO C++ 2014
7324and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
7325
7326@item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7327@opindex Wc++20-compat
7328@opindex Wno-c++20-compat
7329Warn about C++ constructs whose meaning differs between ISO C++ 2017
7330and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
7331
7332@item -Wcast-qual
7333@opindex Wcast-qual
7334@opindex Wno-cast-qual
7335Warn whenever a pointer is cast so as to remove a type qualifier from
7336the target type.  For example, warn if a @code{const char *} is cast
7337to an ordinary @code{char *}.
7338
7339Also warn when making a cast that introduces a type qualifier in an
7340unsafe way.  For example, casting @code{char **} to @code{const char **}
7341is unsafe, as in this example:
7342
7343@smallexample
7344  /* p is char ** value.  */
7345  const char **q = (const char **) p;
7346  /* Assignment of readonly string to const char * is OK.  */
7347  *q = "string";
7348  /* Now char** pointer points to read-only memory.  */
7349  **p = 'b';
7350@end smallexample
7351
7352@item -Wcast-align
7353@opindex Wcast-align
7354@opindex Wno-cast-align
7355Warn whenever a pointer is cast such that the required alignment of the
7356target is increased.  For example, warn if a @code{char *} is cast to
7357an @code{int *} on machines where integers can only be accessed at
7358two- or four-byte boundaries.
7359
7360@item -Wcast-align=strict
7361@opindex Wcast-align=strict
7362Warn whenever a pointer is cast such that the required alignment of the
7363target is increased.  For example, warn if a @code{char *} is cast to
7364an @code{int *} regardless of the target machine.
7365
7366@item -Wcast-function-type
7367@opindex Wcast-function-type
7368@opindex Wno-cast-function-type
7369Warn when a function pointer is cast to an incompatible function pointer.
7370In a cast involving function types with a variable argument list only
7371the types of initial arguments that are provided are considered.
7372Any parameter of pointer-type matches any other pointer-type.  Any benign
7373differences in integral types are ignored, like @code{int} vs.@: @code{long}
7374on ILP32 targets.  Likewise type qualifiers are ignored.  The function
7375type @code{void (*) (void)} is special and matches everything, which can
7376be used to suppress this warning.
7377In a cast involving pointer to member types this warning warns whenever
7378the type cast is changing the pointer to member type.
7379This warning is enabled by @option{-Wextra}.
7380
7381@item -Wwrite-strings
7382@opindex Wwrite-strings
7383@opindex Wno-write-strings
7384When compiling C, give string constants the type @code{const
7385char[@var{length}]} so that copying the address of one into a
7386non-@code{const} @code{char *} pointer produces a warning.  These
7387warnings help you find at compile time code that can try to write
7388into a string constant, but only if you have been very careful about
7389using @code{const} in declarations and prototypes.  Otherwise, it is
7390just a nuisance. This is why we did not make @option{-Wall} request
7391these warnings.
7392
7393When compiling C++, warn about the deprecated conversion from string
7394literals to @code{char *}.  This warning is enabled by default for C++
7395programs.
7396
7397@item -Wclobbered
7398@opindex Wclobbered
7399@opindex Wno-clobbered
7400Warn for variables that might be changed by @code{longjmp} or
7401@code{vfork}.  This warning is also enabled by @option{-Wextra}.
7402
7403@item -Wconversion
7404@opindex Wconversion
7405@opindex Wno-conversion
7406Warn for implicit conversions that may alter a value. This includes
7407conversions between real and integer, like @code{abs (x)} when
7408@code{x} is @code{double}; conversions between signed and unsigned,
7409like @code{unsigned ui = -1}; and conversions to smaller types, like
7410@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7411((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7412changed by the conversion like in @code{abs (2.0)}.  Warnings about
7413conversions between signed and unsigned integers can be disabled by
7414using @option{-Wno-sign-conversion}.
7415
7416For C++, also warn for confusing overload resolution for user-defined
7417conversions; and conversions that never use a type conversion
7418operator: conversions to @code{void}, the same type, a base class or a
7419reference to them. Warnings about conversions between signed and
7420unsigned integers are disabled by default in C++ unless
7421@option{-Wsign-conversion} is explicitly enabled.
7422
7423Warnings about conversion from arithmetic on a small type back to that
7424type are only given with @option{-Warith-conversion}.
7425
7426@item -Wdangling-else
7427@opindex Wdangling-else
7428@opindex Wno-dangling-else
7429Warn about constructions where there may be confusion to which
7430@code{if} statement an @code{else} branch belongs.  Here is an example of
7431such a case:
7432
7433@smallexample
7434@group
7435@{
7436  if (a)
7437    if (b)
7438      foo ();
7439  else
7440    bar ();
7441@}
7442@end group
7443@end smallexample
7444
7445In C/C++, every @code{else} branch belongs to the innermost possible
7446@code{if} statement, which in this example is @code{if (b)}.  This is
7447often not what the programmer expected, as illustrated in the above
7448example by indentation the programmer chose.  When there is the
7449potential for this confusion, GCC issues a warning when this flag
7450is specified.  To eliminate the warning, add explicit braces around
7451the innermost @code{if} statement so there is no way the @code{else}
7452can belong to the enclosing @code{if}.  The resulting code
7453looks like this:
7454
7455@smallexample
7456@group
7457@{
7458  if (a)
7459    @{
7460      if (b)
7461        foo ();
7462      else
7463        bar ();
7464    @}
7465@}
7466@end group
7467@end smallexample
7468
7469This warning is enabled by @option{-Wparentheses}.
7470
7471@item -Wdate-time
7472@opindex Wdate-time
7473@opindex Wno-date-time
7474Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7475are encountered as they might prevent bit-wise-identical reproducible
7476compilations.
7477
7478@item -Wempty-body
7479@opindex Wempty-body
7480@opindex Wno-empty-body
7481Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7482while} statement.  This warning is also enabled by @option{-Wextra}.
7483
7484@item -Wno-endif-labels
7485@opindex Wendif-labels
7486@opindex Wno-endif-labels
7487Do not warn about stray tokens after @code{#else} and @code{#endif}.
7488
7489@item -Wenum-compare
7490@opindex Wenum-compare
7491@opindex Wno-enum-compare
7492Warn about a comparison between values of different enumerated types.
7493In C++ enumerated type mismatches in conditional expressions are also
7494diagnosed and the warning is enabled by default.  In C this warning is
7495enabled by @option{-Wall}.
7496
7497@item -Wenum-conversion @r{(C, Objective-C only)}
7498@opindex Wenum-conversion
7499@opindex Wno-enum-conversion
7500Warn when a value of enumerated type is implicitly converted to a
7501different enumerated type.  This warning is enabled by @option{-Wextra}.
7502
7503@item -Wjump-misses-init @r{(C, Objective-C only)}
7504@opindex Wjump-misses-init
7505@opindex Wno-jump-misses-init
7506Warn if a @code{goto} statement or a @code{switch} statement jumps
7507forward across the initialization of a variable, or jumps backward to a
7508label after the variable has been initialized.  This only warns about
7509variables that are initialized when they are declared.  This warning is
7510only supported for C and Objective-C; in C++ this sort of branch is an
7511error in any case.
7512
7513@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
7514can be disabled with the @option{-Wno-jump-misses-init} option.
7515
7516@item -Wsign-compare
7517@opindex Wsign-compare
7518@opindex Wno-sign-compare
7519@cindex warning for comparison of signed and unsigned values
7520@cindex comparison of signed and unsigned values, warning
7521@cindex signed and unsigned values, comparison warning
7522Warn when a comparison between signed and unsigned values could produce
7523an incorrect result when the signed value is converted to unsigned.
7524In C++, this warning is also enabled by @option{-Wall}.  In C, it is
7525also enabled by @option{-Wextra}.
7526
7527@item -Wsign-conversion
7528@opindex Wsign-conversion
7529@opindex Wno-sign-conversion
7530Warn for implicit conversions that may change the sign of an integer
7531value, like assigning a signed integer expression to an unsigned
7532integer variable. An explicit cast silences the warning. In C, this
7533option is enabled also by @option{-Wconversion}.
7534
7535@item -Wfloat-conversion
7536@opindex Wfloat-conversion
7537@opindex Wno-float-conversion
7538Warn for implicit conversions that reduce the precision of a real value.
7539This includes conversions from real to integer, and from higher precision
7540real to lower precision real values.  This option is also enabled by
7541@option{-Wconversion}.
7542
7543@item -Wno-scalar-storage-order
7544@opindex Wno-scalar-storage-order
7545@opindex Wscalar-storage-order
7546Do not warn on suspicious constructs involving reverse scalar storage order.
7547
7548@item -Wsizeof-pointer-div
7549@opindex Wsizeof-pointer-div
7550@opindex Wno-sizeof-pointer-div
7551Warn for suspicious divisions of two sizeof expressions that divide
7552the pointer size by the element size, which is the usual way to compute
7553the array size but won't work out correctly with pointers.  This warning
7554warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7555not an array, but a pointer.  This warning is enabled by @option{-Wall}.
7556
7557@item -Wsizeof-pointer-memaccess
7558@opindex Wsizeof-pointer-memaccess
7559@opindex Wno-sizeof-pointer-memaccess
7560Warn for suspicious length parameters to certain string and memory built-in
7561functions if the argument uses @code{sizeof}.  This warning triggers for
7562example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7563an array, but a pointer, and suggests a possible fix, or about
7564@code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
7565also warns about calls to bounded string copy functions like @code{strncat}
7566or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7567the source array.  For example, in the following function the call to
7568@code{strncat} specifies the size of the source string as the bound.  That
7569is almost certainly a mistake and so the call is diagnosed.
7570@smallexample
7571void make_file (const char *name)
7572@{
7573  char path[PATH_MAX];
7574  strncpy (path, name, sizeof path - 1);
7575  strncat (path, ".text", sizeof ".text");
7576  @dots{}
7577@}
7578@end smallexample
7579
7580The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7581
7582@item -Wno-sizeof-array-argument
7583@opindex Wsizeof-array-argument
7584@opindex Wno-sizeof-array-argument
7585Do not warn when the @code{sizeof} operator is applied to a parameter that is
7586declared as an array in a function definition.  This warning is enabled by
7587default for C and C++ programs.
7588
7589@item -Wmemset-elt-size
7590@opindex Wmemset-elt-size
7591@opindex Wno-memset-elt-size
7592Warn for suspicious calls to the @code{memset} built-in function, if the
7593first argument references an array, and the third argument is a number
7594equal to the number of elements, but not equal to the size of the array
7595in memory.  This indicates that the user has omitted a multiplication by
7596the element size.  This warning is enabled by @option{-Wall}.
7597
7598@item -Wmemset-transposed-args
7599@opindex Wmemset-transposed-args
7600@opindex Wno-memset-transposed-args
7601Warn for suspicious calls to the @code{memset} built-in function where
7602the second argument is not zero and the third argument is zero.  For
7603example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7604@code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
7605is only emitted if the third argument is a literal zero.  Otherwise, if
7606it is an expression that is folded to zero, or a cast of zero to some
7607type, it is far less likely that the arguments have been mistakenly
7608transposed and no warning is emitted.  This warning is enabled
7609by @option{-Wall}.
7610
7611@item -Waddress
7612@opindex Waddress
7613@opindex Wno-address
7614Warn about suspicious uses of memory addresses. These include using
7615the address of a function in a conditional expression, such as
7616@code{void func(void); if (func)}, and comparisons against the memory
7617address of a string literal, such as @code{if (x == "abc")}.  Such
7618uses typically indicate a programmer error: the address of a function
7619always evaluates to true, so their use in a conditional usually
7620indicate that the programmer forgot the parentheses in a function
7621call; and comparisons against string literals result in unspecified
7622behavior and are not portable in C, so they usually indicate that the
7623programmer intended to use @code{strcmp}.  This warning is enabled by
7624@option{-Wall}.
7625
7626@item -Wno-address-of-packed-member
7627@opindex Waddress-of-packed-member
7628@opindex Wno-address-of-packed-member
7629Do not warn when the address of packed member of struct or union is taken,
7630which usually results in an unaligned pointer value.  This is
7631enabled by default.
7632
7633@item -Wlogical-op
7634@opindex Wlogical-op
7635@opindex Wno-logical-op
7636Warn about suspicious uses of logical operators in expressions.
7637This includes using logical operators in contexts where a
7638bit-wise operator is likely to be expected.  Also warns when
7639the operands of a logical operator are the same:
7640@smallexample
7641extern int a;
7642if (a < 0 && a < 0) @{ @dots{} @}
7643@end smallexample
7644
7645@item -Wlogical-not-parentheses
7646@opindex Wlogical-not-parentheses
7647@opindex Wno-logical-not-parentheses
7648Warn about logical not used on the left hand side operand of a comparison.
7649This option does not warn if the right operand is considered to be a boolean
7650expression.  Its purpose is to detect suspicious code like the following:
7651@smallexample
7652int a;
7653@dots{}
7654if (!a > 1) @{ @dots{} @}
7655@end smallexample
7656
7657It is possible to suppress the warning by wrapping the LHS into
7658parentheses:
7659@smallexample
7660if ((!a) > 1) @{ @dots{} @}
7661@end smallexample
7662
7663This warning is enabled by @option{-Wall}.
7664
7665@item -Waggregate-return
7666@opindex Waggregate-return
7667@opindex Wno-aggregate-return
7668Warn if any functions that return structures or unions are defined or
7669called.  (In languages where you can return an array, this also elicits
7670a warning.)
7671
7672@item -Wno-aggressive-loop-optimizations
7673@opindex Wno-aggressive-loop-optimizations
7674@opindex Waggressive-loop-optimizations
7675Warn if in a loop with constant number of iterations the compiler detects
7676undefined behavior in some statement during one or more of the iterations.
7677
7678@item -Wno-attributes
7679@opindex Wno-attributes
7680@opindex Wattributes
7681Do not warn if an unexpected @code{__attribute__} is used, such as
7682unrecognized attributes, function attributes applied to variables,
7683etc.  This does not stop errors for incorrect use of supported
7684attributes.
7685
7686@item -Wno-builtin-declaration-mismatch
7687@opindex Wno-builtin-declaration-mismatch
7688@opindex Wbuiltin-declaration-mismatch
7689Warn if a built-in function is declared with an incompatible signature
7690or as a non-function, or when a built-in function declared with a type
7691that does not include a prototype is called with arguments whose promoted
7692types do not match those expected by the function.  When @option{-Wextra}
7693is specified, also warn when a built-in function that takes arguments is
7694declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
7695warning is enabled by default.  To avoid the warning include the appropriate
7696header to bring the prototypes of built-in functions into scope.
7697
7698For example, the call to @code{memset} below is diagnosed by the warning
7699because the function expects a value of type @code{size_t} as its argument
7700but the type of @code{32} is @code{int}.  With @option{-Wextra},
7701the declaration of the function is diagnosed as well.
7702@smallexample
7703extern void* memset ();
7704void f (void *d)
7705@{
7706  memset (d, '\0', 32);
7707@}
7708@end smallexample
7709
7710@item -Wno-builtin-macro-redefined
7711@opindex Wno-builtin-macro-redefined
7712@opindex Wbuiltin-macro-redefined
7713Do not warn if certain built-in macros are redefined.  This suppresses
7714warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7715@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7716
7717@item -Wstrict-prototypes @r{(C and Objective-C only)}
7718@opindex Wstrict-prototypes
7719@opindex Wno-strict-prototypes
7720Warn if a function is declared or defined without specifying the
7721argument types.  (An old-style function definition is permitted without
7722a warning if preceded by a declaration that specifies the argument
7723types.)
7724
7725@item -Wold-style-declaration @r{(C and Objective-C only)}
7726@opindex Wold-style-declaration
7727@opindex Wno-old-style-declaration
7728Warn for obsolescent usages, according to the C Standard, in a
7729declaration. For example, warn if storage-class specifiers like
7730@code{static} are not the first things in a declaration.  This warning
7731is also enabled by @option{-Wextra}.
7732
7733@item -Wold-style-definition @r{(C and Objective-C only)}
7734@opindex Wold-style-definition
7735@opindex Wno-old-style-definition
7736Warn if an old-style function definition is used.  A warning is given
7737even if there is a previous prototype.  A definition using @samp{()}
7738is not considered an old-style definition in C2X mode, because it is
7739equivalent to @samp{(void)} in that case, but is considered an
7740old-style definition for older standards.
7741
7742@item -Wmissing-parameter-type @r{(C and Objective-C only)}
7743@opindex Wmissing-parameter-type
7744@opindex Wno-missing-parameter-type
7745A function parameter is declared without a type specifier in K&R-style
7746functions:
7747
7748@smallexample
7749void foo(bar) @{ @}
7750@end smallexample
7751
7752This warning is also enabled by @option{-Wextra}.
7753
7754@item -Wmissing-prototypes @r{(C and Objective-C only)}
7755@opindex Wmissing-prototypes
7756@opindex Wno-missing-prototypes
7757Warn if a global function is defined without a previous prototype
7758declaration.  This warning is issued even if the definition itself
7759provides a prototype.  Use this option to detect global functions
7760that do not have a matching prototype declaration in a header file.
7761This option is not valid for C++ because all function declarations
7762provide prototypes and a non-matching declaration declares an
7763overload rather than conflict with an earlier declaration.
7764Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7765
7766@item -Wmissing-declarations
7767@opindex Wmissing-declarations
7768@opindex Wno-missing-declarations
7769Warn if a global function is defined without a previous declaration.
7770Do so even if the definition itself provides a prototype.
7771Use this option to detect global functions that are not declared in
7772header files.  In C, no warnings are issued for functions with previous
7773non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7774missing prototypes.  In C++, no warnings are issued for function templates,
7775or for inline functions, or for functions in anonymous namespaces.
7776
7777@item -Wmissing-field-initializers
7778@opindex Wmissing-field-initializers
7779@opindex Wno-missing-field-initializers
7780@opindex W
7781@opindex Wextra
7782@opindex Wno-extra
7783Warn if a structure's initializer has some fields missing.  For
7784example, the following code causes such a warning, because
7785@code{x.h} is implicitly zero:
7786
7787@smallexample
7788struct s @{ int f, g, h; @};
7789struct s x = @{ 3, 4 @};
7790@end smallexample
7791
7792This option does not warn about designated initializers, so the following
7793modification does not trigger a warning:
7794
7795@smallexample
7796struct s @{ int f, g, h; @};
7797struct s x = @{ .f = 3, .g = 4 @};
7798@end smallexample
7799
7800In C this option does not warn about the universal zero initializer
7801@samp{@{ 0 @}}:
7802
7803@smallexample
7804struct s @{ int f, g, h; @};
7805struct s x = @{ 0 @};
7806@end smallexample
7807
7808Likewise, in C++ this option does not warn about the empty @{ @}
7809initializer, for example:
7810
7811@smallexample
7812struct s @{ int f, g, h; @};
7813s x = @{ @};
7814@end smallexample
7815
7816This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
7817warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7818
7819@item -Wno-multichar
7820@opindex Wno-multichar
7821@opindex Wmultichar
7822Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7823Usually they indicate a typo in the user's code, as they have
7824implementation-defined values, and should not be used in portable code.
7825
7826@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7827@opindex Wnormalized=
7828@opindex Wnormalized
7829@opindex Wno-normalized
7830@cindex NFC
7831@cindex NFKC
7832@cindex character set, input normalization
7833In ISO C and ISO C++, two identifiers are different if they are
7834different sequences of characters.  However, sometimes when characters
7835outside the basic ASCII character set are used, you can have two
7836different character sequences that look the same.  To avoid confusion,
7837the ISO 10646 standard sets out some @dfn{normalization rules} which
7838when applied ensure that two sequences that look the same are turned into
7839the same sequence.  GCC can warn you if you are using identifiers that
7840have not been normalized; this option controls that warning.
7841
7842There are four levels of warning supported by GCC@.  The default is
7843@option{-Wnormalized=nfc}, which warns about any identifier that is
7844not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
7845recommended form for most uses.  It is equivalent to
7846@option{-Wnormalized}.
7847
7848Unfortunately, there are some characters allowed in identifiers by
7849ISO C and ISO C++ that, when turned into NFC, are not allowed in
7850identifiers.  That is, there's no way to use these symbols in portable
7851ISO C or C++ and have all your identifiers in NFC@.
7852@option{-Wnormalized=id} suppresses the warning for these characters.
7853It is hoped that future versions of the standards involved will correct
7854this, which is why this option is not the default.
7855
7856You can switch the warning off for all characters by writing
7857@option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
7858only do this if you are using some other normalization scheme (like
7859``D''), because otherwise you can easily create bugs that are
7860literally impossible to see.
7861
7862Some characters in ISO 10646 have distinct meanings but look identical
7863in some fonts or display methodologies, especially once formatting has
7864been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7865LETTER N'', displays just like a regular @code{n} that has been
7866placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
7867normalization scheme to convert all these into a standard form as
7868well, and GCC warns if your code is not in NFKC if you use
7869@option{-Wnormalized=nfkc}.  This warning is comparable to warning
7870about every identifier that contains the letter O because it might be
7871confused with the digit 0, and so is not the default, but may be
7872useful as a local coding convention if the programming environment
7873cannot be fixed to display these characters distinctly.
7874
7875@item -Wno-attribute-warning
7876@opindex Wno-attribute-warning
7877@opindex Wattribute-warning
7878Do not warn about usage of functions (@pxref{Function Attributes})
7879declared with @code{warning} attribute.  By default, this warning is
7880enabled.  @option{-Wno-attribute-warning} can be used to disable the
7881warning or @option{-Wno-error=attribute-warning} can be used to
7882disable the error when compiled with @option{-Werror} flag.
7883
7884@item -Wno-deprecated
7885@opindex Wno-deprecated
7886@opindex Wdeprecated
7887Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
7888
7889@item -Wno-deprecated-declarations
7890@opindex Wno-deprecated-declarations
7891@opindex Wdeprecated-declarations
7892Do not warn about uses of functions (@pxref{Function Attributes}),
7893variables (@pxref{Variable Attributes}), and types (@pxref{Type
7894Attributes}) marked as deprecated by using the @code{deprecated}
7895attribute.
7896
7897@item -Wno-overflow
7898@opindex Wno-overflow
7899@opindex Woverflow
7900Do not warn about compile-time overflow in constant expressions.
7901
7902@item -Wno-odr
7903@opindex Wno-odr
7904@opindex Wodr
7905Warn about One Definition Rule violations during link-time optimization.
7906Enabled by default.
7907
7908@item -Wopenmp-simd
7909@opindex Wopenmp-simd
7910@opindex Wno-openmp-simd
7911Warn if the vectorizer cost model overrides the OpenMP
7912simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
7913option can be used to relax the cost model.
7914
7915@item -Woverride-init @r{(C and Objective-C only)}
7916@opindex Woverride-init
7917@opindex Wno-override-init
7918@opindex W
7919@opindex Wextra
7920@opindex Wno-extra
7921Warn if an initialized field without side effects is overridden when
7922using designated initializers (@pxref{Designated Inits, , Designated
7923Initializers}).
7924
7925This warning is included in @option{-Wextra}.  To get other
7926@option{-Wextra} warnings without this one, use @option{-Wextra
7927-Wno-override-init}.
7928
7929@item -Wno-override-init-side-effects @r{(C and Objective-C only)}
7930@opindex Woverride-init-side-effects
7931@opindex Wno-override-init-side-effects
7932Do not warn if an initialized field with side effects is overridden when
7933using designated initializers (@pxref{Designated Inits, , Designated
7934Initializers}).  This warning is enabled by default.
7935
7936@item -Wpacked
7937@opindex Wpacked
7938@opindex Wno-packed
7939Warn if a structure is given the packed attribute, but the packed
7940attribute has no effect on the layout or size of the structure.
7941Such structures may be mis-aligned for little benefit.  For
7942instance, in this code, the variable @code{f.x} in @code{struct bar}
7943is misaligned even though @code{struct bar} does not itself
7944have the packed attribute:
7945
7946@smallexample
7947@group
7948struct foo @{
7949  int x;
7950  char a, b, c, d;
7951@} __attribute__((packed));
7952struct bar @{
7953  char z;
7954  struct foo f;
7955@};
7956@end group
7957@end smallexample
7958
7959@item -Wnopacked-bitfield-compat
7960@opindex Wpacked-bitfield-compat
7961@opindex Wno-packed-bitfield-compat
7962The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7963on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
7964the change can lead to differences in the structure layout.  GCC
7965informs you when the offset of such a field has changed in GCC 4.4.
7966For example there is no longer a 4-bit padding between field @code{a}
7967and @code{b} in this structure:
7968
7969@smallexample
7970struct foo
7971@{
7972  char a:4;
7973  char b:8;
7974@} __attribute__ ((packed));
7975@end smallexample
7976
7977This warning is enabled by default.  Use
7978@option{-Wno-packed-bitfield-compat} to disable this warning.
7979
7980@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7981@opindex Wpacked-not-aligned
7982@opindex Wno-packed-not-aligned
7983Warn if a structure field with explicitly specified alignment in a
7984packed struct or union is misaligned.  For example, a warning will
7985be issued on @code{struct S}, like, @code{warning: alignment 1 of
7986'struct S' is less than 8}, in this code:
7987
7988@smallexample
7989@group
7990struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7991struct __attribute__ ((packed)) S @{
7992  struct S8 s8;
7993@};
7994@end group
7995@end smallexample
7996
7997This warning is enabled by @option{-Wall}.
7998
7999@item -Wpadded
8000@opindex Wpadded
8001@opindex Wno-padded
8002Warn if padding is included in a structure, either to align an element
8003of the structure or to align the whole structure.  Sometimes when this
8004happens it is possible to rearrange the fields of the structure to
8005reduce the padding and so make the structure smaller.
8006
8007@item -Wredundant-decls
8008@opindex Wredundant-decls
8009@opindex Wno-redundant-decls
8010Warn if anything is declared more than once in the same scope, even in
8011cases where multiple declaration is valid and changes nothing.
8012
8013@item -Wrestrict
8014@opindex Wrestrict
8015@opindex Wno-restrict
8016Warn when an object referenced by a @code{restrict}-qualified parameter
8017(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8018argument, or when copies between such objects overlap.  For example,
8019the call to the @code{strcpy} function below attempts to truncate the string
8020by replacing its initial characters with the last four.  However, because
8021the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8022the call is diagnosed.
8023
8024@smallexample
8025void foo (void)
8026@{
8027  char a[] = "abcd1234";
8028  strcpy (a, a + 4);
8029  @dots{}
8030@}
8031@end smallexample
8032The @option{-Wrestrict} option detects some instances of simple overlap
8033even without optimization but works best at @option{-O2} and above.  It
8034is included in @option{-Wall}.
8035
8036@item -Wnested-externs @r{(C and Objective-C only)}
8037@opindex Wnested-externs
8038@opindex Wno-nested-externs
8039Warn if an @code{extern} declaration is encountered within a function.
8040
8041@item -Winline
8042@opindex Winline
8043@opindex Wno-inline
8044Warn if a function that is declared as inline cannot be inlined.
8045Even with this option, the compiler does not warn about failures to
8046inline functions declared in system headers.
8047
8048The compiler uses a variety of heuristics to determine whether or not
8049to inline a function.  For example, the compiler takes into account
8050the size of the function being inlined and the amount of inlining
8051that has already been done in the current function.  Therefore,
8052seemingly insignificant changes in the source program can cause the
8053warnings produced by @option{-Winline} to appear or disappear.
8054
8055@item -Wint-in-bool-context
8056@opindex Wint-in-bool-context
8057@opindex Wno-int-in-bool-context
8058Warn for suspicious use of integer values where boolean values are expected,
8059such as conditional expressions (?:) using non-boolean integer constants in
8060boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
8061integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
8062for all kinds of multiplications regardless of the data type.
8063This warning is enabled by @option{-Wall}.
8064
8065@item -Wno-int-to-pointer-cast
8066@opindex Wno-int-to-pointer-cast
8067@opindex Wint-to-pointer-cast
8068Suppress warnings from casts to pointer type of an integer of a
8069different size. In C++, casting to a pointer type of smaller size is
8070an error. @option{Wint-to-pointer-cast} is enabled by default.
8071
8072
8073@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8074@opindex Wno-pointer-to-int-cast
8075@opindex Wpointer-to-int-cast
8076Suppress warnings from casts from a pointer to an integer type of a
8077different size.
8078
8079@item -Winvalid-pch
8080@opindex Winvalid-pch
8081@opindex Wno-invalid-pch
8082Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8083the search path but cannot be used.
8084
8085@item -Wlong-long
8086@opindex Wlong-long
8087@opindex Wno-long-long
8088Warn if @code{long long} type is used.  This is enabled by either
8089@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8090modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
8091
8092@item -Wvariadic-macros
8093@opindex Wvariadic-macros
8094@opindex Wno-variadic-macros
8095Warn if variadic macros are used in ISO C90 mode, or if the GNU
8096alternate syntax is used in ISO C99 mode.  This is enabled by either
8097@option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
8098messages, use @option{-Wno-variadic-macros}.
8099
8100@item -Wno-varargs
8101@opindex Wvarargs
8102@opindex Wno-varargs
8103Do not warn upon questionable usage of the macros used to handle variable
8104arguments like @code{va_start}.  These warnings are enabled by default.
8105
8106@item -Wvector-operation-performance
8107@opindex Wvector-operation-performance
8108@opindex Wno-vector-operation-performance
8109Warn if vector operation is not implemented via SIMD capabilities of the
8110architecture.  Mainly useful for the performance tuning.
8111Vector operation can be implemented @code{piecewise}, which means that the
8112scalar operation is performed on every vector element;
8113@code{in parallel}, which means that the vector operation is implemented
8114using scalars of wider type, which normally is more performance efficient;
8115and @code{as a single scalar}, which means that vector fits into a
8116scalar type.
8117
8118@item -Wvla
8119@opindex Wvla
8120@opindex Wno-vla
8121Warn if a variable-length array is used in the code.
8122@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8123the variable-length array.
8124
8125@item -Wvla-larger-than=@var{byte-size}
8126@opindex Wvla-larger-than=
8127@opindex Wno-vla-larger-than
8128If this option is used, the compiler warns for declarations of
8129variable-length arrays whose size is either unbounded, or bounded
8130by an argument that allows the array size to exceed @var{byte-size}
8131bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8132works, but with variable-length arrays.
8133
8134Note that GCC may optimize small variable-length arrays of a known
8135value into plain arrays, so this warning may not get triggered for
8136such arrays.
8137
8138@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8139is typically only effective when @option{-ftree-vrp} is active (default
8140for @option{-O2} and above).
8141
8142See also @option{-Walloca-larger-than=@var{byte-size}}.
8143
8144@item -Wno-vla-larger-than
8145@opindex Wno-vla-larger-than
8146Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
8147to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8148
8149@item -Wvolatile-register-var
8150@opindex Wvolatile-register-var
8151@opindex Wno-volatile-register-var
8152Warn if a register variable is declared volatile.  The volatile
8153modifier does not inhibit all optimizations that may eliminate reads
8154and/or writes to register variables.  This warning is enabled by
8155@option{-Wall}.
8156
8157@item -Wdisabled-optimization
8158@opindex Wdisabled-optimization
8159@opindex Wno-disabled-optimization
8160Warn if a requested optimization pass is disabled.  This warning does
8161not generally indicate that there is anything wrong with your code; it
8162merely indicates that GCC's optimizers are unable to handle the code
8163effectively.  Often, the problem is that your code is too big or too
8164complex; GCC refuses to optimize programs when the optimization
8165itself is likely to take inordinate amounts of time.
8166
8167@item -Wpointer-sign @r{(C and Objective-C only)}
8168@opindex Wpointer-sign
8169@opindex Wno-pointer-sign
8170Warn for pointer argument passing or assignment with different signedness.
8171This option is only supported for C and Objective-C@.  It is implied by
8172@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8173@option{-Wno-pointer-sign}.
8174
8175@item -Wstack-protector
8176@opindex Wstack-protector
8177@opindex Wno-stack-protector
8178This option is only active when @option{-fstack-protector} is active.  It
8179warns about functions that are not protected against stack smashing.
8180
8181@item -Woverlength-strings
8182@opindex Woverlength-strings
8183@opindex Wno-overlength-strings
8184Warn about string constants that are longer than the ``minimum
8185maximum'' length specified in the C standard.  Modern compilers
8186generally allow string constants that are much longer than the
8187standard's minimum limit, but very portable programs should avoid
8188using longer strings.
8189
8190The limit applies @emph{after} string constant concatenation, and does
8191not count the trailing NUL@.  In C90, the limit was 509 characters; in
8192C99, it was raised to 4095.  C++98 does not specify a normative
8193minimum maximum, so we do not diagnose overlength strings in C++@.
8194
8195This option is implied by @option{-Wpedantic}, and can be disabled with
8196@option{-Wno-overlength-strings}.
8197
8198@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8199@opindex Wunsuffixed-float-constants
8200@opindex Wno-unsuffixed-float-constants
8201
8202Issue a warning for any floating constant that does not have
8203a suffix.  When used together with @option{-Wsystem-headers} it
8204warns about such constants in system header files.  This can be useful
8205when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8206from the decimal floating-point extension to C99.
8207
8208@item -Wno-lto-type-mismatch
8209@opindex Wlto-type-mismatch
8210@opindex Wno-lto-type-mismatch
8211
8212During the link-time optimization, do not warn about type mismatches in
8213global declarations from different compilation units.
8214Requires @option{-flto} to be enabled.  Enabled by default.
8215
8216@item -Wno-designated-init @r{(C and Objective-C only)}
8217@opindex Wdesignated-init
8218@opindex Wno-designated-init
8219Suppress warnings when a positional initializer is used to initialize
8220a structure that has been marked with the @code{designated_init}
8221attribute.
8222
8223@item -Wno-hsa
8224@opindex Whsa
8225@opindex Wno-hsa
8226Do not warn when HSAIL cannot be emitted for the compiled function or
8227OpenMP construct.  These warnings are enabled by default.
8228
8229@end table
8230
8231@node Static Analyzer Options
8232@section Options That Control Static Analysis
8233
8234@table @gcctabopt
8235@item -fanalyzer
8236@opindex analyzer
8237@opindex fanalyzer
8238@opindex fno-analyzer
8239This option enables an static analysis of program flow which looks
8240for ``interesting'' interprocedural paths through the
8241code, and issues warnings for problems found on them.
8242
8243This analysis is much more expensive than other GCC warnings.
8244
8245Enabling this option effectively enables the following warnings:
8246
8247@gccoptlist{ @gol
8248-Wanalyzer-double-fclose @gol
8249-Wanalyzer-double-free @gol
8250-Wanalyzer-exposure-through-output-file @gol
8251-Wanalyzer-file-leak @gol
8252-Wanalyzer-free-of-non-heap @gol
8253-Wanalyzer-malloc-leak @gol
8254-Wanalyzer-possible-null-argument @gol
8255-Wanalyzer-possible-null-dereference @gol
8256-Wanalyzer-null-argument @gol
8257-Wanalyzer-null-dereference @gol
8258-Wanalyzer-stale-setjmp-buffer @gol
8259-Wanalyzer-tainted-array-index @gol
8260-Wanalyzer-unsafe-call-within-signal-handler @gol
8261-Wanalyzer-use-after-free @gol
8262-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8263}
8264
8265This option is only available if GCC was configured with analyzer
8266support enabled.
8267
8268@item -Wanalyzer-too-complex
8269@opindex Wanalyzer-too-complex
8270@opindex Wno-analyzer-too-complex
8271If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8272to attempt to explore the control flow and data flow in the program,
8273but these can be defeated by sufficiently complicated code.
8274
8275By default, the analysis silently stops if the code is too
8276complicated for the analyzer to fully explore and it reaches an internal
8277limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
8278
8279@item -Wno-analyzer-double-fclose
8280@opindex Wanalyzer-double-fclose
8281@opindex Wno-analyzer-double-fclose
8282This warning requires @option{-fanalyzer}, which enables it; use
8283@option{-Wno-analyzer-double-fclose} to disable it.
8284
8285This diagnostic warns for paths through the code in which a @code{FILE *}
8286can have @code{fclose} called on it more than once.
8287
8288@item -Wno-analyzer-double-free
8289@opindex Wanalyzer-double-free
8290@opindex Wno-analyzer-double-free
8291This warning requires @option{-fanalyzer}, which enables it; use
8292@option{-Wno-analyzer-double-free} to disable it.
8293
8294This diagnostic warns for paths through the code in which a pointer
8295can have @code{free} called on it more than once.
8296
8297@item -Wno-analyzer-exposure-through-output-file
8298@opindex Wanalyzer-exposure-through-output-file
8299@opindex Wno-analyzer-exposure-through-output-file
8300This warning requires @option{-fanalyzer}, which enables it; use
8301@option{-Wno-analyzer-exposure-through-output-file}
8302to disable it.
8303
8304This diagnostic warns for paths through the code in which a
8305security-sensitive value is written to an output file
8306(such as writing a password to a log file).
8307
8308@item -Wno-analyzer-file-leak
8309@opindex Wanalyzer-file-leak
8310@opindex Wno-analyzer-file-leak
8311This warning requires @option{-fanalyzer}, which enables it; use
8312@option{-Wno-analyzer-file-leak}
8313to disable it.
8314
8315This diagnostic warns for paths through the code in which a
8316@code{<stdio.h>} @code{FILE *} stream object is leaked.
8317
8318@item -Wno-analyzer-free-of-non-heap
8319@opindex Wanalyzer-free-of-non-heap
8320@opindex Wno-analyzer-free-of-non-heap
8321This warning requires @option{-fanalyzer}, which enables it; use
8322@option{-Wno-analyzer-free-of-non-heap}
8323to disable it.
8324
8325This diagnostic warns for paths through the code in which @code{free}
8326is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8327
8328@item -Wno-analyzer-malloc-leak
8329@opindex Wanalyzer-malloc-leak
8330@opindex Wno-analyzer-malloc-leak
8331This warning requires @option{-fanalyzer}, which enables it; use
8332@option{-Wno-analyzer-malloc-leak}
8333to disable it.
8334
8335This diagnostic warns for paths through the code in which a
8336pointer allocated via @code{malloc} is leaked.
8337
8338@item -Wno-analyzer-possible-null-argument
8339@opindex Wanalyzer-possible-null-argument
8340@opindex Wno-analyzer-possible-null-argument
8341This warning requires @option{-fanalyzer}, which enables it; use
8342@option{-Wno-analyzer-possible-null-argument} to disable it.
8343
8344This diagnostic warns for paths through the code in which a
8345possibly-NULL value is passed to a function argument marked
8346with @code{__attribute__((nonnull))} as requiring a non-NULL
8347value.
8348
8349@item -Wno-analyzer-possible-null-dereference
8350@opindex Wanalyzer-possible-null-dereference
8351@opindex Wno-analyzer-possible-null-dereference
8352This warning requires @option{-fanalyzer}, which enables it; use
8353@option{-Wno-analyzer-possible-null-dereference} to disable it.
8354
8355This diagnostic warns for paths through the code in which a
8356possibly-NULL value is dereferenced.
8357
8358@item -Wno-analyzer-null-argument
8359@opindex Wanalyzer-null-argument
8360@opindex Wno-analyzer-null-argument
8361This warning requires @option{-fanalyzer}, which enables it; use
8362@option{-Wno-analyzer-null-argument} to disable it.
8363
8364This diagnostic warns for paths through the code in which a
8365value known to be NULL is passed to a function argument marked
8366with @code{__attribute__((nonnull))} as requiring a non-NULL
8367value.
8368
8369@item -Wno-analyzer-null-dereference
8370@opindex Wanalyzer-null-dereference
8371@opindex Wno-analyzer-null-dereference
8372This warning requires @option{-fanalyzer}, which enables it; use
8373@option{-Wno-analyzer-null-dereference} to disable it.
8374
8375This diagnostic warns for paths through the code in which a
8376value known to be NULL is dereferenced.
8377
8378@item -Wno-analyzer-stale-setjmp-buffer
8379@opindex Wanalyzer-stale-setjmp-buffer
8380@opindex Wno-analyzer-stale-setjmp-buffer
8381This warning requires @option{-fanalyzer}, which enables it; use
8382@option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8383
8384This diagnostic warns for paths through the code in which
8385@code{longjmp} is called to rewind to a @code{jmp_buf} relating
8386to a @code{setjmp} call in a function that has returned.
8387
8388When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8389location, it records the stack frame.  The stack frame becomes invalid
8390when the function containing the @code{setjmp} call returns.  Attempting
8391to rewind to it via @code{longjmp} would reference a stack frame that
8392no longer exists, and likely lead to a crash (or worse).
8393
8394@item -Wno-analyzer-tainted-array-index
8395@opindex Wanalyzer-tainted-array-index
8396@opindex Wno-analyzer-tainted-array-index
8397This warning requires both @option{-fanalyzer} and
8398@option{-fanalyzer-checker=taint} to enable it;
8399use @option{-Wno-analyzer-tainted-array-index} to disable it.
8400
8401This diagnostic warns for paths through the code in which a value
8402that could be under an attacker's control is used as the index
8403of an array access without being sanitized.
8404
8405@item -Wno-analyzer-unsafe-call-within-signal-handler
8406@opindex Wanalyzer-unsafe-call-within-signal-handler
8407@opindex Wno-analyzer-unsafe-call-within-signal-handler
8408This warning requires @option{-fanalyzer}, which enables it; use
8409@option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8410
8411This diagnostic warns for paths through the code in which a
8412function known to be async-signal-unsafe (such as @code{fprintf}) is
8413called from a signal handler.
8414
8415@item -Wno-analyzer-use-after-free
8416@opindex Wanalyzer-use-after-free
8417@opindex Wno-analyzer-use-after-free
8418This warning requires @option{-fanalyzer}, which enables it; use
8419@option{-Wno-analyzer-use-after-free} to disable it.
8420
8421This diagnostic warns for paths through the code in which a
8422pointer is used after @code{free} is called on it.
8423
8424@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8425@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8426@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8427This warning requires @option{-fanalyzer}, which enables it; use
8428@option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8429to disable it.
8430
8431This diagnostic warns for paths through the code in which a pointer
8432is dereferenced that points to a variable in a stale stack frame.
8433
8434@end table
8435
8436Pertinent parameters for controlling the exploration are:
8437@option{--param analyzer-bb-explosion-factor=@var{value}},
8438@option{--param analyzer-max-enodes-per-program-point=@var{value}},
8439@option{--param analyzer-max-recursion-depth=@var{value}}, and
8440@option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8441
8442The following options control the analyzer.
8443
8444@table @gcctabopt
8445
8446@item -fanalyzer-call-summaries
8447@opindex fanalyzer-call-summaries
8448@opindex fno-analyzer-call-summaries
8449Simplify interprocedural analysis by computing the effect of certain calls,
8450rather than exploring all paths through the function from callsite to each
8451possible return.
8452
8453If enabled, call summaries are only used for functions with more than one
8454call site, and that are sufficiently complicated (as per
8455@option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8456
8457@item -fanalyzer-checker=@var{name}
8458@opindex fanalyzer-checker
8459Restrict the analyzer to run just the named checker, and enable it.
8460
8461Some checkers are disabled by default (even with @option{-fanalyzer}),
8462such as the @code{taint} checker that implements
8463@option{-Wanalyzer-tainted-array-index}, and this option is required
8464to enable them.
8465
8466@item -fanalyzer-fine-grained
8467@opindex fanalyzer-fine-grained
8468@opindex fno-analyzer-fine-grained
8469This option is intended for analyzer developers.
8470
8471Internally the analyzer builds an ``exploded graph'' that combines
8472control flow graphs with data flow information.
8473
8474By default, an edge in this graph can contain the effects of a run
8475of multiple statements within a basic block.  With
8476@option{-fanalyzer-fine-grained}, each statement gets its own edge.
8477
8478@item -fanalyzer-show-duplicate-count
8479@opindex fanalyzer-show-duplicate-count
8480@opindex fno-analyzer-show-duplicate-count
8481This option is intended for analyzer developers: if multiple diagnostics
8482have been detected as being duplicates of each other, it emits a note when
8483reporting the best diagnostic, giving the number of additional diagnostics
8484that were suppressed by the deduplication logic.
8485
8486@item -fno-analyzer-state-merge
8487@opindex fanalyzer-state-merge
8488@opindex fno-analyzer-state-merge
8489This option is intended for analyzer developers.
8490
8491By default the analyzer attempts to simplify analysis by merging
8492sufficiently similar states at each program point as it builds its
8493``exploded graph''.  With @option{-fno-analyzer-state-merge} this
8494merging can be suppressed, for debugging state-handling issues.
8495
8496@item -fno-analyzer-state-purge
8497@opindex fanalyzer-state-purge
8498@opindex fno-analyzer-state-purge
8499This option is intended for analyzer developers.
8500
8501By default the analyzer attempts to simplify analysis by purging
8502aspects of state at a program point that appear to no longer be relevant
8503e.g. the values of locals that aren't accessed later in the function
8504and which aren't relevant to leak analysis.
8505
8506With @option{-fno-analyzer-state-purge} this purging of state can
8507be suppressed, for debugging state-handling issues.
8508
8509@item -fanalyzer-transitivity
8510@opindex fanalyzer-transitivity
8511@opindex fno-analyzer-transitivity
8512This option enables transitivity of constraints within the analyzer.
8513
8514@item -fanalyzer-verbose-edges
8515This option is intended for analyzer developers.  It enables more
8516verbose, lower-level detail in the descriptions of control flow
8517within diagnostic paths.
8518
8519@item -fanalyzer-verbose-state-changes
8520This option is intended for analyzer developers.  It enables more
8521verbose, lower-level detail in the descriptions of events relating
8522to state machines within diagnostic paths.
8523
8524@item -fanalyzer-verbosity=@var{level}
8525This option controls the complexity of the control flow paths that are
8526emitted for analyzer diagnostics.
8527
8528The @var{level} can be one of:
8529
8530@table @samp
8531@item 0
8532At this level, interprocedural call and return events are displayed,
8533along with the most pertinent state-change events relating to
8534a diagnostic.  For example, for a double-@code{free} diagnostic,
8535both calls to @code{free} will be shown.
8536
8537@item 1
8538As per the previous level, but also show events for the entry
8539to each function.
8540
8541@item 2
8542As per the previous level, but also show events relating to
8543control flow that are significant to triggering the issue
8544(e.g. ``true path taken'' at a conditional).
8545
8546This level is the default.
8547
8548@item 3
8549As per the previous level, but show all control flow events, not
8550just significant ones.
8551
8552@item 4
8553This level is intended for analyzer developers; it adds various
8554other events intended for debugging the analyzer.
8555
8556@end table
8557
8558@item -fdump-analyzer
8559@opindex fdump-analyzer
8560Dump internal details about what the analyzer is doing to
8561@file{@var{file}.analyzer.txt}.
8562This option is overridden by @option{-fdump-analyzer-stderr}.
8563
8564@item -fdump-analyzer-stderr
8565@opindex fdump-analyzer-stderr
8566Dump internal details about what the analyzer is doing to stderr.
8567This option overrides @option{-fdump-analyzer}.
8568
8569@item -fdump-analyzer-callgraph
8570@opindex fdump-analyzer-callgraph
8571Dump a representation of the call graph suitable for viewing with
8572GraphViz to @file{@var{file}.callgraph.dot}.
8573
8574@item -fdump-analyzer-exploded-graph
8575@opindex fdump-analyzer-exploded-graph
8576Dump a representation of the ``exploded graph'' suitable for viewing with
8577GraphViz to @file{@var{file}.eg.dot}.
8578Nodes are color-coded based on state-machine states to emphasize
8579state changes.
8580
8581@item -fdump-analyzer-exploded-nodes
8582@opindex dump-analyzer-exploded-nodes
8583Emit diagnostics showing where nodes in the ``exploded graph'' are
8584in relation to the program source.
8585
8586@item -fdump-analyzer-exploded-nodes-2
8587@opindex dump-analyzer-exploded-nodes-2
8588Dump a textual representation of the ``exploded graph'' to
8589@file{@var{file}.eg.txt}.
8590
8591@item -fdump-analyzer-exploded-nodes-3
8592@opindex dump-analyzer-exploded-nodes-3
8593Dump a textual representation of the ``exploded graph'' to
8594one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8595This is typically a large number of dump files.
8596
8597@item -fdump-analyzer-state-purge
8598@opindex fdump-analyzer-state-purge
8599As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8600``supergraph'' suitable for viewing with GraphViz, but annotate the
8601graph with information on what state will be purged at each node.
8602The graph is written to @file{@var{file}.state-purge.dot}.
8603
8604@item -fdump-analyzer-supergraph
8605@opindex fdump-analyzer-supergraph
8606Dump representations of the ``supergraph'' suitable for viewing with
8607GraphViz to @file{@var{file}.supergraph.dot} and to
8608@file{@var{file}.supergraph-eg.dot}.  These show all of the
8609control flow graphs in the program, with interprocedural edges for
8610calls and returns.  The second dump contains annotations showing nodes
8611in the ``exploded graph'' and diagnostics associated with them.
8612
8613@end table
8614
8615@node Debugging Options
8616@section Options for Debugging Your Program
8617@cindex options, debugging
8618@cindex debugging information options
8619
8620To tell GCC to emit extra information for use by a debugger, in almost
8621all cases you need only to add @option{-g} to your other options.
8622
8623GCC allows you to use @option{-g} with
8624@option{-O}.  The shortcuts taken by optimized code may occasionally
8625be surprising: some variables you declared may not exist
8626at all; flow of control may briefly move where you did not expect it;
8627some statements may not be executed because they compute constant
8628results or their values are already at hand; some statements may
8629execute in different places because they have been moved out of loops.
8630Nevertheless it is possible to debug optimized output.  This makes
8631it reasonable to use the optimizer for programs that might have bugs.
8632
8633If you are not using some other optimization option, consider
8634using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
8635With no @option{-O} option at all, some compiler passes that collect
8636information useful for debugging do not run at all, so that
8637@option{-Og} may result in a better debugging experience.
8638
8639@table @gcctabopt
8640@item -g
8641@opindex g
8642Produce debugging information in the operating system's native format
8643(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
8644information.
8645
8646On most systems that use stabs format, @option{-g} enables use of extra
8647debugging information that only GDB can use; this extra information
8648makes debugging work better in GDB but probably makes other debuggers
8649crash or
8650refuse to read the program.  If you want to control for certain whether
8651to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8652@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8653
8654@item -ggdb
8655@opindex ggdb
8656Produce debugging information for use by GDB@.  This means to use the
8657most expressive format available (DWARF, stabs, or the native format
8658if neither of those are supported), including GDB extensions if at all
8659possible.
8660
8661@item -gdwarf
8662@itemx -gdwarf-@var{version}
8663@opindex gdwarf
8664Produce debugging information in DWARF format (if that is supported).
8665The value of @var{version} may be either 2, 3, 4 or 5; the default version
8666for most targets is 4.  DWARF Version 5 is only experimental.
8667
8668Note that with DWARF Version 2, some ports require and always
8669use some non-conflicting DWARF 3 extensions in the unwind tables.
8670
8671Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8672for maximum benefit.
8673
8674GCC no longer supports DWARF Version 1, which is substantially
8675different than Version 2 and later.  For historical reasons, some
8676other DWARF-related options such as
8677@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8678in their names, but apply to all currently-supported versions of DWARF.
8679
8680@item -gstabs
8681@opindex gstabs
8682Produce debugging information in stabs format (if that is supported),
8683without GDB extensions.  This is the format used by DBX on most BSD
8684systems.  On MIPS, Alpha and System V Release 4 systems this option
8685produces stabs debugging output that is not understood by DBX@.
8686On System V Release 4 systems this option requires the GNU assembler.
8687
8688@item -gstabs+
8689@opindex gstabs+
8690Produce debugging information in stabs format (if that is supported),
8691using GNU extensions understood only by the GNU debugger (GDB)@.  The
8692use of these extensions is likely to make other debuggers crash or
8693refuse to read the program.
8694
8695@item -gxcoff
8696@opindex gxcoff
8697Produce debugging information in XCOFF format (if that is supported).
8698This is the format used by the DBX debugger on IBM RS/6000 systems.
8699
8700@item -gxcoff+
8701@opindex gxcoff+
8702Produce debugging information in XCOFF format (if that is supported),
8703using GNU extensions understood only by the GNU debugger (GDB)@.  The
8704use of these extensions is likely to make other debuggers crash or
8705refuse to read the program, and may cause assemblers other than the GNU
8706assembler (GAS) to fail with an error.
8707
8708@item -gvms
8709@opindex gvms
8710Produce debugging information in Alpha/VMS debug format (if that is
8711supported).  This is the format used by DEBUG on Alpha/VMS systems.
8712
8713@item -g@var{level}
8714@itemx -ggdb@var{level}
8715@itemx -gstabs@var{level}
8716@itemx -gxcoff@var{level}
8717@itemx -gvms@var{level}
8718Request debugging information and also use @var{level} to specify how
8719much information.  The default level is 2.
8720
8721Level 0 produces no debug information at all.  Thus, @option{-g0} negates
8722@option{-g}.
8723
8724Level 1 produces minimal information, enough for making backtraces in
8725parts of the program that you don't plan to debug.  This includes
8726descriptions of functions and external variables, and line number
8727tables, but no information about local variables.
8728
8729Level 3 includes extra information, such as all the macro definitions
8730present in the program.  Some debuggers support macro expansion when
8731you use @option{-g3}.
8732
8733If you use multiple @option{-g} options, with or without level numbers,
8734the last such option is the one that is effective.
8735
8736@option{-gdwarf} does not accept a concatenated debug level, to avoid
8737confusion with @option{-gdwarf-@var{level}}.
8738Instead use an additional @option{-g@var{level}} option to change the
8739debug level for DWARF.
8740
8741@item -fno-eliminate-unused-debug-symbols
8742@opindex feliminate-unused-debug-symbols
8743@opindex fno-eliminate-unused-debug-symbols
8744By default, no debug information is produced for symbols that are not actually
8745used. Use this option if you want debug information for all symbols.
8746
8747@item -femit-class-debug-always
8748@opindex femit-class-debug-always
8749Instead of emitting debugging information for a C++ class in only one
8750object file, emit it in all object files using the class.  This option
8751should be used only with debuggers that are unable to handle the way GCC
8752normally emits debugging information for classes because using this
8753option increases the size of debugging information by as much as a
8754factor of two.
8755
8756@item -fno-merge-debug-strings
8757@opindex fmerge-debug-strings
8758@opindex fno-merge-debug-strings
8759Direct the linker to not merge together strings in the debugging
8760information that are identical in different object files.  Merging is
8761not supported by all assemblers or linkers.  Merging decreases the size
8762of the debug information in the output file at the cost of increasing
8763link processing time.  Merging is enabled by default.
8764
8765@item -fdebug-prefix-map=@var{old}=@var{new}
8766@opindex fdebug-prefix-map
8767When compiling files residing in directory @file{@var{old}}, record
8768debugging information describing them as if the files resided in
8769directory @file{@var{new}} instead.  This can be used to replace a
8770build-time path with an install-time path in the debug info.  It can
8771also be used to change an absolute path to a relative path by using
8772@file{.} for @var{new}.  This can give more reproducible builds, which
8773are location independent, but may require an extra command to tell GDB
8774where to find the source files. See also @option{-ffile-prefix-map}.
8775
8776@item -fvar-tracking
8777@opindex fvar-tracking
8778Run variable tracking pass.  It computes where variables are stored at each
8779position in code.  Better debugging information is then generated
8780(if the debugging information format supports this information).
8781
8782It is enabled by default when compiling with optimization (@option{-Os},
8783@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8784the debug info format supports it.
8785
8786@item -fvar-tracking-assignments
8787@opindex fvar-tracking-assignments
8788@opindex fno-var-tracking-assignments
8789Annotate assignments to user variables early in the compilation and
8790attempt to carry the annotations over throughout the compilation all the
8791way to the end, in an attempt to improve debug information while
8792optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
8793
8794It can be enabled even if var-tracking is disabled, in which case
8795annotations are created and maintained, but discarded at the end.
8796By default, this flag is enabled together with @option{-fvar-tracking},
8797except when selective scheduling is enabled.
8798
8799@item -gsplit-dwarf
8800@opindex gsplit-dwarf
8801Separate as much DWARF debugging information as possible into a
8802separate output file with the extension @file{.dwo}.  This option allows
8803the build system to avoid linking files with debug information.  To
8804be useful, this option requires a debugger capable of reading @file{.dwo}
8805files.
8806
8807@item -gdescribe-dies
8808@opindex gdescribe-dies
8809Add description attributes to some DWARF DIEs that have no name attribute,
8810such as artificial variables, external references and call site
8811parameter DIEs.
8812
8813@item -gpubnames
8814@opindex gpubnames
8815Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8816
8817@item -ggnu-pubnames
8818@opindex ggnu-pubnames
8819Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8820suitable for conversion into a GDB@ index.  This option is only useful
8821with a linker that can produce GDB@ index version 7.
8822
8823@item -fdebug-types-section
8824@opindex fdebug-types-section
8825@opindex fno-debug-types-section
8826When using DWARF Version 4 or higher, type DIEs can be put into
8827their own @code{.debug_types} section instead of making them part of the
8828@code{.debug_info} section.  It is more efficient to put them in a separate
8829comdat section since the linker can then remove duplicates.
8830But not all DWARF consumers support @code{.debug_types} sections yet
8831and on some objects @code{.debug_types} produces larger instead of smaller
8832debugging information.
8833
8834@item -grecord-gcc-switches
8835@itemx -gno-record-gcc-switches
8836@opindex grecord-gcc-switches
8837@opindex gno-record-gcc-switches
8838This switch causes the command-line options used to invoke the
8839compiler that may affect code generation to be appended to the
8840DW_AT_producer attribute in DWARF debugging information.  The options
8841are concatenated with spaces separating them from each other and from
8842the compiler version.
8843It is enabled by default.
8844See also @option{-frecord-gcc-switches} for another
8845way of storing compiler options into the object file.
8846
8847@item -gstrict-dwarf
8848@opindex gstrict-dwarf
8849Disallow using extensions of later DWARF standard version than selected
8850with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
8851DWARF extensions from later standard versions is allowed.
8852
8853@item -gno-strict-dwarf
8854@opindex gno-strict-dwarf
8855Allow using extensions of later DWARF standard version than selected with
8856@option{-gdwarf-@var{version}}.
8857
8858@item -gas-loc-support
8859@opindex gas-loc-support
8860Inform the compiler that the assembler supports @code{.loc} directives.
8861It may then use them for the assembler to generate DWARF2+ line number
8862tables.
8863
8864This is generally desirable, because assembler-generated line-number
8865tables are a lot more compact than those the compiler can generate
8866itself.
8867
8868This option will be enabled by default if, at GCC configure time, the
8869assembler was found to support such directives.
8870
8871@item -gno-as-loc-support
8872@opindex gno-as-loc-support
8873Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8874line number tables are to be generated.
8875
8876@item -gas-locview-support
8877@opindex gas-locview-support
8878Inform the compiler that the assembler supports @code{view} assignment
8879and reset assertion checking in @code{.loc} directives.
8880
8881This option will be enabled by default if, at GCC configure time, the
8882assembler was found to support them.
8883
8884@item -gno-as-locview-support
8885Force GCC to assign view numbers internally, if
8886@option{-gvariable-location-views} are explicitly requested.
8887
8888@item -gcolumn-info
8889@itemx -gno-column-info
8890@opindex gcolumn-info
8891@opindex gno-column-info
8892Emit location column information into DWARF debugging information, rather
8893than just file and line.
8894This option is enabled by default.
8895
8896@item -gstatement-frontiers
8897@itemx -gno-statement-frontiers
8898@opindex gstatement-frontiers
8899@opindex gno-statement-frontiers
8900This option causes GCC to create markers in the internal representation
8901at the beginning of statements, and to keep them roughly in place
8902throughout compilation, using them to guide the output of @code{is_stmt}
8903markers in the line number table.  This is enabled by default when
8904compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8905@dots{}), and outputting DWARF 2 debug information at the normal level.
8906
8907@item -gvariable-location-views
8908@itemx -gvariable-location-views=incompat5
8909@itemx -gno-variable-location-views
8910@opindex gvariable-location-views
8911@opindex gvariable-location-views=incompat5
8912@opindex gno-variable-location-views
8913Augment variable location lists with progressive view numbers implied
8914from the line number table.  This enables debug information consumers to
8915inspect state at certain points of the program, even if no instructions
8916associated with the corresponding source locations are present at that
8917point.  If the assembler lacks support for view numbers in line number
8918tables, this will cause the compiler to emit the line number table,
8919which generally makes them somewhat less compact.  The augmented line
8920number tables and location lists are fully backward-compatible, so they
8921can be consumed by debug information consumers that are not aware of
8922these augmentations, but they won't derive any benefit from them either.
8923
8924This is enabled by default when outputting DWARF 2 debug information at
8925the normal level, as long as there is assembler support,
8926@option{-fvar-tracking-assignments} is enabled and
8927@option{-gstrict-dwarf} is not.  When assembler support is not
8928available, this may still be enabled, but it will force GCC to output
8929internal line number tables, and if
8930@option{-ginternal-reset-location-views} is not enabled, that will most
8931certainly lead to silently mismatching location views.
8932
8933There is a proposed representation for view numbers that is not backward
8934compatible with the location list format introduced in DWARF 5, that can
8935be enabled with @option{-gvariable-location-views=incompat5}.  This
8936option may be removed in the future, is only provided as a reference
8937implementation of the proposed representation.  Debug information
8938consumers are not expected to support this extended format, and they
8939would be rendered unable to decode location lists using it.
8940
8941@item -ginternal-reset-location-views
8942@itemx -gno-internal-reset-location-views
8943@opindex ginternal-reset-location-views
8944@opindex gno-internal-reset-location-views
8945Attempt to determine location views that can be omitted from location
8946view lists.  This requires the compiler to have very accurate insn
8947length estimates, which isn't always the case, and it may cause
8948incorrect view lists to be generated silently when using an assembler
8949that does not support location view lists.  The GNU assembler will flag
8950any such error as a @code{view number mismatch}.  This is only enabled
8951on ports that define a reliable estimation function.
8952
8953@item -ginline-points
8954@itemx -gno-inline-points
8955@opindex ginline-points
8956@opindex gno-inline-points
8957Generate extended debug information for inlined functions.  Location
8958view tracking markers are inserted at inlined entry points, so that
8959address and view numbers can be computed and output in debug
8960information.  This can be enabled independently of location views, in
8961which case the view numbers won't be output, but it can only be enabled
8962along with statement frontiers, and it is only enabled by default if
8963location views are enabled.
8964
8965@item -gz@r{[}=@var{type}@r{]}
8966@opindex gz
8967Produce compressed debug sections in DWARF format, if that is supported.
8968If @var{type} is not given, the default type depends on the capabilities
8969of the assembler and linker used.  @var{type} may be one of
8970@samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8971compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8972compression in traditional GNU format).  If the linker doesn't support
8973writing compressed debug sections, the option is rejected.  Otherwise,
8974if the assembler does not support them, @option{-gz} is silently ignored
8975when producing object files.
8976
8977@item -femit-struct-debug-baseonly
8978@opindex femit-struct-debug-baseonly
8979Emit debug information for struct-like types
8980only when the base name of the compilation source file
8981matches the base name of file in which the struct is defined.
8982
8983This option substantially reduces the size of debugging information,
8984but at significant potential loss in type information to the debugger.
8985See @option{-femit-struct-debug-reduced} for a less aggressive option.
8986See @option{-femit-struct-debug-detailed} for more detailed control.
8987
8988This option works only with DWARF debug output.
8989
8990@item -femit-struct-debug-reduced
8991@opindex femit-struct-debug-reduced
8992Emit debug information for struct-like types
8993only when the base name of the compilation source file
8994matches the base name of file in which the type is defined,
8995unless the struct is a template or defined in a system header.
8996
8997This option significantly reduces the size of debugging information,
8998with some potential loss in type information to the debugger.
8999See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9000See @option{-femit-struct-debug-detailed} for more detailed control.
9001
9002This option works only with DWARF debug output.
9003
9004@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9005@opindex femit-struct-debug-detailed
9006Specify the struct-like types
9007for which the compiler generates debug information.
9008The intent is to reduce duplicate struct debug information
9009between different object files within the same program.
9010
9011This option is a detailed version of
9012@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9013which serves for most needs.
9014
9015A specification has the syntax@*
9016[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9017
9018The optional first word limits the specification to
9019structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9020A struct type is used directly when it is the type of a variable, member.
9021Indirect uses arise through pointers to structs.
9022That is, when use of an incomplete struct is valid, the use is indirect.
9023An example is
9024@samp{struct one direct; struct two * indirect;}.
9025
9026The optional second word limits the specification to
9027ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9028Generic structs are a bit complicated to explain.
9029For C++, these are non-explicit specializations of template classes,
9030or non-template classes within the above.
9031Other programming languages have generics,
9032but @option{-femit-struct-debug-detailed} does not yet implement them.
9033
9034The third word specifies the source files for those
9035structs for which the compiler should emit debug information.
9036The values @samp{none} and @samp{any} have the normal meaning.
9037The value @samp{base} means that
9038the base of name of the file in which the type declaration appears
9039must match the base of the name of the main compilation file.
9040In practice, this means that when compiling @file{foo.c}, debug information
9041is generated for types declared in that file and @file{foo.h},
9042but not other header files.
9043The value @samp{sys} means those types satisfying @samp{base}
9044or declared in system or compiler headers.
9045
9046You may need to experiment to determine the best settings for your application.
9047
9048The default is @option{-femit-struct-debug-detailed=all}.
9049
9050This option works only with DWARF debug output.
9051
9052@item -fno-dwarf2-cfi-asm
9053@opindex fdwarf2-cfi-asm
9054@opindex fno-dwarf2-cfi-asm
9055Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9056instead of using GAS @code{.cfi_*} directives.
9057
9058@item -fno-eliminate-unused-debug-types
9059@opindex feliminate-unused-debug-types
9060@opindex fno-eliminate-unused-debug-types
9061Normally, when producing DWARF output, GCC avoids producing debug symbol
9062output for types that are nowhere used in the source file being compiled.
9063Sometimes it is useful to have GCC emit debugging
9064information for all types declared in a compilation
9065unit, regardless of whether or not they are actually used
9066in that compilation unit, for example
9067if, in the debugger, you want to cast a value to a type that is
9068not actually used in your program (but is declared).  More often,
9069however, this results in a significant amount of wasted space.
9070@end table
9071
9072@node Optimize Options
9073@section Options That Control Optimization
9074@cindex optimize options
9075@cindex options, optimization
9076
9077These options control various sorts of optimizations.
9078
9079Without any optimization option, the compiler's goal is to reduce the
9080cost of compilation and to make debugging produce the expected
9081results.  Statements are independent: if you stop the program with a
9082breakpoint between statements, you can then assign a new value to any
9083variable or change the program counter to any other statement in the
9084function and get exactly the results you expect from the source
9085code.
9086
9087Turning on optimization flags makes the compiler attempt to improve
9088the performance and/or code size at the expense of compilation time
9089and possibly the ability to debug the program.
9090
9091The compiler performs optimization based on the knowledge it has of the
9092program.  Compiling multiple files at once to a single output file mode allows
9093the compiler to use information gained from all of the files when compiling
9094each of them.
9095
9096Not all optimizations are controlled directly by a flag.  Only
9097optimizations that have a flag are listed in this section.
9098
9099Most optimizations are completely disabled at @option{-O0} or if an
9100@option{-O} level is not set on the command line, even if individual
9101optimization flags are specified.  Similarly, @option{-Og} suppresses
9102many optimization passes.
9103
9104Depending on the target and how GCC was configured, a slightly different
9105set of optimizations may be enabled at each @option{-O} level than
9106those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
9107to find out the exact set of optimizations that are enabled at each level.
9108@xref{Overall Options}, for examples.
9109
9110@table @gcctabopt
9111@item -O
9112@itemx -O1
9113@opindex O
9114@opindex O1
9115Optimize.  Optimizing compilation takes somewhat more time, and a lot
9116more memory for a large function.
9117
9118With @option{-O}, the compiler tries to reduce code size and execution
9119time, without performing any optimizations that take a great deal of
9120compilation time.
9121
9122@c Note that in addition to the default_options_table list in opts.c,
9123@c several optimization flags default to true but control optimization
9124@c passes that are explicitly disabled at -O0.
9125
9126@option{-O} turns on the following optimization flags:
9127
9128@c Please keep the following list alphabetized.
9129@gccoptlist{-fauto-inc-dec @gol
9130-fbranch-count-reg @gol
9131-fcombine-stack-adjustments @gol
9132-fcompare-elim @gol
9133-fcprop-registers @gol
9134-fdce @gol
9135-fdefer-pop @gol
9136-fdelayed-branch @gol
9137-fdse @gol
9138-fforward-propagate @gol
9139-fguess-branch-probability @gol
9140-fif-conversion @gol
9141-fif-conversion2 @gol
9142-finline-functions-called-once @gol
9143-fipa-profile @gol
9144-fipa-pure-const @gol
9145-fipa-reference @gol
9146-fipa-reference-addressable @gol
9147-fmerge-constants @gol
9148-fmove-loop-invariants @gol
9149-fomit-frame-pointer @gol
9150-freorder-blocks @gol
9151-fshrink-wrap @gol
9152-fshrink-wrap-separate @gol
9153-fsplit-wide-types @gol
9154-fssa-backprop @gol
9155-fssa-phiopt @gol
9156-ftree-bit-ccp @gol
9157-ftree-ccp @gol
9158-ftree-ch @gol
9159-ftree-coalesce-vars @gol
9160-ftree-copy-prop @gol
9161-ftree-dce @gol
9162-ftree-dominator-opts @gol
9163-ftree-dse @gol
9164-ftree-forwprop @gol
9165-ftree-fre @gol
9166-ftree-phiprop @gol
9167-ftree-pta @gol
9168-ftree-scev-cprop @gol
9169-ftree-sink @gol
9170-ftree-slsr @gol
9171-ftree-sra @gol
9172-ftree-ter @gol
9173-funit-at-a-time}
9174
9175@item -O2
9176@opindex O2
9177Optimize even more.  GCC performs nearly all supported optimizations
9178that do not involve a space-speed tradeoff.
9179As compared to @option{-O}, this option increases both compilation time
9180and the performance of the generated code.
9181
9182@option{-O2} turns on all optimization flags specified by @option{-O}.  It
9183also turns on the following optimization flags:
9184
9185@c Please keep the following list alphabetized!
9186@gccoptlist{-falign-functions  -falign-jumps @gol
9187-falign-labels  -falign-loops @gol
9188-fcaller-saves @gol
9189-fcode-hoisting @gol
9190-fcrossjumping @gol
9191-fcse-follow-jumps  -fcse-skip-blocks @gol
9192-fdelete-null-pointer-checks @gol
9193-fdevirtualize  -fdevirtualize-speculatively @gol
9194-fexpensive-optimizations @gol
9195-ffinite-loops @gol
9196-fgcse  -fgcse-lm  @gol
9197-fhoist-adjacent-loads @gol
9198-finline-functions @gol
9199-finline-small-functions @gol
9200-findirect-inlining @gol
9201-fipa-bit-cp  -fipa-cp  -fipa-icf @gol
9202-fipa-ra  -fipa-sra  -fipa-vrp @gol
9203-fisolate-erroneous-paths-dereference @gol
9204-flra-remat @gol
9205-foptimize-sibling-calls @gol
9206-foptimize-strlen @gol
9207-fpartial-inlining @gol
9208-fpeephole2 @gol
9209-freorder-blocks-algorithm=stc @gol
9210-freorder-blocks-and-partition  -freorder-functions @gol
9211-frerun-cse-after-loop  @gol
9212-fschedule-insns  -fschedule-insns2 @gol
9213-fsched-interblock  -fsched-spec @gol
9214-fstore-merging @gol
9215-fstrict-aliasing @gol
9216-fthread-jumps @gol
9217-ftree-builtin-call-dce @gol
9218-ftree-pre @gol
9219-ftree-switch-conversion  -ftree-tail-merge @gol
9220-ftree-vrp}
9221
9222Please note the warning under @option{-fgcse} about
9223invoking @option{-O2} on programs that use computed gotos.
9224
9225@item -O3
9226@opindex O3
9227Optimize yet more.  @option{-O3} turns on all optimizations specified
9228by @option{-O2} and also turns on the following optimization flags:
9229
9230@c Please keep the following list alphabetized!
9231@gccoptlist{-fgcse-after-reload @gol
9232-fipa-cp-clone
9233-floop-interchange @gol
9234-floop-unroll-and-jam @gol
9235-fpeel-loops @gol
9236-fpredictive-commoning @gol
9237-fsplit-loops @gol
9238-fsplit-paths @gol
9239-ftree-loop-distribution @gol
9240-ftree-loop-vectorize @gol
9241-ftree-partial-pre @gol
9242-ftree-slp-vectorize @gol
9243-funswitch-loops @gol
9244-fvect-cost-model @gol
9245-fvect-cost-model=dynamic @gol
9246-fversion-loops-for-strides}
9247
9248@item -O0
9249@opindex O0
9250Reduce compilation time and make debugging produce the expected
9251results.  This is the default.
9252
9253@item -Os
9254@opindex Os
9255Optimize for size.  @option{-Os} enables all @option{-O2} optimizations
9256except those that often increase code size:
9257
9258@gccoptlist{-falign-functions  -falign-jumps @gol
9259-falign-labels  -falign-loops @gol
9260-fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
9261
9262It also enables @option{-finline-functions}, causes the compiler to tune for
9263code size rather than execution speed, and performs further optimizations
9264designed to reduce code size.
9265
9266@item -Ofast
9267@opindex Ofast
9268Disregard strict standards compliance.  @option{-Ofast} enables all
9269@option{-O3} optimizations.  It also enables optimizations that are not
9270valid for all standard-compliant programs.
9271It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9272and the Fortran-specific @option{-fstack-arrays}, unless
9273@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9274
9275@item -Og
9276@opindex Og
9277Optimize debugging experience.  @option{-Og} should be the optimization
9278level of choice for the standard edit-compile-debug cycle, offering
9279a reasonable level of optimization while maintaining fast compilation
9280and a good debugging experience.  It is a better choice than @option{-O0}
9281for producing debuggable code because some compiler passes
9282that collect debug information are disabled at @option{-O0}.
9283
9284Like @option{-O0}, @option{-Og} completely disables a number of
9285optimization passes so that individual options controlling them have
9286no effect.  Otherwise @option{-Og} enables all @option{-O1}
9287optimization flags except for those that may interfere with debugging:
9288
9289@gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
9290-fdse  -fif-conversion  -fif-conversion2  @gol
9291-finline-functions-called-once @gol
9292-fmove-loop-invariants  -fssa-phiopt @gol
9293-ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
9294
9295@end table
9296
9297If you use multiple @option{-O} options, with or without level numbers,
9298the last such option is the one that is effective.
9299
9300Options of the form @option{-f@var{flag}} specify machine-independent
9301flags.  Most flags have both positive and negative forms; the negative
9302form of @option{-ffoo} is @option{-fno-foo}.  In the table
9303below, only one of the forms is listed---the one you typically
9304use.  You can figure out the other form by either removing @samp{no-}
9305or adding it.
9306
9307The following options control specific optimizations.  They are either
9308activated by @option{-O} options or are related to ones that are.  You
9309can use the following flags in the rare cases when ``fine-tuning'' of
9310optimizations to be performed is desired.
9311
9312@table @gcctabopt
9313@item -fno-defer-pop
9314@opindex fno-defer-pop
9315@opindex fdefer-pop
9316For machines that must pop arguments after a function call, always pop
9317the arguments as soon as each function returns.
9318At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9319this allows the compiler to let arguments accumulate on the stack for several
9320function calls and pop them all at once.
9321
9322@item -fforward-propagate
9323@opindex fforward-propagate
9324Perform a forward propagation pass on RTL@.  The pass tries to combine two
9325instructions and checks if the result can be simplified.  If loop unrolling
9326is active, two passes are performed and the second is scheduled after
9327loop unrolling.
9328
9329This option is enabled by default at optimization levels @option{-O},
9330@option{-O2}, @option{-O3}, @option{-Os}.
9331
9332@item -ffp-contract=@var{style}
9333@opindex ffp-contract
9334@option{-ffp-contract=off} disables floating-point expression contraction.
9335@option{-ffp-contract=fast} enables floating-point expression contraction
9336such as forming of fused multiply-add operations if the target has
9337native support for them.
9338@option{-ffp-contract=on} enables floating-point expression contraction
9339if allowed by the language standard.  This is currently not implemented
9340and treated equal to @option{-ffp-contract=off}.
9341
9342The default is @option{-ffp-contract=fast}.
9343
9344@item -fomit-frame-pointer
9345@opindex fomit-frame-pointer
9346Omit the frame pointer in functions that don't need one.  This avoids the
9347instructions to save, set up and restore the frame pointer; on many targets
9348it also makes an extra register available.
9349
9350On some targets this flag has no effect because the standard calling sequence
9351always uses a frame pointer, so it cannot be omitted.
9352
9353Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9354is used in all functions.  Several targets always omit the frame pointer in
9355leaf functions.
9356
9357Enabled by default at @option{-O} and higher.
9358
9359@item -foptimize-sibling-calls
9360@opindex foptimize-sibling-calls
9361Optimize sibling and tail recursive calls.
9362
9363Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9364
9365@item -foptimize-strlen
9366@opindex foptimize-strlen
9367Optimize various standard C string functions (e.g.@: @code{strlen},
9368@code{strchr} or @code{strcpy}) and
9369their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9370
9371Enabled at levels @option{-O2}, @option{-O3}.
9372
9373@item -fno-inline
9374@opindex fno-inline
9375@opindex finline
9376Do not expand any functions inline apart from those marked with
9377the @code{always_inline} attribute.  This is the default when not
9378optimizing.
9379
9380Single functions can be exempted from inlining by marking them
9381with the @code{noinline} attribute.
9382
9383@item -finline-small-functions
9384@opindex finline-small-functions
9385Integrate functions into their callers when their body is smaller than expected
9386function call code (so overall size of program gets smaller).  The compiler
9387heuristically decides which functions are simple enough to be worth integrating
9388in this way.  This inlining applies to all functions, even those not declared
9389inline.
9390
9391Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9392
9393@item -findirect-inlining
9394@opindex findirect-inlining
9395Inline also indirect calls that are discovered to be known at compile
9396time thanks to previous inlining.  This option has any effect only
9397when inlining itself is turned on by the @option{-finline-functions}
9398or @option{-finline-small-functions} options.
9399
9400Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9401
9402@item -finline-functions
9403@opindex finline-functions
9404Consider all functions for inlining, even if they are not declared inline.
9405The compiler heuristically decides which functions are worth integrating
9406in this way.
9407
9408If all calls to a given function are integrated, and the function is
9409declared @code{static}, then the function is normally not output as
9410assembler code in its own right.
9411
9412Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
9413by @option{-fprofile-use} and @option{-fauto-profile}.
9414
9415@item -finline-functions-called-once
9416@opindex finline-functions-called-once
9417Consider all @code{static} functions called once for inlining into their
9418caller even if they are not marked @code{inline}.  If a call to a given
9419function is integrated, then the function is not output as assembler code
9420in its own right.
9421
9422Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9423but not @option{-Og}.
9424
9425@item -fearly-inlining
9426@opindex fearly-inlining
9427Inline functions marked by @code{always_inline} and functions whose body seems
9428smaller than the function call overhead early before doing
9429@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
9430makes profiling significantly cheaper and usually inlining faster on programs
9431having large chains of nested wrapper functions.
9432
9433Enabled by default.
9434
9435@item -fipa-sra
9436@opindex fipa-sra
9437Perform interprocedural scalar replacement of aggregates, removal of
9438unused parameters and replacement of parameters passed by reference
9439by parameters passed by value.
9440
9441Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9442
9443@item -finline-limit=@var{n}
9444@opindex finline-limit
9445By default, GCC limits the size of functions that can be inlined.  This flag
9446allows coarse control of this limit.  @var{n} is the size of functions that
9447can be inlined in number of pseudo instructions.
9448
9449Inlining is actually controlled by a number of parameters, which may be
9450specified individually by using @option{--param @var{name}=@var{value}}.
9451The @option{-finline-limit=@var{n}} option sets some of these parameters
9452as follows:
9453
9454@table @gcctabopt
9455@item max-inline-insns-single
9456is set to @var{n}/2.
9457@item max-inline-insns-auto
9458is set to @var{n}/2.
9459@end table
9460
9461See below for a documentation of the individual
9462parameters controlling inlining and for the defaults of these parameters.
9463
9464@emph{Note:} there may be no value to @option{-finline-limit} that results
9465in default behavior.
9466
9467@emph{Note:} pseudo instruction represents, in this particular context, an
9468abstract measurement of function's size.  In no way does it represent a count
9469of assembly instructions and as such its exact meaning might change from one
9470release to an another.
9471
9472@item -fno-keep-inline-dllexport
9473@opindex fno-keep-inline-dllexport
9474@opindex fkeep-inline-dllexport
9475This is a more fine-grained version of @option{-fkeep-inline-functions},
9476which applies only to functions that are declared using the @code{dllexport}
9477attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
9478Functions}.
9479
9480@item -fkeep-inline-functions
9481@opindex fkeep-inline-functions
9482In C, emit @code{static} functions that are declared @code{inline}
9483into the object file, even if the function has been inlined into all
9484of its callers.  This switch does not affect functions using the
9485@code{extern inline} extension in GNU C90@.  In C++, emit any and all
9486inline functions into the object file.
9487
9488@item -fkeep-static-functions
9489@opindex fkeep-static-functions
9490Emit @code{static} functions into the object file, even if the function
9491is never used.
9492
9493@item -fkeep-static-consts
9494@opindex fkeep-static-consts
9495Emit variables declared @code{static const} when optimization isn't turned
9496on, even if the variables aren't referenced.
9497
9498GCC enables this option by default.  If you want to force the compiler to
9499check if a variable is referenced, regardless of whether or not
9500optimization is turned on, use the @option{-fno-keep-static-consts} option.
9501
9502@item -fmerge-constants
9503@opindex fmerge-constants
9504Attempt to merge identical constants (string constants and floating-point
9505constants) across compilation units.
9506
9507This option is the default for optimized compilation if the assembler and
9508linker support it.  Use @option{-fno-merge-constants} to inhibit this
9509behavior.
9510
9511Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9512
9513@item -fmerge-all-constants
9514@opindex fmerge-all-constants
9515Attempt to merge identical constants and identical variables.
9516
9517This option implies @option{-fmerge-constants}.  In addition to
9518@option{-fmerge-constants} this considers e.g.@: even constant initialized
9519arrays or initialized constant variables with integral or floating-point
9520types.  Languages like C or C++ require each variable, including multiple
9521instances of the same variable in recursive calls, to have distinct locations,
9522so using this option results in non-conforming
9523behavior.
9524
9525@item -fmodulo-sched
9526@opindex fmodulo-sched
9527Perform swing modulo scheduling immediately before the first scheduling
9528pass.  This pass looks at innermost loops and reorders their
9529instructions by overlapping different iterations.
9530
9531@item -fmodulo-sched-allow-regmoves
9532@opindex fmodulo-sched-allow-regmoves
9533Perform more aggressive SMS-based modulo scheduling with register moves
9534allowed.  By setting this flag certain anti-dependences edges are
9535deleted, which triggers the generation of reg-moves based on the
9536life-range analysis.  This option is effective only with
9537@option{-fmodulo-sched} enabled.
9538
9539@item -fno-branch-count-reg
9540@opindex fno-branch-count-reg
9541@opindex fbranch-count-reg
9542Disable the optimization pass that scans for opportunities to use
9543``decrement and branch'' instructions on a count register instead of
9544instruction sequences that decrement a register, compare it against zero, and
9545then branch based upon the result.  This option is only meaningful on
9546architectures that support such instructions, which include x86, PowerPC,
9547IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
9548doesn't remove the decrement and branch instructions from the generated
9549instruction stream introduced by other optimization passes.
9550
9551The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9552except for @option{-Og}.
9553
9554@item -fno-function-cse
9555@opindex fno-function-cse
9556@opindex ffunction-cse
9557Do not put function addresses in registers; make each instruction that
9558calls a constant function contain the function's address explicitly.
9559
9560This option results in less efficient code, but some strange hacks
9561that alter the assembler output may be confused by the optimizations
9562performed when this option is not used.
9563
9564The default is @option{-ffunction-cse}
9565
9566@item -fno-zero-initialized-in-bss
9567@opindex fno-zero-initialized-in-bss
9568@opindex fzero-initialized-in-bss
9569If the target supports a BSS section, GCC by default puts variables that
9570are initialized to zero into BSS@.  This can save space in the resulting
9571code.
9572
9573This option turns off this behavior because some programs explicitly
9574rely on variables going to the data section---e.g., so that the
9575resulting executable can find the beginning of that section and/or make
9576assumptions based on that.
9577
9578The default is @option{-fzero-initialized-in-bss}.
9579
9580@item -fthread-jumps
9581@opindex fthread-jumps
9582Perform optimizations that check to see if a jump branches to a
9583location where another comparison subsumed by the first is found.  If
9584so, the first branch is redirected to either the destination of the
9585second branch or a point immediately following it, depending on whether
9586the condition is known to be true or false.
9587
9588Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9589
9590@item -fsplit-wide-types
9591@opindex fsplit-wide-types
9592When using a type that occupies multiple registers, such as @code{long
9593long} on a 32-bit system, split the registers apart and allocate them
9594independently.  This normally generates better code for those types,
9595but may make debugging more difficult.
9596
9597Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9598@option{-Os}.
9599
9600@item -fsplit-wide-types-early
9601@opindex fsplit-wide-types-early
9602Fully split wide types early, instead of very late.
9603This option has no effect unless @option{-fsplit-wide-types} is turned on.
9604
9605This is the default on some targets.
9606
9607@item -fcse-follow-jumps
9608@opindex fcse-follow-jumps
9609In common subexpression elimination (CSE), scan through jump instructions
9610when the target of the jump is not reached by any other path.  For
9611example, when CSE encounters an @code{if} statement with an
9612@code{else} clause, CSE follows the jump when the condition
9613tested is false.
9614
9615Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9616
9617@item -fcse-skip-blocks
9618@opindex fcse-skip-blocks
9619This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9620follow jumps that conditionally skip over blocks.  When CSE
9621encounters a simple @code{if} statement with no else clause,
9622@option{-fcse-skip-blocks} causes CSE to follow the jump around the
9623body of the @code{if}.
9624
9625Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9626
9627@item -frerun-cse-after-loop
9628@opindex frerun-cse-after-loop
9629Re-run common subexpression elimination after loop optimizations are
9630performed.
9631
9632Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9633
9634@item -fgcse
9635@opindex fgcse
9636Perform a global common subexpression elimination pass.
9637This pass also performs global constant and copy propagation.
9638
9639@emph{Note:} When compiling a program using computed gotos, a GCC
9640extension, you may get better run-time performance if you disable
9641the global common subexpression elimination pass by adding
9642@option{-fno-gcse} to the command line.
9643
9644Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9645
9646@item -fgcse-lm
9647@opindex fgcse-lm
9648When @option{-fgcse-lm} is enabled, global common subexpression elimination
9649attempts to move loads that are only killed by stores into themselves.  This
9650allows a loop containing a load/store sequence to be changed to a load outside
9651the loop, and a copy/store within the loop.
9652
9653Enabled by default when @option{-fgcse} is enabled.
9654
9655@item -fgcse-sm
9656@opindex fgcse-sm
9657When @option{-fgcse-sm} is enabled, a store motion pass is run after
9658global common subexpression elimination.  This pass attempts to move
9659stores out of loops.  When used in conjunction with @option{-fgcse-lm},
9660loops containing a load/store sequence can be changed to a load before
9661the loop and a store after the loop.
9662
9663Not enabled at any optimization level.
9664
9665@item -fgcse-las
9666@opindex fgcse-las
9667When @option{-fgcse-las} is enabled, the global common subexpression
9668elimination pass eliminates redundant loads that come after stores to the
9669same memory location (both partial and full redundancies).
9670
9671Not enabled at any optimization level.
9672
9673@item -fgcse-after-reload
9674@opindex fgcse-after-reload
9675When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9676pass is performed after reload.  The purpose of this pass is to clean up
9677redundant spilling.
9678
9679Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9680
9681@item -faggressive-loop-optimizations
9682@opindex faggressive-loop-optimizations
9683This option tells the loop optimizer to use language constraints to
9684derive bounds for the number of iterations of a loop.  This assumes that
9685loop code does not invoke undefined behavior by for example causing signed
9686integer overflows or out-of-bound array accesses.  The bounds for the
9687number of iterations of a loop are used to guide loop unrolling and peeling
9688and loop exit test optimizations.
9689This option is enabled by default.
9690
9691@item -funconstrained-commons
9692@opindex funconstrained-commons
9693This option tells the compiler that variables declared in common blocks
9694(e.g.@: Fortran) may later be overridden with longer trailing arrays. This
9695prevents certain optimizations that depend on knowing the array bounds.
9696
9697@item -fcrossjumping
9698@opindex fcrossjumping
9699Perform cross-jumping transformation.
9700This transformation unifies equivalent code and saves code size.  The
9701resulting code may or may not perform better than without cross-jumping.
9702
9703Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9704
9705@item -fauto-inc-dec
9706@opindex fauto-inc-dec
9707Combine increments or decrements of addresses with memory accesses.
9708This pass is always skipped on architectures that do not have
9709instructions to support this.  Enabled by default at @option{-O} and
9710higher on architectures that support this.
9711
9712@item -fdce
9713@opindex fdce
9714Perform dead code elimination (DCE) on RTL@.
9715Enabled by default at @option{-O} and higher.
9716
9717@item -fdse
9718@opindex fdse
9719Perform dead store elimination (DSE) on RTL@.
9720Enabled by default at @option{-O} and higher.
9721
9722@item -fif-conversion
9723@opindex fif-conversion
9724Attempt to transform conditional jumps into branch-less equivalents.  This
9725includes use of conditional moves, min, max, set flags and abs instructions, and
9726some tricks doable by standard arithmetics.  The use of conditional execution
9727on chips where it is available is controlled by @option{-fif-conversion2}.
9728
9729Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9730not with @option{-Og}.
9731
9732@item -fif-conversion2
9733@opindex fif-conversion2
9734Use conditional execution (where available) to transform conditional jumps into
9735branch-less equivalents.
9736
9737Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9738not with @option{-Og}.
9739
9740@item -fdeclone-ctor-dtor
9741@opindex fdeclone-ctor-dtor
9742The C++ ABI requires multiple entry points for constructors and
9743destructors: one for a base subobject, one for a complete object, and
9744one for a virtual destructor that calls operator delete afterwards.
9745For a hierarchy with virtual bases, the base and complete variants are
9746clones, which means two copies of the function.  With this option, the
9747base and complete variants are changed to be thunks that call a common
9748implementation.
9749
9750Enabled by @option{-Os}.
9751
9752@item -fdelete-null-pointer-checks
9753@opindex fdelete-null-pointer-checks
9754Assume that programs cannot safely dereference null pointers, and that
9755no code or data element resides at address zero.
9756This option enables simple constant
9757folding optimizations at all optimization levels.  In addition, other
9758optimization passes in GCC use this flag to control global dataflow
9759analyses that eliminate useless checks for null pointers; these assume
9760that a memory access to address zero always results in a trap, so
9761that if a pointer is checked after it has already been dereferenced,
9762it cannot be null.
9763
9764Note however that in some environments this assumption is not true.
9765Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9766for programs that depend on that behavior.
9767
9768This option is enabled by default on most targets.  On Nios II ELF, it
9769defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
9770
9771Passes that use the dataflow information
9772are enabled independently at different optimization levels.
9773
9774@item -fdevirtualize
9775@opindex fdevirtualize
9776Attempt to convert calls to virtual functions to direct calls.  This
9777is done both within a procedure and interprocedurally as part of
9778indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9779propagation (@option{-fipa-cp}).
9780Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9781
9782@item -fdevirtualize-speculatively
9783@opindex fdevirtualize-speculatively
9784Attempt to convert calls to virtual functions to speculative direct calls.
9785Based on the analysis of the type inheritance graph, determine for a given call
9786the set of likely targets. If the set is small, preferably of size 1, change
9787the call into a conditional deciding between direct and indirect calls.  The
9788speculative calls enable more optimizations, such as inlining.  When they seem
9789useless after further optimization, they are converted back into original form.
9790
9791@item -fdevirtualize-at-ltrans
9792@opindex fdevirtualize-at-ltrans
9793Stream extra information needed for aggressive devirtualization when running
9794the link-time optimizer in local transformation mode.
9795This option enables more devirtualization but
9796significantly increases the size of streamed data. For this reason it is
9797disabled by default.
9798
9799@item -fexpensive-optimizations
9800@opindex fexpensive-optimizations
9801Perform a number of minor optimizations that are relatively expensive.
9802
9803Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9804
9805@item -free
9806@opindex free
9807Attempt to remove redundant extension instructions.  This is especially
9808helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9809registers after writing to their lower 32-bit half.
9810
9811Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9812@option{-O3}, @option{-Os}.
9813
9814@item -fno-lifetime-dse
9815@opindex fno-lifetime-dse
9816@opindex flifetime-dse
9817In C++ the value of an object is only affected by changes within its
9818lifetime: when the constructor begins, the object has an indeterminate
9819value, and any changes during the lifetime of the object are dead when
9820the object is destroyed.  Normally dead store elimination will take
9821advantage of this; if your code relies on the value of the object
9822storage persisting beyond the lifetime of the object, you can use this
9823flag to disable this optimization.  To preserve stores before the
9824constructor starts (e.g.@: because your operator new clears the object
9825storage) but still treat the object as dead after the destructor, you
9826can use @option{-flifetime-dse=1}.  The default behavior can be
9827explicitly selected with @option{-flifetime-dse=2}.
9828@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9829
9830@item -flive-range-shrinkage
9831@opindex flive-range-shrinkage
9832Attempt to decrease register pressure through register live range
9833shrinkage.  This is helpful for fast processors with small or moderate
9834size register sets.
9835
9836@item -fira-algorithm=@var{algorithm}
9837@opindex fira-algorithm
9838Use the specified coloring algorithm for the integrated register
9839allocator.  The @var{algorithm} argument can be @samp{priority}, which
9840specifies Chow's priority coloring, or @samp{CB}, which specifies
9841Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
9842for all architectures, but for those targets that do support it, it is
9843the default because it generates better code.
9844
9845@item -fira-region=@var{region}
9846@opindex fira-region
9847Use specified regions for the integrated register allocator.  The
9848@var{region} argument should be one of the following:
9849
9850@table @samp
9851
9852@item all
9853Use all loops as register allocation regions.
9854This can give the best results for machines with a small and/or
9855irregular register set.
9856
9857@item mixed
9858Use all loops except for loops with small register pressure
9859as the regions.  This value usually gives
9860the best results in most cases and for most architectures,
9861and is enabled by default when compiling with optimization for speed
9862(@option{-O}, @option{-O2}, @dots{}).
9863
9864@item one
9865Use all functions as a single region.
9866This typically results in the smallest code size, and is enabled by default for
9867@option{-Os} or @option{-O0}.
9868
9869@end table
9870
9871@item -fira-hoist-pressure
9872@opindex fira-hoist-pressure
9873Use IRA to evaluate register pressure in the code hoisting pass for
9874decisions to hoist expressions.  This option usually results in smaller
9875code, but it can slow the compiler down.
9876
9877This option is enabled at level @option{-Os} for all targets.
9878
9879@item -fira-loop-pressure
9880@opindex fira-loop-pressure
9881Use IRA to evaluate register pressure in loops for decisions to move
9882loop invariants.  This option usually results in generation
9883of faster and smaller code on machines with large register files (>= 32
9884registers), but it can slow the compiler down.
9885
9886This option is enabled at level @option{-O3} for some targets.
9887
9888@item -fno-ira-share-save-slots
9889@opindex fno-ira-share-save-slots
9890@opindex fira-share-save-slots
9891Disable sharing of stack slots used for saving call-used hard
9892registers living through a call.  Each hard register gets a
9893separate stack slot, and as a result function stack frames are
9894larger.
9895
9896@item -fno-ira-share-spill-slots
9897@opindex fno-ira-share-spill-slots
9898@opindex fira-share-spill-slots
9899Disable sharing of stack slots allocated for pseudo-registers.  Each
9900pseudo-register that does not get a hard register gets a separate
9901stack slot, and as a result function stack frames are larger.
9902
9903@item -flra-remat
9904@opindex flra-remat
9905Enable CFG-sensitive rematerialization in LRA.  Instead of loading
9906values of spilled pseudos, LRA tries to rematerialize (recalculate)
9907values if it is profitable.
9908
9909Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9910
9911@item -fdelayed-branch
9912@opindex fdelayed-branch
9913If supported for the target machine, attempt to reorder instructions
9914to exploit instruction slots available after delayed branch
9915instructions.
9916
9917Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9918but not at @option{-Og}.
9919
9920@item -fschedule-insns
9921@opindex fschedule-insns
9922If supported for the target machine, attempt to reorder instructions to
9923eliminate execution stalls due to required data being unavailable.  This
9924helps machines that have slow floating point or memory load instructions
9925by allowing other instructions to be issued until the result of the load
9926or floating-point instruction is required.
9927
9928Enabled at levels @option{-O2}, @option{-O3}.
9929
9930@item -fschedule-insns2
9931@opindex fschedule-insns2
9932Similar to @option{-fschedule-insns}, but requests an additional pass of
9933instruction scheduling after register allocation has been done.  This is
9934especially useful on machines with a relatively small number of
9935registers and where memory load instructions take more than one cycle.
9936
9937Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9938
9939@item -fno-sched-interblock
9940@opindex fno-sched-interblock
9941@opindex fsched-interblock
9942Disable instruction scheduling across basic blocks, which
9943is normally enabled when scheduling before register allocation, i.e.@:
9944with @option{-fschedule-insns} or at @option{-O2} or higher.
9945
9946@item -fno-sched-spec
9947@opindex fno-sched-spec
9948@opindex fsched-spec
9949Disable speculative motion of non-load instructions, which
9950is normally enabled when scheduling before register allocation, i.e.@:
9951with @option{-fschedule-insns} or at @option{-O2} or higher.
9952
9953@item -fsched-pressure
9954@opindex fsched-pressure
9955Enable register pressure sensitive insn scheduling before register
9956allocation.  This only makes sense when scheduling before register
9957allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9958@option{-O2} or higher.  Usage of this option can improve the
9959generated code and decrease its size by preventing register pressure
9960increase above the number of available hard registers and subsequent
9961spills in register allocation.
9962
9963@item -fsched-spec-load
9964@opindex fsched-spec-load
9965Allow speculative motion of some load instructions.  This only makes
9966sense when scheduling before register allocation, i.e.@: with
9967@option{-fschedule-insns} or at @option{-O2} or higher.
9968
9969@item -fsched-spec-load-dangerous
9970@opindex fsched-spec-load-dangerous
9971Allow speculative motion of more load instructions.  This only makes
9972sense when scheduling before register allocation, i.e.@: with
9973@option{-fschedule-insns} or at @option{-O2} or higher.
9974
9975@item -fsched-stalled-insns
9976@itemx -fsched-stalled-insns=@var{n}
9977@opindex fsched-stalled-insns
9978Define how many insns (if any) can be moved prematurely from the queue
9979of stalled insns into the ready list during the second scheduling pass.
9980@option{-fno-sched-stalled-insns} means that no insns are moved
9981prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9982on how many queued insns can be moved prematurely.
9983@option{-fsched-stalled-insns} without a value is equivalent to
9984@option{-fsched-stalled-insns=1}.
9985
9986@item -fsched-stalled-insns-dep
9987@itemx -fsched-stalled-insns-dep=@var{n}
9988@opindex fsched-stalled-insns-dep
9989Define how many insn groups (cycles) are examined for a dependency
9990on a stalled insn that is a candidate for premature removal from the queue
9991of stalled insns.  This has an effect only during the second scheduling pass,
9992and only if @option{-fsched-stalled-insns} is used.
9993@option{-fno-sched-stalled-insns-dep} is equivalent to
9994@option{-fsched-stalled-insns-dep=0}.
9995@option{-fsched-stalled-insns-dep} without a value is equivalent to
9996@option{-fsched-stalled-insns-dep=1}.
9997
9998@item -fsched2-use-superblocks
9999@opindex fsched2-use-superblocks
10000When scheduling after register allocation, use superblock scheduling.
10001This allows motion across basic block boundaries,
10002resulting in faster schedules.  This option is experimental, as not all machine
10003descriptions used by GCC model the CPU closely enough to avoid unreliable
10004results from the algorithm.
10005
10006This only makes sense when scheduling after register allocation, i.e.@: with
10007@option{-fschedule-insns2} or at @option{-O2} or higher.
10008
10009@item -fsched-group-heuristic
10010@opindex fsched-group-heuristic
10011Enable the group heuristic in the scheduler.  This heuristic favors
10012the instruction that belongs to a schedule group.  This is enabled
10013by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10014or @option{-fschedule-insns2} or at @option{-O2} or higher.
10015
10016@item -fsched-critical-path-heuristic
10017@opindex fsched-critical-path-heuristic
10018Enable the critical-path heuristic in the scheduler.  This heuristic favors
10019instructions on the critical path.  This is enabled by default when
10020scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10021or @option{-fschedule-insns2} or at @option{-O2} or higher.
10022
10023@item -fsched-spec-insn-heuristic
10024@opindex fsched-spec-insn-heuristic
10025Enable the speculative instruction heuristic in the scheduler.  This
10026heuristic favors speculative instructions with greater dependency weakness.
10027This is enabled by default when scheduling is enabled, i.e.@:
10028with @option{-fschedule-insns} or @option{-fschedule-insns2}
10029or at @option{-O2} or higher.
10030
10031@item -fsched-rank-heuristic
10032@opindex fsched-rank-heuristic
10033Enable the rank heuristic in the scheduler.  This heuristic favors
10034the instruction belonging to a basic block with greater size or frequency.
10035This is enabled by default when scheduling is enabled, i.e.@:
10036with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10037at @option{-O2} or higher.
10038
10039@item -fsched-last-insn-heuristic
10040@opindex fsched-last-insn-heuristic
10041Enable the last-instruction heuristic in the scheduler.  This heuristic
10042favors the instruction that is less dependent on the last instruction
10043scheduled.  This is enabled by default when scheduling is enabled,
10044i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10045at @option{-O2} or higher.
10046
10047@item -fsched-dep-count-heuristic
10048@opindex fsched-dep-count-heuristic
10049Enable the dependent-count heuristic in the scheduler.  This heuristic
10050favors the instruction that has more instructions depending on it.
10051This is enabled by default when scheduling is enabled, i.e.@:
10052with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10053at @option{-O2} or higher.
10054
10055@item -freschedule-modulo-scheduled-loops
10056@opindex freschedule-modulo-scheduled-loops
10057Modulo scheduling is performed before traditional scheduling.  If a loop
10058is modulo scheduled, later scheduling passes may change its schedule.
10059Use this option to control that behavior.
10060
10061@item -fselective-scheduling
10062@opindex fselective-scheduling
10063Schedule instructions using selective scheduling algorithm.  Selective
10064scheduling runs instead of the first scheduler pass.
10065
10066@item -fselective-scheduling2
10067@opindex fselective-scheduling2
10068Schedule instructions using selective scheduling algorithm.  Selective
10069scheduling runs instead of the second scheduler pass.
10070
10071@item -fsel-sched-pipelining
10072@opindex fsel-sched-pipelining
10073Enable software pipelining of innermost loops during selective scheduling.
10074This option has no effect unless one of @option{-fselective-scheduling} or
10075@option{-fselective-scheduling2} is turned on.
10076
10077@item -fsel-sched-pipelining-outer-loops
10078@opindex fsel-sched-pipelining-outer-loops
10079When pipelining loops during selective scheduling, also pipeline outer loops.
10080This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10081
10082@item -fsemantic-interposition
10083@opindex fsemantic-interposition
10084Some object formats, like ELF, allow interposing of symbols by the
10085dynamic linker.
10086This means that for symbols exported from the DSO, the compiler cannot perform
10087interprocedural propagation, inlining and other optimizations in anticipation
10088that the function or variable in question may change. While this feature is
10089useful, for example, to rewrite memory allocation functions by a debugging
10090implementation, it is expensive in the terms of code quality.
10091With @option{-fno-semantic-interposition} the compiler assumes that
10092if interposition happens for functions the overwriting function will have
10093precisely the same semantics (and side effects).
10094Similarly if interposition happens
10095for variables, the constructor of the variable will be the same. The flag
10096has no effect for functions explicitly declared inline
10097(where it is never allowed for interposition to change semantics)
10098and for symbols explicitly declared weak.
10099
10100@item -fshrink-wrap
10101@opindex fshrink-wrap
10102Emit function prologues only before parts of the function that need it,
10103rather than at the top of the function.  This flag is enabled by default at
10104@option{-O} and higher.
10105
10106@item -fshrink-wrap-separate
10107@opindex fshrink-wrap-separate
10108Shrink-wrap separate parts of the prologue and epilogue separately, so that
10109those parts are only executed when needed.
10110This option is on by default, but has no effect unless @option{-fshrink-wrap}
10111is also turned on and the target supports this.
10112
10113@item -fcaller-saves
10114@opindex fcaller-saves
10115Enable allocation of values to registers that are clobbered by
10116function calls, by emitting extra instructions to save and restore the
10117registers around such calls.  Such allocation is done only when it
10118seems to result in better code.
10119
10120This option is always enabled by default on certain machines, usually
10121those which have no call-preserved registers to use instead.
10122
10123Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10124
10125@item -fcombine-stack-adjustments
10126@opindex fcombine-stack-adjustments
10127Tracks stack adjustments (pushes and pops) and stack memory references
10128and then tries to find ways to combine them.
10129
10130Enabled by default at @option{-O1} and higher.
10131
10132@item -fipa-ra
10133@opindex fipa-ra
10134Use caller save registers for allocation if those registers are not used by
10135any called function.  In that case it is not necessary to save and restore
10136them around calls.  This is only possible if called functions are part of
10137same compilation unit as current function and they are compiled before it.
10138
10139Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10140is disabled if generated code will be instrumented for profiling
10141(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10142exactly (this happens on targets that do not expose prologues
10143and epilogues in RTL).
10144
10145@item -fconserve-stack
10146@opindex fconserve-stack
10147Attempt to minimize stack usage.  The compiler attempts to use less
10148stack space, even if that makes the program slower.  This option
10149implies setting the @option{large-stack-frame} parameter to 100
10150and the @option{large-stack-frame-growth} parameter to 400.
10151
10152@item -ftree-reassoc
10153@opindex ftree-reassoc
10154Perform reassociation on trees.  This flag is enabled by default
10155at @option{-O} and higher.
10156
10157@item -fcode-hoisting
10158@opindex fcode-hoisting
10159Perform code hoisting.  Code hoisting tries to move the
10160evaluation of expressions executed on all paths to the function exit
10161as early as possible.  This is especially useful as a code size
10162optimization, but it often helps for code speed as well.
10163This flag is enabled by default at @option{-O2} and higher.
10164
10165@item -ftree-pre
10166@opindex ftree-pre
10167Perform partial redundancy elimination (PRE) on trees.  This flag is
10168enabled by default at @option{-O2} and @option{-O3}.
10169
10170@item -ftree-partial-pre
10171@opindex ftree-partial-pre
10172Make partial redundancy elimination (PRE) more aggressive.  This flag is
10173enabled by default at @option{-O3}.
10174
10175@item -ftree-forwprop
10176@opindex ftree-forwprop
10177Perform forward propagation on trees.  This flag is enabled by default
10178at @option{-O} and higher.
10179
10180@item -ftree-fre
10181@opindex ftree-fre
10182Perform full redundancy elimination (FRE) on trees.  The difference
10183between FRE and PRE is that FRE only considers expressions
10184that are computed on all paths leading to the redundant computation.
10185This analysis is faster than PRE, though it exposes fewer redundancies.
10186This flag is enabled by default at @option{-O} and higher.
10187
10188@item -ftree-phiprop
10189@opindex ftree-phiprop
10190Perform hoisting of loads from conditional pointers on trees.  This
10191pass is enabled by default at @option{-O} and higher.
10192
10193@item -fhoist-adjacent-loads
10194@opindex fhoist-adjacent-loads
10195Speculatively hoist loads from both branches of an if-then-else if the
10196loads are from adjacent locations in the same structure and the target
10197architecture has a conditional move instruction.  This flag is enabled
10198by default at @option{-O2} and higher.
10199
10200@item -ftree-copy-prop
10201@opindex ftree-copy-prop
10202Perform copy propagation on trees.  This pass eliminates unnecessary
10203copy operations.  This flag is enabled by default at @option{-O} and
10204higher.
10205
10206@item -fipa-pure-const
10207@opindex fipa-pure-const
10208Discover which functions are pure or constant.
10209Enabled by default at @option{-O} and higher.
10210
10211@item -fipa-reference
10212@opindex fipa-reference
10213Discover which static variables do not escape the
10214compilation unit.
10215Enabled by default at @option{-O} and higher.
10216
10217@item -fipa-reference-addressable
10218@opindex fipa-reference-addressable
10219Discover read-only, write-only and non-addressable static variables.
10220Enabled by default at @option{-O} and higher.
10221
10222@item -fipa-stack-alignment
10223@opindex fipa-stack-alignment
10224Reduce stack alignment on call sites if possible.
10225Enabled by default.
10226
10227@item -fipa-pta
10228@opindex fipa-pta
10229Perform interprocedural pointer analysis and interprocedural modification
10230and reference analysis.  This option can cause excessive memory and
10231compile-time usage on large compilation units.  It is not enabled by
10232default at any optimization level.
10233
10234@item -fipa-profile
10235@opindex fipa-profile
10236Perform interprocedural profile propagation.  The functions called only from
10237cold functions are marked as cold. Also functions executed once (such as
10238@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10239functions and loop less parts of functions executed once are then optimized for
10240size.
10241Enabled by default at @option{-O} and higher.
10242
10243@item -fipa-cp
10244@opindex fipa-cp
10245Perform interprocedural constant propagation.
10246This optimization analyzes the program to determine when values passed
10247to functions are constants and then optimizes accordingly.
10248This optimization can substantially increase performance
10249if the application has constants passed to functions.
10250This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10251It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10252
10253@item -fipa-cp-clone
10254@opindex fipa-cp-clone
10255Perform function cloning to make interprocedural constant propagation stronger.
10256When enabled, interprocedural constant propagation performs function cloning
10257when externally visible function can be called with constant arguments.
10258Because this optimization can create multiple copies of functions,
10259it may significantly increase code size
10260(see @option{--param ipa-cp-unit-growth=@var{value}}).
10261This flag is enabled by default at @option{-O3}.
10262It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10263
10264@item -fipa-bit-cp
10265@opindex fipa-bit-cp
10266When enabled, perform interprocedural bitwise constant
10267propagation. This flag is enabled by default at @option{-O2} and
10268by @option{-fprofile-use} and @option{-fauto-profile}.
10269It requires that @option{-fipa-cp} is enabled.
10270
10271@item -fipa-vrp
10272@opindex fipa-vrp
10273When enabled, perform interprocedural propagation of value
10274ranges. This flag is enabled by default at @option{-O2}. It requires
10275that @option{-fipa-cp} is enabled.
10276
10277@item -fipa-icf
10278@opindex fipa-icf
10279Perform Identical Code Folding for functions and read-only variables.
10280The optimization reduces code size and may disturb unwind stacks by replacing
10281a function by equivalent one with a different name. The optimization works
10282more effectively with link-time optimization enabled.
10283
10284Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10285works on different levels and thus the optimizations are not same - there are
10286equivalences that are found only by GCC and equivalences found only by Gold.
10287
10288This flag is enabled by default at @option{-O2} and @option{-Os}.
10289
10290@item -flive-patching=@var{level}
10291@opindex flive-patching
10292Control GCC's optimizations to produce output suitable for live-patching.
10293
10294If the compiler's optimization uses a function's body or information extracted
10295from its body to optimize/change another function, the latter is called an
10296impacted function of the former.  If a function is patched, its impacted
10297functions should be patched too.
10298
10299The impacted functions are determined by the compiler's interprocedural
10300optimizations.  For example, a caller is impacted when inlining a function
10301into its caller,
10302cloning a function and changing its caller to call this new clone,
10303or extracting a function's pureness/constness information to optimize
10304its direct or indirect callers, etc.
10305
10306Usually, the more IPA optimizations enabled, the larger the number of
10307impacted functions for each function.  In order to control the number of
10308impacted functions and more easily compute the list of impacted function,
10309IPA optimizations can be partially enabled at two different levels.
10310
10311The @var{level} argument should be one of the following:
10312
10313@table @samp
10314
10315@item inline-clone
10316
10317Only enable inlining and cloning optimizations, which includes inlining,
10318cloning, interprocedural scalar replacement of aggregates and partial inlining.
10319As a result, when patching a function, all its callers and its clones'
10320callers are impacted, therefore need to be patched as well.
10321
10322@option{-flive-patching=inline-clone} disables the following optimization flags:
10323@gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
10324-fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
10325-fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
10326-fipa-stack-alignment}
10327
10328@item inline-only-static
10329
10330Only enable inlining of static functions.
10331As a result, when patching a static function, all its callers are impacted
10332and so need to be patched as well.
10333
10334In addition to all the flags that @option{-flive-patching=inline-clone}
10335disables,
10336@option{-flive-patching=inline-only-static} disables the following additional
10337optimization flags:
10338@gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
10339
10340@end table
10341
10342When @option{-flive-patching} is specified without any value, the default value
10343is @var{inline-clone}.
10344
10345This flag is disabled by default.
10346
10347Note that @option{-flive-patching} is not supported with link-time optimization
10348(@option{-flto}).
10349
10350@item -fisolate-erroneous-paths-dereference
10351@opindex fisolate-erroneous-paths-dereference
10352Detect paths that trigger erroneous or undefined behavior due to
10353dereferencing a null pointer.  Isolate those paths from the main control
10354flow and turn the statement with erroneous or undefined behavior into a trap.
10355This flag is enabled by default at @option{-O2} and higher and depends on
10356@option{-fdelete-null-pointer-checks} also being enabled.
10357
10358@item -fisolate-erroneous-paths-attribute
10359@opindex fisolate-erroneous-paths-attribute
10360Detect paths that trigger erroneous or undefined behavior due to a null value
10361being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10362attribute.  Isolate those paths from the main control flow and turn the
10363statement with erroneous or undefined behavior into a trap.  This is not
10364currently enabled, but may be enabled by @option{-O2} in the future.
10365
10366@item -ftree-sink
10367@opindex ftree-sink
10368Perform forward store motion on trees.  This flag is
10369enabled by default at @option{-O} and higher.
10370
10371@item -ftree-bit-ccp
10372@opindex ftree-bit-ccp
10373Perform sparse conditional bit constant propagation on trees and propagate
10374pointer alignment information.
10375This pass only operates on local scalar variables and is enabled by default
10376at @option{-O1} and higher, except for @option{-Og}.
10377It requires that @option{-ftree-ccp} is enabled.
10378
10379@item -ftree-ccp
10380@opindex ftree-ccp
10381Perform sparse conditional constant propagation (CCP) on trees.  This
10382pass only operates on local scalar variables and is enabled by default
10383at @option{-O} and higher.
10384
10385@item -fssa-backprop
10386@opindex fssa-backprop
10387Propagate information about uses of a value up the definition chain
10388in order to simplify the definitions.  For example, this pass strips
10389sign operations if the sign of a value never matters.  The flag is
10390enabled by default at @option{-O} and higher.
10391
10392@item -fssa-phiopt
10393@opindex fssa-phiopt
10394Perform pattern matching on SSA PHI nodes to optimize conditional
10395code.  This pass is enabled by default at @option{-O1} and higher,
10396except for @option{-Og}.
10397
10398@item -ftree-switch-conversion
10399@opindex ftree-switch-conversion
10400Perform conversion of simple initializations in a switch to
10401initializations from a scalar array.  This flag is enabled by default
10402at @option{-O2} and higher.
10403
10404@item -ftree-tail-merge
10405@opindex ftree-tail-merge
10406Look for identical code sequences.  When found, replace one with a jump to the
10407other.  This optimization is known as tail merging or cross jumping.  This flag
10408is enabled by default at @option{-O2} and higher.  The compilation time
10409in this pass can
10410be limited using @option{max-tail-merge-comparisons} parameter and
10411@option{max-tail-merge-iterations} parameter.
10412
10413@item -ftree-dce
10414@opindex ftree-dce
10415Perform dead code elimination (DCE) on trees.  This flag is enabled by
10416default at @option{-O} and higher.
10417
10418@item -ftree-builtin-call-dce
10419@opindex ftree-builtin-call-dce
10420Perform conditional dead code elimination (DCE) for calls to built-in functions
10421that may set @code{errno} but are otherwise free of side effects.  This flag is
10422enabled by default at @option{-O2} and higher if @option{-Os} is not also
10423specified.
10424
10425@item -ffinite-loops
10426@opindex ffinite-loops
10427@opindex fno-finite-loops
10428Assume that a loop with an exit will eventually take the exit and not loop
10429indefinitely.  This allows the compiler to remove loops that otherwise have
10430no side-effects, not considering eventual endless looping as such.
10431
10432This option is enabled by default at @option{-O2} for C++ with -std=c++11
10433or higher.
10434
10435@item -ftree-dominator-opts
10436@opindex ftree-dominator-opts
10437Perform a variety of simple scalar cleanups (constant/copy
10438propagation, redundancy elimination, range propagation and expression
10439simplification) based on a dominator tree traversal.  This also
10440performs jump threading (to reduce jumps to jumps). This flag is
10441enabled by default at @option{-O} and higher.
10442
10443@item -ftree-dse
10444@opindex ftree-dse
10445Perform dead store elimination (DSE) on trees.  A dead store is a store into
10446a memory location that is later overwritten by another store without
10447any intervening loads.  In this case the earlier store can be deleted.  This
10448flag is enabled by default at @option{-O} and higher.
10449
10450@item -ftree-ch
10451@opindex ftree-ch
10452Perform loop header copying on trees.  This is beneficial since it increases
10453effectiveness of code motion optimizations.  It also saves one jump.  This flag
10454is enabled by default at @option{-O} and higher.  It is not enabled
10455for @option{-Os}, since it usually increases code size.
10456
10457@item -ftree-loop-optimize
10458@opindex ftree-loop-optimize
10459Perform loop optimizations on trees.  This flag is enabled by default
10460at @option{-O} and higher.
10461
10462@item -ftree-loop-linear
10463@itemx -floop-strip-mine
10464@itemx -floop-block
10465@opindex ftree-loop-linear
10466@opindex floop-strip-mine
10467@opindex floop-block
10468Perform loop nest optimizations.  Same as
10469@option{-floop-nest-optimize}.  To use this code transformation, GCC has
10470to be configured with @option{--with-isl} to enable the Graphite loop
10471transformation infrastructure.
10472
10473@item -fgraphite-identity
10474@opindex fgraphite-identity
10475Enable the identity transformation for graphite.  For every SCoP we generate
10476the polyhedral representation and transform it back to gimple.  Using
10477@option{-fgraphite-identity} we can check the costs or benefits of the
10478GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
10479are also performed by the code generator isl, like index splitting and
10480dead code elimination in loops.
10481
10482@item -floop-nest-optimize
10483@opindex floop-nest-optimize
10484Enable the isl based loop nest optimizer.  This is a generic loop nest
10485optimizer based on the Pluto optimization algorithms.  It calculates a loop
10486structure optimized for data-locality and parallelism.  This option
10487is experimental.
10488
10489@item -floop-parallelize-all
10490@opindex floop-parallelize-all
10491Use the Graphite data dependence analysis to identify loops that can
10492be parallelized.  Parallelize all the loops that can be analyzed to
10493not contain loop carried dependences without checking that it is
10494profitable to parallelize the loops.
10495
10496@item -ftree-coalesce-vars
10497@opindex ftree-coalesce-vars
10498While transforming the program out of the SSA representation, attempt to
10499reduce copying by coalescing versions of different user-defined
10500variables, instead of just compiler temporaries.  This may severely
10501limit the ability to debug an optimized program compiled with
10502@option{-fno-var-tracking-assignments}.  In the negated form, this flag
10503prevents SSA coalescing of user variables.  This option is enabled by
10504default if optimization is enabled, and it does very little otherwise.
10505
10506@item -ftree-loop-if-convert
10507@opindex ftree-loop-if-convert
10508Attempt to transform conditional jumps in the innermost loops to
10509branch-less equivalents.  The intent is to remove control-flow from
10510the innermost loops in order to improve the ability of the
10511vectorization pass to handle these loops.  This is enabled by default
10512if vectorization is enabled.
10513
10514@item -ftree-loop-distribution
10515@opindex ftree-loop-distribution
10516Perform loop distribution.  This flag can improve cache performance on
10517big loop bodies and allow further loop optimizations, like
10518parallelization or vectorization, to take place.  For example, the loop
10519@smallexample
10520DO I = 1, N
10521  A(I) = B(I) + C
10522  D(I) = E(I) * F
10523ENDDO
10524@end smallexample
10525is transformed to
10526@smallexample
10527DO I = 1, N
10528   A(I) = B(I) + C
10529ENDDO
10530DO I = 1, N
10531   D(I) = E(I) * F
10532ENDDO
10533@end smallexample
10534This flag is enabled by default at @option{-O3}.
10535It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10536
10537@item -ftree-loop-distribute-patterns
10538@opindex ftree-loop-distribute-patterns
10539Perform loop distribution of patterns that can be code generated with
10540calls to a library.  This flag is enabled by default at @option{-O2} and
10541higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10542
10543This pass distributes the initialization loops and generates a call to
10544memset zero.  For example, the loop
10545@smallexample
10546DO I = 1, N
10547  A(I) = 0
10548  B(I) = A(I) + I
10549ENDDO
10550@end smallexample
10551is transformed to
10552@smallexample
10553DO I = 1, N
10554   A(I) = 0
10555ENDDO
10556DO I = 1, N
10557   B(I) = A(I) + I
10558ENDDO
10559@end smallexample
10560and the initialization loop is transformed into a call to memset zero.
10561This flag is enabled by default at @option{-O3}.
10562It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10563
10564@item -floop-interchange
10565@opindex floop-interchange
10566Perform loop interchange outside of graphite.  This flag can improve cache
10567performance on loop nest and allow further loop optimizations, like
10568vectorization, to take place.  For example, the loop
10569@smallexample
10570for (int i = 0; i < N; i++)
10571  for (int j = 0; j < N; j++)
10572    for (int k = 0; k < N; k++)
10573      c[i][j] = c[i][j] + a[i][k]*b[k][j];
10574@end smallexample
10575is transformed to
10576@smallexample
10577for (int i = 0; i < N; i++)
10578  for (int k = 0; k < N; k++)
10579    for (int j = 0; j < N; j++)
10580      c[i][j] = c[i][j] + a[i][k]*b[k][j];
10581@end smallexample
10582This flag is enabled by default at @option{-O3}.
10583It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10584
10585@item -floop-unroll-and-jam
10586@opindex floop-unroll-and-jam
10587Apply unroll and jam transformations on feasible loops.  In a loop
10588nest this unrolls the outer loop by some factor and fuses the resulting
10589multiple inner loops.  This flag is enabled by default at @option{-O3}.
10590It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10591
10592@item -ftree-loop-im
10593@opindex ftree-loop-im
10594Perform loop invariant motion on trees.  This pass moves only invariants that
10595are hard to handle at RTL level (function calls, operations that expand to
10596nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
10597operands of conditions that are invariant out of the loop, so that we can use
10598just trivial invariantness analysis in loop unswitching.  The pass also includes
10599store motion.
10600
10601@item -ftree-loop-ivcanon
10602@opindex ftree-loop-ivcanon
10603Create a canonical counter for number of iterations in loops for which
10604determining number of iterations requires complicated analysis.  Later
10605optimizations then may determine the number easily.  Useful especially
10606in connection with unrolling.
10607
10608@item -ftree-scev-cprop
10609@opindex ftree-scev-cprop
10610Perform final value replacement.  If a variable is modified in a loop
10611in such a way that its value when exiting the loop can be determined using
10612only its initial value and the number of loop iterations, replace uses of
10613the final value by such a computation, provided it is sufficiently cheap.
10614This reduces data dependencies and may allow further simplifications.
10615Enabled by default at @option{-O} and higher.
10616
10617@item -fivopts
10618@opindex fivopts
10619Perform induction variable optimizations (strength reduction, induction
10620variable merging and induction variable elimination) on trees.
10621
10622@item -ftree-parallelize-loops=n
10623@opindex ftree-parallelize-loops
10624Parallelize loops, i.e., split their iteration space to run in n threads.
10625This is only possible for loops whose iterations are independent
10626and can be arbitrarily reordered.  The optimization is only
10627profitable on multiprocessor machines, for loops that are CPU-intensive,
10628rather than constrained e.g.@: by memory bandwidth.  This option
10629implies @option{-pthread}, and thus is only supported on targets
10630that have support for @option{-pthread}.
10631
10632@item -ftree-pta
10633@opindex ftree-pta
10634Perform function-local points-to analysis on trees.  This flag is
10635enabled by default at @option{-O1} and higher, except for @option{-Og}.
10636
10637@item -ftree-sra
10638@opindex ftree-sra
10639Perform scalar replacement of aggregates.  This pass replaces structure
10640references with scalars to prevent committing structures to memory too
10641early.  This flag is enabled by default at @option{-O1} and higher,
10642except for @option{-Og}.
10643
10644@item -fstore-merging
10645@opindex fstore-merging
10646Perform merging of narrow stores to consecutive memory addresses.  This pass
10647merges contiguous stores of immediate values narrower than a word into fewer
10648wider stores to reduce the number of instructions.  This is enabled by default
10649at @option{-O2} and higher as well as @option{-Os}.
10650
10651@item -ftree-ter
10652@opindex ftree-ter
10653Perform temporary expression replacement during the SSA->normal phase.  Single
10654use/single def temporaries are replaced at their use location with their
10655defining expression.  This results in non-GIMPLE code, but gives the expanders
10656much more complex trees to work on resulting in better RTL generation.  This is
10657enabled by default at @option{-O} and higher.
10658
10659@item -ftree-slsr
10660@opindex ftree-slsr
10661Perform straight-line strength reduction on trees.  This recognizes related
10662expressions involving multiplications and replaces them by less expensive
10663calculations when possible.  This is enabled by default at @option{-O} and
10664higher.
10665
10666@item -ftree-vectorize
10667@opindex ftree-vectorize
10668Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10669and @option{-ftree-slp-vectorize} if not explicitly specified.
10670
10671@item -ftree-loop-vectorize
10672@opindex ftree-loop-vectorize
10673Perform loop vectorization on trees. This flag is enabled by default at
10674@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10675and @option{-fauto-profile}.
10676
10677@item -ftree-slp-vectorize
10678@opindex ftree-slp-vectorize
10679Perform basic block vectorization on trees. This flag is enabled by default at
10680@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10681and @option{-fauto-profile}.
10682
10683@item -fvect-cost-model=@var{model}
10684@opindex fvect-cost-model
10685Alter the cost model used for vectorization.  The @var{model} argument
10686should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10687With the @samp{unlimited} model the vectorized code-path is assumed
10688to be profitable while with the @samp{dynamic} model a runtime check
10689guards the vectorized code-path to enable it only for iteration
10690counts that will likely execute faster than when executing the original
10691scalar loop.  The @samp{cheap} model disables vectorization of
10692loops where doing so would be cost prohibitive for example due to
10693required runtime checks for data dependence or alignment but otherwise
10694is equal to the @samp{dynamic} model.
10695The default cost model depends on other optimization flags and is
10696either @samp{dynamic} or @samp{cheap}.
10697
10698@item -fsimd-cost-model=@var{model}
10699@opindex fsimd-cost-model
10700Alter the cost model used for vectorization of loops marked with the OpenMP
10701simd directive.  The @var{model} argument should be one of
10702@samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
10703have the same meaning as described in @option{-fvect-cost-model} and by
10704default a cost model defined with @option{-fvect-cost-model} is used.
10705
10706@item -ftree-vrp
10707@opindex ftree-vrp
10708Perform Value Range Propagation on trees.  This is similar to the
10709constant propagation pass, but instead of values, ranges of values are
10710propagated.  This allows the optimizers to remove unnecessary range
10711checks like array bound checks and null pointer checks.  This is
10712enabled by default at @option{-O2} and higher.  Null pointer check
10713elimination is only done if @option{-fdelete-null-pointer-checks} is
10714enabled.
10715
10716@item -fsplit-paths
10717@opindex fsplit-paths
10718Split paths leading to loop backedges.  This can improve dead code
10719elimination and common subexpression elimination.  This is enabled by
10720default at @option{-O3} and above.
10721
10722@item -fsplit-ivs-in-unroller
10723@opindex fsplit-ivs-in-unroller
10724Enables expression of values of induction variables in later iterations
10725of the unrolled loop using the value in the first iteration.  This breaks
10726long dependency chains, thus improving efficiency of the scheduling passes.
10727
10728A combination of @option{-fweb} and CSE is often sufficient to obtain the
10729same effect.  However, that is not reliable in cases where the loop body
10730is more complicated than a single basic block.  It also does not work at all
10731on some architectures due to restrictions in the CSE pass.
10732
10733This optimization is enabled by default.
10734
10735@item -fvariable-expansion-in-unroller
10736@opindex fvariable-expansion-in-unroller
10737With this option, the compiler creates multiple copies of some
10738local variables when unrolling a loop, which can result in superior code.
10739
10740This optimization is enabled by default for PowerPC targets, but disabled
10741by default otherwise.
10742
10743@item -fpartial-inlining
10744@opindex fpartial-inlining
10745Inline parts of functions.  This option has any effect only
10746when inlining itself is turned on by the @option{-finline-functions}
10747or @option{-finline-small-functions} options.
10748
10749Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10750
10751@item -fpredictive-commoning
10752@opindex fpredictive-commoning
10753Perform predictive commoning optimization, i.e., reusing computations
10754(especially memory loads and stores) performed in previous
10755iterations of loops.
10756
10757This option is enabled at level @option{-O3}.
10758It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10759
10760@item -fprefetch-loop-arrays
10761@opindex fprefetch-loop-arrays
10762If supported by the target machine, generate instructions to prefetch
10763memory to improve the performance of loops that access large arrays.
10764
10765This option may generate better or worse code; results are highly
10766dependent on the structure of loops within the source code.
10767
10768Disabled at level @option{-Os}.
10769
10770@item -fno-printf-return-value
10771@opindex fno-printf-return-value
10772@opindex fprintf-return-value
10773Do not substitute constants for known return value of formatted output
10774functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10775@code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
10776transformation allows GCC to optimize or even eliminate branches based
10777on the known return value of these functions called with arguments that
10778are either constant, or whose values are known to be in a range that
10779makes determining the exact return value possible.  For example, when
10780@option{-fprintf-return-value} is in effect, both the branch and the
10781body of the @code{if} statement (but not the call to @code{snprint})
10782can be optimized away when @code{i} is a 32-bit or smaller integer
10783because the return value is guaranteed to be at most 8.
10784
10785@smallexample
10786char buf[9];
10787if (snprintf (buf, "%08x", i) >= sizeof buf)
10788  @dots{}
10789@end smallexample
10790
10791The @option{-fprintf-return-value} option relies on other optimizations
10792and yields best results with @option{-O2} and above.  It works in tandem
10793with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10794options.  The @option{-fprintf-return-value} option is enabled by default.
10795
10796@item -fno-peephole
10797@itemx -fno-peephole2
10798@opindex fno-peephole
10799@opindex fpeephole
10800@opindex fno-peephole2
10801@opindex fpeephole2
10802Disable any machine-specific peephole optimizations.  The difference
10803between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10804are implemented in the compiler; some targets use one, some use the
10805other, a few use both.
10806
10807@option{-fpeephole} is enabled by default.
10808@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10809
10810@item -fno-guess-branch-probability
10811@opindex fno-guess-branch-probability
10812@opindex fguess-branch-probability
10813Do not guess branch probabilities using heuristics.
10814
10815GCC uses heuristics to guess branch probabilities if they are
10816not provided by profiling feedback (@option{-fprofile-arcs}).  These
10817heuristics are based on the control flow graph.  If some branch probabilities
10818are specified by @code{__builtin_expect}, then the heuristics are
10819used to guess branch probabilities for the rest of the control flow graph,
10820taking the @code{__builtin_expect} info into account.  The interactions
10821between the heuristics and @code{__builtin_expect} can be complex, and in
10822some cases, it may be useful to disable the heuristics so that the effects
10823of @code{__builtin_expect} are easier to understand.
10824
10825It is also possible to specify expected probability of the expression
10826with @code{__builtin_expect_with_probability} built-in function.
10827
10828The default is @option{-fguess-branch-probability} at levels
10829@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10830
10831@item -freorder-blocks
10832@opindex freorder-blocks
10833Reorder basic blocks in the compiled function in order to reduce number of
10834taken branches and improve code locality.
10835
10836Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10837
10838@item -freorder-blocks-algorithm=@var{algorithm}
10839@opindex freorder-blocks-algorithm
10840Use the specified algorithm for basic block reordering.  The
10841@var{algorithm} argument can be @samp{simple}, which does not increase
10842code size (except sometimes due to secondary effects like alignment),
10843or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10844put all often executed code together, minimizing the number of branches
10845executed by making extra copies of code.
10846
10847The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10848@samp{stc} at levels @option{-O2}, @option{-O3}.
10849
10850@item -freorder-blocks-and-partition
10851@opindex freorder-blocks-and-partition
10852In addition to reordering basic blocks in the compiled function, in order
10853to reduce number of taken branches, partitions hot and cold basic blocks
10854into separate sections of the assembly and @file{.o} files, to improve
10855paging and cache locality performance.
10856
10857This optimization is automatically turned off in the presence of
10858exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10859section attribute and on any architecture that does not support named
10860sections.  When @option{-fsplit-stack} is used this option is not
10861enabled by default (to avoid linker errors), but may be enabled
10862explicitly (if using a working linker).
10863
10864Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10865
10866@item -freorder-functions
10867@opindex freorder-functions
10868Reorder functions in the object file in order to
10869improve code locality.  This is implemented by using special
10870subsections @code{.text.hot} for most frequently executed functions and
10871@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
10872the linker so object file format must support named sections and linker must
10873place them in a reasonable way.
10874
10875This option isn't effective unless you either provide profile feedback
10876(see @option{-fprofile-arcs} for details) or manually annotate functions with
10877@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10878
10879Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10880
10881@item -fstrict-aliasing
10882@opindex fstrict-aliasing
10883Allow the compiler to assume the strictest aliasing rules applicable to
10884the language being compiled.  For C (and C++), this activates
10885optimizations based on the type of expressions.  In particular, an
10886object of one type is assumed never to reside at the same address as an
10887object of a different type, unless the types are almost the same.  For
10888example, an @code{unsigned int} can alias an @code{int}, but not a
10889@code{void*} or a @code{double}.  A character type may alias any other
10890type.
10891
10892@anchor{Type-punning}Pay special attention to code like this:
10893@smallexample
10894union a_union @{
10895  int i;
10896  double d;
10897@};
10898
10899int f() @{
10900  union a_union t;
10901  t.d = 3.0;
10902  return t.i;
10903@}
10904@end smallexample
10905The practice of reading from a different union member than the one most
10906recently written to (called ``type-punning'') is common.  Even with
10907@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10908is accessed through the union type.  So, the code above works as
10909expected.  @xref{Structures unions enumerations and bit-fields
10910implementation}.  However, this code might not:
10911@smallexample
10912int f() @{
10913  union a_union t;
10914  int* ip;
10915  t.d = 3.0;
10916  ip = &t.i;
10917  return *ip;
10918@}
10919@end smallexample
10920
10921Similarly, access by taking the address, casting the resulting pointer
10922and dereferencing the result has undefined behavior, even if the cast
10923uses a union type, e.g.:
10924@smallexample
10925int f() @{
10926  double d = 3.0;
10927  return ((union a_union *) &d)->i;
10928@}
10929@end smallexample
10930
10931The @option{-fstrict-aliasing} option is enabled at levels
10932@option{-O2}, @option{-O3}, @option{-Os}.
10933
10934@item -falign-functions
10935@itemx -falign-functions=@var{n}
10936@itemx -falign-functions=@var{n}:@var{m}
10937@itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10938@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10939@opindex falign-functions
10940Align the start of functions to the next power-of-two greater than or
10941equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
10942least the first @var{m} bytes of the function can be fetched by the CPU
10943without crossing an @var{n}-byte alignment boundary.
10944
10945If @var{m} is not specified, it defaults to @var{n}.
10946
10947Examples: @option{-falign-functions=32} aligns functions to the next
1094832-byte boundary, @option{-falign-functions=24} aligns to the next
1094932-byte boundary only if this can be done by skipping 23 bytes or less,
10950@option{-falign-functions=32:7} aligns to the next
1095132-byte boundary only if this can be done by skipping 6 bytes or less.
10952
10953The second pair of @var{n2}:@var{m2} values allows you to specify
10954a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10955the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10956otherwise aligns to the next 32-byte boundary if this can be done
10957by skipping 2 bytes or less.
10958If @var{m2} is not specified, it defaults to @var{n2}.
10959
10960Some assemblers only support this flag when @var{n} is a power of two;
10961in that case, it is rounded up.
10962
10963@option{-fno-align-functions} and @option{-falign-functions=1} are
10964equivalent and mean that functions are not aligned.
10965
10966If @var{n} is not specified or is zero, use a machine-dependent default.
10967The maximum allowed @var{n} option value is 65536.
10968
10969Enabled at levels @option{-O2}, @option{-O3}.
10970
10971@item -flimit-function-alignment
10972If this option is enabled, the compiler tries to avoid unnecessarily
10973overaligning functions. It attempts to instruct the assembler to align
10974by the amount specified by @option{-falign-functions}, but not to
10975skip more bytes than the size of the function.
10976
10977@item -falign-labels
10978@itemx -falign-labels=@var{n}
10979@itemx -falign-labels=@var{n}:@var{m}
10980@itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10981@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10982@opindex falign-labels
10983Align all branch targets to a power-of-two boundary.
10984
10985Parameters of this option are analogous to the @option{-falign-functions} option.
10986@option{-fno-align-labels} and @option{-falign-labels=1} are
10987equivalent and mean that labels are not aligned.
10988
10989If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10990are greater than this value, then their values are used instead.
10991
10992If @var{n} is not specified or is zero, use a machine-dependent default
10993which is very likely to be @samp{1}, meaning no alignment.
10994The maximum allowed @var{n} option value is 65536.
10995
10996Enabled at levels @option{-O2}, @option{-O3}.
10997
10998@item -falign-loops
10999@itemx -falign-loops=@var{n}
11000@itemx -falign-loops=@var{n}:@var{m}
11001@itemx -falign-loops=@var{n}:@var{m}:@var{n2}
11002@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11003@opindex falign-loops
11004Align loops to a power-of-two boundary.  If the loops are executed
11005many times, this makes up for any execution of the dummy padding
11006instructions.
11007
11008If @option{-falign-labels} is greater than this value, then its value
11009is used instead.
11010
11011Parameters of this option are analogous to the @option{-falign-functions} option.
11012@option{-fno-align-loops} and @option{-falign-loops=1} are
11013equivalent and mean that loops are not aligned.
11014The maximum allowed @var{n} option value is 65536.
11015
11016If @var{n} is not specified or is zero, use a machine-dependent default.
11017
11018Enabled at levels @option{-O2}, @option{-O3}.
11019
11020@item -falign-jumps
11021@itemx -falign-jumps=@var{n}
11022@itemx -falign-jumps=@var{n}:@var{m}
11023@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11024@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11025@opindex falign-jumps
11026Align branch targets to a power-of-two boundary, for branch targets
11027where the targets can only be reached by jumping.  In this case,
11028no dummy operations need be executed.
11029
11030If @option{-falign-labels} is greater than this value, then its value
11031is used instead.
11032
11033Parameters of this option are analogous to the @option{-falign-functions} option.
11034@option{-fno-align-jumps} and @option{-falign-jumps=1} are
11035equivalent and mean that loops are not aligned.
11036
11037If @var{n} is not specified or is zero, use a machine-dependent default.
11038The maximum allowed @var{n} option value is 65536.
11039
11040Enabled at levels @option{-O2}, @option{-O3}.
11041
11042@item -fno-allocation-dce
11043@opindex fno-allocation-dce
11044Do not remove unused C++ allocations in dead code elimination.
11045
11046@item -fallow-store-data-races
11047@opindex fallow-store-data-races
11048Allow the compiler to introduce new data races on stores.
11049
11050Enabled at level @option{-Ofast}.
11051
11052@item -funit-at-a-time
11053@opindex funit-at-a-time
11054This option is left for compatibility reasons. @option{-funit-at-a-time}
11055has no effect, while @option{-fno-unit-at-a-time} implies
11056@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11057
11058Enabled by default.
11059
11060@item -fno-toplevel-reorder
11061@opindex fno-toplevel-reorder
11062@opindex ftoplevel-reorder
11063Do not reorder top-level functions, variables, and @code{asm}
11064statements.  Output them in the same order that they appear in the
11065input file.  When this option is used, unreferenced static variables
11066are not removed.  This option is intended to support existing code
11067that relies on a particular ordering.  For new code, it is better to
11068use attributes when possible.
11069
11070@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11071also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11072Additionally @option{-fno-toplevel-reorder} implies
11073@option{-fno-section-anchors}.
11074
11075@item -fweb
11076@opindex fweb
11077Constructs webs as commonly used for register allocation purposes and assign
11078each web individual pseudo register.  This allows the register allocation pass
11079to operate on pseudos directly, but also strengthens several other optimization
11080passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
11081however, make debugging impossible, since variables no longer stay in a
11082``home register''.
11083
11084Enabled by default with @option{-funroll-loops}.
11085
11086@item -fwhole-program
11087@opindex fwhole-program
11088Assume that the current compilation unit represents the whole program being
11089compiled.  All public functions and variables with the exception of @code{main}
11090and those merged by attribute @code{externally_visible} become static functions
11091and in effect are optimized more aggressively by interprocedural optimizers.
11092
11093This option should not be used in combination with @option{-flto}.
11094Instead relying on a linker plugin should provide safer and more precise
11095information.
11096
11097@item -flto[=@var{n}]
11098@opindex flto
11099This option runs the standard link-time optimizer.  When invoked
11100with source code, it generates GIMPLE (one of GCC's internal
11101representations) and writes it to special ELF sections in the object
11102file.  When the object files are linked together, all the function
11103bodies are read from these ELF sections and instantiated as if they
11104had been part of the same translation unit.
11105
11106To use the link-time optimizer, @option{-flto} and optimization
11107options should be specified at compile time and during the final link.
11108It is recommended that you compile all the files participating in the
11109same link with the same options and also specify those options at
11110link time.
11111For example:
11112
11113@smallexample
11114gcc -c -O2 -flto foo.c
11115gcc -c -O2 -flto bar.c
11116gcc -o myprog -flto -O2 foo.o bar.o
11117@end smallexample
11118
11119The first two invocations to GCC save a bytecode representation
11120of GIMPLE into special ELF sections inside @file{foo.o} and
11121@file{bar.o}.  The final invocation reads the GIMPLE bytecode from
11122@file{foo.o} and @file{bar.o}, merges the two files into a single
11123internal image, and compiles the result as usual.  Since both
11124@file{foo.o} and @file{bar.o} are merged into a single image, this
11125causes all the interprocedural analyses and optimizations in GCC to
11126work across the two files as if they were a single one.  This means,
11127for example, that the inliner is able to inline functions in
11128@file{bar.o} into functions in @file{foo.o} and vice-versa.
11129
11130Another (simpler) way to enable link-time optimization is:
11131
11132@smallexample
11133gcc -o myprog -flto -O2 foo.c bar.c
11134@end smallexample
11135
11136The above generates bytecode for @file{foo.c} and @file{bar.c},
11137merges them together into a single GIMPLE representation and optimizes
11138them as usual to produce @file{myprog}.
11139
11140The important thing to keep in mind is that to enable link-time
11141optimizations you need to use the GCC driver to perform the link step.
11142GCC automatically performs link-time optimization if any of the
11143objects involved were compiled with the @option{-flto} command-line option.
11144You can always override
11145the automatic decision to do link-time optimization
11146by passing @option{-fno-lto} to the link command.
11147
11148To make whole program optimization effective, it is necessary to make
11149certain whole program assumptions.  The compiler needs to know
11150what functions and variables can be accessed by libraries and runtime
11151outside of the link-time optimized unit.  When supported by the linker,
11152the linker plugin (see @option{-fuse-linker-plugin}) passes information
11153to the compiler about used and externally visible symbols.  When
11154the linker plugin is not available, @option{-fwhole-program} should be
11155used to allow the compiler to make these assumptions, which leads
11156to more aggressive optimization decisions.
11157
11158When a file is compiled with @option{-flto} without
11159@option{-fuse-linker-plugin}, the generated object file is larger than
11160a regular object file because it contains GIMPLE bytecodes and the usual
11161final code (see @option{-ffat-lto-objects}.  This means that
11162object files with LTO information can be linked as normal object
11163files; if @option{-fno-lto} is passed to the linker, no
11164interprocedural optimizations are applied.  Note that when
11165@option{-fno-fat-lto-objects} is enabled the compile stage is faster
11166but you cannot perform a regular, non-LTO link on them.
11167
11168When producing the final binary, GCC only
11169applies link-time optimizations to those files that contain bytecode.
11170Therefore, you can mix and match object files and libraries with
11171GIMPLE bytecodes and final object code.  GCC automatically selects
11172which files to optimize in LTO mode and which files to link without
11173further processing.
11174
11175Generally, options specified at link time override those
11176specified at compile time, although in some cases GCC attempts to infer
11177link-time options from the settings used to compile the input files.
11178
11179If you do not specify an optimization level option @option{-O} at
11180link time, then GCC uses the highest optimization level
11181used when compiling the object files.  Note that it is generally
11182ineffective to specify an optimization level option only at link time and
11183not at compile time, for two reasons.  First, compiling without
11184optimization suppresses compiler passes that gather information
11185needed for effective optimization at link time.  Second, some early
11186optimization passes can be performed only at compile time and
11187not at link time.
11188
11189There are some code generation flags preserved by GCC when
11190generating bytecodes, as they need to be used during the final link.
11191Currently, the following options and their settings are taken from
11192the first object file that explicitly specifies them:
11193@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11194@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11195and all the @option{-m} target flags.
11196
11197Certain ABI-changing flags are required to match in all compilation units,
11198and trying to override this at link time with a conflicting value
11199is ignored.  This includes options such as @option{-freg-struct-return}
11200and @option{-fpcc-struct-return}.
11201
11202Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11203@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11204are passed through to the link stage and merged conservatively for
11205conflicting translation units.  Specifically
11206@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11207precedence; and for example @option{-ffp-contract=off} takes precedence
11208over @option{-ffp-contract=fast}.  You can override them at link time.
11209
11210Diagnostic options such as @option{-Wstringop-overflow} are passed
11211through to the link stage and their setting matches that of the
11212compile-step at function granularity.  Note that this matters only
11213for diagnostics emitted during optimization.  Note that code
11214transforms such as inlining can lead to warnings being enabled
11215or disabled for regions if code not consistent with the setting
11216at compile time.
11217
11218When you need to pass options to the assembler via @option{-Wa} or
11219@option{-Xassembler} make sure to either compile such translation
11220units with @option{-fno-lto} or consistently use the same assembler
11221options on all translation units.  You can alternatively also
11222specify assembler options at LTO link time.
11223
11224To enable debug info generation you need to supply @option{-g} at
11225compile time.  If any of the input files at link time were built
11226with debug info generation enabled the link will enable debug info
11227generation as well.  Any elaborate debug info settings
11228like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11229at the linker command line and mixing different settings in different
11230translation units is discouraged.
11231
11232If LTO encounters objects with C linkage declared with incompatible
11233types in separate translation units to be linked together (undefined
11234behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11235issued.  The behavior is still undefined at run time.  Similar
11236diagnostics may be raised for other languages.
11237
11238Another feature of LTO is that it is possible to apply interprocedural
11239optimizations on files written in different languages:
11240
11241@smallexample
11242gcc -c -flto foo.c
11243g++ -c -flto bar.cc
11244gfortran -c -flto baz.f90
11245g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11246@end smallexample
11247
11248Notice that the final link is done with @command{g++} to get the C++
11249runtime libraries and @option{-lgfortran} is added to get the Fortran
11250runtime libraries.  In general, when mixing languages in LTO mode, you
11251should use the same link command options as when mixing languages in a
11252regular (non-LTO) compilation.
11253
11254If object files containing GIMPLE bytecode are stored in a library archive, say
11255@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11256are using a linker with plugin support.  To create static libraries suitable
11257for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11258and @command{ranlib};
11259to show the symbols of object files with GIMPLE bytecode, use
11260@command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
11261and @command{nm} have been compiled with plugin support.  At link time, use the
11262flag @option{-fuse-linker-plugin} to ensure that the library participates in
11263the LTO optimization process:
11264
11265@smallexample
11266gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11267@end smallexample
11268
11269With the linker plugin enabled, the linker extracts the needed
11270GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11271to make them part of the aggregated GIMPLE image to be optimized.
11272
11273If you are not using a linker with plugin support and/or do not
11274enable the linker plugin, then the objects inside @file{libfoo.a}
11275are extracted and linked as usual, but they do not participate
11276in the LTO optimization process.  In order to make a static library suitable
11277for both LTO optimization and usual linkage, compile its object files with
11278@option{-flto} @option{-ffat-lto-objects}.
11279
11280Link-time optimizations do not require the presence of the whole program to
11281operate.  If the program does not require any symbols to be exported, it is
11282possible to combine @option{-flto} and @option{-fwhole-program} to allow
11283the interprocedural optimizers to use more aggressive assumptions which may
11284lead to improved optimization opportunities.
11285Use of @option{-fwhole-program} is not needed when linker plugin is
11286active (see @option{-fuse-linker-plugin}).
11287
11288The current implementation of LTO makes no
11289attempt to generate bytecode that is portable between different
11290types of hosts.  The bytecode files are versioned and there is a
11291strict version check, so bytecode files generated in one version of
11292GCC do not work with an older or newer version of GCC.
11293
11294Link-time optimization does not work well with generation of debugging
11295information on systems other than those using a combination of ELF and
11296DWARF.
11297
11298If you specify the optional @var{n}, the optimization and code
11299generation done at link time is executed in parallel using @var{n}
11300parallel jobs by utilizing an installed @command{make} program.  The
11301environment variable @env{MAKE} may be used to override the program
11302used.
11303
11304You can also specify @option{-flto=jobserver} to use GNU make's
11305job server mode to determine the number of parallel jobs. This
11306is useful when the Makefile calling GCC is already executing in parallel.
11307You must prepend a @samp{+} to the command recipe in the parent Makefile
11308for this to work.  This option likely only works if @env{MAKE} is
11309GNU make.  Even without the option value, GCC tries to automatically
11310detect a running GNU make's job server.
11311
11312Use @option{-flto=auto} to use GNU make's job server, if available,
11313or otherwise fall back to autodetection of the number of CPU threads
11314present in your system.
11315
11316@item -flto-partition=@var{alg}
11317@opindex flto-partition
11318Specify the partitioning algorithm used by the link-time optimizer.
11319The value is either @samp{1to1} to specify a partitioning mirroring
11320the original source files or @samp{balanced} to specify partitioning
11321into equally sized chunks (whenever possible) or @samp{max} to create
11322new partition for every symbol where possible.  Specifying @samp{none}
11323as an algorithm disables partitioning and streaming completely.
11324The default value is @samp{balanced}. While @samp{1to1} can be used
11325as an workaround for various code ordering issues, the @samp{max}
11326partitioning is intended for internal testing only.
11327The value @samp{one} specifies that exactly one partition should be
11328used while the value @samp{none} bypasses partitioning and executes
11329the link-time optimization step directly from the WPA phase.
11330
11331@item -flto-compression-level=@var{n}
11332@opindex flto-compression-level
11333This option specifies the level of compression used for intermediate
11334language written to LTO object files, and is only meaningful in
11335conjunction with LTO mode (@option{-flto}).  Valid
11336values are 0 (no compression) to 9 (maximum compression).  Values
11337outside this range are clamped to either 0 or 9.  If the option is not
11338given, a default balanced compression setting is used.
11339
11340@item -fuse-linker-plugin
11341@opindex fuse-linker-plugin
11342Enables the use of a linker plugin during link-time optimization.  This
11343option relies on plugin support in the linker, which is available in gold
11344or in GNU ld 2.21 or newer.
11345
11346This option enables the extraction of object files with GIMPLE bytecode out
11347of library archives. This improves the quality of optimization by exposing
11348more code to the link-time optimizer.  This information specifies what
11349symbols can be accessed externally (by non-LTO object or during dynamic
11350linking).  Resulting code quality improvements on binaries (and shared
11351libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11352See @option{-flto} for a description of the effect of this flag and how to
11353use it.
11354
11355This option is enabled by default when LTO support in GCC is enabled
11356and GCC was configured for use with
11357a linker supporting plugins (GNU ld 2.21 or newer or gold).
11358
11359@item -ffat-lto-objects
11360@opindex ffat-lto-objects
11361Fat LTO objects are object files that contain both the intermediate language
11362and the object code. This makes them usable for both LTO linking and normal
11363linking. This option is effective only when compiling with @option{-flto}
11364and is ignored at link time.
11365
11366@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11367requires the complete toolchain to be aware of LTO. It requires a linker with
11368linker plugin support for basic functionality.  Additionally,
11369@command{nm}, @command{ar} and @command{ranlib}
11370need to support linker plugins to allow a full-featured build environment
11371(capable of building static libraries etc).  GCC provides the @command{gcc-ar},
11372@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11373to these tools. With non fat LTO makefiles need to be modified to use them.
11374
11375Note that modern binutils provide plugin auto-load mechanism.
11376Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11377effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11378@command{gcc-ranlib}).
11379
11380The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11381support.
11382
11383@item -fcompare-elim
11384@opindex fcompare-elim
11385After register allocation and post-register allocation instruction splitting,
11386identify arithmetic instructions that compute processor flags similar to a
11387comparison operation based on that arithmetic.  If possible, eliminate the
11388explicit comparison operation.
11389
11390This pass only applies to certain targets that cannot explicitly represent
11391the comparison operation before register allocation is complete.
11392
11393Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11394
11395@item -fcprop-registers
11396@opindex fcprop-registers
11397After register allocation and post-register allocation instruction splitting,
11398perform a copy-propagation pass to try to reduce scheduling dependencies
11399and occasionally eliminate the copy.
11400
11401Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11402
11403@item -fprofile-correction
11404@opindex fprofile-correction
11405Profiles collected using an instrumented binary for multi-threaded programs may
11406be inconsistent due to missed counter updates. When this option is specified,
11407GCC uses heuristics to correct or smooth out such inconsistencies. By
11408default, GCC emits an error message when an inconsistent profile is detected.
11409
11410This option is enabled by @option{-fauto-profile}.
11411
11412@item -fprofile-partial-training
11413@opindex fprofile-partial-training
11414With @code{-fprofile-use} all portions of programs not executed during train
11415run are optimized agressively for size rather than speed.  In some cases it is
11416not practical to train all possible hot paths in the program. (For
11417example, program may contain functions specific for a given hardware and
11418trianing may not cover all hardware configurations program is run on.)  With
11419@code{-fprofile-partial-training} profile feedback will be ignored for all
11420functions not executed during the train run leading them to be optimized as if
11421they were compiled without profile feedback. This leads to better performance
11422when train run is not representative but also leads to significantly bigger
11423code.
11424
11425@item -fprofile-use
11426@itemx -fprofile-use=@var{path}
11427@opindex fprofile-use
11428Enable profile feedback-directed optimizations,
11429and the following optimizations, many of which
11430are generally profitable only with profile feedback available:
11431
11432@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11433-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11434-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11435-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11436-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11437-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11438-fprofile-reorder-functions}
11439
11440Before you can use this option, you must first generate profiling information.
11441@xref{Instrumentation Options}, for information about the
11442@option{-fprofile-generate} option.
11443
11444By default, GCC emits an error message if the feedback profiles do not
11445match the source code.  This error can be turned into a warning by using
11446@option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
11447optimized code.  Additionally, by default, GCC also emits a warning message if
11448the feedback profiles do not exist (see @option{-Wmissing-profile}).
11449
11450If @var{path} is specified, GCC looks at the @var{path} to find
11451the profile feedback data files. See @option{-fprofile-dir}.
11452
11453@item -fauto-profile
11454@itemx -fauto-profile=@var{path}
11455@opindex fauto-profile
11456Enable sampling-based feedback-directed optimizations,
11457and the following optimizations,
11458many of which are generally profitable only with profile feedback available:
11459
11460@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11461-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11462-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11463-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11464-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11465-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11466-fprofile-correction}
11467
11468@var{path} is the name of a file containing AutoFDO profile information.
11469If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11470
11471Producing an AutoFDO profile data file requires running your program
11472with the @command{perf} utility on a supported GNU/Linux target system.
11473For more information, see @uref{https://perf.wiki.kernel.org/}.
11474
11475E.g.
11476@smallexample
11477perf record -e br_inst_retired:near_taken -b -o perf.data \
11478    -- your_program
11479@end smallexample
11480
11481Then use the @command{create_gcov} tool to convert the raw profile data
11482to a format that can be used by GCC.@  You must also supply the
11483unstripped binary for your program to this tool.
11484See @uref{https://github.com/google/autofdo}.
11485
11486E.g.
11487@smallexample
11488create_gcov --binary=your_program.unstripped --profile=perf.data \
11489    --gcov=profile.afdo
11490@end smallexample
11491@end table
11492
11493The following options control compiler behavior regarding floating-point
11494arithmetic.  These options trade off between speed and
11495correctness.  All must be specifically enabled.
11496
11497@table @gcctabopt
11498@item -ffloat-store
11499@opindex ffloat-store
11500Do not store floating-point variables in registers, and inhibit other
11501options that might change whether a floating-point value is taken from a
11502register or memory.
11503
11504@cindex floating-point precision
11505This option prevents undesirable excess precision on machines such as
11506the 68000 where the floating registers (of the 68881) keep more
11507precision than a @code{double} is supposed to have.  Similarly for the
11508x86 architecture.  For most programs, the excess precision does only
11509good, but a few programs rely on the precise definition of IEEE floating
11510point.  Use @option{-ffloat-store} for such programs, after modifying
11511them to store all pertinent intermediate computations into variables.
11512
11513@item -fexcess-precision=@var{style}
11514@opindex fexcess-precision
11515This option allows further control over excess precision on machines
11516where floating-point operations occur in a format with more precision or
11517range than the IEEE standard and interchange floating-point types.  By
11518default, @option{-fexcess-precision=fast} is in effect; this means that
11519operations may be carried out in a wider precision than the types specified
11520in the source if that would result in faster code, and it is unpredictable
11521when rounding to the types specified in the source code takes place.
11522When compiling C, if @option{-fexcess-precision=standard} is specified then
11523excess precision follows the rules specified in ISO C99; in particular,
11524both casts and assignments cause values to be rounded to their
11525semantic types (whereas @option{-ffloat-store} only affects
11526assignments).  This option is enabled by default for C if a strict
11527conformance option such as @option{-std=c99} is used.
11528@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11529regardless of whether a strict conformance option is used.
11530
11531@opindex mfpmath
11532@option{-fexcess-precision=standard} is not implemented for languages
11533other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
11534or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11535semantics apply without excess precision, and in the latter, rounding
11536is unpredictable.
11537
11538@item -ffast-math
11539@opindex ffast-math
11540Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11541@option{-ffinite-math-only}, @option{-fno-rounding-math},
11542@option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11543@option{-fexcess-precision=fast}.
11544
11545This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11546
11547This option is not turned on by any @option{-O} option besides
11548@option{-Ofast} since it can result in incorrect output for programs
11549that depend on an exact implementation of IEEE or ISO rules/specifications
11550for math functions. It may, however, yield faster code for programs
11551that do not require the guarantees of these specifications.
11552
11553@item -fno-math-errno
11554@opindex fno-math-errno
11555@opindex fmath-errno
11556Do not set @code{errno} after calling math functions that are executed
11557with a single instruction, e.g., @code{sqrt}.  A program that relies on
11558IEEE exceptions for math error handling may want to use this flag
11559for speed while maintaining IEEE arithmetic compatibility.
11560
11561This option is not turned on by any @option{-O} option since
11562it can result in incorrect output for programs that depend on
11563an exact implementation of IEEE or ISO rules/specifications for
11564math functions. It may, however, yield faster code for programs
11565that do not require the guarantees of these specifications.
11566
11567The default is @option{-fmath-errno}.
11568
11569On Darwin systems, the math library never sets @code{errno}.  There is
11570therefore no reason for the compiler to consider the possibility that
11571it might, and @option{-fno-math-errno} is the default.
11572
11573@item -funsafe-math-optimizations
11574@opindex funsafe-math-optimizations
11575
11576Allow optimizations for floating-point arithmetic that (a) assume
11577that arguments and results are valid and (b) may violate IEEE or
11578ANSI standards.  When used at link time, it may include libraries
11579or startup files that change the default FPU control word or other
11580similar optimizations.
11581
11582This option is not turned on by any @option{-O} option since
11583it can result in incorrect output for programs that depend on
11584an exact implementation of IEEE or ISO rules/specifications for
11585math functions. It may, however, yield faster code for programs
11586that do not require the guarantees of these specifications.
11587Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11588@option{-fassociative-math} and @option{-freciprocal-math}.
11589
11590The default is @option{-fno-unsafe-math-optimizations}.
11591
11592@item -fassociative-math
11593@opindex fassociative-math
11594
11595Allow re-association of operands in series of floating-point operations.
11596This violates the ISO C and C++ language standard by possibly changing
11597computation result.  NOTE: re-ordering may change the sign of zero as
11598well as ignore NaNs and inhibit or create underflow or overflow (and
11599thus cannot be used on code that relies on rounding behavior like
11600@code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
11601and thus may not be used when ordered comparisons are required.
11602This option requires that both @option{-fno-signed-zeros} and
11603@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
11604much sense with @option{-frounding-math}. For Fortran the option
11605is automatically enabled when both @option{-fno-signed-zeros} and
11606@option{-fno-trapping-math} are in effect.
11607
11608The default is @option{-fno-associative-math}.
11609
11610@item -freciprocal-math
11611@opindex freciprocal-math
11612
11613Allow the reciprocal of a value to be used instead of dividing by
11614the value if this enables optimizations.  For example @code{x / y}
11615can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11616is subject to common subexpression elimination.  Note that this loses
11617precision and increases the number of flops operating on the value.
11618
11619The default is @option{-fno-reciprocal-math}.
11620
11621@item -ffinite-math-only
11622@opindex ffinite-math-only
11623Allow optimizations for floating-point arithmetic that assume
11624that arguments and results are not NaNs or +-Infs.
11625
11626This option is not turned on by any @option{-O} option since
11627it can result in incorrect output for programs that depend on
11628an exact implementation of IEEE or ISO rules/specifications for
11629math functions. It may, however, yield faster code for programs
11630that do not require the guarantees of these specifications.
11631
11632The default is @option{-fno-finite-math-only}.
11633
11634@item -fno-signed-zeros
11635@opindex fno-signed-zeros
11636@opindex fsigned-zeros
11637Allow optimizations for floating-point arithmetic that ignore the
11638signedness of zero.  IEEE arithmetic specifies the behavior of
11639distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11640of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11641This option implies that the sign of a zero result isn't significant.
11642
11643The default is @option{-fsigned-zeros}.
11644
11645@item -fno-trapping-math
11646@opindex fno-trapping-math
11647@opindex ftrapping-math
11648Compile code assuming that floating-point operations cannot generate
11649user-visible traps.  These traps include division by zero, overflow,
11650underflow, inexact result and invalid operation.  This option requires
11651that @option{-fno-signaling-nans} be in effect.  Setting this option may
11652allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11653
11654This option should never be turned on by any @option{-O} option since
11655it can result in incorrect output for programs that depend on
11656an exact implementation of IEEE or ISO rules/specifications for
11657math functions.
11658
11659The default is @option{-ftrapping-math}.
11660
11661@item -frounding-math
11662@opindex frounding-math
11663Disable transformations and optimizations that assume default floating-point
11664rounding behavior.  This is round-to-zero for all floating point
11665to integer conversions, and round-to-nearest for all other arithmetic
11666truncations.  This option should be specified for programs that change
11667the FP rounding mode dynamically, or that may be executed with a
11668non-default rounding mode.  This option disables constant folding of
11669floating-point expressions at compile time (which may be affected by
11670rounding mode) and arithmetic transformations that are unsafe in the
11671presence of sign-dependent rounding modes.
11672
11673The default is @option{-fno-rounding-math}.
11674
11675This option is experimental and does not currently guarantee to
11676disable all GCC optimizations that are affected by rounding mode.
11677Future versions of GCC may provide finer control of this setting
11678using C99's @code{FENV_ACCESS} pragma.  This command-line option
11679will be used to specify the default state for @code{FENV_ACCESS}.
11680
11681@item -fsignaling-nans
11682@opindex fsignaling-nans
11683Compile code assuming that IEEE signaling NaNs may generate user-visible
11684traps during floating-point operations.  Setting this option disables
11685optimizations that may change the number of exceptions visible with
11686signaling NaNs.  This option implies @option{-ftrapping-math}.
11687
11688This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11689be defined.
11690
11691The default is @option{-fno-signaling-nans}.
11692
11693This option is experimental and does not currently guarantee to
11694disable all GCC optimizations that affect signaling NaN behavior.
11695
11696@item -fno-fp-int-builtin-inexact
11697@opindex fno-fp-int-builtin-inexact
11698@opindex ffp-int-builtin-inexact
11699Do not allow the built-in functions @code{ceil}, @code{floor},
11700@code{round} and @code{trunc}, and their @code{float} and @code{long
11701double} variants, to generate code that raises the ``inexact''
11702floating-point exception for noninteger arguments.  ISO C99 and C11
11703allow these functions to raise the ``inexact'' exception, but ISO/IEC
11704TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
11705ISO C2X, does not allow these functions to do so.
11706
11707The default is @option{-ffp-int-builtin-inexact}, allowing the
11708exception to be raised, unless C2X or a later C standard is selected.
11709This option does nothing unless @option{-ftrapping-math} is in effect.
11710
11711Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
11712generate a call to a library function then the ``inexact'' exception
11713may be raised if the library implementation does not follow TS 18661.
11714
11715@item -fsingle-precision-constant
11716@opindex fsingle-precision-constant
11717Treat floating-point constants as single precision instead of
11718implicitly converting them to double-precision constants.
11719
11720@item -fcx-limited-range
11721@opindex fcx-limited-range
11722When enabled, this option states that a range reduction step is not
11723needed when performing complex division.  Also, there is no checking
11724whether the result of a complex multiplication or division is @code{NaN
11725+ I*NaN}, with an attempt to rescue the situation in that case.  The
11726default is @option{-fno-cx-limited-range}, but is enabled by
11727@option{-ffast-math}.
11728
11729This option controls the default setting of the ISO C99
11730@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
11731all languages.
11732
11733@item -fcx-fortran-rules
11734@opindex fcx-fortran-rules
11735Complex multiplication and division follow Fortran rules.  Range
11736reduction is done as part of complex division, but there is no checking
11737whether the result of a complex multiplication or division is @code{NaN
11738+ I*NaN}, with an attempt to rescue the situation in that case.
11739
11740The default is @option{-fno-cx-fortran-rules}.
11741
11742@end table
11743
11744The following options control optimizations that may improve
11745performance, but are not enabled by any @option{-O} options.  This
11746section includes experimental options that may produce broken code.
11747
11748@table @gcctabopt
11749@item -fbranch-probabilities
11750@opindex fbranch-probabilities
11751After running a program compiled with @option{-fprofile-arcs}
11752(@pxref{Instrumentation Options}),
11753you can compile it a second time using
11754@option{-fbranch-probabilities}, to improve optimizations based on
11755the number of times each branch was taken.  When a program
11756compiled with @option{-fprofile-arcs} exits, it saves arc execution
11757counts to a file called @file{@var{sourcename}.gcda} for each source
11758file.  The information in this data file is very dependent on the
11759structure of the generated code, so you must use the same source code
11760and the same optimization options for both compilations.
11761
11762With @option{-fbranch-probabilities}, GCC puts a
11763@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
11764These can be used to improve optimization.  Currently, they are only
11765used in one place: in @file{reorg.c}, instead of guessing which path a
11766branch is most likely to take, the @samp{REG_BR_PROB} values are used to
11767exactly determine which path is taken more often.
11768
11769Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11770
11771@item -fprofile-values
11772@opindex fprofile-values
11773If combined with @option{-fprofile-arcs}, it adds code so that some
11774data about values of expressions in the program is gathered.
11775
11776With @option{-fbranch-probabilities}, it reads back the data gathered
11777from profiling values of expressions for usage in optimizations.
11778
11779Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
11780@option{-fauto-profile}.
11781
11782@item -fprofile-reorder-functions
11783@opindex fprofile-reorder-functions
11784Function reordering based on profile instrumentation collects
11785first time of execution of a function and orders these functions
11786in ascending order.
11787
11788Enabled with @option{-fprofile-use}.
11789
11790@item -fvpt
11791@opindex fvpt
11792If combined with @option{-fprofile-arcs}, this option instructs the compiler
11793to add code to gather information about values of expressions.
11794
11795With @option{-fbranch-probabilities}, it reads back the data gathered
11796and actually performs the optimizations based on them.
11797Currently the optimizations include specialization of division operations
11798using the knowledge about the value of the denominator.
11799
11800Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
11801
11802@item -frename-registers
11803@opindex frename-registers
11804Attempt to avoid false dependencies in scheduled code by making use
11805of registers left over after register allocation.  This optimization
11806most benefits processors with lots of registers.  Depending on the
11807debug information format adopted by the target, however, it can
11808make debugging impossible, since variables no longer stay in
11809a ``home register''.
11810
11811Enabled by default with @option{-funroll-loops}.
11812
11813@item -fschedule-fusion
11814@opindex fschedule-fusion
11815Performs a target dependent pass over the instruction stream to schedule
11816instructions of same type together because target machine can execute them
11817more efficiently if they are adjacent to each other in the instruction flow.
11818
11819Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11820
11821@item -ftracer
11822@opindex ftracer
11823Perform tail duplication to enlarge superblock size.  This transformation
11824simplifies the control flow of the function allowing other optimizations to do
11825a better job.
11826
11827Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11828
11829@item -funroll-loops
11830@opindex funroll-loops
11831Unroll loops whose number of iterations can be determined at compile time or
11832upon entry to the loop.  @option{-funroll-loops} implies
11833@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11834It also turns on complete loop peeling (i.e.@: complete removal of loops with
11835a small constant number of iterations).  This option makes code larger, and may
11836or may not make it run faster.
11837
11838Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11839
11840@item -funroll-all-loops
11841@opindex funroll-all-loops
11842Unroll all loops, even if their number of iterations is uncertain when
11843the loop is entered.  This usually makes programs run more slowly.
11844@option{-funroll-all-loops} implies the same options as
11845@option{-funroll-loops}.
11846
11847@item -fpeel-loops
11848@opindex fpeel-loops
11849Peels loops for which there is enough information that they do not
11850roll much (from profile feedback or static analysis).  It also turns on
11851complete loop peeling (i.e.@: complete removal of loops with small constant
11852number of iterations).
11853
11854Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11855
11856@item -fmove-loop-invariants
11857@opindex fmove-loop-invariants
11858Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
11859at level @option{-O1} and higher, except for @option{-Og}.
11860
11861@item -fsplit-loops
11862@opindex fsplit-loops
11863Split a loop into two if it contains a condition that's always true
11864for one side of the iteration space and false for the other.
11865
11866Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11867
11868@item -funswitch-loops
11869@opindex funswitch-loops
11870Move branches with loop invariant conditions out of the loop, with duplicates
11871of the loop on both branches (modified according to result of the condition).
11872
11873Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11874
11875@item -fversion-loops-for-strides
11876@opindex fversion-loops-for-strides
11877If a loop iterates over an array with a variable stride, create another
11878version of the loop that assumes the stride is always one.  For example:
11879
11880@smallexample
11881for (int i = 0; i < n; ++i)
11882  x[i * stride] = @dots{};
11883@end smallexample
11884
11885becomes:
11886
11887@smallexample
11888if (stride == 1)
11889  for (int i = 0; i < n; ++i)
11890    x[i] = @dots{};
11891else
11892  for (int i = 0; i < n; ++i)
11893    x[i * stride] = @dots{};
11894@end smallexample
11895
11896This is particularly useful for assumed-shape arrays in Fortran where
11897(for example) it allows better vectorization assuming contiguous accesses.
11898This flag is enabled by default at @option{-O3}.
11899It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11900
11901@item -ffunction-sections
11902@itemx -fdata-sections
11903@opindex ffunction-sections
11904@opindex fdata-sections
11905Place each function or data item into its own section in the output
11906file if the target supports arbitrary sections.  The name of the
11907function or the name of the data item determines the section's name
11908in the output file.
11909
11910Use these options on systems where the linker can perform optimizations to
11911improve locality of reference in the instruction space.  Most systems using the
11912ELF object format have linkers with such optimizations.  On AIX, the linker
11913rearranges sections (CSECTs) based on the call graph.  The performance impact
11914varies.
11915
11916Together with a linker garbage collection (linker @option{--gc-sections}
11917option) these options may lead to smaller statically-linked executables (after
11918stripping).
11919
11920On ELF/DWARF systems these options do not degenerate the quality of the debug
11921information.  There could be issues with other object files/debug info formats.
11922
11923Only use these options when there are significant benefits from doing so.  When
11924you specify these options, the assembler and linker create larger object and
11925executable files and are also slower.  These options affect code generation.
11926They prevent optimizations by the compiler and assembler using relative
11927locations inside a translation unit since the locations are unknown until
11928link time.  An example of such an optimization is relaxing calls to short call
11929instructions.
11930
11931@item -fstdarg-opt
11932@opindex fstdarg-opt
11933Optimize the prologue of variadic argument functions with respect to usage of
11934those arguments.
11935
11936@item -fsection-anchors
11937@opindex fsection-anchors
11938Try to reduce the number of symbolic address calculations by using
11939shared ``anchor'' symbols to address nearby objects.  This transformation
11940can help to reduce the number of GOT entries and GOT accesses on some
11941targets.
11942
11943For example, the implementation of the following function @code{foo}:
11944
11945@smallexample
11946static int a, b, c;
11947int foo (void) @{ return a + b + c; @}
11948@end smallexample
11949
11950@noindent
11951usually calculates the addresses of all three variables, but if you
11952compile it with @option{-fsection-anchors}, it accesses the variables
11953from a common anchor point instead.  The effect is similar to the
11954following pseudocode (which isn't valid C):
11955
11956@smallexample
11957int foo (void)
11958@{
11959  register int *xr = &x;
11960  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11961@}
11962@end smallexample
11963
11964Not all targets support this option.
11965
11966@item --param @var{name}=@var{value}
11967@opindex param
11968In some places, GCC uses various constants to control the amount of
11969optimization that is done.  For example, GCC does not inline functions
11970that contain more than a certain number of instructions.  You can
11971control some of these constants on the command line using the
11972@option{--param} option.
11973
11974The names of specific parameters, and the meaning of the values, are
11975tied to the internals of the compiler, and are subject to change
11976without notice in future releases.
11977
11978In order to get minimal, maximal and default value of a parameter,
11979one can use @option{--help=param -Q} options.
11980
11981In each case, the @var{value} is an integer.  The following choices
11982of @var{name} are recognized for all targets:
11983
11984@table @gcctabopt
11985@item predictable-branch-outcome
11986When branch is predicted to be taken with probability lower than this threshold
11987(in percent), then it is considered well predictable.
11988
11989@item max-rtl-if-conversion-insns
11990RTL if-conversion tries to remove conditional branches around a block and
11991replace them with conditionally executed instructions.  This parameter
11992gives the maximum number of instructions in a block which should be
11993considered for if-conversion.  The compiler will
11994also use other heuristics to decide whether if-conversion is likely to be
11995profitable.
11996
11997@item max-rtl-if-conversion-predictable-cost
11998@itemx max-rtl-if-conversion-unpredictable-cost
11999RTL if-conversion will try to remove conditional branches around a block
12000and replace them with conditionally executed instructions.  These parameters
12001give the maximum permissible cost for the sequence that would be generated
12002by if-conversion depending on whether the branch is statically determined
12003to be predictable or not.  The units for this parameter are the same as
12004those for the GCC internal seq_cost metric.  The compiler will try to
12005provide a reasonable default for this parameter using the BRANCH_COST
12006target macro.
12007
12008@item max-crossjump-edges
12009The maximum number of incoming edges to consider for cross-jumping.
12010The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
12011the number of edges incoming to each block.  Increasing values mean
12012more aggressive optimization, making the compilation time increase with
12013probably small improvement in executable size.
12014
12015@item min-crossjump-insns
12016The minimum number of instructions that must be matched at the end
12017of two blocks before cross-jumping is performed on them.  This
12018value is ignored in the case where all instructions in the block being
12019cross-jumped from are matched.
12020
12021@item max-grow-copy-bb-insns
12022The maximum code size expansion factor when copying basic blocks
12023instead of jumping.  The expansion is relative to a jump instruction.
12024
12025@item max-goto-duplication-insns
12026The maximum number of instructions to duplicate to a block that jumps
12027to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
12028passes, GCC factors computed gotos early in the compilation process,
12029and unfactors them as late as possible.  Only computed jumps at the
12030end of a basic blocks with no more than max-goto-duplication-insns are
12031unfactored.
12032
12033@item max-delay-slot-insn-search
12034The maximum number of instructions to consider when looking for an
12035instruction to fill a delay slot.  If more than this arbitrary number of
12036instructions are searched, the time savings from filling the delay slot
12037are minimal, so stop searching.  Increasing values mean more
12038aggressive optimization, making the compilation time increase with probably
12039small improvement in execution time.
12040
12041@item max-delay-slot-live-search
12042When trying to fill delay slots, the maximum number of instructions to
12043consider when searching for a block with valid live register
12044information.  Increasing this arbitrarily chosen value means more
12045aggressive optimization, increasing the compilation time.  This parameter
12046should be removed when the delay slot code is rewritten to maintain the
12047control-flow graph.
12048
12049@item max-gcse-memory
12050The approximate maximum amount of memory that can be allocated in
12051order to perform the global common subexpression elimination
12052optimization.  If more memory than specified is required, the
12053optimization is not done.
12054
12055@item max-gcse-insertion-ratio
12056If the ratio of expression insertions to deletions is larger than this value
12057for any expression, then RTL PRE inserts or removes the expression and thus
12058leaves partially redundant computations in the instruction stream.
12059
12060@item max-pending-list-length
12061The maximum number of pending dependencies scheduling allows
12062before flushing the current state and starting over.  Large functions
12063with few branches or calls can create excessively large lists which
12064needlessly consume memory and resources.
12065
12066@item max-modulo-backtrack-attempts
12067The maximum number of backtrack attempts the scheduler should make
12068when modulo scheduling a loop.  Larger values can exponentially increase
12069compilation time.
12070
12071@item max-inline-insns-single
12072Several parameters control the tree inliner used in GCC@.  This number sets the
12073maximum number of instructions (counted in GCC's internal representation) in a
12074single function that the tree inliner considers for inlining.  This only
12075affects functions declared inline and methods implemented in a class
12076declaration (C++).
12077
12078
12079@item max-inline-insns-auto
12080When you use @option{-finline-functions} (included in @option{-O3}),
12081a lot of functions that would otherwise not be considered for inlining
12082by the compiler are investigated.  To those functions, a different
12083(more restrictive) limit compared to functions declared inline can
12084be applied (@option{--param max-inline-insns-auto}).
12085
12086@item max-inline-insns-small
12087This is bound applied to calls which are considered relevant with
12088@option{-finline-small-functions}.
12089
12090@item max-inline-insns-size
12091This is bound applied to calls which are optimized for size. Small growth
12092may be desirable to anticipate optimization oppurtunities exposed by inlining.
12093
12094@item uninlined-function-insns
12095Number of instructions accounted by inliner for function overhead such as
12096function prologue and epilogue.
12097
12098@item uninlined-function-time
12099Extra time accounted by inliner for function overhead such as time needed to
12100execute function prologue and epilogue
12101
12102@item inline-heuristics-hint-percent
12103The scale (in percents) applied to @option{inline-insns-single},
12104@option{inline-insns-single-O2}, @option{inline-insns-auto}
12105when inline heuristics hints that inlining is
12106very profitable (will enable later optimizations).
12107
12108@item uninlined-thunk-insns
12109@item uninlined-thunk-time
12110Same as @option{--param uninlined-function-insns} and
12111@option{--param uninlined-function-time} but applied to function thunks
12112
12113@item inline-min-speedup
12114When estimated performance improvement of caller + callee runtime exceeds this
12115threshold (in percent), the function can be inlined regardless of the limit on
12116@option{--param max-inline-insns-single} and @option{--param
12117max-inline-insns-auto}.
12118
12119@item large-function-insns
12120The limit specifying really large functions.  For functions larger than this
12121limit after inlining, inlining is constrained by
12122@option{--param large-function-growth}.  This parameter is useful primarily
12123to avoid extreme compilation time caused by non-linear algorithms used by the
12124back end.
12125
12126@item large-function-growth
12127Specifies maximal growth of large function caused by inlining in percents.
12128For example, parameter value 100 limits large function growth to 2.0 times
12129the original size.
12130
12131@item large-unit-insns
12132The limit specifying large translation unit.  Growth caused by inlining of
12133units larger than this limit is limited by @option{--param inline-unit-growth}.
12134For small units this might be too tight.
12135For example, consider a unit consisting of function A
12136that is inline and B that just calls A three times.  If B is small relative to
12137A, the growth of unit is 300\% and yet such inlining is very sane.  For very
12138large units consisting of small inlineable functions, however, the overall unit
12139growth limit is needed to avoid exponential explosion of code size.  Thus for
12140smaller units, the size is increased to @option{--param large-unit-insns}
12141before applying @option{--param inline-unit-growth}.
12142
12143@item inline-unit-growth
12144Specifies maximal overall growth of the compilation unit caused by inlining.
12145For example, parameter value 20 limits unit growth to 1.2 times the original
12146size. Cold functions (either marked cold via an attribute or by profile
12147feedback) are not accounted into the unit size.
12148
12149@item ipa-cp-unit-growth
12150Specifies maximal overall growth of the compilation unit caused by
12151interprocedural constant propagation.  For example, parameter value 10 limits
12152unit growth to 1.1 times the original size.
12153
12154@item large-stack-frame
12155The limit specifying large stack frames.  While inlining the algorithm is trying
12156to not grow past this limit too much.
12157
12158@item large-stack-frame-growth
12159Specifies maximal growth of large stack frames caused by inlining in percents.
12160For example, parameter value 1000 limits large stack frame growth to 11 times
12161the original size.
12162
12163@item max-inline-insns-recursive
12164@itemx max-inline-insns-recursive-auto
12165Specifies the maximum number of instructions an out-of-line copy of a
12166self-recursive inline
12167function can grow into by performing recursive inlining.
12168
12169@option{--param max-inline-insns-recursive} applies to functions
12170declared inline.
12171For functions not declared inline, recursive inlining
12172happens only when @option{-finline-functions} (included in @option{-O3}) is
12173enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12174
12175@item max-inline-recursive-depth
12176@itemx max-inline-recursive-depth-auto
12177Specifies the maximum recursion depth used for recursive inlining.
12178
12179@option{--param max-inline-recursive-depth} applies to functions
12180declared inline.  For functions not declared inline, recursive inlining
12181happens only when @option{-finline-functions} (included in @option{-O3}) is
12182enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12183
12184@item min-inline-recursive-probability
12185Recursive inlining is profitable only for function having deep recursion
12186in average and can hurt for function having little recursion depth by
12187increasing the prologue size or complexity of function body to other
12188optimizers.
12189
12190When profile feedback is available (see @option{-fprofile-generate}) the actual
12191recursion depth can be guessed from the probability that function recurses
12192via a given call expression.  This parameter limits inlining only to call
12193expressions whose probability exceeds the given threshold (in percents).
12194
12195@item early-inlining-insns
12196Specify growth that the early inliner can make.  In effect it increases
12197the amount of inlining for code having a large abstraction penalty.
12198
12199@item max-early-inliner-iterations
12200Limit of iterations of the early inliner.  This basically bounds
12201the number of nested indirect calls the early inliner can resolve.
12202Deeper chains are still handled by late inlining.
12203
12204@item comdat-sharing-probability
12205Probability (in percent) that C++ inline function with comdat visibility
12206are shared across multiple compilation units.
12207
12208@item profile-func-internal-id
12209A parameter to control whether to use function internal id in profile
12210database lookup. If the value is 0, the compiler uses an id that
12211is based on function assembler name and filename, which makes old profile
12212data more tolerant to source changes such as function reordering etc.
12213
12214@item min-vect-loop-bound
12215The minimum number of iterations under which loops are not vectorized
12216when @option{-ftree-vectorize} is used.  The number of iterations after
12217vectorization needs to be greater than the value specified by this option
12218to allow vectorization.
12219
12220@item gcse-cost-distance-ratio
12221Scaling factor in calculation of maximum distance an expression
12222can be moved by GCSE optimizations.  This is currently supported only in the
12223code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
12224is with simple expressions, i.e., the expressions that have cost
12225less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
12226hoisting of simple expressions.
12227
12228@item gcse-unrestricted-cost
12229Cost, roughly measured as the cost of a single typical machine
12230instruction, at which GCSE optimizations do not constrain
12231the distance an expression can travel.  This is currently
12232supported only in the code hoisting pass.  The lesser the cost,
12233the more aggressive code hoisting is.  Specifying 0
12234allows all expressions to travel unrestricted distances.
12235
12236@item max-hoist-depth
12237The depth of search in the dominator tree for expressions to hoist.
12238This is used to avoid quadratic behavior in hoisting algorithm.
12239The value of 0 does not limit on the search, but may slow down compilation
12240of huge functions.
12241
12242@item max-tail-merge-comparisons
12243The maximum amount of similar bbs to compare a bb with.  This is used to
12244avoid quadratic behavior in tree tail merging.
12245
12246@item max-tail-merge-iterations
12247The maximum amount of iterations of the pass over the function.  This is used to
12248limit compilation time in tree tail merging.
12249
12250@item store-merging-allow-unaligned
12251Allow the store merging pass to introduce unaligned stores if it is legal to
12252do so.
12253
12254@item max-stores-to-merge
12255The maximum number of stores to attempt to merge into wider stores in the store
12256merging pass.
12257
12258@item max-unrolled-insns
12259The maximum number of instructions that a loop may have to be unrolled.
12260If a loop is unrolled, this parameter also determines how many times
12261the loop code is unrolled.
12262
12263@item max-average-unrolled-insns
12264The maximum number of instructions biased by probabilities of their execution
12265that a loop may have to be unrolled.  If a loop is unrolled,
12266this parameter also determines how many times the loop code is unrolled.
12267
12268@item max-unroll-times
12269The maximum number of unrollings of a single loop.
12270
12271@item max-peeled-insns
12272The maximum number of instructions that a loop may have to be peeled.
12273If a loop is peeled, this parameter also determines how many times
12274the loop code is peeled.
12275
12276@item max-peel-times
12277The maximum number of peelings of a single loop.
12278
12279@item max-peel-branches
12280The maximum number of branches on the hot path through the peeled sequence.
12281
12282@item max-completely-peeled-insns
12283The maximum number of insns of a completely peeled loop.
12284
12285@item max-completely-peel-times
12286The maximum number of iterations of a loop to be suitable for complete peeling.
12287
12288@item max-completely-peel-loop-nest-depth
12289The maximum depth of a loop nest suitable for complete peeling.
12290
12291@item max-unswitch-insns
12292The maximum number of insns of an unswitched loop.
12293
12294@item max-unswitch-level
12295The maximum number of branches unswitched in a single loop.
12296
12297@item lim-expensive
12298The minimum cost of an expensive expression in the loop invariant motion.
12299
12300@item min-loop-cond-split-prob
12301When FDO profile information is available, @option{min-loop-cond-split-prob}
12302specifies minimum threshold for probability of semi-invariant condition
12303statement to trigger loop split.
12304
12305@item iv-consider-all-candidates-bound
12306Bound on number of candidates for induction variables, below which
12307all candidates are considered for each use in induction variable
12308optimizations.  If there are more candidates than this,
12309only the most relevant ones are considered to avoid quadratic time complexity.
12310
12311@item iv-max-considered-uses
12312The induction variable optimizations give up on loops that contain more
12313induction variable uses.
12314
12315@item iv-always-prune-cand-set-bound
12316If the number of candidates in the set is smaller than this value,
12317always try to remove unnecessary ivs from the set
12318when adding a new one.
12319
12320@item avg-loop-niter
12321Average number of iterations of a loop.
12322
12323@item dse-max-object-size
12324Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12325Larger values may result in larger compilation times.
12326
12327@item dse-max-alias-queries-per-store
12328Maximum number of queries into the alias oracle per store.
12329Larger values result in larger compilation times and may result in more
12330removed dead stores.
12331
12332@item scev-max-expr-size
12333Bound on size of expressions used in the scalar evolutions analyzer.
12334Large expressions slow the analyzer.
12335
12336@item scev-max-expr-complexity
12337Bound on the complexity of the expressions in the scalar evolutions analyzer.
12338Complex expressions slow the analyzer.
12339
12340@item max-tree-if-conversion-phi-args
12341Maximum number of arguments in a PHI supported by TREE if conversion
12342unless the loop is marked with simd pragma.
12343
12344@item vect-max-version-for-alignment-checks
12345The maximum number of run-time checks that can be performed when
12346doing loop versioning for alignment in the vectorizer.
12347
12348@item vect-max-version-for-alias-checks
12349The maximum number of run-time checks that can be performed when
12350doing loop versioning for alias in the vectorizer.
12351
12352@item vect-max-peeling-for-alignment
12353The maximum number of loop peels to enhance access alignment
12354for vectorizer. Value -1 means no limit.
12355
12356@item max-iterations-to-track
12357The maximum number of iterations of a loop the brute-force algorithm
12358for analysis of the number of iterations of the loop tries to evaluate.
12359
12360@item hot-bb-count-fraction
12361The denominator n of fraction 1/n of the maximal execution count of a
12362basic block in the entire program that a basic block needs to at least
12363have in order to be considered hot.  The default is 10000, which means
12364that a basic block is considered hot if its execution count is greater
12365than 1/10000 of the maximal execution count.  0 means that it is never
12366considered hot.  Used in non-LTO mode.
12367
12368@item hot-bb-count-ws-permille
12369The number of most executed permilles, ranging from 0 to 1000, of the
12370profiled execution of the entire program to which the execution count
12371of a basic block must be part of in order to be considered hot.  The
12372default is 990, which means that a basic block is considered hot if
12373its execution count contributes to the upper 990 permilles, or 99.0%,
12374of the profiled execution of the entire program.  0 means that it is
12375never considered hot.  Used in LTO mode.
12376
12377@item hot-bb-frequency-fraction
12378The denominator n of fraction 1/n of the execution frequency of the
12379entry block of a function that a basic block of this function needs
12380to at least have in order to be considered hot.  The default is 1000,
12381which means that a basic block is considered hot in a function if it
12382is executed more frequently than 1/1000 of the frequency of the entry
12383block of the function.  0 means that it is never considered hot.
12384
12385@item unlikely-bb-count-fraction
12386The denominator n of fraction 1/n of the number of profiled runs of
12387the entire program below which the execution count of a basic block
12388must be in order for the basic block to be considered unlikely executed.
12389The default is 20, which means that a basic block is considered unlikely
12390executed if it is executed in fewer than 1/20, or 5%, of the runs of
12391the program.  0 means that it is always considered unlikely executed.
12392
12393@item max-predicted-iterations
12394The maximum number of loop iterations we predict statically.  This is useful
12395in cases where a function contains a single loop with known bound and
12396another loop with unknown bound.
12397The known number of iterations is predicted correctly, while
12398the unknown number of iterations average to roughly 10.  This means that the
12399loop without bounds appears artificially cold relative to the other one.
12400
12401@item builtin-expect-probability
12402Control the probability of the expression having the specified value. This
12403parameter takes a percentage (i.e.@: 0 ... 100) as input.
12404
12405@item builtin-string-cmp-inline-length
12406The maximum length of a constant string for a builtin string cmp call
12407eligible for inlining.
12408
12409@item align-threshold
12410
12411Select fraction of the maximal frequency of executions of a basic block in
12412a function to align the basic block.
12413
12414@item align-loop-iterations
12415
12416A loop expected to iterate at least the selected number of iterations is
12417aligned.
12418
12419@item tracer-dynamic-coverage
12420@itemx tracer-dynamic-coverage-feedback
12421
12422This value is used to limit superblock formation once the given percentage of
12423executed instructions is covered.  This limits unnecessary code size
12424expansion.
12425
12426The @option{tracer-dynamic-coverage-feedback} parameter
12427is used only when profile
12428feedback is available.  The real profiles (as opposed to statically estimated
12429ones) are much less balanced allowing the threshold to be larger value.
12430
12431@item tracer-max-code-growth
12432Stop tail duplication once code growth has reached given percentage.  This is
12433a rather artificial limit, as most of the duplicates are eliminated later in
12434cross jumping, so it may be set to much higher values than is the desired code
12435growth.
12436
12437@item tracer-min-branch-ratio
12438
12439Stop reverse growth when the reverse probability of best edge is less than this
12440threshold (in percent).
12441
12442@item tracer-min-branch-probability
12443@itemx tracer-min-branch-probability-feedback
12444
12445Stop forward growth if the best edge has probability lower than this
12446threshold.
12447
12448Similarly to @option{tracer-dynamic-coverage} two parameters are
12449provided.  @option{tracer-min-branch-probability-feedback} is used for
12450compilation with profile feedback and @option{tracer-min-branch-probability}
12451compilation without.  The value for compilation with profile feedback
12452needs to be more conservative (higher) in order to make tracer
12453effective.
12454
12455@item stack-clash-protection-guard-size
12456Specify the size of the operating system provided stack guard as
124572 raised to @var{num} bytes.  Higher values may reduce the
12458number of explicit probes, but a value larger than the operating system
12459provided guard will leave code vulnerable to stack clash style attacks.
12460
12461@item stack-clash-protection-probe-interval
12462Stack clash protection involves probing stack space as it is allocated.  This
12463param controls the maximum distance between probes into the stack as 2 raised
12464to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
12465larger than the operating system provided guard will leave code vulnerable to
12466stack clash style attacks.
12467
12468@item max-cse-path-length
12469
12470The maximum number of basic blocks on path that CSE considers.
12471
12472@item max-cse-insns
12473The maximum number of instructions CSE processes before flushing.
12474
12475@item ggc-min-expand
12476
12477GCC uses a garbage collector to manage its own memory allocation.  This
12478parameter specifies the minimum percentage by which the garbage
12479collector's heap should be allowed to expand between collections.
12480Tuning this may improve compilation speed; it has no effect on code
12481generation.
12482
12483The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12484RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
12485the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
12486GCC is not able to calculate RAM on a particular platform, the lower
12487bound of 30% is used.  Setting this parameter and
12488@option{ggc-min-heapsize} to zero causes a full collection to occur at
12489every opportunity.  This is extremely slow, but can be useful for
12490debugging.
12491
12492@item ggc-min-heapsize
12493
12494Minimum size of the garbage collector's heap before it begins bothering
12495to collect garbage.  The first collection occurs after the heap expands
12496by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
12497tuning this may improve compilation speed, and has no effect on code
12498generation.
12499
12500The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12501tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12502with a lower bound of 4096 (four megabytes) and an upper bound of
12503131072 (128 megabytes).  If GCC is not able to calculate RAM on a
12504particular platform, the lower bound is used.  Setting this parameter
12505very large effectively disables garbage collection.  Setting this
12506parameter and @option{ggc-min-expand} to zero causes a full collection
12507to occur at every opportunity.
12508
12509@item max-reload-search-insns
12510The maximum number of instruction reload should look backward for equivalent
12511register.  Increasing values mean more aggressive optimization, making the
12512compilation time increase with probably slightly better performance.
12513
12514@item max-cselib-memory-locations
12515The maximum number of memory locations cselib should take into account.
12516Increasing values mean more aggressive optimization, making the compilation time
12517increase with probably slightly better performance.
12518
12519@item max-sched-ready-insns
12520The maximum number of instructions ready to be issued the scheduler should
12521consider at any given time during the first scheduling pass.  Increasing
12522values mean more thorough searches, making the compilation time increase
12523with probably little benefit.
12524
12525@item max-sched-region-blocks
12526The maximum number of blocks in a region to be considered for
12527interblock scheduling.
12528
12529@item max-pipeline-region-blocks
12530The maximum number of blocks in a region to be considered for
12531pipelining in the selective scheduler.
12532
12533@item max-sched-region-insns
12534The maximum number of insns in a region to be considered for
12535interblock scheduling.
12536
12537@item max-pipeline-region-insns
12538The maximum number of insns in a region to be considered for
12539pipelining in the selective scheduler.
12540
12541@item min-spec-prob
12542The minimum probability (in percents) of reaching a source block
12543for interblock speculative scheduling.
12544
12545@item max-sched-extend-regions-iters
12546The maximum number of iterations through CFG to extend regions.
12547A value of 0 disables region extensions.
12548
12549@item max-sched-insn-conflict-delay
12550The maximum conflict delay for an insn to be considered for speculative motion.
12551
12552@item sched-spec-prob-cutoff
12553The minimal probability of speculation success (in percents), so that
12554speculative insns are scheduled.
12555
12556@item sched-state-edge-prob-cutoff
12557The minimum probability an edge must have for the scheduler to save its
12558state across it.
12559
12560@item sched-mem-true-dep-cost
12561Minimal distance (in CPU cycles) between store and load targeting same
12562memory locations.
12563
12564@item selsched-max-lookahead
12565The maximum size of the lookahead window of selective scheduling.  It is a
12566depth of search for available instructions.
12567
12568@item selsched-max-sched-times
12569The maximum number of times that an instruction is scheduled during
12570selective scheduling.  This is the limit on the number of iterations
12571through which the instruction may be pipelined.
12572
12573@item selsched-insns-to-rename
12574The maximum number of best instructions in the ready list that are considered
12575for renaming in the selective scheduler.
12576
12577@item sms-min-sc
12578The minimum value of stage count that swing modulo scheduler
12579generates.
12580
12581@item max-last-value-rtl
12582The maximum size measured as number of RTLs that can be recorded in an expression
12583in combiner for a pseudo register as last known value of that register.
12584
12585@item max-combine-insns
12586The maximum number of instructions the RTL combiner tries to combine.
12587
12588@item integer-share-limit
12589Small integer constants can use a shared data structure, reducing the
12590compiler's memory usage and increasing its speed.  This sets the maximum
12591value of a shared integer constant.
12592
12593@item ssp-buffer-size
12594The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12595protection when @option{-fstack-protection} is used.
12596
12597@item min-size-for-stack-sharing
12598The minimum size of variables taking part in stack slot sharing when not
12599optimizing.
12600
12601@item max-jump-thread-duplication-stmts
12602Maximum number of statements allowed in a block that needs to be
12603duplicated when threading jumps.
12604
12605@item max-fields-for-field-sensitive
12606Maximum number of fields in a structure treated in
12607a field sensitive manner during pointer analysis.
12608
12609@item prefetch-latency
12610Estimate on average number of instructions that are executed before
12611prefetch finishes.  The distance prefetched ahead is proportional
12612to this constant.  Increasing this number may also lead to less
12613streams being prefetched (see @option{simultaneous-prefetches}).
12614
12615@item simultaneous-prefetches
12616Maximum number of prefetches that can run at the same time.
12617
12618@item l1-cache-line-size
12619The size of cache line in L1 data cache, in bytes.
12620
12621@item l1-cache-size
12622The size of L1 data cache, in kilobytes.
12623
12624@item l2-cache-size
12625The size of L2 data cache, in kilobytes.
12626
12627@item prefetch-dynamic-strides
12628Whether the loop array prefetch pass should issue software prefetch hints
12629for strides that are non-constant.  In some cases this may be
12630beneficial, though the fact the stride is non-constant may make it
12631hard to predict when there is clear benefit to issuing these hints.
12632
12633Set to 1 if the prefetch hints should be issued for non-constant
12634strides.  Set to 0 if prefetch hints should be issued only for strides that
12635are known to be constant and below @option{prefetch-minimum-stride}.
12636
12637@item prefetch-minimum-stride
12638Minimum constant stride, in bytes, to start using prefetch hints for.  If
12639the stride is less than this threshold, prefetch hints will not be issued.
12640
12641This setting is useful for processors that have hardware prefetchers, in
12642which case there may be conflicts between the hardware prefetchers and
12643the software prefetchers.  If the hardware prefetchers have a maximum
12644stride they can handle, it should be used here to improve the use of
12645software prefetchers.
12646
12647A value of -1 means we don't have a threshold and therefore
12648prefetch hints can be issued for any constant stride.
12649
12650This setting is only useful for strides that are known and constant.
12651
12652@item loop-interchange-max-num-stmts
12653The maximum number of stmts in a loop to be interchanged.
12654
12655@item loop-interchange-stride-ratio
12656The minimum ratio between stride of two loops for interchange to be profitable.
12657
12658@item min-insn-to-prefetch-ratio
12659The minimum ratio between the number of instructions and the
12660number of prefetches to enable prefetching in a loop.
12661
12662@item prefetch-min-insn-to-mem-ratio
12663The minimum ratio between the number of instructions and the
12664number of memory references to enable prefetching in a loop.
12665
12666@item use-canonical-types
12667Whether the compiler should use the ``canonical'' type system.
12668Should always be 1, which uses a more efficient internal
12669mechanism for comparing types in C++ and Objective-C++.  However, if
12670bugs in the canonical type system are causing compilation failures,
12671set this value to 0 to disable canonical types.
12672
12673@item switch-conversion-max-branch-ratio
12674Switch initialization conversion refuses to create arrays that are
12675bigger than @option{switch-conversion-max-branch-ratio} times the number of
12676branches in the switch.
12677
12678@item max-partial-antic-length
12679Maximum length of the partial antic set computed during the tree
12680partial redundancy elimination optimization (@option{-ftree-pre}) when
12681optimizing at @option{-O3} and above.  For some sorts of source code
12682the enhanced partial redundancy elimination optimization can run away,
12683consuming all of the memory available on the host machine.  This
12684parameter sets a limit on the length of the sets that are computed,
12685which prevents the runaway behavior.  Setting a value of 0 for
12686this parameter allows an unlimited set length.
12687
12688@item rpo-vn-max-loop-depth
12689Maximum loop depth that is value-numbered optimistically.
12690When the limit hits the innermost
12691@var{rpo-vn-max-loop-depth} loops and the outermost loop in the
12692loop nest are value-numbered optimistically and the remaining ones not.
12693
12694@item sccvn-max-alias-queries-per-access
12695Maximum number of alias-oracle queries we perform when looking for
12696redundancies for loads and stores.  If this limit is hit the search
12697is aborted and the load or store is not considered redundant.  The
12698number of queries is algorithmically limited to the number of
12699stores on all paths from the load to the function entry.
12700
12701@item ira-max-loops-num
12702IRA uses regional register allocation by default.  If a function
12703contains more loops than the number given by this parameter, only at most
12704the given number of the most frequently-executed loops form regions
12705for regional register allocation.
12706
12707@item ira-max-conflict-table-size
12708Although IRA uses a sophisticated algorithm to compress the conflict
12709table, the table can still require excessive amounts of memory for
12710huge functions.  If the conflict table for a function could be more
12711than the size in MB given by this parameter, the register allocator
12712instead uses a faster, simpler, and lower-quality
12713algorithm that does not require building a pseudo-register conflict table.
12714
12715@item ira-loop-reserved-regs
12716IRA can be used to evaluate more accurate register pressure in loops
12717for decisions to move loop invariants (see @option{-O3}).  The number
12718of available registers reserved for some other purposes is given
12719by this parameter.  Default of the parameter
12720is the best found from numerous experiments.
12721
12722@item lra-inheritance-ebb-probability-cutoff
12723LRA tries to reuse values reloaded in registers in subsequent insns.
12724This optimization is called inheritance.  EBB is used as a region to
12725do this optimization.  The parameter defines a minimal fall-through
12726edge probability in percentage used to add BB to inheritance EBB in
12727LRA.  The default value was chosen
12728from numerous runs of SPEC2000 on x86-64.
12729
12730@item loop-invariant-max-bbs-in-loop
12731Loop invariant motion can be very expensive, both in compilation time and
12732in amount of needed compile-time memory, with very large loops.  Loops
12733with more basic blocks than this parameter won't have loop invariant
12734motion optimization performed on them.
12735
12736@item loop-max-datarefs-for-datadeps
12737Building data dependencies is expensive for very large loops.  This
12738parameter limits the number of data references in loops that are
12739considered for data dependence analysis.  These large loops are no
12740handled by the optimizations using loop data dependencies.
12741
12742@item max-vartrack-size
12743Sets a maximum number of hash table slots to use during variable
12744tracking dataflow analysis of any function.  If this limit is exceeded
12745with variable tracking at assignments enabled, analysis for that
12746function is retried without it, after removing all debug insns from
12747the function.  If the limit is exceeded even without debug insns, var
12748tracking analysis is completely disabled for the function.  Setting
12749the parameter to zero makes it unlimited.
12750
12751@item max-vartrack-expr-depth
12752Sets a maximum number of recursion levels when attempting to map
12753variable names or debug temporaries to value expressions.  This trades
12754compilation time for more complete debug information.  If this is set too
12755low, value expressions that are available and could be represented in
12756debug information may end up not being used; setting this higher may
12757enable the compiler to find more complex debug expressions, but compile
12758time and memory use may grow.
12759
12760@item max-debug-marker-count
12761Sets a threshold on the number of debug markers (e.g.@: begin stmt
12762markers) to avoid complexity explosion at inlining or expanding to RTL.
12763If a function has more such gimple stmts than the set limit, such stmts
12764will be dropped from the inlined copy of a function, and from its RTL
12765expansion.
12766
12767@item min-nondebug-insn-uid
12768Use uids starting at this parameter for nondebug insns.  The range below
12769the parameter is reserved exclusively for debug insns created by
12770@option{-fvar-tracking-assignments}, but debug insns may get
12771(non-overlapping) uids above it if the reserved range is exhausted.
12772
12773@item ipa-sra-ptr-growth-factor
12774IPA-SRA replaces a pointer to an aggregate with one or more new
12775parameters only when their cumulative size is less or equal to
12776@option{ipa-sra-ptr-growth-factor} times the size of the original
12777pointer parameter.
12778
12779@item ipa-sra-max-replacements
12780Maximum pieces of an aggregate that IPA-SRA tracks.  As a
12781consequence, it is also the maximum number of replacements of a formal
12782parameter.
12783
12784@item sra-max-scalarization-size-Ospeed
12785@itemx sra-max-scalarization-size-Osize
12786The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12787replace scalar parts of aggregates with uses of independent scalar
12788variables.  These parameters control the maximum size, in storage units,
12789of aggregate which is considered for replacement when compiling for
12790speed
12791(@option{sra-max-scalarization-size-Ospeed}) or size
12792(@option{sra-max-scalarization-size-Osize}) respectively.
12793
12794@item sra-max-propagations
12795The maximum number of artificial accesses that Scalar Replacement of
12796Aggregates (SRA) will track, per one local variable, in order to
12797facilitate copy propagation.
12798
12799@item tm-max-aggregate-size
12800When making copies of thread-local variables in a transaction, this
12801parameter specifies the size in bytes after which variables are
12802saved with the logging functions as opposed to save/restore code
12803sequence pairs.  This option only applies when using
12804@option{-fgnu-tm}.
12805
12806@item graphite-max-nb-scop-params
12807To avoid exponential effects in the Graphite loop transforms, the
12808number of parameters in a Static Control Part (SCoP) is bounded.
12809A value of zero can be used to lift
12810the bound.  A variable whose value is unknown at compilation time and
12811defined outside a SCoP is a parameter of the SCoP.
12812
12813@item loop-block-tile-size
12814Loop blocking or strip mining transforms, enabled with
12815@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12816loop in the loop nest by a given number of iterations.  The strip
12817length can be changed using the @option{loop-block-tile-size}
12818parameter.
12819
12820@item ipa-cp-value-list-size
12821IPA-CP attempts to track all possible values and types passed to a function's
12822parameter in order to propagate them and perform devirtualization.
12823@option{ipa-cp-value-list-size} is the maximum number of values and types it
12824stores per one formal parameter of a function.
12825
12826@item ipa-cp-eval-threshold
12827IPA-CP calculates its own score of cloning profitability heuristics
12828and performs those cloning opportunities with scores that exceed
12829@option{ipa-cp-eval-threshold}.
12830
12831@item ipa-cp-max-recursive-depth
12832Maximum depth of recursive cloning for self-recursive function.
12833
12834@item ipa-cp-min-recursive-probability
12835Recursive cloning only when the probability of call being executed exceeds
12836the parameter.
12837
12838@item ipa-cp-recursion-penalty
12839Percentage penalty the recursive functions will receive when they
12840are evaluated for cloning.
12841
12842@item ipa-cp-single-call-penalty
12843Percentage penalty functions containing a single call to another
12844function will receive when they are evaluated for cloning.
12845
12846@item ipa-max-agg-items
12847IPA-CP is also capable to propagate a number of scalar values passed
12848in an aggregate. @option{ipa-max-agg-items} controls the maximum
12849number of such values per one parameter.
12850
12851@item ipa-cp-loop-hint-bonus
12852When IPA-CP determines that a cloning candidate would make the number
12853of iterations of a loop known, it adds a bonus of
12854@option{ipa-cp-loop-hint-bonus} to the profitability score of
12855the candidate.
12856
12857@item ipa-max-aa-steps
12858During its analysis of function bodies, IPA-CP employs alias analysis
12859in order to track values pointed to by function parameters.  In order
12860not spend too much time analyzing huge functions, it gives up and
12861consider all memory clobbered after examining
12862@option{ipa-max-aa-steps} statements modifying memory.
12863
12864@item ipa-max-switch-predicate-bounds
12865Maximal number of boundary endpoints of case ranges of switch statement.
12866For switch exceeding this limit, IPA-CP will not construct cloning cost
12867predicate, which is used to estimate cloning benefit, for default case
12868of the switch statement.
12869
12870@item ipa-max-param-expr-ops
12871IPA-CP will analyze conditional statement that references some function
12872parameter to estimate benefit for cloning upon certain constant value.
12873But if number of operations in a parameter expression exceeds
12874@option{ipa-max-param-expr-ops}, the expression is treated as complicated
12875one, and is not handled by IPA analysis.
12876
12877@item lto-partitions
12878Specify desired number of partitions produced during WHOPR compilation.
12879The number of partitions should exceed the number of CPUs used for compilation.
12880
12881@item lto-min-partition
12882Size of minimal partition for WHOPR (in estimated instructions).
12883This prevents expenses of splitting very small programs into too many
12884partitions.
12885
12886@item lto-max-partition
12887Size of max partition for WHOPR (in estimated instructions).
12888to provide an upper bound for individual size of partition.
12889Meant to be used only with balanced partitioning.
12890
12891@item lto-max-streaming-parallelism
12892Maximal number of parallel processes used for LTO streaming.
12893
12894@item cxx-max-namespaces-for-diagnostic-help
12895The maximum number of namespaces to consult for suggestions when C++
12896name lookup fails for an identifier.
12897
12898@item sink-frequency-threshold
12899The maximum relative execution frequency (in percents) of the target block
12900relative to a statement's original block to allow statement sinking of a
12901statement.  Larger numbers result in more aggressive statement sinking.
12902A small positive adjustment is applied for
12903statements with memory operands as those are even more profitable so sink.
12904
12905@item max-stores-to-sink
12906The maximum number of conditional store pairs that can be sunk.  Set to 0
12907if either vectorization (@option{-ftree-vectorize}) or if-conversion
12908(@option{-ftree-loop-if-convert}) is disabled.
12909
12910@item case-values-threshold
12911The smallest number of different values for which it is best to use a
12912jump-table instead of a tree of conditional branches.  If the value is
129130, use the default for the machine.
12914
12915@item jump-table-max-growth-ratio-for-size
12916The maximum code size growth ratio when expanding
12917into a jump table (in percent).  The parameter is used when
12918optimizing for size.
12919
12920@item jump-table-max-growth-ratio-for-speed
12921The maximum code size growth ratio when expanding
12922into a jump table (in percent).  The parameter is used when
12923optimizing for speed.
12924
12925@item tree-reassoc-width
12926Set the maximum number of instructions executed in parallel in
12927reassociated tree. This parameter overrides target dependent
12928heuristics used by default if has non zero value.
12929
12930@item sched-pressure-algorithm
12931Choose between the two available implementations of
12932@option{-fsched-pressure}.  Algorithm 1 is the original implementation
12933and is the more likely to prevent instructions from being reordered.
12934Algorithm 2 was designed to be a compromise between the relatively
12935conservative approach taken by algorithm 1 and the rather aggressive
12936approach taken by the default scheduler.  It relies more heavily on
12937having a regular register file and accurate register pressure classes.
12938See @file{haifa-sched.c} in the GCC sources for more details.
12939
12940The default choice depends on the target.
12941
12942@item max-slsr-cand-scan
12943Set the maximum number of existing candidates that are considered when
12944seeking a basis for a new straight-line strength reduction candidate.
12945
12946@item asan-globals
12947Enable buffer overflow detection for global objects.  This kind
12948of protection is enabled by default if you are using
12949@option{-fsanitize=address} option.
12950To disable global objects protection use @option{--param asan-globals=0}.
12951
12952@item asan-stack
12953Enable buffer overflow detection for stack objects.  This kind of
12954protection is enabled by default when using @option{-fsanitize=address}.
12955To disable stack protection use @option{--param asan-stack=0} option.
12956
12957@item asan-instrument-reads
12958Enable buffer overflow detection for memory reads.  This kind of
12959protection is enabled by default when using @option{-fsanitize=address}.
12960To disable memory reads protection use
12961@option{--param asan-instrument-reads=0}.
12962
12963@item asan-instrument-writes
12964Enable buffer overflow detection for memory writes.  This kind of
12965protection is enabled by default when using @option{-fsanitize=address}.
12966To disable memory writes protection use
12967@option{--param asan-instrument-writes=0} option.
12968
12969@item asan-memintrin
12970Enable detection for built-in functions.  This kind of protection
12971is enabled by default when using @option{-fsanitize=address}.
12972To disable built-in functions protection use
12973@option{--param asan-memintrin=0}.
12974
12975@item asan-use-after-return
12976Enable detection of use-after-return.  This kind of protection
12977is enabled by default when using the @option{-fsanitize=address} option.
12978To disable it use @option{--param asan-use-after-return=0}.
12979
12980Note: By default the check is disabled at run time.  To enable it,
12981add @code{detect_stack_use_after_return=1} to the environment variable
12982@env{ASAN_OPTIONS}.
12983
12984@item asan-instrumentation-with-call-threshold
12985If number of memory accesses in function being instrumented
12986is greater or equal to this number, use callbacks instead of inline checks.
12987E.g. to disable inline code use
12988@option{--param asan-instrumentation-with-call-threshold=0}.
12989
12990@item use-after-scope-direct-emission-threshold
12991If the size of a local variable in bytes is smaller or equal to this
12992number, directly poison (or unpoison) shadow memory instead of using
12993run-time callbacks.
12994
12995@item max-fsm-thread-path-insns
12996Maximum number of instructions to copy when duplicating blocks on a
12997finite state automaton jump thread path.
12998
12999@item max-fsm-thread-length
13000Maximum number of basic blocks on a finite state automaton jump thread
13001path.
13002
13003@item max-fsm-thread-paths
13004Maximum number of new jump thread paths to create for a finite state
13005automaton.
13006
13007@item parloops-chunk-size
13008Chunk size of omp schedule for loops parallelized by parloops.
13009
13010@item parloops-schedule
13011Schedule type of omp schedule for loops parallelized by parloops (static,
13012dynamic, guided, auto, runtime).
13013
13014@item parloops-min-per-thread
13015The minimum number of iterations per thread of an innermost parallelized
13016loop for which the parallelized variant is preferred over the single threaded
13017one.  Note that for a parallelized loop nest the
13018minimum number of iterations of the outermost loop per thread is two.
13019
13020@item max-ssa-name-query-depth
13021Maximum depth of recursion when querying properties of SSA names in things
13022like fold routines.  One level of recursion corresponds to following a
13023use-def chain.
13024
13025@item hsa-gen-debug-stores
13026Enable emission of special debug stores within HSA kernels which are
13027then read and reported by libgomp plugin.  Generation of these stores
13028is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
13029enable it.
13030
13031@item max-speculative-devirt-maydefs
13032The maximum number of may-defs we analyze when looking for a must-def
13033specifying the dynamic type of an object that invokes a virtual call
13034we may be able to devirtualize speculatively.
13035
13036@item max-vrp-switch-assertions
13037The maximum number of assertions to add along the default edge of a switch
13038statement during VRP.
13039
13040@item unroll-jam-min-percent
13041The minimum percentage of memory references that must be optimized
13042away for the unroll-and-jam transformation to be considered profitable.
13043
13044@item unroll-jam-max-unroll
13045The maximum number of times the outer loop should be unrolled by
13046the unroll-and-jam transformation.
13047
13048@item max-rtl-if-conversion-unpredictable-cost
13049Maximum permissible cost for the sequence that would be generated
13050by the RTL if-conversion pass for a branch that is considered unpredictable.
13051
13052@item max-variable-expansions-in-unroller
13053If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13054of times that an individual variable will be expanded during loop unrolling.
13055
13056@item tracer-min-branch-probability-feedback
13057Stop forward growth if the probability of best edge is less than
13058this threshold (in percent). Used when profile feedback is available.
13059
13060@item partial-inlining-entry-probability
13061Maximum probability of the entry BB of split region
13062(in percent relative to entry BB of the function)
13063to make partial inlining happen.
13064
13065@item max-tracked-strlens
13066Maximum number of strings for which strlen optimization pass will
13067track string lengths.
13068
13069@item gcse-after-reload-partial-fraction
13070The threshold ratio for performing partial redundancy
13071elimination after reload.
13072
13073@item gcse-after-reload-critical-fraction
13074The threshold ratio of critical edges execution count that
13075permit performing redundancy elimination after reload.
13076
13077@item max-loop-header-insns
13078The maximum number of insns in loop header duplicated
13079by the copy loop headers pass.
13080
13081@item vect-epilogues-nomask
13082Enable loop epilogue vectorization using smaller vector size.
13083
13084@item slp-max-insns-in-bb
13085Maximum number of instructions in basic block to be
13086considered for SLP vectorization.
13087
13088@item avoid-fma-max-bits
13089Maximum number of bits for which we avoid creating FMAs.
13090
13091@item sms-loop-average-count-threshold
13092A threshold on the average loop count considered by the swing modulo scheduler.
13093
13094@item sms-dfa-history
13095The number of cycles the swing modulo scheduler considers when checking
13096conflicts using DFA.
13097
13098@item max-inline-insns-recursive-auto
13099The maximum number of instructions non-inline function
13100can grow to via recursive inlining.
13101
13102@item graphite-allow-codegen-errors
13103Whether codegen errors should be ICEs when @option{-fchecking}.
13104
13105@item sms-max-ii-factor
13106A factor for tuning the upper bound that swing modulo scheduler
13107uses for scheduling a loop.
13108
13109@item lra-max-considered-reload-pseudos
13110The max number of reload pseudos which are considered during
13111spilling a non-reload pseudo.
13112
13113@item max-pow-sqrt-depth
13114Maximum depth of sqrt chains to use when synthesizing exponentiation
13115by a real constant.
13116
13117@item max-dse-active-local-stores
13118Maximum number of active local stores in RTL dead store elimination.
13119
13120@item asan-instrument-allocas
13121Enable asan allocas/VLAs protection.
13122
13123@item max-iterations-computation-cost
13124Bound on the cost of an expression to compute the number of iterations.
13125
13126@item max-isl-operations
13127Maximum number of isl operations, 0 means unlimited.
13128
13129@item graphite-max-arrays-per-scop
13130Maximum number of arrays per scop.
13131
13132@item max-vartrack-reverse-op-size
13133Max. size of loc list for which reverse ops should be added.
13134
13135@item tracer-dynamic-coverage-feedback
13136The percentage of function, weighted by execution frequency,
13137that must be covered by trace formation.
13138Used when profile feedback is available.
13139
13140@item max-inline-recursive-depth-auto
13141The maximum depth of recursive inlining for non-inline functions.
13142
13143@item fsm-scale-path-stmts
13144Scale factor to apply to the number of statements in a threading path
13145when comparing to the number of (scaled) blocks.
13146
13147@item fsm-maximum-phi-arguments
13148Maximum number of arguments a PHI may have before the FSM threader
13149will not try to thread through its block.
13150
13151@item uninit-control-dep-attempts
13152Maximum number of nested calls to search for control dependencies
13153during uninitialized variable analysis.
13154
13155@item sra-max-scalarization-size-Osize
13156Maximum size, in storage units, of an aggregate
13157which should be considered for scalarization when compiling for size.
13158
13159@item fsm-scale-path-blocks
13160Scale factor to apply to the number of blocks in a threading path
13161when comparing to the number of (scaled) statements.
13162
13163@item sched-autopref-queue-depth
13164Hardware autoprefetcher scheduler model control flag.
13165Number of lookahead cycles the model looks into; at '
13166' only enable instruction sorting heuristic.
13167
13168@item loop-versioning-max-inner-insns
13169The maximum number of instructions that an inner loop can have
13170before the loop versioning pass considers it too big to copy.
13171
13172@item loop-versioning-max-outer-insns
13173The maximum number of instructions that an outer loop can have
13174before the loop versioning pass considers it too big to copy,
13175discounting any instructions in inner loops that directly benefit
13176from versioning.
13177
13178@item ssa-name-def-chain-limit
13179The maximum number of SSA_NAME assignments to follow in determining
13180a property of a variable such as its value.  This limits the number
13181of iterations or recursive calls GCC performs when optimizing certain
13182statements or when determining their validity prior to issuing
13183diagnostics.
13184
13185@item store-merging-max-size
13186Maximum size of a single store merging region in bytes.
13187
13188@item hash-table-verification-limit
13189The number of elements for which hash table verification is done
13190for each searched element.
13191
13192@item max-find-base-term-values
13193Maximum number of VALUEs handled during a single find_base_term call.
13194
13195@item analyzer-max-enodes-per-program-point
13196The maximum number of exploded nodes per program point within
13197the analyzer, before terminating analysis of that point.
13198
13199@item analyzer-min-snodes-for-call-summary
13200The minimum number of supernodes within a function for the
13201analyzer to consider summarizing its effects at call sites.
13202
13203@item analyzer-max-recursion-depth
13204The maximum number of times a callsite can appear in a call stack
13205within the analyzer, before terminating analysis of a call that would
13206recurse deeper.
13207
13208@item gimple-fe-computed-hot-bb-threshold
13209The number of executions of a basic block which is considered hot.
13210The parameter is used only in GIMPLE FE.
13211
13212@item analyzer-bb-explosion-factor
13213The maximum number of 'after supernode' exploded nodes within the analyzer
13214per supernode, before terminating analysis.
13215
13216@end table
13217
13218The following choices of @var{name} are available on AArch64 targets:
13219
13220@table @gcctabopt
13221@item aarch64-sve-compare-costs
13222When vectorizing for SVE, consider using ``unpacked'' vectors for
13223smaller elements and use the cost model to pick the cheapest approach.
13224Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13225
13226Using unpacked vectors includes storing smaller elements in larger
13227containers and accessing elements with extending loads and truncating
13228stores.
13229
13230@item aarch64-float-recp-precision
13231The number of Newton iterations for calculating the reciprocal for float type.
13232The precision of division is proportional to this param when division
13233approximation is enabled.  The default value is 1.
13234
13235@item aarch64-double-recp-precision
13236The number of Newton iterations for calculating the reciprocal for double type.
13237The precision of division is propotional to this param when division
13238approximation is enabled.  The default value is 2.
13239
13240@item aarch64-autovec-preference
13241Force an ISA selection strategy for auto-vectorization.  Accepts values from
132420 to 4, inclusive.
13243@table @samp
13244@item 0
13245Use the default heuristics.
13246@item 1
13247Use only Advanced SIMD for auto-vectorization.
13248@item 2
13249Use only SVE for auto-vectorization.
13250@item 3
13251Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
13252deemed equal.
13253@item 4
13254Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
13255@end table
13256The default value is 0.
13257
13258@end table
13259
13260@end table
13261
13262@node Instrumentation Options
13263@section Program Instrumentation Options
13264@cindex instrumentation options
13265@cindex program instrumentation options
13266@cindex run-time error checking options
13267@cindex profiling options
13268@cindex options, program instrumentation
13269@cindex options, run-time error checking
13270@cindex options, profiling
13271
13272GCC supports a number of command-line options that control adding
13273run-time instrumentation to the code it normally generates.
13274For example, one purpose of instrumentation is collect profiling
13275statistics for use in finding program hot spots, code coverage
13276analysis, or profile-guided optimizations.
13277Another class of program instrumentation is adding run-time checking
13278to detect programming errors like invalid pointer
13279dereferences or out-of-bounds array accesses, as well as deliberately
13280hostile attacks such as stack smashing or C++ vtable hijacking.
13281There is also a general hook which can be used to implement other
13282forms of tracing or function-level instrumentation for debug or
13283program analysis purposes.
13284
13285@table @gcctabopt
13286@cindex @command{prof}
13287@cindex @command{gprof}
13288@item -p
13289@itemx -pg
13290@opindex p
13291@opindex pg
13292Generate extra code to write profile information suitable for the
13293analysis program @command{prof} (for @option{-p}) or @command{gprof}
13294(for @option{-pg}).  You must use this option when compiling
13295the source files you want data about, and you must also use it when
13296linking.
13297
13298You can use the function attribute @code{no_instrument_function} to
13299suppress profiling of individual functions when compiling with these options.
13300@xref{Common Function Attributes}.
13301
13302@item -fprofile-arcs
13303@opindex fprofile-arcs
13304Add code so that program flow @dfn{arcs} are instrumented.  During
13305execution the program records how many times each branch and call is
13306executed and how many times it is taken or returns.  On targets that support
13307constructors with priority support, profiling properly handles constructors,
13308destructors and C++ constructors (and destructors) of classes which are used
13309as a type of a global variable.
13310
13311When the compiled
13312program exits it saves this data to a file called
13313@file{@var{auxname}.gcda} for each source file.  The data may be used for
13314profile-directed optimizations (@option{-fbranch-probabilities}), or for
13315test coverage analysis (@option{-ftest-coverage}).  Each object file's
13316@var{auxname} is generated from the name of the output file, if
13317explicitly specified and it is not the final executable, otherwise it is
13318the basename of the source file.  In both cases any suffix is removed
13319(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13320@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13321@xref{Cross-profiling}.
13322
13323@cindex @command{gcov}
13324@item --coverage
13325@opindex coverage
13326
13327This option is used to compile and link code instrumented for coverage
13328analysis.  The option is a synonym for @option{-fprofile-arcs}
13329@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13330linking).  See the documentation for those options for more details.
13331
13332@itemize
13333
13334@item
13335Compile the source files with @option{-fprofile-arcs} plus optimization
13336and code generation options.  For test coverage analysis, use the
13337additional @option{-ftest-coverage} option.  You do not need to profile
13338every source file in a program.
13339
13340@item
13341Compile the source files additionally with @option{-fprofile-abs-path}
13342to create absolute path names in the @file{.gcno} files.  This allows
13343@command{gcov} to find the correct sources in projects where compilations
13344occur with different working directories.
13345
13346@item
13347Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13348(the latter implies the former).
13349
13350@item
13351Run the program on a representative workload to generate the arc profile
13352information.  This may be repeated any number of times.  You can run
13353concurrent instances of your program, and provided that the file system
13354supports locking, the data files will be correctly updated.  Unless
13355a strict ISO C dialect option is in effect, @code{fork} calls are
13356detected and correctly handled without double counting.
13357
13358@item
13359For profile-directed optimizations, compile the source files again with
13360the same optimization and code generation options plus
13361@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13362Control Optimization}).
13363
13364@item
13365For test coverage analysis, use @command{gcov} to produce human readable
13366information from the @file{.gcno} and @file{.gcda} files.  Refer to the
13367@command{gcov} documentation for further information.
13368
13369@end itemize
13370
13371With @option{-fprofile-arcs}, for each function of your program GCC
13372creates a program flow graph, then finds a spanning tree for the graph.
13373Only arcs that are not on the spanning tree have to be instrumented: the
13374compiler adds code to count the number of times that these arcs are
13375executed.  When an arc is the only exit or only entrance to a block, the
13376instrumentation code can be added to the block; otherwise, a new basic
13377block must be created to hold the instrumentation code.
13378
13379@need 2000
13380@item -ftest-coverage
13381@opindex ftest-coverage
13382Produce a notes file that the @command{gcov} code-coverage utility
13383(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13384show program coverage.  Each source file's note file is called
13385@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
13386above for a description of @var{auxname} and instructions on how to
13387generate test coverage data.  Coverage data matches the source files
13388more closely if you do not optimize.
13389
13390@item -fprofile-abs-path
13391@opindex fprofile-abs-path
13392Automatically convert relative source file names to absolute path names
13393in the @file{.gcno} files.  This allows @command{gcov} to find the correct
13394sources in projects where compilations occur with different working
13395directories.
13396
13397@item -fprofile-dir=@var{path}
13398@opindex fprofile-dir
13399
13400Set the directory to search for the profile data files in to @var{path}.
13401This option affects only the profile data generated by
13402@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13403and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13404and its related options.  Both absolute and relative paths can be used.
13405By default, GCC uses the current directory as @var{path}, thus the
13406profile data file appears in the same directory as the object file.
13407In order to prevent the file name clashing, if the object file name is
13408not an absolute path, we mangle the absolute path of the
13409@file{@var{sourcename}.gcda} file and use it as the file name of a
13410@file{.gcda} file.  See similar option @option{-fprofile-note}.
13411
13412When an executable is run in a massive parallel environment, it is recommended
13413to save profile to different folders.  That can be done with variables
13414in @var{path} that are exported during run-time:
13415
13416@table @gcctabopt
13417
13418@item %p
13419process ID.
13420
13421@item %q@{VAR@}
13422value of environment variable @var{VAR}
13423
13424@end table
13425
13426@item -fprofile-generate
13427@itemx -fprofile-generate=@var{path}
13428@opindex fprofile-generate
13429
13430Enable options usually used for instrumenting application to produce
13431profile useful for later recompilation with profile feedback based
13432optimization.  You must use @option{-fprofile-generate} both when
13433compiling and when linking your program.
13434
13435The following options are enabled:
13436@option{-fprofile-arcs}, @option{-fprofile-values},
13437@option{-finline-functions}, and @option{-fipa-bit-cp}.
13438
13439If @var{path} is specified, GCC looks at the @var{path} to find
13440the profile feedback data files. See @option{-fprofile-dir}.
13441
13442To optimize the program based on the collected profile information, use
13443@option{-fprofile-use}.  @xref{Optimize Options}, for more information.
13444
13445@item -fprofile-note=@var{path}
13446@opindex fprofile-note
13447
13448If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13449location.  If you combine the option with multiple source files,
13450the @file{.gcno} file will be overwritten.
13451
13452@item -fprofile-prefix-path=@var{path}
13453@opindex fprofile-prefix-path
13454
13455This option can be used in combination with
13456@option{profile-generate=}@var{profile_dir} and
13457@option{profile-use=}@var{profile_dir} to inform GCC where is the base
13458directory of built source tree.  By default @var{profile_dir} will contain
13459files with mangled absolute paths of all object files in the built project.
13460This is not desirable when directory used to build the instrumented binary
13461differs from the directory used to build the binary optimized with profile
13462feedback because the profile data will not be found during the optimized build.
13463In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
13464pointing to the base directory of the build can be used to strip the irrelevant
13465part of the path and keep all file names relative to the main build directory.
13466
13467@item -fprofile-update=@var{method}
13468@opindex fprofile-update
13469
13470Alter the update method for an application instrumented for profile
13471feedback based optimization.  The @var{method} argument should be one of
13472@samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13473The first one is useful for single-threaded applications,
13474while the second one prevents profile corruption by emitting thread-safe code.
13475
13476@strong{Warning:} When an application does not properly join all threads
13477(or creates an detached thread), a profile file can be still corrupted.
13478
13479Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13480when supported by a target, or to @samp{single} otherwise.  The GCC driver
13481automatically selects @samp{prefer-atomic} when @option{-pthread}
13482is present in the command line.
13483
13484@item -fprofile-filter-files=@var{regex}
13485@opindex fprofile-filter-files
13486
13487Instrument only functions from files where names match
13488any regular expression (separated by a semi-colon).
13489
13490For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13491only @file{main.c} and all C files starting with 'module'.
13492
13493@item -fprofile-exclude-files=@var{regex}
13494@opindex fprofile-exclude-files
13495
13496Instrument only functions from files where names do not match
13497all the regular expressions (separated by a semi-colon).
13498
13499For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13500of all files that are located in @file{/usr/} folder.
13501
13502@item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
13503@opindex fprofile-reproducible
13504Control level of reproducibility of profile gathered by
13505@code{-fprofile-generate}.  This makes it possible to rebuild program
13506with same outcome which is useful, for example, for distribution
13507packages.
13508
13509With @option{-fprofile-reproducible=serial} the profile gathered by
13510@option{-fprofile-generate} is reproducible provided the trained program
13511behaves the same at each invocation of the train run, it is not
13512multi-threaded and profile data streaming is always done in the same
13513order.  Note that profile streaming happens at the end of program run but
13514also before @code{fork} function is invoked.
13515
13516Note that it is quite common that execution counts of some part of
13517programs depends, for example, on length of temporary file names or
13518memory space randomization (that may affect hash-table collision rate).
13519Such non-reproducible part of programs may be annotated by
13520@code{no_instrument_function} function attribute. @code{gcov-dump} with
13521@option{-l} can be used to dump gathered data and verify that they are
13522indeed reproducible.
13523
13524With @option{-fprofile-reproducible=parallel-runs} collected profile
13525stays reproducible regardless the order of streaming of the data into
13526gcda files.  This setting makes it possible to run multiple instances of
13527instrumented program in parallel (such as with @code{make -j}). This
13528reduces quality of gathered data, in particular of indirect call
13529profiling.
13530
13531@item -fsanitize=address
13532@opindex fsanitize=address
13533Enable AddressSanitizer, a fast memory error detector.
13534Memory access instructions are instrumented to detect
13535out-of-bounds and use-after-free bugs.
13536The option enables @option{-fsanitize-address-use-after-scope}.
13537See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13538more details.  The run-time behavior can be influenced using the
13539@env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
13540the available options are shown at startup of the instrumented program.  See
13541@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13542for a list of supported options.
13543The option cannot be combined with @option{-fsanitize=thread}.
13544
13545@item -fsanitize=kernel-address
13546@opindex fsanitize=kernel-address
13547Enable AddressSanitizer for Linux kernel.
13548See @uref{https://github.com/google/kasan/wiki} for more details.
13549
13550@item -fsanitize=pointer-compare
13551@opindex fsanitize=pointer-compare
13552Instrument comparison operation (<, <=, >, >=) with pointer operands.
13553The option must be combined with either @option{-fsanitize=kernel-address} or
13554@option{-fsanitize=address}
13555The option cannot be combined with @option{-fsanitize=thread}.
13556Note: By default the check is disabled at run time.  To enable it,
13557add @code{detect_invalid_pointer_pairs=2} to the environment variable
13558@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13559invalid operation only when both pointers are non-null.
13560
13561@item -fsanitize=pointer-subtract
13562@opindex fsanitize=pointer-subtract
13563Instrument subtraction with pointer operands.
13564The option must be combined with either @option{-fsanitize=kernel-address} or
13565@option{-fsanitize=address}
13566The option cannot be combined with @option{-fsanitize=thread}.
13567Note: By default the check is disabled at run time.  To enable it,
13568add @code{detect_invalid_pointer_pairs=2} to the environment variable
13569@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13570invalid operation only when both pointers are non-null.
13571
13572@item -fsanitize=thread
13573@opindex fsanitize=thread
13574Enable ThreadSanitizer, a fast data race detector.
13575Memory access instructions are instrumented to detect
13576data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13577details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13578environment variable; see
13579@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13580supported options.
13581The option cannot be combined with @option{-fsanitize=address},
13582@option{-fsanitize=leak}.
13583
13584Note that sanitized atomic builtins cannot throw exceptions when
13585operating on invalid memory addresses with non-call exceptions
13586(@option{-fnon-call-exceptions}).
13587
13588@item -fsanitize=leak
13589@opindex fsanitize=leak
13590Enable LeakSanitizer, a memory leak detector.
13591This option only matters for linking of executables and
13592the executable is linked against a library that overrides @code{malloc}
13593and other allocator functions.  See
13594@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13595details.  The run-time behavior can be influenced using the
13596@env{LSAN_OPTIONS} environment variable.
13597The option cannot be combined with @option{-fsanitize=thread}.
13598
13599@item -fsanitize=undefined
13600@opindex fsanitize=undefined
13601Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13602Various computations are instrumented to detect undefined behavior
13603at runtime.  Current suboptions are:
13604
13605@table @gcctabopt
13606
13607@item -fsanitize=shift
13608@opindex fsanitize=shift
13609This option enables checking that the result of a shift operation is
13610not undefined.  Note that what exactly is considered undefined differs
13611slightly between C and C++, as well as between ISO C90 and C99, etc.
13612This option has two suboptions, @option{-fsanitize=shift-base} and
13613@option{-fsanitize=shift-exponent}.
13614
13615@item -fsanitize=shift-exponent
13616@opindex fsanitize=shift-exponent
13617This option enables checking that the second argument of a shift operation
13618is not negative and is smaller than the precision of the promoted first
13619argument.
13620
13621@item -fsanitize=shift-base
13622@opindex fsanitize=shift-base
13623If the second argument of a shift operation is within range, check that the
13624result of a shift operation is not undefined.  Note that what exactly is
13625considered undefined differs slightly between C and C++, as well as between
13626ISO C90 and C99, etc.
13627
13628@item -fsanitize=integer-divide-by-zero
13629@opindex fsanitize=integer-divide-by-zero
13630Detect integer division by zero as well as @code{INT_MIN / -1} division.
13631
13632@item -fsanitize=unreachable
13633@opindex fsanitize=unreachable
13634With this option, the compiler turns the @code{__builtin_unreachable}
13635call into a diagnostics message call instead.  When reaching the
13636@code{__builtin_unreachable} call, the behavior is undefined.
13637
13638@item -fsanitize=vla-bound
13639@opindex fsanitize=vla-bound
13640This option instructs the compiler to check that the size of a variable
13641length array is positive.
13642
13643@item -fsanitize=null
13644@opindex fsanitize=null
13645This option enables pointer checking.  Particularly, the application
13646built with this option turned on will issue an error message when it
13647tries to dereference a NULL pointer, or if a reference (possibly an
13648rvalue reference) is bound to a NULL pointer, or if a method is invoked
13649on an object pointed by a NULL pointer.
13650
13651@item -fsanitize=return
13652@opindex fsanitize=return
13653This option enables return statement checking.  Programs
13654built with this option turned on will issue an error message
13655when the end of a non-void function is reached without actually
13656returning a value.  This option works in C++ only.
13657
13658@item -fsanitize=signed-integer-overflow
13659@opindex fsanitize=signed-integer-overflow
13660This option enables signed integer overflow checking.  We check that
13661the result of @code{+}, @code{*}, and both unary and binary @code{-}
13662does not overflow in the signed arithmetics.  Note, integer promotion
13663rules must be taken into account.  That is, the following is not an
13664overflow:
13665@smallexample
13666signed char a = SCHAR_MAX;
13667a++;
13668@end smallexample
13669
13670@item -fsanitize=bounds
13671@opindex fsanitize=bounds
13672This option enables instrumentation of array bounds.  Various out of bounds
13673accesses are detected.  Flexible array members, flexible array member-like
13674arrays, and initializers of variables with static storage are not instrumented.
13675
13676@item -fsanitize=bounds-strict
13677@opindex fsanitize=bounds-strict
13678This option enables strict instrumentation of array bounds.  Most out of bounds
13679accesses are detected, including flexible array members and flexible array
13680member-like arrays.  Initializers of variables with static storage are not
13681instrumented.
13682
13683@item -fsanitize=alignment
13684@opindex fsanitize=alignment
13685
13686This option enables checking of alignment of pointers when they are
13687dereferenced, or when a reference is bound to insufficiently aligned target,
13688or when a method or constructor is invoked on insufficiently aligned object.
13689
13690@item -fsanitize=object-size
13691@opindex fsanitize=object-size
13692This option enables instrumentation of memory references using the
13693@code{__builtin_object_size} function.  Various out of bounds pointer
13694accesses are detected.
13695
13696@item -fsanitize=float-divide-by-zero
13697@opindex fsanitize=float-divide-by-zero
13698Detect floating-point division by zero.  Unlike other similar options,
13699@option{-fsanitize=float-divide-by-zero} is not enabled by
13700@option{-fsanitize=undefined}, since floating-point division by zero can
13701be a legitimate way of obtaining infinities and NaNs.
13702
13703@item -fsanitize=float-cast-overflow
13704@opindex fsanitize=float-cast-overflow
13705This option enables floating-point type to integer conversion checking.
13706We check that the result of the conversion does not overflow.
13707Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13708not enabled by @option{-fsanitize=undefined}.
13709This option does not work well with @code{FE_INVALID} exceptions enabled.
13710
13711@item -fsanitize=nonnull-attribute
13712@opindex fsanitize=nonnull-attribute
13713
13714This option enables instrumentation of calls, checking whether null values
13715are not passed to arguments marked as requiring a non-null value by the
13716@code{nonnull} function attribute.
13717
13718@item -fsanitize=returns-nonnull-attribute
13719@opindex fsanitize=returns-nonnull-attribute
13720
13721This option enables instrumentation of return statements in functions
13722marked with @code{returns_nonnull} function attribute, to detect returning
13723of null values from such functions.
13724
13725@item -fsanitize=bool
13726@opindex fsanitize=bool
13727
13728This option enables instrumentation of loads from bool.  If a value other
13729than 0/1 is loaded, a run-time error is issued.
13730
13731@item -fsanitize=enum
13732@opindex fsanitize=enum
13733
13734This option enables instrumentation of loads from an enum type.  If
13735a value outside the range of values for the enum type is loaded,
13736a run-time error is issued.
13737
13738@item -fsanitize=vptr
13739@opindex fsanitize=vptr
13740
13741This option enables instrumentation of C++ member function calls, member
13742accesses and some conversions between pointers to base and derived classes,
13743to verify the referenced object has the correct dynamic type.
13744
13745@item -fsanitize=pointer-overflow
13746@opindex fsanitize=pointer-overflow
13747
13748This option enables instrumentation of pointer arithmetics.  If the pointer
13749arithmetics overflows, a run-time error is issued.
13750
13751@item -fsanitize=builtin
13752@opindex fsanitize=builtin
13753
13754This option enables instrumentation of arguments to selected builtin
13755functions.  If an invalid value is passed to such arguments, a run-time
13756error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
13757or @code{__builtin_clz} invokes undefined behavior and is diagnosed
13758by this option.
13759
13760@end table
13761
13762While @option{-ftrapv} causes traps for signed overflows to be emitted,
13763@option{-fsanitize=undefined} gives a diagnostic message.
13764This currently works only for the C family of languages.
13765
13766@item -fno-sanitize=all
13767@opindex fno-sanitize=all
13768
13769This option disables all previously enabled sanitizers.
13770@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
13771together.
13772
13773@item -fasan-shadow-offset=@var{number}
13774@opindex fasan-shadow-offset
13775This option forces GCC to use custom shadow offset in AddressSanitizer checks.
13776It is useful for experimenting with different shadow memory layouts in
13777Kernel AddressSanitizer.
13778
13779@item -fsanitize-sections=@var{s1},@var{s2},...
13780@opindex fsanitize-sections
13781Sanitize global variables in selected user-defined sections.  @var{si} may
13782contain wildcards.
13783
13784@item -fsanitize-recover@r{[}=@var{opts}@r{]}
13785@opindex fsanitize-recover
13786@opindex fno-sanitize-recover
13787@option{-fsanitize-recover=} controls error recovery mode for sanitizers
13788mentioned in comma-separated list of @var{opts}.  Enabling this option
13789for a sanitizer component causes it to attempt to continue
13790running the program as if no error happened.  This means multiple
13791runtime errors can be reported in a single program run, and the exit
13792code of the program may indicate success even when errors
13793have been reported.  The @option{-fno-sanitize-recover=} option
13794can be used to alter
13795this behavior: only the first detected error is reported
13796and program then exits with a non-zero exit code.
13797
13798Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
13799except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
13800@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
13801@option{-fsanitize=bounds-strict},
13802@option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
13803For these sanitizers error recovery is turned on by default,
13804except @option{-fsanitize=address}, for which this feature is experimental.
13805@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
13806accepted, the former enables recovery for all sanitizers that support it,
13807the latter disables recovery for all sanitizers that support it.
13808
13809Even if a recovery mode is turned on the compiler side, it needs to be also
13810enabled on the runtime library side, otherwise the failures are still fatal.
13811The runtime library defaults to @code{halt_on_error=0} for
13812ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
13813AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
13814setting the @code{halt_on_error} flag in the corresponding environment variable.
13815
13816Syntax without an explicit @var{opts} parameter is deprecated.  It is
13817equivalent to specifying an @var{opts} list of:
13818
13819@smallexample
13820undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13821@end smallexample
13822
13823@item -fsanitize-address-use-after-scope
13824@opindex fsanitize-address-use-after-scope
13825Enable sanitization of local variables to detect use-after-scope bugs.
13826The option sets @option{-fstack-reuse} to @samp{none}.
13827
13828@item -fsanitize-undefined-trap-on-error
13829@opindex fsanitize-undefined-trap-on-error
13830The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
13831report undefined behavior using @code{__builtin_trap} rather than
13832a @code{libubsan} library routine.  The advantage of this is that the
13833@code{libubsan} library is not needed and is not linked in, so this
13834is usable even in freestanding environments.
13835
13836@item -fsanitize-coverage=trace-pc
13837@opindex fsanitize-coverage=trace-pc
13838Enable coverage-guided fuzzing code instrumentation.
13839Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
13840
13841@item -fsanitize-coverage=trace-cmp
13842@opindex fsanitize-coverage=trace-cmp
13843Enable dataflow guided fuzzing code instrumentation.
13844Inserts a call to @code{__sanitizer_cov_trace_cmp1},
13845@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
13846@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
13847variable or @code{__sanitizer_cov_trace_const_cmp1},
13848@code{__sanitizer_cov_trace_const_cmp2},
13849@code{__sanitizer_cov_trace_const_cmp4} or
13850@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
13851operand constant, @code{__sanitizer_cov_trace_cmpf} or
13852@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
13853@code{__sanitizer_cov_trace_switch} for switch statements.
13854
13855@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
13856@opindex fcf-protection
13857Enable code instrumentation of control-flow transfers to increase
13858program security by checking that target addresses of control-flow
13859transfer instructions (such as indirect function call, function return,
13860indirect jump) are valid.  This prevents diverting the flow of control
13861to an unexpected target.  This is intended to protect against such
13862threats as Return-oriented Programming (ROP), and similarly
13863call/jmp-oriented programming (COP/JOP).
13864
13865The value @code{branch} tells the compiler to implement checking of
13866validity of control-flow transfer at the point of indirect branch
13867instructions, i.e.@: call/jmp instructions.  The value @code{return}
13868implements checking of validity at the point of returning from a
13869function.  The value @code{full} is an alias for specifying both
13870@code{branch} and @code{return}. The value @code{none} turns off
13871instrumentation.
13872
13873The value @code{check} is used for the final link with link-time
13874optimization (LTO).  An error is issued if LTO object files are
13875compiled with different @option{-fcf-protection} values.  The
13876value @code{check} is ignored at the compile time.
13877
13878The macro @code{__CET__} is defined when @option{-fcf-protection} is
13879used.  The first bit of @code{__CET__} is set to 1 for the value
13880@code{branch} and the second bit of @code{__CET__} is set to 1 for
13881the @code{return}.
13882
13883You can also use the @code{nocf_check} attribute to identify
13884which functions and calls should be skipped from instrumentation
13885(@pxref{Function Attributes}).
13886
13887Currently the x86 GNU/Linux target provides an implementation based
13888on Intel Control-flow Enforcement Technology (CET).
13889
13890@item -fstack-protector
13891@opindex fstack-protector
13892Emit extra code to check for buffer overflows, such as stack smashing
13893attacks.  This is done by adding a guard variable to functions with
13894vulnerable objects.  This includes functions that call @code{alloca}, and
13895functions with buffers larger than or equal to 8 bytes.  The guards are
13896initialized when a function is entered and then checked when the function
13897exits.  If a guard check fails, an error message is printed and the program
13898exits.  Only variables that are actually allocated on the stack are
13899considered, optimized away variables or variables allocated in registers
13900don't count.
13901
13902@item -fstack-protector-all
13903@opindex fstack-protector-all
13904Like @option{-fstack-protector} except that all functions are protected.
13905
13906@item -fstack-protector-strong
13907@opindex fstack-protector-strong
13908Like @option{-fstack-protector} but includes additional functions to
13909be protected --- those that have local array definitions, or have
13910references to local frame addresses.  Only variables that are actually
13911allocated on the stack are considered, optimized away variables or variables
13912allocated in registers don't count.
13913
13914@item -fstack-protector-explicit
13915@opindex fstack-protector-explicit
13916Like @option{-fstack-protector} but only protects those functions which
13917have the @code{stack_protect} attribute.
13918
13919@item -fstack-check
13920@opindex fstack-check
13921Generate code to verify that you do not go beyond the boundary of the
13922stack.  You should specify this flag if you are running in an
13923environment with multiple threads, but you only rarely need to specify it in
13924a single-threaded environment since stack overflow is automatically
13925detected on nearly all systems if there is only one stack.
13926
13927Note that this switch does not actually cause checking to be done; the
13928operating system or the language runtime must do that.  The switch causes
13929generation of code to ensure that they see the stack being extended.
13930
13931You can additionally specify a string parameter: @samp{no} means no
13932checking, @samp{generic} means force the use of old-style checking,
13933@samp{specific} means use the best checking method and is equivalent
13934to bare @option{-fstack-check}.
13935
13936Old-style checking is a generic mechanism that requires no specific
13937target support in the compiler but comes with the following drawbacks:
13938
13939@enumerate
13940@item
13941Modified allocation strategy for large objects: they are always
13942allocated dynamically if their size exceeds a fixed threshold.  Note this
13943may change the semantics of some code.
13944
13945@item
13946Fixed limit on the size of the static frame of functions: when it is
13947topped by a particular function, stack checking is not reliable and
13948a warning is issued by the compiler.
13949
13950@item
13951Inefficiency: because of both the modified allocation strategy and the
13952generic implementation, code performance is hampered.
13953@end enumerate
13954
13955Note that old-style stack checking is also the fallback method for
13956@samp{specific} if no target support has been added in the compiler.
13957
13958@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13959and stack overflows.  @samp{specific} is an excellent choice when compiling
13960Ada code.  It is not generally sufficient to protect against stack-clash
13961attacks.  To protect against those you want @samp{-fstack-clash-protection}.
13962
13963@item -fstack-clash-protection
13964@opindex fstack-clash-protection
13965Generate code to prevent stack clash style attacks.  When this option is
13966enabled, the compiler will only allocate one page of stack space at a time
13967and each page is accessed immediately after allocation.  Thus, it prevents
13968allocations from jumping over any stack guard page provided by the
13969operating system.
13970
13971Most targets do not fully support stack clash protection.  However, on
13972those targets @option{-fstack-clash-protection} will protect dynamic stack
13973allocations.  @option{-fstack-clash-protection} may also provide limited
13974protection for static stack allocations if the target supports
13975@option{-fstack-check=specific}.
13976
13977@item -fstack-limit-register=@var{reg}
13978@itemx -fstack-limit-symbol=@var{sym}
13979@itemx -fno-stack-limit
13980@opindex fstack-limit-register
13981@opindex fstack-limit-symbol
13982@opindex fno-stack-limit
13983Generate code to ensure that the stack does not grow beyond a certain value,
13984either the value of a register or the address of a symbol.  If a larger
13985stack is required, a signal is raised at run time.  For most targets,
13986the signal is raised before the stack overruns the boundary, so
13987it is possible to catch the signal without taking special precautions.
13988
13989For instance, if the stack starts at absolute address @samp{0x80000000}
13990and grows downwards, you can use the flags
13991@option{-fstack-limit-symbol=__stack_limit} and
13992@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13993of 128KB@.  Note that this may only work with the GNU linker.
13994
13995You can locally override stack limit checking by using the
13996@code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13997
13998@item -fsplit-stack
13999@opindex fsplit-stack
14000Generate code to automatically split the stack before it overflows.
14001The resulting program has a discontiguous stack which can only
14002overflow if the program is unable to allocate any more memory.  This
14003is most useful when running threaded programs, as it is no longer
14004necessary to calculate a good stack size to use for each thread.  This
14005is currently only implemented for the x86 targets running
14006GNU/Linux.
14007
14008When code compiled with @option{-fsplit-stack} calls code compiled
14009without @option{-fsplit-stack}, there may not be much stack space
14010available for the latter code to run.  If compiling all code,
14011including library code, with @option{-fsplit-stack} is not an option,
14012then the linker can fix up these calls so that the code compiled
14013without @option{-fsplit-stack} always has a large stack.  Support for
14014this is implemented in the gold linker in GNU binutils release 2.21
14015and later.
14016
14017@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
14018@opindex fvtable-verify
14019This option is only available when compiling C++ code.
14020It turns on (or off, if using @option{-fvtable-verify=none}) the security
14021feature that verifies at run time, for every virtual call, that
14022the vtable pointer through which the call is made is valid for the type of
14023the object, and has not been corrupted or overwritten.  If an invalid vtable
14024pointer is detected at run time, an error is reported and execution of the
14025program is immediately halted.
14026
14027This option causes run-time data structures to be built at program startup,
14028which are used for verifying the vtable pointers.
14029The options @samp{std} and @samp{preinit}
14030control the timing of when these data structures are built.  In both cases the
14031data structures are built before execution reaches @code{main}.  Using
14032@option{-fvtable-verify=std} causes the data structures to be built after
14033shared libraries have been loaded and initialized.
14034@option{-fvtable-verify=preinit} causes them to be built before shared
14035libraries have been loaded and initialized.
14036
14037If this option appears multiple times in the command line with different
14038values specified, @samp{none} takes highest priority over both @samp{std} and
14039@samp{preinit}; @samp{preinit} takes priority over @samp{std}.
14040
14041@item -fvtv-debug
14042@opindex fvtv-debug
14043When used in conjunction with @option{-fvtable-verify=std} or
14044@option{-fvtable-verify=preinit}, causes debug versions of the
14045runtime functions for the vtable verification feature to be called.
14046This flag also causes the compiler to log information about which
14047vtable pointers it finds for each class.
14048This information is written to a file named @file{vtv_set_ptr_data.log}
14049in the directory named by the environment variable @env{VTV_LOGS_DIR}
14050if that is defined or the current working directory otherwise.
14051
14052Note:  This feature @emph{appends} data to the log file. If you want a fresh log
14053file, be sure to delete any existing one.
14054
14055@item -fvtv-counts
14056@opindex fvtv-counts
14057This is a debugging flag.  When used in conjunction with
14058@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
14059causes the compiler to keep track of the total number of virtual calls
14060it encounters and the number of verifications it inserts.  It also
14061counts the number of calls to certain run-time library functions
14062that it inserts and logs this information for each compilation unit.
14063The compiler writes this information to a file named
14064@file{vtv_count_data.log} in the directory named by the environment
14065variable @env{VTV_LOGS_DIR} if that is defined or the current working
14066directory otherwise.  It also counts the size of the vtable pointer sets
14067for each class, and writes this information to @file{vtv_class_set_sizes.log}
14068in the same directory.
14069
14070Note:  This feature @emph{appends} data to the log files.  To get fresh log
14071files, be sure to delete any existing ones.
14072
14073@item -finstrument-functions
14074@opindex finstrument-functions
14075Generate instrumentation calls for entry and exit to functions.  Just
14076after function entry and just before function exit, the following
14077profiling functions are called with the address of the current
14078function and its call site.  (On some platforms,
14079@code{__builtin_return_address} does not work beyond the current
14080function, so the call site information may not be available to the
14081profiling functions otherwise.)
14082
14083@smallexample
14084void __cyg_profile_func_enter (void *this_fn,
14085                               void *call_site);
14086void __cyg_profile_func_exit  (void *this_fn,
14087                               void *call_site);
14088@end smallexample
14089
14090The first argument is the address of the start of the current function,
14091which may be looked up exactly in the symbol table.
14092
14093This instrumentation is also done for functions expanded inline in other
14094functions.  The profiling calls indicate where, conceptually, the
14095inline function is entered and exited.  This means that addressable
14096versions of such functions must be available.  If all your uses of a
14097function are expanded inline, this may mean an additional expansion of
14098code size.  If you use @code{extern inline} in your C code, an
14099addressable version of such functions must be provided.  (This is
14100normally the case anyway, but if you get lucky and the optimizer always
14101expands the functions inline, you might have gotten away without
14102providing static copies.)
14103
14104A function may be given the attribute @code{no_instrument_function}, in
14105which case this instrumentation is not done.  This can be used, for
14106example, for the profiling functions listed above, high-priority
14107interrupt routines, and any functions from which the profiling functions
14108cannot safely be called (perhaps signal handlers, if the profiling
14109routines generate output or allocate memory).
14110@xref{Common Function Attributes}.
14111
14112@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14113@opindex finstrument-functions-exclude-file-list
14114
14115Set the list of functions that are excluded from instrumentation (see
14116the description of @option{-finstrument-functions}).  If the file that
14117contains a function definition matches with one of @var{file}, then
14118that function is not instrumented.  The match is done on substrings:
14119if the @var{file} parameter is a substring of the file name, it is
14120considered to be a match.
14121
14122For example:
14123
14124@smallexample
14125-finstrument-functions-exclude-file-list=/bits/stl,include/sys
14126@end smallexample
14127
14128@noindent
14129excludes any inline function defined in files whose pathnames
14130contain @file{/bits/stl} or @file{include/sys}.
14131
14132If, for some reason, you want to include letter @samp{,} in one of
14133@var{sym}, write @samp{\,}. For example,
14134@option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14135(note the single quote surrounding the option).
14136
14137@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14138@opindex finstrument-functions-exclude-function-list
14139
14140This is similar to @option{-finstrument-functions-exclude-file-list},
14141but this option sets the list of function names to be excluded from
14142instrumentation.  The function name to be matched is its user-visible
14143name, such as @code{vector<int> blah(const vector<int> &)}, not the
14144internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
14145match is done on substrings: if the @var{sym} parameter is a substring
14146of the function name, it is considered to be a match.  For C99 and C++
14147extended identifiers, the function name must be given in UTF-8, not
14148using universal character names.
14149
14150@item -fpatchable-function-entry=@var{N}[,@var{M}]
14151@opindex fpatchable-function-entry
14152Generate @var{N} NOPs right at the beginning
14153of each function, with the function entry point before the @var{M}th NOP.
14154If @var{M} is omitted, it defaults to @code{0} so the
14155function entry points to the address just at the first NOP.
14156The NOP instructions reserve extra space which can be used to patch in
14157any desired instrumentation at run time, provided that the code segment
14158is writable.  The amount of space is controllable indirectly via
14159the number of NOPs; the NOP instruction used corresponds to the instruction
14160emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
14161is target-specific and may also depend on the architecture variant and/or
14162other compilation options.
14163
14164For run-time identification, the starting addresses of these areas,
14165which correspond to their respective function entries minus @var{M},
14166are additionally collected in the @code{__patchable_function_entries}
14167section of the resulting binary.
14168
14169Note that the value of @code{__attribute__ ((patchable_function_entry
14170(N,M)))} takes precedence over command-line option
14171@option{-fpatchable-function-entry=N,M}.  This can be used to increase
14172the area size or to remove it completely on a single function.
14173If @code{N=0}, no pad location is recorded.
14174
14175The NOP instructions are inserted at---and maybe before, depending on
14176@var{M}---the function entry address, even before the prologue.
14177
14178@end table
14179
14180
14181@node Preprocessor Options
14182@section Options Controlling the Preprocessor
14183@cindex preprocessor options
14184@cindex options, preprocessor
14185
14186These options control the C preprocessor, which is run on each C source
14187file before actual compilation.
14188
14189If you use the @option{-E} option, nothing is done except preprocessing.
14190Some of these options make sense only together with @option{-E} because
14191they cause the preprocessor output to be unsuitable for actual
14192compilation.
14193
14194In addition to the options listed here, there are a number of options
14195to control search paths for include files documented in
14196@ref{Directory Options}.
14197Options to control preprocessor diagnostics are listed in
14198@ref{Warning Options}.
14199
14200@table @gcctabopt
14201@include cppopts.texi
14202
14203@item -Wp,@var{option}
14204@opindex Wp
14205You can use @option{-Wp,@var{option}} to bypass the compiler driver
14206and pass @var{option} directly through to the preprocessor.  If
14207@var{option} contains commas, it is split into multiple options at the
14208commas.  However, many options are modified, translated or interpreted
14209by the compiler driver before being passed to the preprocessor, and
14210@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
14211interface is undocumented and subject to change, so whenever possible
14212you should avoid using @option{-Wp} and let the driver handle the
14213options instead.
14214
14215@item -Xpreprocessor @var{option}
14216@opindex Xpreprocessor
14217Pass @var{option} as an option to the preprocessor.  You can use this to
14218supply system-specific preprocessor options that GCC does not
14219recognize.
14220
14221If you want to pass an option that takes an argument, you must use
14222@option{-Xpreprocessor} twice, once for the option and once for the argument.
14223
14224@item -no-integrated-cpp
14225@opindex no-integrated-cpp
14226Perform preprocessing as a separate pass before compilation.
14227By default, GCC performs preprocessing as an integrated part of
14228input tokenization and parsing.
14229If this option is provided, the appropriate language front end
14230(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14231and Objective-C, respectively) is instead invoked twice,
14232once for preprocessing only and once for actual compilation
14233of the preprocessed input.
14234This option may be useful in conjunction with the @option{-B} or
14235@option{-wrapper} options to specify an alternate preprocessor or
14236perform additional processing of the program source between
14237normal preprocessing and compilation.
14238
14239@end table
14240
14241@node Assembler Options
14242@section Passing Options to the Assembler
14243
14244@c prevent bad page break with this line
14245You can pass options to the assembler.
14246
14247@table @gcctabopt
14248@item -Wa,@var{option}
14249@opindex Wa
14250Pass @var{option} as an option to the assembler.  If @var{option}
14251contains commas, it is split into multiple options at the commas.
14252
14253@item -Xassembler @var{option}
14254@opindex Xassembler
14255Pass @var{option} as an option to the assembler.  You can use this to
14256supply system-specific assembler options that GCC does not
14257recognize.
14258
14259If you want to pass an option that takes an argument, you must use
14260@option{-Xassembler} twice, once for the option and once for the argument.
14261
14262@end table
14263
14264@node Link Options
14265@section Options for Linking
14266@cindex link options
14267@cindex options, linking
14268
14269These options come into play when the compiler links object files into
14270an executable output file.  They are meaningless if the compiler is
14271not doing a link step.
14272
14273@table @gcctabopt
14274@cindex file names
14275@item @var{object-file-name}
14276A file name that does not end in a special recognized suffix is
14277considered to name an object file or library.  (Object files are
14278distinguished from libraries by the linker according to the file
14279contents.)  If linking is done, these object files are used as input
14280to the linker.
14281
14282@item -c
14283@itemx -S
14284@itemx -E
14285@opindex c
14286@opindex S
14287@opindex E
14288If any of these options is used, then the linker is not run, and
14289object file names should not be used as arguments.  @xref{Overall
14290Options}.
14291
14292@item -flinker-output=@var{type}
14293@opindex flinker-output
14294This option controls code generation of the link-time optimizer.  By
14295default the linker output is automatically determined by the linker
14296plugin.  For debugging the compiler and if incremental linking with a
14297non-LTO object file is desired, it may be useful to control the type
14298manually.
14299
14300If @var{type} is @samp{exec}, code generation produces a static
14301binary. In this case @option{-fpic} and @option{-fpie} are both
14302disabled.
14303
14304If @var{type} is @samp{dyn}, code generation produces a shared
14305library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
14306but not enabled automatically.  This allows to build shared libraries
14307without position-independent code on architectures where this is
14308possible, i.e.@: on x86.
14309
14310If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14311executable. This results in similar optimizations as @samp{exec}
14312except that @option{-fpie} is not disabled if specified at compilation
14313time.
14314
14315If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14316done.  The sections containing intermediate code for link-time optimization are
14317merged, pre-optimized, and output to the resulting object file. In addition, if
14318@option{-ffat-lto-objects} is specified, binary code is produced for future
14319non-LTO linking. The object file produced by incremental linking is smaller
14320than a static library produced from the same object files.  At link time the
14321result of incremental linking also loads faster than a static
14322library assuming that the majority of objects in the library are used.
14323
14324Finally @samp{nolto-rel} configures the compiler for incremental linking where
14325code generation is forced, a final binary is produced, and the intermediate
14326code for later link-time optimization is stripped. When multiple object files
14327are linked together the resulting code is better optimized than with
14328link-time optimizations disabled (for example, cross-module inlining
14329happens), but most of benefits of whole program optimizations are lost.
14330
14331During the incremental link (by @option{-r}) the linker plugin defaults to
14332@option{rel}. With current interfaces to GNU Binutils it is however not
14333possible to incrementally link LTO objects and non-LTO objects into a single
14334mixed object file.  If any of object files in incremental link cannot
14335be used for link-time optimization, the linker plugin issues a warning and
14336uses @samp{nolto-rel}. To maintain whole program optimization, it is
14337recommended to link such objects into static library instead. Alternatively it
14338is possible to use H.J. Lu's binutils with support for mixed objects.
14339
14340@item -fuse-ld=bfd
14341@opindex fuse-ld=bfd
14342Use the @command{bfd} linker instead of the default linker.
14343
14344@item -fuse-ld=gold
14345@opindex fuse-ld=gold
14346Use the @command{gold} linker instead of the default linker.
14347
14348@item -fuse-ld=lld
14349@opindex fuse-ld=lld
14350Use the LLVM @command{lld} linker instead of the default linker.
14351
14352@cindex Libraries
14353@item -l@var{library}
14354@itemx -l @var{library}
14355@opindex l
14356Search the library named @var{library} when linking.  (The second
14357alternative with the library as a separate argument is only for
14358POSIX compliance and is not recommended.)
14359
14360The @option{-l} option is passed directly to the linker by GCC.  Refer
14361to your linker documentation for exact details.  The general
14362description below applies to the GNU linker.
14363
14364The linker searches a standard list of directories for the library.
14365The directories searched include several standard system directories
14366plus any that you specify with @option{-L}.
14367
14368Static libraries are archives of object files, and have file names
14369like @file{lib@var{library}.a}.  Some targets also support shared
14370libraries, which typically have names like @file{lib@var{library}.so}.
14371If both static and shared libraries are found, the linker gives
14372preference to linking with the shared library unless the
14373@option{-static} option is used.
14374
14375It makes a difference where in the command you write this option; the
14376linker searches and processes libraries and object files in the order they
14377are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14378after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
14379to functions in @samp{z}, those functions may not be loaded.
14380
14381@item -lobjc
14382@opindex lobjc
14383You need this special case of the @option{-l} option in order to
14384link an Objective-C or Objective-C++ program.
14385
14386@item -nostartfiles
14387@opindex nostartfiles
14388Do not use the standard system startup files when linking.
14389The standard system libraries are used normally, unless @option{-nostdlib},
14390@option{-nolibc}, or @option{-nodefaultlibs} is used.
14391
14392@item -nodefaultlibs
14393@opindex nodefaultlibs
14394Do not use the standard system libraries when linking.
14395Only the libraries you specify are passed to the linker, and options
14396specifying linkage of the system libraries, such as @option{-static-libgcc}
14397or @option{-shared-libgcc}, are ignored.
14398The standard startup files are used normally, unless @option{-nostartfiles}
14399is used.
14400
14401The compiler may generate calls to @code{memcmp},
14402@code{memset}, @code{memcpy} and @code{memmove}.
14403These entries are usually resolved by entries in
14404libc.  These entry points should be supplied through some other
14405mechanism when this option is specified.
14406
14407@item -nolibc
14408@opindex nolibc
14409Do not use the C library or system libraries tightly coupled with it when
14410linking.  Still link with the startup files, @file{libgcc} or toolchain
14411provided language support libraries such as @file{libgnat}, @file{libgfortran}
14412or @file{libstdc++} unless options preventing their inclusion are used as
14413well.  This typically removes @option{-lc} from the link command line, as well
14414as system libraries that normally go with it and become meaningless when
14415absence of a C library is assumed, for example @option{-lpthread} or
14416@option{-lm} in some configurations.  This is intended for bare-board
14417targets when there is indeed no C library available.
14418
14419@item -nostdlib
14420@opindex nostdlib
14421Do not use the standard system startup files or libraries when linking.
14422No startup files and only the libraries you specify are passed to
14423the linker, and options specifying linkage of the system libraries, such as
14424@option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14425
14426The compiler may generate calls to @code{memcmp}, @code{memset},
14427@code{memcpy} and @code{memmove}.
14428These entries are usually resolved by entries in
14429libc.  These entry points should be supplied through some other
14430mechanism when this option is specified.
14431
14432@cindex @option{-lgcc}, use with @option{-nostdlib}
14433@cindex @option{-nostdlib} and unresolved references
14434@cindex unresolved references and @option{-nostdlib}
14435@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14436@cindex @option{-nodefaultlibs} and unresolved references
14437@cindex unresolved references and @option{-nodefaultlibs}
14438One of the standard libraries bypassed by @option{-nostdlib} and
14439@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14440which GCC uses to overcome shortcomings of particular machines, or special
14441needs for some languages.
14442(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14443Collection (GCC) Internals},
14444for more discussion of @file{libgcc.a}.)
14445In most cases, you need @file{libgcc.a} even when you want to avoid
14446other standard libraries.  In other words, when you specify @option{-nostdlib}
14447or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14448This ensures that you have no unresolved references to internal GCC
14449library subroutines.
14450(An example of such an internal subroutine is @code{__main}, used to ensure C++
14451constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14452GNU Compiler Collection (GCC) Internals}.)
14453
14454@item -e @var{entry}
14455@itemx --entry=@var{entry}
14456@opindex e
14457@opindex entry
14458
14459Specify that the program entry point is @var{entry}.  The argument is
14460interpreted by the linker; the GNU linker accepts either a symbol name
14461or an address.
14462
14463@item -pie
14464@opindex pie
14465Produce a dynamically linked position independent executable on targets
14466that support it.  For predictable results, you must also specify the same
14467set of options used for compilation (@option{-fpie}, @option{-fPIE},
14468or model suboptions) when you specify this linker option.
14469
14470@item -no-pie
14471@opindex no-pie
14472Don't produce a dynamically linked position independent executable.
14473
14474@item -static-pie
14475@opindex static-pie
14476Produce a static position independent executable on targets that support
14477it.  A static position independent executable is similar to a static
14478executable, but can be loaded at any address without a dynamic linker.
14479For predictable results, you must also specify the same set of options
14480used for compilation (@option{-fpie}, @option{-fPIE}, or model
14481suboptions) when you specify this linker option.
14482
14483@item -pthread
14484@opindex pthread
14485Link with the POSIX threads library.  This option is supported on
14486GNU/Linux targets, most other Unix derivatives, and also on
14487x86 Cygwin and MinGW targets.  On some targets this option also sets
14488flags for the preprocessor, so it should be used consistently for both
14489compilation and linking.
14490
14491@item -r
14492@opindex r
14493Produce a relocatable object as output.  This is also known as partial
14494linking.
14495
14496@item -rdynamic
14497@opindex rdynamic
14498Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14499that support it. This instructs the linker to add all symbols, not
14500only used ones, to the dynamic symbol table. This option is needed
14501for some uses of @code{dlopen} or to allow obtaining backtraces
14502from within a program.
14503
14504@item -s
14505@opindex s
14506Remove all symbol table and relocation information from the executable.
14507
14508@item -static
14509@opindex static
14510On systems that support dynamic linking, this overrides @option{-pie}
14511and prevents linking with the shared libraries.  On other systems, this
14512option has no effect.
14513
14514@item -shared
14515@opindex shared
14516Produce a shared object which can then be linked with other objects to
14517form an executable.  Not all systems support this option.  For predictable
14518results, you must also specify the same set of options used for compilation
14519(@option{-fpic}, @option{-fPIC}, or model suboptions) when
14520you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14521needs to build supplementary stub code for constructors to work.  On
14522multi-libbed systems, @samp{gcc -shared} must select the correct support
14523libraries to link against.  Failing to supply the correct flags may lead
14524to subtle defects.  Supplying them in cases where they are not necessary
14525is innocuous.}
14526
14527@item -shared-libgcc
14528@itemx -static-libgcc
14529@opindex shared-libgcc
14530@opindex static-libgcc
14531On systems that provide @file{libgcc} as a shared library, these options
14532force the use of either the shared or static version, respectively.
14533If no shared version of @file{libgcc} was built when the compiler was
14534configured, these options have no effect.
14535
14536There are several situations in which an application should use the
14537shared @file{libgcc} instead of the static version.  The most common
14538of these is when the application wishes to throw and catch exceptions
14539across different shared libraries.  In that case, each of the libraries
14540as well as the application itself should use the shared @file{libgcc}.
14541
14542Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14543whenever you build a shared library or a main executable, because C++
14544programs typically use exceptions, so this is the right thing to do.
14545
14546If, instead, you use the GCC driver to create shared libraries, you may
14547find that they are not always linked with the shared @file{libgcc}.
14548If GCC finds, at its configuration time, that you have a non-GNU linker
14549or a GNU linker that does not support option @option{--eh-frame-hdr},
14550it links the shared version of @file{libgcc} into shared libraries
14551by default.  Otherwise, it takes advantage of the linker and optimizes
14552away the linking with the shared version of @file{libgcc}, linking with
14553the static version of libgcc by default.  This allows exceptions to
14554propagate through such shared libraries, without incurring relocation
14555costs at library load time.
14556
14557However, if a library or main executable is supposed to throw or catch
14558exceptions, you must link it using the G++ driver, or using the option
14559@option{-shared-libgcc}, such that it is linked with the shared
14560@file{libgcc}.
14561
14562@item -static-libasan
14563@opindex static-libasan
14564When the @option{-fsanitize=address} option is used to link a program,
14565the GCC driver automatically links against @option{libasan}.  If
14566@file{libasan} is available as a shared library, and the @option{-static}
14567option is not used, then this links against the shared version of
14568@file{libasan}.  The @option{-static-libasan} option directs the GCC
14569driver to link @file{libasan} statically, without necessarily linking
14570other libraries statically.
14571
14572@item -static-libtsan
14573@opindex static-libtsan
14574When the @option{-fsanitize=thread} option is used to link a program,
14575the GCC driver automatically links against @option{libtsan}.  If
14576@file{libtsan} is available as a shared library, and the @option{-static}
14577option is not used, then this links against the shared version of
14578@file{libtsan}.  The @option{-static-libtsan} option directs the GCC
14579driver to link @file{libtsan} statically, without necessarily linking
14580other libraries statically.
14581
14582@item -static-liblsan
14583@opindex static-liblsan
14584When the @option{-fsanitize=leak} option is used to link a program,
14585the GCC driver automatically links against @option{liblsan}.  If
14586@file{liblsan} is available as a shared library, and the @option{-static}
14587option is not used, then this links against the shared version of
14588@file{liblsan}.  The @option{-static-liblsan} option directs the GCC
14589driver to link @file{liblsan} statically, without necessarily linking
14590other libraries statically.
14591
14592@item -static-libubsan
14593@opindex static-libubsan
14594When the @option{-fsanitize=undefined} option is used to link a program,
14595the GCC driver automatically links against @option{libubsan}.  If
14596@file{libubsan} is available as a shared library, and the @option{-static}
14597option is not used, then this links against the shared version of
14598@file{libubsan}.  The @option{-static-libubsan} option directs the GCC
14599driver to link @file{libubsan} statically, without necessarily linking
14600other libraries statically.
14601
14602@item -static-libstdc++
14603@opindex static-libstdc++
14604When the @command{g++} program is used to link a C++ program, it
14605normally automatically links against @option{libstdc++}.  If
14606@file{libstdc++} is available as a shared library, and the
14607@option{-static} option is not used, then this links against the
14608shared version of @file{libstdc++}.  That is normally fine.  However, it
14609is sometimes useful to freeze the version of @file{libstdc++} used by
14610the program without going all the way to a fully static link.  The
14611@option{-static-libstdc++} option directs the @command{g++} driver to
14612link @file{libstdc++} statically, without necessarily linking other
14613libraries statically.
14614
14615@item -symbolic
14616@opindex symbolic
14617Bind references to global symbols when building a shared object.  Warn
14618about any unresolved references (unless overridden by the link editor
14619option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
14620this option.
14621
14622@item -T @var{script}
14623@opindex T
14624@cindex linker script
14625Use @var{script} as the linker script.  This option is supported by most
14626systems using the GNU linker.  On some targets, such as bare-board
14627targets without an operating system, the @option{-T} option may be required
14628when linking to avoid references to undefined symbols.
14629
14630@item -Xlinker @var{option}
14631@opindex Xlinker
14632Pass @var{option} as an option to the linker.  You can use this to
14633supply system-specific linker options that GCC does not recognize.
14634
14635If you want to pass an option that takes a separate argument, you must use
14636@option{-Xlinker} twice, once for the option and once for the argument.
14637For example, to pass @option{-assert definitions}, you must write
14638@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
14639@option{-Xlinker "-assert definitions"}, because this passes the entire
14640string as a single argument, which is not what the linker expects.
14641
14642When using the GNU linker, it is usually more convenient to pass
14643arguments to linker options using the @option{@var{option}=@var{value}}
14644syntax than as separate arguments.  For example, you can specify
14645@option{-Xlinker -Map=output.map} rather than
14646@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
14647this syntax for command-line options.
14648
14649@item -Wl,@var{option}
14650@opindex Wl
14651Pass @var{option} as an option to the linker.  If @var{option} contains
14652commas, it is split into multiple options at the commas.  You can use this
14653syntax to pass an argument to the option.
14654For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14655linker.  When using the GNU linker, you can also get the same effect with
14656@option{-Wl,-Map=output.map}.
14657
14658@item -u @var{symbol}
14659@opindex u
14660Pretend the symbol @var{symbol} is undefined, to force linking of
14661library modules to define it.  You can use @option{-u} multiple times with
14662different symbols to force loading of additional library modules.
14663
14664@item -z @var{keyword}
14665@opindex z
14666@option{-z} is passed directly on to the linker along with the keyword
14667@var{keyword}. See the section in the documentation of your linker for
14668permitted values and their meanings.
14669@end table
14670
14671@node Directory Options
14672@section Options for Directory Search
14673@cindex directory options
14674@cindex options, directory search
14675@cindex search path
14676
14677These options specify directories to search for header files, for
14678libraries and for parts of the compiler:
14679
14680@table @gcctabopt
14681@include cppdiropts.texi
14682
14683@item -iplugindir=@var{dir}
14684@opindex iplugindir=
14685Set the directory to search for plugins that are passed
14686by @option{-fplugin=@var{name}} instead of
14687@option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
14688to be used by the user, but only passed by the driver.
14689
14690@item -L@var{dir}
14691@opindex L
14692Add directory @var{dir} to the list of directories to be searched
14693for @option{-l}.
14694
14695@item -B@var{prefix}
14696@opindex B
14697This option specifies where to find the executables, libraries,
14698include files, and data files of the compiler itself.
14699
14700The compiler driver program runs one or more of the subprograms
14701@command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
14702@var{prefix} as a prefix for each program it tries to run, both with and
14703without @samp{@var{machine}/@var{version}/} for the corresponding target
14704machine and compiler version.
14705
14706For each subprogram to be run, the compiler driver first tries the
14707@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
14708is not specified, the driver tries two standard prefixes,
14709@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
14710those results in a file name that is found, the unmodified program
14711name is searched for using the directories specified in your
14712@env{PATH} environment variable.
14713
14714The compiler checks to see if the path provided by @option{-B}
14715refers to a directory, and if necessary it adds a directory
14716separator character at the end of the path.
14717
14718@option{-B} prefixes that effectively specify directory names also apply
14719to libraries in the linker, because the compiler translates these
14720options into @option{-L} options for the linker.  They also apply to
14721include files in the preprocessor, because the compiler translates these
14722options into @option{-isystem} options for the preprocessor.  In this case,
14723the compiler appends @samp{include} to the prefix.
14724
14725The runtime support file @file{libgcc.a} can also be searched for using
14726the @option{-B} prefix, if needed.  If it is not found there, the two
14727standard prefixes above are tried, and that is all.  The file is left
14728out of the link if it is not found by those means.
14729
14730Another way to specify a prefix much like the @option{-B} prefix is to use
14731the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
14732Variables}.
14733
14734As a special kludge, if the path provided by @option{-B} is
14735@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
147369, then it is replaced by @file{[dir/]include}.  This is to help
14737with boot-strapping the compiler.
14738
14739@item -no-canonical-prefixes
14740@opindex no-canonical-prefixes
14741Do not expand any symbolic links, resolve references to @samp{/../}
14742or @samp{/./}, or make the path absolute when generating a relative
14743prefix.
14744
14745@item --sysroot=@var{dir}
14746@opindex sysroot
14747Use @var{dir} as the logical root directory for headers and libraries.
14748For example, if the compiler normally searches for headers in
14749@file{/usr/include} and libraries in @file{/usr/lib}, it instead
14750searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14751
14752If you use both this option and the @option{-isysroot} option, then
14753the @option{--sysroot} option applies to libraries, but the
14754@option{-isysroot} option applies to header files.
14755
14756The GNU linker (beginning with version 2.16) has the necessary support
14757for this option.  If your linker does not support this option, the
14758header file aspect of @option{--sysroot} still works, but the
14759library aspect does not.
14760
14761@item --no-sysroot-suffix
14762@opindex no-sysroot-suffix
14763For some targets, a suffix is added to the root directory specified
14764with @option{--sysroot}, depending on the other options used, so that
14765headers may for example be found in
14766@file{@var{dir}/@var{suffix}/usr/include} instead of
14767@file{@var{dir}/usr/include}.  This option disables the addition of
14768such a suffix.
14769
14770@end table
14771
14772@node Code Gen Options
14773@section Options for Code Generation Conventions
14774@cindex code generation conventions
14775@cindex options, code generation
14776@cindex run-time options
14777
14778These machine-independent options control the interface conventions
14779used in code generation.
14780
14781Most of them have both positive and negative forms; the negative form
14782of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
14783one of the forms is listed---the one that is not the default.  You
14784can figure out the other form by either removing @samp{no-} or adding
14785it.
14786
14787@table @gcctabopt
14788@item -fstack-reuse=@var{reuse-level}
14789@opindex fstack_reuse
14790This option controls stack space reuse for user declared local/auto variables
14791and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
14792@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
14793local variables and temporaries, @samp{named_vars} enables the reuse only for
14794user defined local variables with names, and @samp{none} disables stack reuse
14795completely. The default value is @samp{all}. The option is needed when the
14796program extends the lifetime of a scoped local variable or a compiler generated
14797temporary beyond the end point defined by the language.  When a lifetime of
14798a variable ends, and if the variable lives in memory, the optimizing compiler
14799has the freedom to reuse its stack space with other temporaries or scoped
14800local variables whose live range does not overlap with it. Legacy code extending
14801local lifetime is likely to break with the stack reuse optimization.
14802
14803For example,
14804
14805@smallexample
14806   int *p;
14807   @{
14808     int local1;
14809
14810     p = &local1;
14811     local1 = 10;
14812     ....
14813   @}
14814   @{
14815      int local2;
14816      local2 = 20;
14817      ...
14818   @}
14819
14820   if (*p == 10)  // out of scope use of local1
14821     @{
14822
14823     @}
14824@end smallexample
14825
14826Another example:
14827@smallexample
14828
14829   struct A
14830   @{
14831       A(int k) : i(k), j(k) @{ @}
14832       int i;
14833       int j;
14834   @};
14835
14836   A *ap;
14837
14838   void foo(const A& ar)
14839   @{
14840      ap = &ar;
14841   @}
14842
14843   void bar()
14844   @{
14845      foo(A(10)); // temp object's lifetime ends when foo returns
14846
14847      @{
14848        A a(20);
14849        ....
14850      @}
14851      ap->i+= 10;  // ap references out of scope temp whose space
14852                   // is reused with a. What is the value of ap->i?
14853   @}
14854
14855@end smallexample
14856
14857The lifetime of a compiler generated temporary is well defined by the C++
14858standard. When a lifetime of a temporary ends, and if the temporary lives
14859in memory, the optimizing compiler has the freedom to reuse its stack
14860space with other temporaries or scoped local variables whose live range
14861does not overlap with it. However some of the legacy code relies on
14862the behavior of older compilers in which temporaries' stack space is
14863not reused, the aggressive stack reuse can lead to runtime errors. This
14864option is used to control the temporary stack reuse optimization.
14865
14866@item -ftrapv
14867@opindex ftrapv
14868This option generates traps for signed overflow on addition, subtraction,
14869multiplication operations.
14870The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14871@option{-ftrapv} @option{-fwrapv} on the command-line results in
14872@option{-fwrapv} being effective.  Note that only active options override, so
14873using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14874results in @option{-ftrapv} being effective.
14875
14876@item -fwrapv
14877@opindex fwrapv
14878This option instructs the compiler to assume that signed arithmetic
14879overflow of addition, subtraction and multiplication wraps around
14880using twos-complement representation.  This flag enables some optimizations
14881and disables others.
14882The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14883@option{-ftrapv} @option{-fwrapv} on the command-line results in
14884@option{-fwrapv} being effective.  Note that only active options override, so
14885using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14886results in @option{-ftrapv} being effective.
14887
14888@item -fwrapv-pointer
14889@opindex fwrapv-pointer
14890This option instructs the compiler to assume that pointer arithmetic
14891overflow on addition and subtraction wraps around using twos-complement
14892representation.  This flag disables some optimizations which assume
14893pointer overflow is invalid.
14894
14895@item -fstrict-overflow
14896@opindex fstrict-overflow
14897This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
14898negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
14899
14900@item -fexceptions
14901@opindex fexceptions
14902Enable exception handling.  Generates extra code needed to propagate
14903exceptions.  For some targets, this implies GCC generates frame
14904unwind information for all functions, which can produce significant data
14905size overhead, although it does not affect execution.  If you do not
14906specify this option, GCC enables it by default for languages like
14907C++ that normally require exception handling, and disables it for
14908languages like C that do not normally require it.  However, you may need
14909to enable this option when compiling C code that needs to interoperate
14910properly with exception handlers written in C++.  You may also wish to
14911disable this option if you are compiling older C++ programs that don't
14912use exception handling.
14913
14914@item -fnon-call-exceptions
14915@opindex fnon-call-exceptions
14916Generate code that allows trapping instructions to throw exceptions.
14917Note that this requires platform-specific runtime support that does
14918not exist everywhere.  Moreover, it only allows @emph{trapping}
14919instructions to throw exceptions, i.e.@: memory references or floating-point
14920instructions.  It does not allow exceptions to be thrown from
14921arbitrary signal handlers such as @code{SIGALRM}.
14922
14923@item -fdelete-dead-exceptions
14924@opindex fdelete-dead-exceptions
14925Consider that instructions that may throw exceptions but don't otherwise
14926contribute to the execution of the program can be optimized away.
14927This option is enabled by default for the Ada front end, as permitted by
14928the Ada language specification.
14929Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14930
14931@item -funwind-tables
14932@opindex funwind-tables
14933Similar to @option{-fexceptions}, except that it just generates any needed
14934static data, but does not affect the generated code in any other way.
14935You normally do not need to enable this option; instead, a language processor
14936that needs this handling enables it on your behalf.
14937
14938@item -fasynchronous-unwind-tables
14939@opindex fasynchronous-unwind-tables
14940Generate unwind table in DWARF format, if supported by target machine.  The
14941table is exact at each instruction boundary, so it can be used for stack
14942unwinding from asynchronous events (such as debugger or garbage collector).
14943
14944@item -fno-gnu-unique
14945@opindex fno-gnu-unique
14946@opindex fgnu-unique
14947On systems with recent GNU assembler and C library, the C++ compiler
14948uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14949of template static data members and static local variables in inline
14950functions are unique even in the presence of @code{RTLD_LOCAL}; this
14951is necessary to avoid problems with a library used by two different
14952@code{RTLD_LOCAL} plugins depending on a definition in one of them and
14953therefore disagreeing with the other one about the binding of the
14954symbol.  But this causes @code{dlclose} to be ignored for affected
14955DSOs; if your program relies on reinitialization of a DSO via
14956@code{dlclose} and @code{dlopen}, you can use
14957@option{-fno-gnu-unique}.
14958
14959@item -fpcc-struct-return
14960@opindex fpcc-struct-return
14961Return ``short'' @code{struct} and @code{union} values in memory like
14962longer ones, rather than in registers.  This convention is less
14963efficient, but it has the advantage of allowing intercallability between
14964GCC-compiled files and files compiled with other compilers, particularly
14965the Portable C Compiler (pcc).
14966
14967The precise convention for returning structures in memory depends
14968on the target configuration macros.
14969
14970Short structures and unions are those whose size and alignment match
14971that of some integer type.
14972
14973@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14974switch is not binary compatible with code compiled with the
14975@option{-freg-struct-return} switch.
14976Use it to conform to a non-default application binary interface.
14977
14978@item -freg-struct-return
14979@opindex freg-struct-return
14980Return @code{struct} and @code{union} values in registers when possible.
14981This is more efficient for small structures than
14982@option{-fpcc-struct-return}.
14983
14984If you specify neither @option{-fpcc-struct-return} nor
14985@option{-freg-struct-return}, GCC defaults to whichever convention is
14986standard for the target.  If there is no standard convention, GCC
14987defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14988the principal compiler.  In those cases, we can choose the standard, and
14989we chose the more efficient register return alternative.
14990
14991@strong{Warning:} code compiled with the @option{-freg-struct-return}
14992switch is not binary compatible with code compiled with the
14993@option{-fpcc-struct-return} switch.
14994Use it to conform to a non-default application binary interface.
14995
14996@item -fshort-enums
14997@opindex fshort-enums
14998Allocate to an @code{enum} type only as many bytes as it needs for the
14999declared range of possible values.  Specifically, the @code{enum} type
15000is equivalent to the smallest integer type that has enough room.
15001
15002@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
15003code that is not binary compatible with code generated without that switch.
15004Use it to conform to a non-default application binary interface.
15005
15006@item -fshort-wchar
15007@opindex fshort-wchar
15008Override the underlying type for @code{wchar_t} to be @code{short
15009unsigned int} instead of the default for the target.  This option is
15010useful for building programs to run under WINE@.
15011
15012@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
15013code that is not binary compatible with code generated without that switch.
15014Use it to conform to a non-default application binary interface.
15015
15016@item -fcommon
15017@opindex fcommon
15018@opindex fno-common
15019@cindex tentative definitions
15020In C code, this option controls the placement of global variables
15021defined without an initializer, known as @dfn{tentative definitions}
15022in the C standard.  Tentative definitions are distinct from declarations
15023of a variable with the @code{extern} keyword, which do not allocate storage.
15024
15025The default is @option{-fno-common}, which specifies that the compiler places
15026uninitialized global variables in the BSS section of the object file.
15027This inhibits the merging of tentative definitions by the linker so you get a
15028multiple-definition error if the same variable is accidentally defined in more
15029than one compilation unit.
15030
15031The @option{-fcommon} places uninitialized global variables in a common block.
15032This allows the linker to resolve all tentative definitions of the same variable
15033in different compilation units to the same object, or to a non-tentative
15034definition.  This behavior is inconsistent with C++, and on many targets implies
15035a speed and code size penalty on global variable references.  It is mainly
15036useful to enable legacy code to link without errors.
15037
15038@item -fno-ident
15039@opindex fno-ident
15040@opindex fident
15041Ignore the @code{#ident} directive.
15042
15043@item -finhibit-size-directive
15044@opindex finhibit-size-directive
15045Don't output a @code{.size} assembler directive, or anything else that
15046would cause trouble if the function is split in the middle, and the
15047two halves are placed at locations far apart in memory.  This option is
15048used when compiling @file{crtstuff.c}; you should not need to use it
15049for anything else.
15050
15051@item -fverbose-asm
15052@opindex fverbose-asm
15053Put extra commentary information in the generated assembly code to
15054make it more readable.  This option is generally only of use to those
15055who actually need to read the generated assembly code (perhaps while
15056debugging the compiler itself).
15057
15058@option{-fno-verbose-asm}, the default, causes the
15059extra information to be omitted and is useful when comparing two assembler
15060files.
15061
15062The added comments include:
15063
15064@itemize @bullet
15065
15066@item
15067information on the compiler version and command-line options,
15068
15069@item
15070the source code lines associated with the assembly instructions,
15071in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15072
15073@item
15074hints on which high-level expressions correspond to
15075the various assembly instruction operands.
15076
15077@end itemize
15078
15079For example, given this C source file:
15080
15081@smallexample
15082int test (int n)
15083@{
15084  int i;
15085  int total = 0;
15086
15087  for (i = 0; i < n; i++)
15088    total += i * i;
15089
15090  return total;
15091@}
15092@end smallexample
15093
15094compiling to (x86_64) assembly via @option{-S} and emitting the result
15095direct to stdout via @option{-o} @option{-}
15096
15097@smallexample
15098gcc -S test.c -fverbose-asm -Os -o -
15099@end smallexample
15100
15101gives output similar to this:
15102
15103@smallexample
15104	.file	"test.c"
15105# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15106  [...snip...]
15107# options passed:
15108  [...snip...]
15109
15110	.text
15111	.globl	test
15112	.type	test, @@function
15113test:
15114.LFB0:
15115	.cfi_startproc
15116# test.c:4:   int total = 0;
15117	xorl	%eax, %eax	# <retval>
15118# test.c:6:   for (i = 0; i < n; i++)
15119	xorl	%edx, %edx	# i
15120.L2:
15121# test.c:6:   for (i = 0; i < n; i++)
15122	cmpl	%edi, %edx	# n, i
15123	jge	.L5	#,
15124# test.c:7:     total += i * i;
15125	movl	%edx, %ecx	# i, tmp92
15126	imull	%edx, %ecx	# i, tmp92
15127# test.c:6:   for (i = 0; i < n; i++)
15128	incl	%edx	# i
15129# test.c:7:     total += i * i;
15130	addl	%ecx, %eax	# tmp92, <retval>
15131	jmp	.L2	#
15132.L5:
15133# test.c:10: @}
15134	ret
15135	.cfi_endproc
15136.LFE0:
15137	.size	test, .-test
15138	.ident	"GCC: (GNU) 7.0.0 20160809 (experimental)"
15139	.section	.note.GNU-stack,"",@@progbits
15140@end smallexample
15141
15142The comments are intended for humans rather than machines and hence the
15143precise format of the comments is subject to change.
15144
15145@item -frecord-gcc-switches
15146@opindex frecord-gcc-switches
15147This switch causes the command line used to invoke the
15148compiler to be recorded into the object file that is being created.
15149This switch is only implemented on some targets and the exact format
15150of the recording is target and binary file format dependent, but it
15151usually takes the form of a section containing ASCII text.  This
15152switch is related to the @option{-fverbose-asm} switch, but that
15153switch only records information in the assembler output file as
15154comments, so it never reaches the object file.
15155See also @option{-grecord-gcc-switches} for another
15156way of storing compiler options into the object file.
15157
15158@item -fpic
15159@opindex fpic
15160@cindex global offset table
15161@cindex PIC
15162Generate position-independent code (PIC) suitable for use in a shared
15163library, if supported for the target machine.  Such code accesses all
15164constant addresses through a global offset table (GOT)@.  The dynamic
15165loader resolves the GOT entries when the program starts (the dynamic
15166loader is not part of GCC; it is part of the operating system).  If
15167the GOT size for the linked executable exceeds a machine-specific
15168maximum size, you get an error message from the linker indicating that
15169@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15170instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15171on the m68k and RS/6000.  The x86 has no such limit.)
15172
15173Position-independent code requires special support, and therefore works
15174only on certain machines.  For the x86, GCC supports PIC for System V
15175but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
15176position-independent.
15177
15178When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15179are defined to 1.
15180
15181@item -fPIC
15182@opindex fPIC
15183If supported for the target machine, emit position-independent code,
15184suitable for dynamic linking and avoiding any limit on the size of the
15185global offset table.  This option makes a difference on AArch64, m68k,
15186PowerPC and SPARC@.
15187
15188Position-independent code requires special support, and therefore works
15189only on certain machines.
15190
15191When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15192are defined to 2.
15193
15194@item -fpie
15195@itemx -fPIE
15196@opindex fpie
15197@opindex fPIE
15198These options are similar to @option{-fpic} and @option{-fPIC}, but the
15199generated position-independent code can be only linked into executables.
15200Usually these options are used to compile code that will be linked using
15201the @option{-pie} GCC option.
15202
15203@option{-fpie} and @option{-fPIE} both define the macros
15204@code{__pie__} and @code{__PIE__}.  The macros have the value 1
15205for @option{-fpie} and 2 for @option{-fPIE}.
15206
15207@item -fno-plt
15208@opindex fno-plt
15209@opindex fplt
15210Do not use the PLT for external function calls in position-independent code.
15211Instead, load the callee address at call sites from the GOT and branch to it.
15212This leads to more efficient code by eliminating PLT stubs and exposing
15213GOT loads to optimizations.  On architectures such as 32-bit x86 where
15214PLT stubs expect the GOT pointer in a specific register, this gives more
15215register allocation freedom to the compiler.
15216Lazy binding requires use of the PLT;
15217with @option{-fno-plt} all external symbols are resolved at load time.
15218
15219Alternatively, the function attribute @code{noplt} can be used to avoid calls
15220through the PLT for specific external functions.
15221
15222In position-dependent code, a few targets also convert calls to
15223functions that are marked to not use the PLT to use the GOT instead.
15224
15225@item -fno-jump-tables
15226@opindex fno-jump-tables
15227@opindex fjump-tables
15228Do not use jump tables for switch statements even where it would be
15229more efficient than other code generation strategies.  This option is
15230of use in conjunction with @option{-fpic} or @option{-fPIC} for
15231building code that forms part of a dynamic linker and cannot
15232reference the address of a jump table.  On some targets, jump tables
15233do not require a GOT and this option is not needed.
15234
15235@item -ffixed-@var{reg}
15236@opindex ffixed
15237Treat the register named @var{reg} as a fixed register; generated code
15238should never refer to it (except perhaps as a stack pointer, frame
15239pointer or in some other fixed role).
15240
15241@var{reg} must be the name of a register.  The register names accepted
15242are machine-specific and are defined in the @code{REGISTER_NAMES}
15243macro in the machine description macro file.
15244
15245This flag does not have a negative form, because it specifies a
15246three-way choice.
15247
15248@item -fcall-used-@var{reg}
15249@opindex fcall-used
15250Treat the register named @var{reg} as an allocable register that is
15251clobbered by function calls.  It may be allocated for temporaries or
15252variables that do not live across a call.  Functions compiled this way
15253do not save and restore the register @var{reg}.
15254
15255It is an error to use this flag with the frame pointer or stack pointer.
15256Use of this flag for other registers that have fixed pervasive roles in
15257the machine's execution model produces disastrous results.
15258
15259This flag does not have a negative form, because it specifies a
15260three-way choice.
15261
15262@item -fcall-saved-@var{reg}
15263@opindex fcall-saved
15264Treat the register named @var{reg} as an allocable register saved by
15265functions.  It may be allocated even for temporaries or variables that
15266live across a call.  Functions compiled this way save and restore
15267the register @var{reg} if they use it.
15268
15269It is an error to use this flag with the frame pointer or stack pointer.
15270Use of this flag for other registers that have fixed pervasive roles in
15271the machine's execution model produces disastrous results.
15272
15273A different sort of disaster results from the use of this flag for
15274a register in which function values may be returned.
15275
15276This flag does not have a negative form, because it specifies a
15277three-way choice.
15278
15279@item -fpack-struct[=@var{n}]
15280@opindex fpack-struct
15281Without a value specified, pack all structure members together without
15282holes.  When a value is specified (which must be a small power of two), pack
15283structure members according to this value, representing the maximum
15284alignment (that is, objects with default alignment requirements larger than
15285this are output potentially unaligned at the next fitting location.
15286
15287@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15288code that is not binary compatible with code generated without that switch.
15289Additionally, it makes the code suboptimal.
15290Use it to conform to a non-default application binary interface.
15291
15292@item -fleading-underscore
15293@opindex fleading-underscore
15294This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15295change the way C symbols are represented in the object file.  One use
15296is to help link with legacy assembly code.
15297
15298@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15299generate code that is not binary compatible with code generated without that
15300switch.  Use it to conform to a non-default application binary interface.
15301Not all targets provide complete support for this switch.
15302
15303@item -ftls-model=@var{model}
15304@opindex ftls-model
15305Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15306The @var{model} argument should be one of @samp{global-dynamic},
15307@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15308Note that the choice is subject to optimization: the compiler may use
15309a more efficient model for symbols not visible outside of the translation
15310unit, or if @option{-fpic} is not given on the command line.
15311
15312The default without @option{-fpic} is @samp{initial-exec}; with
15313@option{-fpic} the default is @samp{global-dynamic}.
15314
15315@item -ftrampolines
15316@opindex ftrampolines
15317For targets that normally need trampolines for nested functions, always
15318generate them instead of using descriptors.  Otherwise, for targets that
15319do not need them, like for example HP-PA or IA-64, do nothing.
15320
15321A trampoline is a small piece of code that is created at run time on the
15322stack when the address of a nested function is taken, and is used to call
15323the nested function indirectly.  Therefore, it requires the stack to be
15324made executable in order for the program to work properly.
15325
15326@option{-fno-trampolines} is enabled by default on a language by language
15327basis to let the compiler avoid generating them, if it computes that this
15328is safe, and replace them with descriptors.  Descriptors are made up of data
15329only, but the generated code must be prepared to deal with them.  As of this
15330writing, @option{-fno-trampolines} is enabled by default only for Ada.
15331
15332Moreover, code compiled with @option{-ftrampolines} and code compiled with
15333@option{-fno-trampolines} are not binary compatible if nested functions are
15334present.  This option must therefore be used on a program-wide basis and be
15335manipulated with extreme care.
15336
15337@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15338@opindex fvisibility
15339Set the default ELF image symbol visibility to the specified option---all
15340symbols are marked with this unless overridden within the code.
15341Using this feature can very substantially improve linking and
15342load times of shared object libraries, produce more optimized
15343code, provide near-perfect API export and prevent symbol clashes.
15344It is @strong{strongly} recommended that you use this in any shared objects
15345you distribute.
15346
15347Despite the nomenclature, @samp{default} always means public; i.e.,
15348available to be linked against from outside the shared object.
15349@samp{protected} and @samp{internal} are pretty useless in real-world
15350usage so the only other commonly used option is @samp{hidden}.
15351The default if @option{-fvisibility} isn't specified is
15352@samp{default}, i.e., make every symbol public.
15353
15354A good explanation of the benefits offered by ensuring ELF
15355symbols have the correct visibility is given by ``How To Write
15356Shared Libraries'' by Ulrich Drepper (which can be found at
15357@w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15358solution made possible by this option to marking things hidden when
15359the default is public is to make the default hidden and mark things
15360public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15361and @code{__attribute__ ((visibility("default")))} instead of
15362@code{__declspec(dllexport)} you get almost identical semantics with
15363identical syntax.  This is a great boon to those working with
15364cross-platform projects.
15365
15366For those adding visibility support to existing code, you may find
15367@code{#pragma GCC visibility} of use.  This works by you enclosing
15368the declarations you wish to set visibility for with (for example)
15369@code{#pragma GCC visibility push(hidden)} and
15370@code{#pragma GCC visibility pop}.
15371Bear in mind that symbol visibility should be viewed @strong{as
15372part of the API interface contract} and thus all new code should
15373always specify visibility when it is not the default; i.e., declarations
15374only for use within the local DSO should @strong{always} be marked explicitly
15375as hidden as so to avoid PLT indirection overheads---making this
15376abundantly clear also aids readability and self-documentation of the code.
15377Note that due to ISO C++ specification requirements, @code{operator new} and
15378@code{operator delete} must always be of default visibility.
15379
15380Be aware that headers from outside your project, in particular system
15381headers and headers from any other library you use, may not be
15382expecting to be compiled with visibility other than the default.  You
15383may need to explicitly say @code{#pragma GCC visibility push(default)}
15384before including any such headers.
15385
15386@code{extern} declarations are not affected by @option{-fvisibility}, so
15387a lot of code can be recompiled with @option{-fvisibility=hidden} with
15388no modifications.  However, this means that calls to @code{extern}
15389functions with no explicit visibility use the PLT, so it is more
15390effective to use @code{__attribute ((visibility))} and/or
15391@code{#pragma GCC visibility} to tell the compiler which @code{extern}
15392declarations should be treated as hidden.
15393
15394Note that @option{-fvisibility} does affect C++ vague linkage
15395entities. This means that, for instance, an exception class that is
15396be thrown between DSOs must be explicitly marked with default
15397visibility so that the @samp{type_info} nodes are unified between
15398the DSOs.
15399
15400An overview of these techniques, their benefits and how to use them
15401is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15402
15403@item -fstrict-volatile-bitfields
15404@opindex fstrict-volatile-bitfields
15405This option should be used if accesses to volatile bit-fields (or other
15406structure fields, although the compiler usually honors those types
15407anyway) should use a single access of the width of the
15408field's type, aligned to a natural alignment if possible.  For
15409example, targets with memory-mapped peripheral registers might require
15410all such accesses to be 16 bits wide; with this flag you can
15411declare all peripheral bit-fields as @code{unsigned short} (assuming short
15412is 16 bits on these targets) to force GCC to use 16-bit accesses
15413instead of, perhaps, a more efficient 32-bit access.
15414
15415If this option is disabled, the compiler uses the most efficient
15416instruction.  In the previous example, that might be a 32-bit load
15417instruction, even though that accesses bytes that do not contain
15418any portion of the bit-field, or memory-mapped registers unrelated to
15419the one being updated.
15420
15421In some cases, such as when the @code{packed} attribute is applied to a
15422structure field, it may not be possible to access the field with a single
15423read or write that is correctly aligned for the target machine.  In this
15424case GCC falls back to generating multiple accesses rather than code that
15425will fault or truncate the result at run time.
15426
15427Note:  Due to restrictions of the C/C++11 memory model, write accesses are
15428not allowed to touch non bit-field members.  It is therefore recommended
15429to define all bits of the field's type as bit-field members.
15430
15431The default value of this option is determined by the application binary
15432interface for the target processor.
15433
15434@item -fsync-libcalls
15435@opindex fsync-libcalls
15436This option controls whether any out-of-line instance of the @code{__sync}
15437family of functions may be used to implement the C++11 @code{__atomic}
15438family of functions.
15439
15440The default value of this option is enabled, thus the only useful form
15441of the option is @option{-fno-sync-libcalls}.  This option is used in
15442the implementation of the @file{libatomic} runtime library.
15443
15444@end table
15445
15446@node Developer Options
15447@section GCC Developer Options
15448@cindex developer options
15449@cindex debugging GCC
15450@cindex debug dump options
15451@cindex dump options
15452@cindex compilation statistics
15453
15454This section describes command-line options that are primarily of
15455interest to GCC developers, including options to support compiler
15456testing and investigation of compiler bugs and compile-time
15457performance problems.  This includes options that produce debug dumps
15458at various points in the compilation; that print statistics such as
15459memory use and execution time; and that print information about GCC's
15460configuration, such as where it searches for libraries.  You should
15461rarely need to use any of these options for ordinary compilation and
15462linking tasks.
15463
15464Many developer options that cause GCC to dump output to a file take an
15465optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15466or @samp{-} to dump to standard output, and @samp{stderr} for standard
15467error.
15468
15469If @samp{=@var{filename}} is omitted, a default dump file name is
15470constructed by concatenating the base dump file name, a pass number,
15471phase letter, and pass name.  The base dump file name is the name of
15472output file produced by the compiler if explicitly specified and not
15473an executable; otherwise it is the source file name.
15474The pass number is determined by the order passes are registered with
15475the compiler's pass manager.
15476This is generally the same as the order of execution, but passes
15477registered by plugins, target-specific passes, or passes that are
15478otherwise registered late are numbered higher than the pass named
15479@samp{final}, even if they are executed earlier.  The phase letter is
15480one of @samp{i} (inter-procedural analysis), @samp{l}
15481(language-specific), @samp{r} (RTL), or @samp{t} (tree).
15482The files are created in the directory of the output file.
15483
15484@table @gcctabopt
15485
15486@item -fcallgraph-info
15487@itemx -fcallgraph-info=@var{MARKERS}
15488@opindex fcallgraph-info
15489Makes the compiler output callgraph information for the program, on a
15490per-object-file basis.  The information is generated in the common VCG
15491format.  It can be decorated with additional, per-node and/or per-edge
15492information, if a list of comma-separated markers is additionally
15493specified.  When the @code{su} marker is specified, the callgraph is
15494decorated with stack usage information; it is equivalent to
15495@option{-fstack-usage}.  When the @code{da} marker is specified, the
15496callgraph is decorated with information about dynamically allocated
15497objects.
15498
15499When compiling with @option{-flto}, no callgraph information is output
15500along with the object file.  At LTO link time, @option{-fcallgraph-info}
15501may generate multiple callgraph information files next to intermediate
15502LTO output files.
15503
15504@item -d@var{letters}
15505@itemx -fdump-rtl-@var{pass}
15506@itemx -fdump-rtl-@var{pass}=@var{filename}
15507@opindex d
15508@opindex fdump-rtl-@var{pass}
15509Says to make debugging dumps during compilation at times specified by
15510@var{letters}.  This is used for debugging the RTL-based passes of the
15511compiler.
15512
15513Some @option{-d@var{letters}} switches have different meaning when
15514@option{-E} is used for preprocessing.  @xref{Preprocessor Options},
15515for information about preprocessor-specific dump options.
15516
15517Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15518@option{-d} option @var{letters}.  Here are the possible
15519letters for use in @var{pass} and @var{letters}, and their meanings:
15520
15521@table @gcctabopt
15522
15523@item -fdump-rtl-alignments
15524@opindex fdump-rtl-alignments
15525Dump after branch alignments have been computed.
15526
15527@item -fdump-rtl-asmcons
15528@opindex fdump-rtl-asmcons
15529Dump after fixing rtl statements that have unsatisfied in/out constraints.
15530
15531@item -fdump-rtl-auto_inc_dec
15532@opindex fdump-rtl-auto_inc_dec
15533Dump after auto-inc-dec discovery.  This pass is only run on
15534architectures that have auto inc or auto dec instructions.
15535
15536@item -fdump-rtl-barriers
15537@opindex fdump-rtl-barriers
15538Dump after cleaning up the barrier instructions.
15539
15540@item -fdump-rtl-bbpart
15541@opindex fdump-rtl-bbpart
15542Dump after partitioning hot and cold basic blocks.
15543
15544@item -fdump-rtl-bbro
15545@opindex fdump-rtl-bbro
15546Dump after block reordering.
15547
15548@item -fdump-rtl-btl1
15549@itemx -fdump-rtl-btl2
15550@opindex fdump-rtl-btl2
15551@opindex fdump-rtl-btl2
15552@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15553after the two branch
15554target load optimization passes.
15555
15556@item -fdump-rtl-bypass
15557@opindex fdump-rtl-bypass
15558Dump after jump bypassing and control flow optimizations.
15559
15560@item -fdump-rtl-combine
15561@opindex fdump-rtl-combine
15562Dump after the RTL instruction combination pass.
15563
15564@item -fdump-rtl-compgotos
15565@opindex fdump-rtl-compgotos
15566Dump after duplicating the computed gotos.
15567
15568@item -fdump-rtl-ce1
15569@itemx -fdump-rtl-ce2
15570@itemx -fdump-rtl-ce3
15571@opindex fdump-rtl-ce1
15572@opindex fdump-rtl-ce2
15573@opindex fdump-rtl-ce3
15574@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15575@option{-fdump-rtl-ce3} enable dumping after the three
15576if conversion passes.
15577
15578@item -fdump-rtl-cprop_hardreg
15579@opindex fdump-rtl-cprop_hardreg
15580Dump after hard register copy propagation.
15581
15582@item -fdump-rtl-csa
15583@opindex fdump-rtl-csa
15584Dump after combining stack adjustments.
15585
15586@item -fdump-rtl-cse1
15587@itemx -fdump-rtl-cse2
15588@opindex fdump-rtl-cse1
15589@opindex fdump-rtl-cse2
15590@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15591the two common subexpression elimination passes.
15592
15593@item -fdump-rtl-dce
15594@opindex fdump-rtl-dce
15595Dump after the standalone dead code elimination passes.
15596
15597@item -fdump-rtl-dbr
15598@opindex fdump-rtl-dbr
15599Dump after delayed branch scheduling.
15600
15601@item -fdump-rtl-dce1
15602@itemx -fdump-rtl-dce2
15603@opindex fdump-rtl-dce1
15604@opindex fdump-rtl-dce2
15605@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15606the two dead store elimination passes.
15607
15608@item -fdump-rtl-eh
15609@opindex fdump-rtl-eh
15610Dump after finalization of EH handling code.
15611
15612@item -fdump-rtl-eh_ranges
15613@opindex fdump-rtl-eh_ranges
15614Dump after conversion of EH handling range regions.
15615
15616@item -fdump-rtl-expand
15617@opindex fdump-rtl-expand
15618Dump after RTL generation.
15619
15620@item -fdump-rtl-fwprop1
15621@itemx -fdump-rtl-fwprop2
15622@opindex fdump-rtl-fwprop1
15623@opindex fdump-rtl-fwprop2
15624@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15625dumping after the two forward propagation passes.
15626
15627@item -fdump-rtl-gcse1
15628@itemx -fdump-rtl-gcse2
15629@opindex fdump-rtl-gcse1
15630@opindex fdump-rtl-gcse2
15631@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15632after global common subexpression elimination.
15633
15634@item -fdump-rtl-init-regs
15635@opindex fdump-rtl-init-regs
15636Dump after the initialization of the registers.
15637
15638@item -fdump-rtl-initvals
15639@opindex fdump-rtl-initvals
15640Dump after the computation of the initial value sets.
15641
15642@item -fdump-rtl-into_cfglayout
15643@opindex fdump-rtl-into_cfglayout
15644Dump after converting to cfglayout mode.
15645
15646@item -fdump-rtl-ira
15647@opindex fdump-rtl-ira
15648Dump after iterated register allocation.
15649
15650@item -fdump-rtl-jump
15651@opindex fdump-rtl-jump
15652Dump after the second jump optimization.
15653
15654@item -fdump-rtl-loop2
15655@opindex fdump-rtl-loop2
15656@option{-fdump-rtl-loop2} enables dumping after the rtl
15657loop optimization passes.
15658
15659@item -fdump-rtl-mach
15660@opindex fdump-rtl-mach
15661Dump after performing the machine dependent reorganization pass, if that
15662pass exists.
15663
15664@item -fdump-rtl-mode_sw
15665@opindex fdump-rtl-mode_sw
15666Dump after removing redundant mode switches.
15667
15668@item -fdump-rtl-rnreg
15669@opindex fdump-rtl-rnreg
15670Dump after register renumbering.
15671
15672@item -fdump-rtl-outof_cfglayout
15673@opindex fdump-rtl-outof_cfglayout
15674Dump after converting from cfglayout mode.
15675
15676@item -fdump-rtl-peephole2
15677@opindex fdump-rtl-peephole2
15678Dump after the peephole pass.
15679
15680@item -fdump-rtl-postreload
15681@opindex fdump-rtl-postreload
15682Dump after post-reload optimizations.
15683
15684@item -fdump-rtl-pro_and_epilogue
15685@opindex fdump-rtl-pro_and_epilogue
15686Dump after generating the function prologues and epilogues.
15687
15688@item -fdump-rtl-sched1
15689@itemx -fdump-rtl-sched2
15690@opindex fdump-rtl-sched1
15691@opindex fdump-rtl-sched2
15692@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15693after the basic block scheduling passes.
15694
15695@item -fdump-rtl-ree
15696@opindex fdump-rtl-ree
15697Dump after sign/zero extension elimination.
15698
15699@item -fdump-rtl-seqabstr
15700@opindex fdump-rtl-seqabstr
15701Dump after common sequence discovery.
15702
15703@item -fdump-rtl-shorten
15704@opindex fdump-rtl-shorten
15705Dump after shortening branches.
15706
15707@item -fdump-rtl-sibling
15708@opindex fdump-rtl-sibling
15709Dump after sibling call optimizations.
15710
15711@item -fdump-rtl-split1
15712@itemx -fdump-rtl-split2
15713@itemx -fdump-rtl-split3
15714@itemx -fdump-rtl-split4
15715@itemx -fdump-rtl-split5
15716@opindex fdump-rtl-split1
15717@opindex fdump-rtl-split2
15718@opindex fdump-rtl-split3
15719@opindex fdump-rtl-split4
15720@opindex fdump-rtl-split5
15721These options enable dumping after five rounds of
15722instruction splitting.
15723
15724@item -fdump-rtl-sms
15725@opindex fdump-rtl-sms
15726Dump after modulo scheduling.  This pass is only run on some
15727architectures.
15728
15729@item -fdump-rtl-stack
15730@opindex fdump-rtl-stack
15731Dump after conversion from GCC's ``flat register file'' registers to the
15732x87's stack-like registers.  This pass is only run on x86 variants.
15733
15734@item -fdump-rtl-subreg1
15735@itemx -fdump-rtl-subreg2
15736@opindex fdump-rtl-subreg1
15737@opindex fdump-rtl-subreg2
15738@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
15739the two subreg expansion passes.
15740
15741@item -fdump-rtl-unshare
15742@opindex fdump-rtl-unshare
15743Dump after all rtl has been unshared.
15744
15745@item -fdump-rtl-vartrack
15746@opindex fdump-rtl-vartrack
15747Dump after variable tracking.
15748
15749@item -fdump-rtl-vregs
15750@opindex fdump-rtl-vregs
15751Dump after converting virtual registers to hard registers.
15752
15753@item -fdump-rtl-web
15754@opindex fdump-rtl-web
15755Dump after live range splitting.
15756
15757@item -fdump-rtl-regclass
15758@itemx -fdump-rtl-subregs_of_mode_init
15759@itemx -fdump-rtl-subregs_of_mode_finish
15760@itemx -fdump-rtl-dfinit
15761@itemx -fdump-rtl-dfinish
15762@opindex fdump-rtl-regclass
15763@opindex fdump-rtl-subregs_of_mode_init
15764@opindex fdump-rtl-subregs_of_mode_finish
15765@opindex fdump-rtl-dfinit
15766@opindex fdump-rtl-dfinish
15767These dumps are defined but always produce empty files.
15768
15769@item -da
15770@itemx -fdump-rtl-all
15771@opindex da
15772@opindex fdump-rtl-all
15773Produce all the dumps listed above.
15774
15775@item -dA
15776@opindex dA
15777Annotate the assembler output with miscellaneous debugging information.
15778
15779@item -dD
15780@opindex dD
15781Dump all macro definitions, at the end of preprocessing, in addition to
15782normal output.
15783
15784@item -dH
15785@opindex dH
15786Produce a core dump whenever an error occurs.
15787
15788@item -dp
15789@opindex dp
15790Annotate the assembler output with a comment indicating which
15791pattern and alternative is used.  The length and cost of each instruction are
15792also printed.
15793
15794@item -dP
15795@opindex dP
15796Dump the RTL in the assembler output as a comment before each instruction.
15797Also turns on @option{-dp} annotation.
15798
15799@item -dx
15800@opindex dx
15801Just generate RTL for a function instead of compiling it.  Usually used
15802with @option{-fdump-rtl-expand}.
15803@end table
15804
15805@item -fdump-debug
15806@opindex fdump-debug
15807Dump debugging information generated during the debug
15808generation phase.
15809
15810@item -fdump-earlydebug
15811@opindex fdump-earlydebug
15812Dump debugging information generated during the early debug
15813generation phase.
15814
15815@item -fdump-noaddr
15816@opindex fdump-noaddr
15817When doing debugging dumps, suppress address output.  This makes it more
15818feasible to use diff on debugging dumps for compiler invocations with
15819different compiler binaries and/or different
15820text / bss / data / heap / stack / dso start locations.
15821
15822@item -freport-bug
15823@opindex freport-bug
15824Collect and dump debug information into a temporary file if an
15825internal compiler error (ICE) occurs.
15826
15827@item -fdump-unnumbered
15828@opindex fdump-unnumbered
15829When doing debugging dumps, suppress instruction numbers and address output.
15830This makes it more feasible to use diff on debugging dumps for compiler
15831invocations with different options, in particular with and without
15832@option{-g}.
15833
15834@item -fdump-unnumbered-links
15835@opindex fdump-unnumbered-links
15836When doing debugging dumps (see @option{-d} option above), suppress
15837instruction numbers for the links to the previous and next instructions
15838in a sequence.
15839
15840@item -fdump-ipa-@var{switch}
15841@itemx -fdump-ipa-@var{switch}-@var{options}
15842@opindex fdump-ipa
15843Control the dumping at various stages of inter-procedural analysis
15844language tree to a file.  The file name is generated by appending a
15845switch specific suffix to the source file name, and the file is created
15846in the same directory as the output file.  The following dumps are
15847possible:
15848
15849@table @samp
15850@item all
15851Enables all inter-procedural analysis dumps.
15852
15853@item cgraph
15854Dumps information about call-graph optimization, unused function removal,
15855and inlining decisions.
15856
15857@item inline
15858Dump after function inlining.
15859
15860@end table
15861
15862Additionally, the options @option{-optimized}, @option{-missed},
15863@option{-note}, and @option{-all} can be provided, with the same meaning
15864as for @option{-fopt-info}, defaulting to @option{-optimized}.
15865
15866For example, @option{-fdump-ipa-inline-optimized-missed} will emit
15867information on callsites that were inlined, along with callsites
15868that were not inlined.
15869
15870By default, the dump will contain messages about successful
15871optimizations (equivalent to @option{-optimized}) together with
15872low-level details about the analysis.
15873
15874@item -fdump-lang-all
15875@itemx -fdump-lang-@var{switch}
15876@itemx -fdump-lang-@var{switch}-@var{options}
15877@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
15878@opindex fdump-lang-all
15879@opindex fdump-lang
15880Control the dumping of language-specific information.  The @var{options}
15881and @var{filename} portions behave as described in the
15882@option{-fdump-tree} option.  The following @var{switch} values are
15883accepted:
15884
15885@table @samp
15886@item all
15887
15888Enable all language-specific dumps.
15889
15890@item class
15891Dump class hierarchy information.  Virtual table information is emitted
15892unless '@option{slim}' is specified.  This option is applicable to C++ only.
15893
15894@item raw
15895Dump the raw internal tree data.  This option is applicable to C++ only.
15896
15897@end table
15898
15899@item -fdump-passes
15900@opindex fdump-passes
15901Print on @file{stderr} the list of optimization passes that are turned
15902on and off by the current command-line options.
15903
15904@item -fdump-statistics-@var{option}
15905@opindex fdump-statistics
15906Enable and control dumping of pass statistics in a separate file.  The
15907file name is generated by appending a suffix ending in
15908@samp{.statistics} to the source file name, and the file is created in
15909the same directory as the output file.  If the @samp{-@var{option}}
15910form is used, @samp{-stats} causes counters to be summed over the
15911whole compilation unit while @samp{-details} dumps every event as
15912the passes generate them.  The default with no option is to sum
15913counters for each function compiled.
15914
15915@item -fdump-tree-all
15916@itemx -fdump-tree-@var{switch}
15917@itemx -fdump-tree-@var{switch}-@var{options}
15918@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15919@opindex fdump-tree-all
15920@opindex fdump-tree
15921Control the dumping at various stages of processing the intermediate
15922language tree to a file.  If the @samp{-@var{options}}
15923form is used, @var{options} is a list of @samp{-} separated options
15924which control the details of the dump.  Not all options are applicable
15925to all dumps; those that are not meaningful are ignored.  The
15926following options are available
15927
15928@table @samp
15929@item address
15930Print the address of each node.  Usually this is not meaningful as it
15931changes according to the environment and source file.  Its primary use
15932is for tying up a dump file with a debug environment.
15933@item asmname
15934If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15935in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
15936use working backward from mangled names in the assembly file.
15937@item slim
15938When dumping front-end intermediate representations, inhibit dumping
15939of members of a scope or body of a function merely because that scope
15940has been reached.  Only dump such items when they are directly reachable
15941by some other path.
15942
15943When dumping pretty-printed trees, this option inhibits dumping the
15944bodies of control structures.
15945
15946When dumping RTL, print the RTL in slim (condensed) form instead of
15947the default LISP-like representation.
15948@item raw
15949Print a raw representation of the tree.  By default, trees are
15950pretty-printed into a C-like representation.
15951@item details
15952Enable more detailed dumps (not honored by every dump option). Also
15953include information from the optimization passes.
15954@item stats
15955Enable dumping various statistics about the pass (not honored by every dump
15956option).
15957@item blocks
15958Enable showing basic block boundaries (disabled in raw dumps).
15959@item graph
15960For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15961dump a representation of the control flow graph suitable for viewing with
15962GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
15963the file is pretty-printed as a subgraph, so that GraphViz can render them
15964all in a single plot.
15965
15966This option currently only works for RTL dumps, and the RTL is always
15967dumped in slim form.
15968@item vops
15969Enable showing virtual operands for every statement.
15970@item lineno
15971Enable showing line numbers for statements.
15972@item uid
15973Enable showing the unique ID (@code{DECL_UID}) for each variable.
15974@item verbose
15975Enable showing the tree dump for each statement.
15976@item eh
15977Enable showing the EH region number holding each statement.
15978@item scev
15979Enable showing scalar evolution analysis details.
15980@item optimized
15981Enable showing optimization information (only available in certain
15982passes).
15983@item missed
15984Enable showing missed optimization information (only available in certain
15985passes).
15986@item note
15987Enable other detailed optimization information (only available in
15988certain passes).
15989@item all
15990Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15991and @option{lineno}.
15992@item optall
15993Turn on all optimization options, i.e., @option{optimized},
15994@option{missed}, and @option{note}.
15995@end table
15996
15997To determine what tree dumps are available or find the dump for a pass
15998of interest follow the steps below.
15999
16000@enumerate
16001@item
16002Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
16003look for a code that corresponds to the pass you are interested in.
16004For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
16005@code{tree-vrp2} correspond to the three Value Range Propagation passes.
16006The number at the end distinguishes distinct invocations of the same pass.
16007@item
16008To enable the creation of the dump file, append the pass code to
16009the @option{-fdump-} option prefix and invoke GCC with it.  For example,
16010to enable the dump from the Early Value Range Propagation pass, invoke
16011GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
16012specify the name of the dump file.  If you don't specify one, GCC
16013creates as described below.
16014@item
16015Find the pass dump in a file whose name is composed of three components
16016separated by a period: the name of the source file GCC was invoked to
16017compile, a numeric suffix indicating the pass number followed by the
16018letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
16019and finally the pass code.  For example, the Early VRP pass dump might
16020be in a file named @file{myfile.c.038t.evrp} in the current working
16021directory.  Note that the numeric codes are not stable and may change
16022from one version of GCC to another.
16023@end enumerate
16024
16025@item -fopt-info
16026@itemx -fopt-info-@var{options}
16027@itemx -fopt-info-@var{options}=@var{filename}
16028@opindex fopt-info
16029Controls optimization dumps from various optimization passes. If the
16030@samp{-@var{options}} form is used, @var{options} is a list of
16031@samp{-} separated option keywords to select the dump details and
16032optimizations.
16033
16034The @var{options} can be divided into three groups:
16035@enumerate
16036@item
16037options describing what kinds of messages should be emitted,
16038@item
16039options describing the verbosity of the dump, and
16040@item
16041options describing which optimizations should be included.
16042@end enumerate
16043The options from each group can be freely mixed as they are
16044non-overlapping. However, in case of any conflicts,
16045the later options override the earlier options on the command
16046line.
16047
16048The following options control which kinds of messages should be emitted:
16049
16050@table @samp
16051@item optimized
16052Print information when an optimization is successfully applied. It is
16053up to a pass to decide which information is relevant. For example, the
16054vectorizer passes print the source location of loops which are
16055successfully vectorized.
16056@item missed
16057Print information about missed optimizations. Individual passes
16058control which information to include in the output.
16059@item note
16060Print verbose information about optimizations, such as certain
16061transformations, more detailed messages about decisions etc.
16062@item all
16063Print detailed optimization information. This includes
16064@samp{optimized}, @samp{missed}, and @samp{note}.
16065@end table
16066
16067The following option controls the dump verbosity:
16068
16069@table @samp
16070@item internals
16071By default, only ``high-level'' messages are emitted. This option enables
16072additional, more detailed, messages, which are likely to only be of interest
16073to GCC developers.
16074@end table
16075
16076One or more of the following option keywords can be used to describe a
16077group of optimizations:
16078
16079@table @samp
16080@item ipa
16081Enable dumps from all interprocedural optimizations.
16082@item loop
16083Enable dumps from all loop optimizations.
16084@item inline
16085Enable dumps from all inlining optimizations.
16086@item omp
16087Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16088@item vec
16089Enable dumps from all vectorization optimizations.
16090@item optall
16091Enable dumps from all optimizations. This is a superset of
16092the optimization groups listed above.
16093@end table
16094
16095If @var{options} is
16096omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16097about successful optimizations from all the passes, omitting messages
16098that are treated as ``internals''.
16099
16100If the @var{filename} is provided, then the dumps from all the
16101applicable optimizations are concatenated into the @var{filename}.
16102Otherwise the dump is output onto @file{stderr}. Though multiple
16103@option{-fopt-info} options are accepted, only one of them can include
16104a @var{filename}. If other filenames are provided then all but the
16105first such option are ignored.
16106
16107Note that the output @var{filename} is overwritten
16108in case of multiple translation units. If a combined output from
16109multiple translation units is desired, @file{stderr} should be used
16110instead.
16111
16112In the following example, the optimization info is output to
16113@file{stderr}:
16114
16115@smallexample
16116gcc -O3 -fopt-info
16117@end smallexample
16118
16119This example:
16120@smallexample
16121gcc -O3 -fopt-info-missed=missed.all
16122@end smallexample
16123
16124@noindent
16125outputs missed optimization report from all the passes into
16126@file{missed.all}, and this one:
16127
16128@smallexample
16129gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16130@end smallexample
16131
16132@noindent
16133prints information about missed optimization opportunities from
16134vectorization passes on @file{stderr}.
16135Note that @option{-fopt-info-vec-missed} is equivalent to
16136@option{-fopt-info-missed-vec}.  The order of the optimization group
16137names and message types listed after @option{-fopt-info} does not matter.
16138
16139As another example,
16140@smallexample
16141gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16142@end smallexample
16143
16144@noindent
16145outputs information about missed optimizations as well as
16146optimized locations from all the inlining passes into
16147@file{inline.txt}.
16148
16149Finally, consider:
16150
16151@smallexample
16152gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16153@end smallexample
16154
16155@noindent
16156Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16157in conflict since only one output file is allowed. In this case, only
16158the first option takes effect and the subsequent options are
16159ignored. Thus only @file{vec.miss} is produced which contains
16160dumps from the vectorizer about missed opportunities.
16161
16162@item -fsave-optimization-record
16163@opindex fsave-optimization-record
16164Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16165were performed, for those optimizations that support @option{-fopt-info}.
16166
16167This option is experimental and the format of the data within the
16168compressed JSON file is subject to change.
16169
16170It is roughly equivalent to a machine-readable version of
16171@option{-fopt-info-all}, as a collection of messages with source file,
16172line number and column number, with the following additional data for
16173each message:
16174
16175@itemize @bullet
16176
16177@item
16178the execution count of the code being optimized, along with metadata about
16179whether this was from actual profile data, or just an estimate, allowing
16180consumers to prioritize messages by code hotness,
16181
16182@item
16183the function name of the code being optimized, where applicable,
16184
16185@item
16186the ``inlining chain'' for the code being optimized, so that when
16187a function is inlined into several different places (which might
16188themselves be inlined), the reader can distinguish between the copies,
16189
16190@item
16191objects identifying those parts of the message that refer to expressions,
16192statements or symbol-table nodes, which of these categories they are, and,
16193when available, their source code location,
16194
16195@item
16196the GCC pass that emitted the message, and
16197
16198@item
16199the location in GCC's own code from which the message was emitted
16200
16201@end itemize
16202
16203Additionally, some messages are logically nested within other
16204messages, reflecting implementation details of the optimization
16205passes.
16206
16207@item -fsched-verbose=@var{n}
16208@opindex fsched-verbose
16209On targets that use instruction scheduling, this option controls the
16210amount of debugging output the scheduler prints to the dump files.
16211
16212For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16213same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16214For @var{n} greater than one, it also output basic block probabilities,
16215detailed ready list information and unit/insn info.  For @var{n} greater
16216than two, it includes RTL at abort point, control-flow and regions info.
16217And for @var{n} over four, @option{-fsched-verbose} also includes
16218dependence info.
16219
16220
16221
16222@item -fenable-@var{kind}-@var{pass}
16223@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16224@opindex fdisable-
16225@opindex fenable-
16226
16227This is a set of options that are used to explicitly disable/enable
16228optimization passes.  These options are intended for use for debugging GCC.
16229Compiler users should use regular options for enabling/disabling
16230passes instead.
16231
16232@table @gcctabopt
16233
16234@item -fdisable-ipa-@var{pass}
16235Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
16236statically invoked in the compiler multiple times, the pass name should be
16237appended with a sequential number starting from 1.
16238
16239@item -fdisable-rtl-@var{pass}
16240@itemx -fdisable-rtl-@var{pass}=@var{range-list}
16241Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16242statically invoked in the compiler multiple times, the pass name should be
16243appended with a sequential number starting from 1.  @var{range-list} is a
16244comma-separated list of function ranges or assembler names.  Each range is a number
16245pair separated by a colon.  The range is inclusive in both ends.  If the range
16246is trivial, the number pair can be simplified as a single number.  If the
16247function's call graph node's @var{uid} falls within one of the specified ranges,
16248the @var{pass} is disabled for that function.  The @var{uid} is shown in the
16249function header of a dump file, and the pass names can be dumped by using
16250option @option{-fdump-passes}.
16251
16252@item -fdisable-tree-@var{pass}
16253@itemx -fdisable-tree-@var{pass}=@var{range-list}
16254Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
16255option arguments.
16256
16257@item -fenable-ipa-@var{pass}
16258Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16259statically invoked in the compiler multiple times, the pass name should be
16260appended with a sequential number starting from 1.
16261
16262@item -fenable-rtl-@var{pass}
16263@itemx -fenable-rtl-@var{pass}=@var{range-list}
16264Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
16265description and examples.
16266
16267@item -fenable-tree-@var{pass}
16268@itemx -fenable-tree-@var{pass}=@var{range-list}
16269Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
16270of option arguments.
16271
16272@end table
16273
16274Here are some examples showing uses of these options.
16275
16276@smallexample
16277
16278# disable ccp1 for all functions
16279   -fdisable-tree-ccp1
16280# disable complete unroll for function whose cgraph node uid is 1
16281   -fenable-tree-cunroll=1
16282# disable gcse2 for functions at the following ranges [1,1],
16283# [300,400], and [400,1000]
16284# disable gcse2 for functions foo and foo2
16285   -fdisable-rtl-gcse2=foo,foo2
16286# disable early inlining
16287   -fdisable-tree-einline
16288# disable ipa inlining
16289   -fdisable-ipa-inline
16290# enable tree full unroll
16291   -fenable-tree-unroll
16292
16293@end smallexample
16294
16295@item -fchecking
16296@itemx -fchecking=@var{n}
16297@opindex fchecking
16298@opindex fno-checking
16299Enable internal consistency checking.  The default depends on
16300the compiler configuration.  @option{-fchecking=2} enables further
16301internal consistency checking that might affect code generation.
16302
16303@item -frandom-seed=@var{string}
16304@opindex frandom-seed
16305This option provides a seed that GCC uses in place of
16306random numbers in generating certain symbol names
16307that have to be different in every compiled file.  It is also used to
16308place unique stamps in coverage data files and the object files that
16309produce them.  You can use the @option{-frandom-seed} option to produce
16310reproducibly identical object files.
16311
16312The @var{string} can either be a number (decimal, octal or hex) or an
16313arbitrary string (in which case it's converted to a number by
16314computing CRC32).
16315
16316The @var{string} should be different for every file you compile.
16317
16318@item -save-temps
16319@itemx -save-temps=cwd
16320@opindex save-temps
16321Store the usual ``temporary'' intermediate files permanently; place them
16322in the current directory and name them based on the source file.  Thus,
16323compiling @file{foo.c} with @option{-c -save-temps} produces files
16324@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
16325preprocessed @file{foo.i} output file even though the compiler now
16326normally uses an integrated preprocessor.
16327
16328When used in combination with the @option{-x} command-line option,
16329@option{-save-temps} is sensible enough to avoid over writing an
16330input source file with the same extension as an intermediate file.
16331The corresponding intermediate file may be obtained by renaming the
16332source file before using @option{-save-temps}.
16333
16334If you invoke GCC in parallel, compiling several different source
16335files that share a common base name in different subdirectories or the
16336same source file compiled for multiple output destinations, it is
16337likely that the different parallel compilers will interfere with each
16338other, and overwrite the temporary files.  For instance:
16339
16340@smallexample
16341gcc -save-temps -o outdir1/foo.o indir1/foo.c&
16342gcc -save-temps -o outdir2/foo.o indir2/foo.c&
16343@end smallexample
16344
16345may result in @file{foo.i} and @file{foo.o} being written to
16346simultaneously by both compilers.
16347
16348@item -save-temps=obj
16349@opindex save-temps=obj
16350Store the usual ``temporary'' intermediate files permanently.  If the
16351@option{-o} option is used, the temporary files are based on the
16352object file.  If the @option{-o} option is not used, the
16353@option{-save-temps=obj} switch behaves like @option{-save-temps}.
16354
16355For example:
16356
16357@smallexample
16358gcc -save-temps=obj -c foo.c
16359gcc -save-temps=obj -c bar.c -o dir/xbar.o
16360gcc -save-temps=obj foobar.c -o dir2/yfoobar
16361@end smallexample
16362
16363@noindent
16364creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
16365@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
16366@file{dir2/yfoobar.o}.
16367
16368@item -time@r{[}=@var{file}@r{]}
16369@opindex time
16370Report the CPU time taken by each subprocess in the compilation
16371sequence.  For C source files, this is the compiler proper and assembler
16372(plus the linker if linking is done).
16373
16374Without the specification of an output file, the output looks like this:
16375
16376@smallexample
16377# cc1 0.12 0.01
16378# as 0.00 0.01
16379@end smallexample
16380
16381The first number on each line is the ``user time'', that is time spent
16382executing the program itself.  The second number is ``system time'',
16383time spent executing operating system routines on behalf of the program.
16384Both numbers are in seconds.
16385
16386With the specification of an output file, the output is appended to the
16387named file, and it looks like this:
16388
16389@smallexample
163900.12 0.01 cc1 @var{options}
163910.00 0.01 as @var{options}
16392@end smallexample
16393
16394The ``user time'' and the ``system time'' are moved before the program
16395name, and the options passed to the program are displayed, so that one
16396can later tell what file was being compiled, and with which options.
16397
16398@item -fdump-final-insns@r{[}=@var{file}@r{]}
16399@opindex fdump-final-insns
16400Dump the final internal representation (RTL) to @var{file}.  If the
16401optional argument is omitted (or if @var{file} is @code{.}), the name
16402of the dump file is determined by appending @code{.gkd} to the
16403compilation output file name.
16404
16405@item -fcompare-debug@r{[}=@var{opts}@r{]}
16406@opindex fcompare-debug
16407@opindex fno-compare-debug
16408If no error occurs during compilation, run the compiler a second time,
16409adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16410passed to the second compilation.  Dump the final internal
16411representation in both compilations, and print an error if they differ.
16412
16413If the equal sign is omitted, the default @option{-gtoggle} is used.
16414
16415The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16416and nonzero, implicitly enables @option{-fcompare-debug}.  If
16417@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16418then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16419is used.
16420
16421@option{-fcompare-debug=}, with the equal sign but without @var{opts},
16422is equivalent to @option{-fno-compare-debug}, which disables the dumping
16423of the final representation and the second compilation, preventing even
16424@env{GCC_COMPARE_DEBUG} from taking effect.
16425
16426To verify full coverage during @option{-fcompare-debug} testing, set
16427@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16428which GCC rejects as an invalid option in any actual compilation
16429(rather than preprocessing, assembly or linking).  To get just a
16430warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16431not overridden} will do.
16432
16433@item -fcompare-debug-second
16434@opindex fcompare-debug-second
16435This option is implicitly passed to the compiler for the second
16436compilation requested by @option{-fcompare-debug}, along with options to
16437silence warnings, and omitting other options that would cause the compiler
16438to produce output to files or to standard output as a side effect.  Dump
16439files and preserved temporary files are renamed so as to contain the
16440@code{.gk} additional extension during the second compilation, to avoid
16441overwriting those generated by the first.
16442
16443When this option is passed to the compiler driver, it causes the
16444@emph{first} compilation to be skipped, which makes it useful for little
16445other than debugging the compiler proper.
16446
16447@item -gtoggle
16448@opindex gtoggle
16449Turn off generation of debug info, if leaving out this option
16450generates it, or turn it on at level 2 otherwise.  The position of this
16451argument in the command line does not matter; it takes effect after all
16452other options are processed, and it does so only once, no matter how
16453many times it is given.  This is mainly intended to be used with
16454@option{-fcompare-debug}.
16455
16456@item -fvar-tracking-assignments-toggle
16457@opindex fvar-tracking-assignments-toggle
16458@opindex fno-var-tracking-assignments-toggle
16459Toggle @option{-fvar-tracking-assignments}, in the same way that
16460@option{-gtoggle} toggles @option{-g}.
16461
16462@item -Q
16463@opindex Q
16464Makes the compiler print out each function name as it is compiled, and
16465print some statistics about each pass when it finishes.
16466
16467@item -ftime-report
16468@opindex ftime-report
16469Makes the compiler print some statistics about the time consumed by each
16470pass when it finishes.
16471
16472@item -ftime-report-details
16473@opindex ftime-report-details
16474Record the time consumed by infrastructure parts separately for each pass.
16475
16476@item -fira-verbose=@var{n}
16477@opindex fira-verbose
16478Control the verbosity of the dump file for the integrated register allocator.
16479The default value is 5.  If the value @var{n} is greater or equal to 10,
16480the dump output is sent to stderr using the same format as @var{n} minus 10.
16481
16482@item -flto-report
16483@opindex flto-report
16484Prints a report with internal details on the workings of the link-time
16485optimizer.  The contents of this report vary from version to version.
16486It is meant to be useful to GCC developers when processing object
16487files in LTO mode (via @option{-flto}).
16488
16489Disabled by default.
16490
16491@item -flto-report-wpa
16492@opindex flto-report-wpa
16493Like @option{-flto-report}, but only print for the WPA phase of link-time
16494optimization.
16495
16496@item -fmem-report
16497@opindex fmem-report
16498Makes the compiler print some statistics about permanent memory
16499allocation when it finishes.
16500
16501@item -fmem-report-wpa
16502@opindex fmem-report-wpa
16503Makes the compiler print some statistics about permanent memory
16504allocation for the WPA phase only.
16505
16506@item -fpre-ipa-mem-report
16507@opindex fpre-ipa-mem-report
16508@item -fpost-ipa-mem-report
16509@opindex fpost-ipa-mem-report
16510Makes the compiler print some statistics about permanent memory
16511allocation before or after interprocedural optimization.
16512
16513@item -fprofile-report
16514@opindex fprofile-report
16515Makes the compiler print some statistics about consistency of the
16516(estimated) profile and effect of individual passes.
16517
16518@item -fstack-usage
16519@opindex fstack-usage
16520Makes the compiler output stack usage information for the program, on a
16521per-function basis.  The filename for the dump is made by appending
16522@file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
16523the output file, if explicitly specified and it is not an executable,
16524otherwise it is the basename of the source file.  An entry is made up
16525of three fields:
16526
16527@itemize
16528@item
16529The name of the function.
16530@item
16531A number of bytes.
16532@item
16533One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16534@end itemize
16535
16536The qualifier @code{static} means that the function manipulates the stack
16537statically: a fixed number of bytes are allocated for the frame on function
16538entry and released on function exit; no stack adjustments are otherwise made
16539in the function.  The second field is this fixed number of bytes.
16540
16541The qualifier @code{dynamic} means that the function manipulates the stack
16542dynamically: in addition to the static allocation described above, stack
16543adjustments are made in the body of the function, for example to push/pop
16544arguments around function calls.  If the qualifier @code{bounded} is also
16545present, the amount of these adjustments is bounded at compile time and
16546the second field is an upper bound of the total amount of stack used by
16547the function.  If it is not present, the amount of these adjustments is
16548not bounded at compile time and the second field only represents the
16549bounded part.
16550
16551@item -fstats
16552@opindex fstats
16553Emit statistics about front-end processing at the end of the compilation.
16554This option is supported only by the C++ front end, and
16555the information is generally only useful to the G++ development team.
16556
16557@item -fdbg-cnt-list
16558@opindex fdbg-cnt-list
16559Print the name and the counter upper bound for all debug counters.
16560
16561
16562@item -fdbg-cnt=@var{counter-value-list}
16563@opindex fdbg-cnt
16564Set the internal debug counter lower and upper bound.  @var{counter-value-list}
16565is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16566[:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16567the name of the counter and list of closed intervals.
16568The @var{lower_bound} is optional and is zero
16569initialized if not set.
16570For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16571@code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16572eleventh invocation.
16573For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16574
16575@item -print-file-name=@var{library}
16576@opindex print-file-name
16577Print the full absolute name of the library file @var{library} that
16578would be used when linking---and don't do anything else.  With this
16579option, GCC does not compile or link anything; it just prints the
16580file name.
16581
16582@item -print-multi-directory
16583@opindex print-multi-directory
16584Print the directory name corresponding to the multilib selected by any
16585other switches present in the command line.  This directory is supposed
16586to exist in @env{GCC_EXEC_PREFIX}.
16587
16588@item -print-multi-lib
16589@opindex print-multi-lib
16590Print the mapping from multilib directory names to compiler switches
16591that enable them.  The directory name is separated from the switches by
16592@samp{;}, and each switch starts with an @samp{@@} instead of the
16593@samp{-}, without spaces between multiple switches.  This is supposed to
16594ease shell processing.
16595
16596@item -print-multi-os-directory
16597@opindex print-multi-os-directory
16598Print the path to OS libraries for the selected
16599multilib, relative to some @file{lib} subdirectory.  If OS libraries are
16600present in the @file{lib} subdirectory and no multilibs are used, this is
16601usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16602sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16603@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16604subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16605
16606@item -print-multiarch
16607@opindex print-multiarch
16608Print the path to OS libraries for the selected multiarch,
16609relative to some @file{lib} subdirectory.
16610
16611@item -print-prog-name=@var{program}
16612@opindex print-prog-name
16613Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16614
16615@item -print-libgcc-file-name
16616@opindex print-libgcc-file-name
16617Same as @option{-print-file-name=libgcc.a}.
16618
16619This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16620but you do want to link with @file{libgcc.a}.  You can do:
16621
16622@smallexample
16623gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16624@end smallexample
16625
16626@item -print-search-dirs
16627@opindex print-search-dirs
16628Print the name of the configured installation directory and a list of
16629program and library directories @command{gcc} searches---and don't do anything else.
16630
16631This is useful when @command{gcc} prints the error message
16632@samp{installation problem, cannot exec cpp0: No such file or directory}.
16633To resolve this you either need to put @file{cpp0} and the other compiler
16634components where @command{gcc} expects to find them, or you can set the environment
16635variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16636Don't forget the trailing @samp{/}.
16637@xref{Environment Variables}.
16638
16639@item -print-sysroot
16640@opindex print-sysroot
16641Print the target sysroot directory that is used during
16642compilation.  This is the target sysroot specified either at configure
16643time or using the @option{--sysroot} option, possibly with an extra
16644suffix that depends on compilation options.  If no target sysroot is
16645specified, the option prints nothing.
16646
16647@item -print-sysroot-headers-suffix
16648@opindex print-sysroot-headers-suffix
16649Print the suffix added to the target sysroot when searching for
16650headers, or give an error if the compiler is not configured with such
16651a suffix---and don't do anything else.
16652
16653@item -dumpmachine
16654@opindex dumpmachine
16655Print the compiler's target machine (for example,
16656@samp{i686-pc-linux-gnu})---and don't do anything else.
16657
16658@item -dumpversion
16659@opindex dumpversion
16660Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16661anything else.  This is the compiler version used in filesystem paths and
16662specs. Depending on how the compiler has been configured it can be just
16663a single number (major version), two numbers separated by a dot (major and
16664minor version) or three numbers separated by dots (major, minor and patchlevel
16665version).
16666
16667@item -dumpfullversion
16668@opindex dumpfullversion
16669Print the full compiler version---and don't do anything else. The output is
16670always three numbers separated by dots, major, minor and patchlevel version.
16671
16672@item -dumpspecs
16673@opindex dumpspecs
16674Print the compiler's built-in specs---and don't do anything else.  (This
16675is used when GCC itself is being built.)  @xref{Spec Files}.
16676@end table
16677
16678@node Submodel Options
16679@section Machine-Dependent Options
16680@cindex submodel options
16681@cindex specifying hardware config
16682@cindex hardware models and configurations, specifying
16683@cindex target-dependent options
16684@cindex machine-dependent options
16685
16686Each target machine supported by GCC can have its own options---for
16687example, to allow you to compile for a particular processor variant or
16688ABI, or to control optimizations specific to that machine.  By
16689convention, the names of machine-specific options start with
16690@samp{-m}.
16691
16692Some configurations of the compiler also support additional target-specific
16693options, usually for compatibility with other compilers on the same
16694platform.
16695
16696@c This list is ordered alphanumerically by subsection name.
16697@c It should be the same order and spelling as these options are listed
16698@c in Machine Dependent Options
16699
16700@menu
16701* AArch64 Options::
16702* Adapteva Epiphany Options::
16703* AMD GCN Options::
16704* ARC Options::
16705* ARM Options::
16706* AVR Options::
16707* Blackfin Options::
16708* C6X Options::
16709* CRIS Options::
16710* CR16 Options::
16711* C-SKY Options::
16712* Darwin Options::
16713* DEC Alpha Options::
16714* eBPF Options::
16715* FR30 Options::
16716* FT32 Options::
16717* FRV Options::
16718* GNU/Linux Options::
16719* H8/300 Options::
16720* HPPA Options::
16721* IA-64 Options::
16722* LM32 Options::
16723* M32C Options::
16724* M32R/D Options::
16725* M680x0 Options::
16726* MCore Options::
16727* MeP Options::
16728* MicroBlaze Options::
16729* MIPS Options::
16730* MMIX Options::
16731* MN10300 Options::
16732* Moxie Options::
16733* MSP430 Options::
16734* NDS32 Options::
16735* Nios II Options::
16736* Nvidia PTX Options::
16737* OpenRISC Options::
16738* PDP-11 Options::
16739* picoChip Options::
16740* PowerPC Options::
16741* PRU Options::
16742* RISC-V Options::
16743* RL78 Options::
16744* RS/6000 and PowerPC Options::
16745* RX Options::
16746* S/390 and zSeries Options::
16747* Score Options::
16748* SH Options::
16749* Solaris 2 Options::
16750* SPARC Options::
16751* System V Options::
16752* TILE-Gx Options::
16753* TILEPro Options::
16754* V850 Options::
16755* VAX Options::
16756* Visium Options::
16757* VMS Options::
16758* VxWorks Options::
16759* x86 Options::
16760* x86 Windows Options::
16761* Xstormy16 Options::
16762* Xtensa Options::
16763* zSeries Options::
16764@end menu
16765
16766@node AArch64 Options
16767@subsection AArch64 Options
16768@cindex AArch64 Options
16769
16770These options are defined for AArch64 implementations:
16771
16772@table @gcctabopt
16773
16774@item -mabi=@var{name}
16775@opindex mabi
16776Generate code for the specified data model.  Permissible values
16777are @samp{ilp32} for SysV-like data model where int, long int and pointers
16778are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
16779but long int and pointers are 64 bits.
16780
16781The default depends on the specific target configuration.  Note that
16782the LP64 and ILP32 ABIs are not link-compatible; you must compile your
16783entire program with the same ABI, and link with a compatible set of libraries.
16784
16785@item -mbig-endian
16786@opindex mbig-endian
16787Generate big-endian code.  This is the default when GCC is configured for an
16788@samp{aarch64_be-*-*} target.
16789
16790@item -mgeneral-regs-only
16791@opindex mgeneral-regs-only
16792Generate code which uses only the general-purpose registers.  This will prevent
16793the compiler from using floating-point and Advanced SIMD registers but will not
16794impose any restrictions on the assembler.
16795
16796@item -mlittle-endian
16797@opindex mlittle-endian
16798Generate little-endian code.  This is the default when GCC is configured for an
16799@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
16800
16801@item -mcmodel=tiny
16802@opindex mcmodel=tiny
16803Generate code for the tiny code model.  The program and its statically defined
16804symbols must be within 1MB of each other.  Programs can be statically or
16805dynamically linked.
16806
16807@item -mcmodel=small
16808@opindex mcmodel=small
16809Generate code for the small code model.  The program and its statically defined
16810symbols must be within 4GB of each other.  Programs can be statically or
16811dynamically linked.  This is the default code model.
16812
16813@item -mcmodel=large
16814@opindex mcmodel=large
16815Generate code for the large code model.  This makes no assumptions about
16816addresses and sizes of sections.  Programs can be statically linked only.  The
16817@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
16818@option{-fpic} and @option{-fPIC}.
16819
16820@item -mstrict-align
16821@itemx -mno-strict-align
16822@opindex mstrict-align
16823@opindex mno-strict-align
16824Avoid or allow generating memory accesses that may not be aligned on a natural
16825object boundary as described in the architecture specification.
16826
16827@item -momit-leaf-frame-pointer
16828@itemx -mno-omit-leaf-frame-pointer
16829@opindex momit-leaf-frame-pointer
16830@opindex mno-omit-leaf-frame-pointer
16831Omit or keep the frame pointer in leaf functions.  The former behavior is the
16832default.
16833
16834@item -mstack-protector-guard=@var{guard}
16835@itemx -mstack-protector-guard-reg=@var{reg}
16836@itemx -mstack-protector-guard-offset=@var{offset}
16837@opindex mstack-protector-guard
16838@opindex mstack-protector-guard-reg
16839@opindex mstack-protector-guard-offset
16840Generate stack protection code using canary at @var{guard}.  Supported
16841locations are @samp{global} for a global canary or @samp{sysreg} for a
16842canary in an appropriate system register.
16843
16844With the latter choice the options
16845@option{-mstack-protector-guard-reg=@var{reg}} and
16846@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16847which system register to use as base register for reading the canary,
16848and from what offset from that base register. There is no default
16849register or offset as this is entirely for use within the Linux
16850kernel.
16851
16852@item -mstack-protector-guard=@var{guard}
16853@itemx -mstack-protector-guard-reg=@var{reg}
16854@itemx -mstack-protector-guard-offset=@var{offset}
16855@opindex mstack-protector-guard
16856@opindex mstack-protector-guard-reg
16857@opindex mstack-protector-guard-offset
16858Generate stack protection code using canary at @var{guard}.  Supported
16859locations are @samp{global} for a global canary or @samp{sysreg} for a
16860canary in an appropriate system register.
16861
16862With the latter choice the options
16863@option{-mstack-protector-guard-reg=@var{reg}} and
16864@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16865which system register to use as base register for reading the canary,
16866and from what offset from that base register. There is no default
16867register or offset as this is entirely for use within the Linux
16868kernel.
16869
16870@item -mtls-dialect=desc
16871@opindex mtls-dialect=desc
16872Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
16873of TLS variables.  This is the default.
16874
16875@item -mtls-dialect=traditional
16876@opindex mtls-dialect=traditional
16877Use traditional TLS as the thread-local storage mechanism for dynamic accesses
16878of TLS variables.
16879
16880@item -mtls-size=@var{size}
16881@opindex mtls-size
16882Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
16883This option requires binutils 2.26 or newer.
16884
16885@item -mfix-cortex-a53-835769
16886@itemx -mno-fix-cortex-a53-835769
16887@opindex mfix-cortex-a53-835769
16888@opindex mno-fix-cortex-a53-835769
16889Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
16890This involves inserting a NOP instruction between memory instructions and
1689164-bit integer multiply-accumulate instructions.
16892
16893@item -mfix-cortex-a53-843419
16894@itemx -mno-fix-cortex-a53-843419
16895@opindex mfix-cortex-a53-843419
16896@opindex mno-fix-cortex-a53-843419
16897Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
16898This erratum workaround is made at link time and this will only pass the
16899corresponding flag to the linker.
16900
16901@item -mlow-precision-recip-sqrt
16902@itemx -mno-low-precision-recip-sqrt
16903@opindex mlow-precision-recip-sqrt
16904@opindex mno-low-precision-recip-sqrt
16905Enable or disable the reciprocal square root approximation.
16906This option only has an effect if @option{-ffast-math} or
16907@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16908precision of reciprocal square root results to about 16 bits for
16909single precision and to 32 bits for double precision.
16910
16911@item -mlow-precision-sqrt
16912@itemx -mno-low-precision-sqrt
16913@opindex mlow-precision-sqrt
16914@opindex mno-low-precision-sqrt
16915Enable or disable the square root approximation.
16916This option only has an effect if @option{-ffast-math} or
16917@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16918precision of square root results to about 16 bits for
16919single precision and to 32 bits for double precision.
16920If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16921
16922@item -mlow-precision-div
16923@itemx -mno-low-precision-div
16924@opindex mlow-precision-div
16925@opindex mno-low-precision-div
16926Enable or disable the division approximation.
16927This option only has an effect if @option{-ffast-math} or
16928@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16929precision of division results to about 16 bits for
16930single precision and to 32 bits for double precision.
16931
16932@item -mtrack-speculation
16933@itemx -mno-track-speculation
16934Enable or disable generation of additional code to track speculative
16935execution through conditional branches.  The tracking state can then
16936be used by the compiler when expanding calls to
16937@code{__builtin_speculation_safe_copy} to permit a more efficient code
16938sequence to be generated.
16939
16940@item -moutline-atomics
16941@itemx -mno-outline-atomics
16942Enable or disable calls to out-of-line helpers to implement atomic operations.
16943These helpers will, at runtime, determine if the LSE instructions from
16944ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16945instructions that are present in the base ARMv8.0 ISA.
16946
16947This option is only applicable when compiling for the base ARMv8.0
16948instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
16949or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16950used directly.  The same applies when using @option{-mcpu=} when the
16951selected cpu supports the @samp{lse} feature.
16952This option is on by default.
16953
16954@item -march=@var{name}
16955@opindex march
16956Specify the name of the target architecture and, optionally, one or
16957more feature modifiers.  This option has the form
16958@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16959
16960The table below summarizes the permissible values for @var{arch}
16961and the features that they enable by default:
16962
16963@multitable @columnfractions 0.20 0.20 0.60
16964@headitem @var{arch} value @tab Architecture @tab Includes by default
16965@item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
16966@item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
16967@item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
16968@item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
16969@item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
16970@item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
16971@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
16972@end multitable
16973
16974The value @samp{native} is available on native AArch64 GNU/Linux and
16975causes the compiler to pick the architecture of the host system.  This
16976option has no effect if the compiler is unable to recognize the
16977architecture of the host system,
16978
16979The permissible values for @var{feature} are listed in the sub-section
16980on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16981Feature Modifiers}.  Where conflicting feature modifiers are
16982specified, the right-most feature is used.
16983
16984GCC uses @var{name} to determine what kind of instructions it can emit
16985when generating assembly code.  If @option{-march} is specified
16986without either of @option{-mtune} or @option{-mcpu} also being
16987specified, the code is tuned to perform well across a range of target
16988processors implementing the target architecture.
16989
16990@item -mtune=@var{name}
16991@opindex mtune
16992Specify the name of the target processor for which GCC should tune the
16993performance of the code.  Permissible values for this option are:
16994@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16995@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16996@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16997@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16998@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16999@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2},
17000@samp{neoverse-v1}, @samp{neoverse-512tvb}, @samp{qdf24xx},
17001@samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
17002@samp{octeontx81},  @samp{octeontx83},
17003@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
17004@samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
17005@samp{octeontx2f95mm},
17006@samp{a64fx},
17007@samp{thunderx}, @samp{thunderxt88},
17008@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
17009@samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
17010@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17011@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17012@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
17013@samp{native}.
17014
17015The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17016@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17017@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
17018should tune for a big.LITTLE system.
17019
17020The value @samp{neoverse-512tvb} specifies that GCC should tune
17021for Neoverse cores that (a) implement SVE and (b) have a total vector
17022bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
17023tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
17024instructions a cycle and that can execute an equivalent number of SVE
17025arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
17026This is more general than tuning for a specific core like Neoverse V1
17027but is more specific than the default tuning described below.
17028
17029Additionally on native AArch64 GNU/Linux systems the value
17030@samp{native} tunes performance to the host system.  This option has no effect
17031if the compiler is unable to recognize the processor of the host system.
17032
17033Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
17034are specified, the code is tuned to perform well across a range
17035of target processors.
17036
17037This option cannot be suffixed by feature modifiers.
17038
17039@item -mcpu=@var{name}
17040@opindex mcpu
17041Specify the name of the target processor, optionally suffixed by one
17042or more feature modifiers.  This option has the form
17043@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
17044the permissible values for @var{cpu} are the same as those available
17045for @option{-mtune}.  The permissible values for @var{feature} are
17046documented in the sub-section on
17047@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17048Feature Modifiers}.  Where conflicting feature modifiers are
17049specified, the right-most feature is used.
17050
17051GCC uses @var{name} to determine what kind of instructions it can emit when
17052generating assembly code (as if by @option{-march}) and to determine
17053the target processor for which to tune for performance (as if
17054by @option{-mtune}).  Where this option is used in conjunction
17055with @option{-march} or @option{-mtune}, those options take precedence
17056over the appropriate part of this option.
17057
17058@option{-mcpu=neoverse-512tvb} is special in that it does not refer
17059to a specific core, but instead refers to all Neoverse cores that
17060(a) implement SVE and (b) have a total vector bandwidth of 512 bits
17061a cycle.  Unless overridden by @option{-march},
17062@option{-mcpu=neoverse-512tvb} generates code that can run on a
17063Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
17064these properties.  Unless overridden by @option{-mtune},
17065@option{-mcpu=neoverse-512tvb} tunes code in the same way as for
17066@option{-mtune=neoverse-512tvb}.
17067
17068@item -moverride=@var{string}
17069@opindex moverride
17070Override tuning decisions made by the back-end in response to a
17071@option{-mtune=} switch.  The syntax, semantics, and accepted values
17072for @var{string} in this option are not guaranteed to be consistent
17073across releases.
17074
17075This option is only intended to be useful when developing GCC.
17076
17077@item -mverbose-cost-dump
17078@opindex mverbose-cost-dump
17079Enable verbose cost model dumping in the debug dump files.  This option is
17080provided for use in debugging the compiler.
17081
17082@item -mpc-relative-literal-loads
17083@itemx -mno-pc-relative-literal-loads
17084@opindex mpc-relative-literal-loads
17085@opindex mno-pc-relative-literal-loads
17086Enable or disable PC-relative literal loads.  With this option literal pools are
17087accessed using a single instruction and emitted after each function.  This
17088limits the maximum size of functions to 1MB.  This is enabled by default for
17089@option{-mcmodel=tiny}.
17090
17091@item -msign-return-address=@var{scope}
17092@opindex msign-return-address
17093Select the function scope on which return address signing will be applied.
17094Permissible values are @samp{none}, which disables return address signing,
17095@samp{non-leaf}, which enables pointer signing for functions which are not leaf
17096functions, and @samp{all}, which enables pointer signing for all functions.  The
17097default value is @samp{none}. This option has been deprecated by
17098-mbranch-protection.
17099
17100@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
17101@opindex mbranch-protection
17102Select the branch protection features to use.
17103@samp{none} is the default and turns off all types of branch protection.
17104@samp{standard} turns on all types of branch protection features.  If a feature
17105has additional tuning options, then @samp{standard} sets it to its standard
17106level.
17107@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
17108level: signing functions that save the return address to memory (non-leaf
17109functions will practically always do this) using the a-key.  The optional
17110argument @samp{leaf} can be used to extend the signing to include leaf
17111functions.  The optional argument @samp{b-key} can be used to sign the functions
17112with the B-key instead of the A-key.
17113@samp{bti} turns on branch target identification mechanism.
17114
17115@item -mharden-sls=@var{opts}
17116@opindex mharden-sls
17117Enable compiler hardening against straight line speculation (SLS).
17118@var{opts} is a comma-separated list of the following options:
17119@table @samp
17120@item retbr
17121@item blr
17122@end table
17123In addition, @samp{-mharden-sls=all} enables all SLS hardening while
17124@samp{-mharden-sls=none} disables all SLS hardening.
17125
17126@item -msve-vector-bits=@var{bits}
17127@opindex msve-vector-bits
17128Specify the number of bits in an SVE vector register.  This option only has
17129an effect when SVE is enabled.
17130
17131GCC supports two forms of SVE code generation: ``vector-length
17132agnostic'' output that works with any size of vector register and
17133``vector-length specific'' output that allows GCC to make assumptions
17134about the vector length when it is useful for optimization reasons.
17135The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17136@samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17137Specifying @samp{scalable} selects vector-length agnostic
17138output.  At present @samp{-msve-vector-bits=128} also generates vector-length
17139agnostic output for big-endian targets.  All other values generate
17140vector-length specific code.  The behavior of these values may change
17141in future releases and no value except @samp{scalable} should be
17142relied on for producing code that is portable across different
17143hardware SVE vector lengths.
17144
17145The default is @samp{-msve-vector-bits=scalable}, which produces
17146vector-length agnostic code.
17147@end table
17148
17149@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17150@anchor{aarch64-feature-modifiers}
17151@cindex @option{-march} feature modifiers
17152@cindex @option{-mcpu} feature modifiers
17153Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17154the following and their inverses @option{no@var{feature}}:
17155
17156@table @samp
17157@item crc
17158Enable CRC extension.  This is on by default for
17159@option{-march=armv8.1-a}.
17160@item crypto
17161Enable Crypto extension.  This also enables Advanced SIMD and floating-point
17162instructions.
17163@item fp
17164Enable floating-point instructions.  This is on by default for all possible
17165values for options @option{-march} and @option{-mcpu}.
17166@item simd
17167Enable Advanced SIMD instructions.  This also enables floating-point
17168instructions.  This is on by default for all possible values for options
17169@option{-march} and @option{-mcpu}.
17170@item sve
17171Enable Scalable Vector Extension instructions.  This also enables Advanced
17172SIMD and floating-point instructions.
17173@item lse
17174Enable Large System Extension instructions.  This is on by default for
17175@option{-march=armv8.1-a}.
17176@item rdma
17177Enable Round Double Multiply Accumulate instructions.  This is on by default
17178for @option{-march=armv8.1-a}.
17179@item fp16
17180Enable FP16 extension.  This also enables floating-point instructions.
17181@item fp16fml
17182Enable FP16 fmla extension.  This also enables FP16 extensions and
17183floating-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.
17184
17185@item rcpc
17186Enable the RcPc extension.  This does not change code generation from GCC,
17187but is passed on to the assembler, enabling inline asm statements to use
17188instructions from the RcPc extension.
17189@item dotprod
17190Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
17191@item aes
17192Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
17193SIMD instructions.
17194@item sha2
17195Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
17196@item sha3
17197Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
17198instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17199@item sm4
17200Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
17201Use of this option with architectures prior to Armv8.2-A is not supported.
17202@item profile
17203Enable the Statistical Profiling extension.  This option is only to enable the
17204extension at the assembler level and does not affect code generation.
17205@item rng
17206Enable the Armv8.5-a Random Number instructions.  This option is only to
17207enable the extension at the assembler level and does not affect code
17208generation.
17209@item memtag
17210Enable the Armv8.5-a Memory Tagging Extensions.
17211Use of this option with architectures prior to Armv8.5-A is not supported.
17212@item sb
17213Enable the Armv8-a Speculation Barrier instruction.  This option is only to
17214enable the extension at the assembler level and does not affect code
17215generation.  This option is enabled by default for @option{-march=armv8.5-a}.
17216@item ssbs
17217Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
17218is only to enable the extension at the assembler level and does not affect code
17219generation.  This option is enabled by default for @option{-march=armv8.5-a}.
17220@item predres
17221Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17222This option is only to enable the extension at the assembler level and does
17223not affect code generation.  This option is enabled by default for
17224@option{-march=armv8.5-a}.
17225@item sve2
17226Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
17227instructions.
17228@item sve2-bitperm
17229Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
17230@item sve2-sm4
17231Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
17232@item sve2-aes
17233Enable SVE2 aes instructions.  This also enables SVE2 instructions.
17234@item sve2-sha3
17235Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
17236@item tme
17237Enable the Transactional Memory Extension.
17238@item i8mm
17239Enable 8-bit Integer Matrix Multiply instructions.  This also enables
17240Advanced SIMD and floating-point instructions.  This option is enabled by
17241default for @option{-march=armv8.6-a}.  Use of this option with architectures
17242prior to Armv8.2-A is not supported.
17243@item f32mm
17244Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
17245SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
17246not supported.
17247@item f64mm
17248Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
17249SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
17250not supported.
17251@item bf16
17252Enable brain half-precision floating-point instructions.  This also enables
17253Advanced SIMD and floating-point instructions.  This option is enabled by
17254default for @option{-march=armv8.6-a}.  Use of this option with architectures
17255prior to Armv8.2-A is not supported.
17256
17257@end table
17258
17259Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17260which implies @option{fp}.
17261Conversely, @option{nofp} implies @option{nosimd}, which implies
17262@option{nocrypto}, @option{noaes} and @option{nosha2}.
17263
17264@node Adapteva Epiphany Options
17265@subsection Adapteva Epiphany Options
17266
17267These @samp{-m} options are defined for Adapteva Epiphany:
17268
17269@table @gcctabopt
17270@item -mhalf-reg-file
17271@opindex mhalf-reg-file
17272Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17273That allows code to run on hardware variants that lack these registers.
17274
17275@item -mprefer-short-insn-regs
17276@opindex mprefer-short-insn-regs
17277Preferentially allocate registers that allow short instruction generation.
17278This can result in increased instruction count, so this may either reduce or
17279increase overall code size.
17280
17281@item -mbranch-cost=@var{num}
17282@opindex mbranch-cost
17283Set the cost of branches to roughly @var{num} ``simple'' instructions.
17284This cost is only a heuristic and is not guaranteed to produce
17285consistent results across releases.
17286
17287@item -mcmove
17288@opindex mcmove
17289Enable the generation of conditional moves.
17290
17291@item -mnops=@var{num}
17292@opindex mnops
17293Emit @var{num} NOPs before every other generated instruction.
17294
17295@item -mno-soft-cmpsf
17296@opindex mno-soft-cmpsf
17297@opindex msoft-cmpsf
17298For single-precision floating-point comparisons, emit an @code{fsub} instruction
17299and test the flags.  This is faster than a software comparison, but can
17300get incorrect results in the presence of NaNs, or when two different small
17301numbers are compared such that their difference is calculated as zero.
17302The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17303software comparisons.
17304
17305@item -mstack-offset=@var{num}
17306@opindex mstack-offset
17307Set the offset between the top of the stack and the stack pointer.
17308E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17309can be used by leaf functions without stack allocation.
17310Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17311Note also that this option changes the ABI; compiling a program with a
17312different stack offset than the libraries have been compiled with
17313generally does not work.
17314This option can be useful if you want to evaluate if a different stack
17315offset would give you better code, but to actually use a different stack
17316offset to build working programs, it is recommended to configure the
17317toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17318
17319@item -mno-round-nearest
17320@opindex mno-round-nearest
17321@opindex mround-nearest
17322Make the scheduler assume that the rounding mode has been set to
17323truncating.  The default is @option{-mround-nearest}.
17324
17325@item -mlong-calls
17326@opindex mlong-calls
17327If not otherwise specified by an attribute, assume all calls might be beyond
17328the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17329function address into a register before performing a (otherwise direct) call.
17330This is the default.
17331
17332@item -mshort-calls
17333@opindex short-calls
17334If not otherwise specified by an attribute, assume all direct calls are
17335in the range of the @code{b} / @code{bl} instructions, so use these instructions
17336for direct calls.  The default is @option{-mlong-calls}.
17337
17338@item -msmall16
17339@opindex msmall16
17340Assume addresses can be loaded as 16-bit unsigned values.  This does not
17341apply to function addresses for which @option{-mlong-calls} semantics
17342are in effect.
17343
17344@item -mfp-mode=@var{mode}
17345@opindex mfp-mode
17346Set the prevailing mode of the floating-point unit.
17347This determines the floating-point mode that is provided and expected
17348at function call and return time.  Making this mode match the mode you
17349predominantly need at function start can make your programs smaller and
17350faster by avoiding unnecessary mode switches.
17351
17352@var{mode} can be set to one the following values:
17353
17354@table @samp
17355@item caller
17356Any mode at function entry is valid, and retained or restored when
17357the function returns, and when it calls other functions.
17358This mode is useful for compiling libraries or other compilation units
17359you might want to incorporate into different programs with different
17360prevailing FPU modes, and the convenience of being able to use a single
17361object file outweighs the size and speed overhead for any extra
17362mode switching that might be needed, compared with what would be needed
17363with a more specific choice of prevailing FPU mode.
17364
17365@item truncate
17366This is the mode used for floating-point calculations with
17367truncating (i.e.@: round towards zero) rounding mode.  That includes
17368conversion from floating point to integer.
17369
17370@item round-nearest
17371This is the mode used for floating-point calculations with
17372round-to-nearest-or-even rounding mode.
17373
17374@item int
17375This is the mode used to perform integer calculations in the FPU, e.g.@:
17376integer multiply, or integer multiply-and-accumulate.
17377@end table
17378
17379The default is @option{-mfp-mode=caller}
17380
17381@item -mno-split-lohi
17382@itemx -mno-postinc
17383@itemx -mno-postmodify
17384@opindex mno-split-lohi
17385@opindex msplit-lohi
17386@opindex mno-postinc
17387@opindex mpostinc
17388@opindex mno-postmodify
17389@opindex mpostmodify
17390Code generation tweaks that disable, respectively, splitting of 32-bit
17391loads, generation of post-increment addresses, and generation of
17392post-modify addresses.  The defaults are @option{msplit-lohi},
17393@option{-mpost-inc}, and @option{-mpost-modify}.
17394
17395@item -mnovect-double
17396@opindex mno-vect-double
17397@opindex mvect-double
17398Change the preferred SIMD mode to SImode.  The default is
17399@option{-mvect-double}, which uses DImode as preferred SIMD mode.
17400
17401@item -max-vect-align=@var{num}
17402@opindex max-vect-align
17403The maximum alignment for SIMD vector mode types.
17404@var{num} may be 4 or 8.  The default is 8.
17405Note that this is an ABI change, even though many library function
17406interfaces are unaffected if they don't use SIMD vector modes
17407in places that affect size and/or alignment of relevant types.
17408
17409@item -msplit-vecmove-early
17410@opindex msplit-vecmove-early
17411Split vector moves into single word moves before reload.  In theory this
17412can give better register allocation, but so far the reverse seems to be
17413generally the case.
17414
17415@item -m1reg-@var{reg}
17416@opindex m1reg-
17417Specify a register to hold the constant @minus{}1, which makes loading small negative
17418constants and certain bitmasks faster.
17419Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17420which specify use of that register as a fixed register,
17421and @samp{none}, which means that no register is used for this
17422purpose.  The default is @option{-m1reg-none}.
17423
17424@end table
17425
17426@node AMD GCN Options
17427@subsection AMD GCN Options
17428@cindex AMD GCN Options
17429
17430These options are defined specifically for the AMD GCN port.
17431
17432@table @gcctabopt
17433
17434@item -march=@var{gpu}
17435@opindex march
17436@itemx -mtune=@var{gpu}
17437@opindex mtune
17438Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17439are
17440
17441@table @samp
17442@opindex fiji
17443@item fiji
17444Compile for GCN3 Fiji devices (gfx803).
17445
17446@item gfx900
17447Compile for GCN5 Vega 10 devices (gfx900).
17448
17449@item gfx906
17450Compile for GCN5 Vega 20 devices (gfx906).
17451
17452@end table
17453
17454@item -mstack-size=@var{bytes}
17455@opindex mstack-size
17456Specify how many @var{bytes} of stack space will be requested for each GPU
17457thread (wave-front).  Beware that there may be many threads and limited memory
17458available.  The size of the stack allocation may also have an impact on
17459run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
174601MB otherwise.
17461
17462@end table
17463
17464@node ARC Options
17465@subsection ARC Options
17466@cindex ARC options
17467
17468The following options control the architecture variant for which code
17469is being compiled:
17470
17471@c architecture variants
17472@table @gcctabopt
17473
17474@item -mbarrel-shifter
17475@opindex mbarrel-shifter
17476Generate instructions supported by barrel shifter.  This is the default
17477unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17478
17479@item -mjli-always
17480@opindex mjli-alawys
17481Force to call a function using jli_s instruction.  This option is
17482valid only for ARCv2 architecture.
17483
17484@item -mcpu=@var{cpu}
17485@opindex mcpu
17486Set architecture type, register usage, and instruction scheduling
17487parameters for @var{cpu}.  There are also shortcut alias options
17488available for backward compatibility and convenience.  Supported
17489values for @var{cpu} are
17490
17491@table @samp
17492@opindex mA6
17493@opindex mARC600
17494@item arc600
17495Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
17496
17497@item arc601
17498@opindex mARC601
17499Compile for ARC601.  Alias: @option{-mARC601}.
17500
17501@item arc700
17502@opindex mA7
17503@opindex mARC700
17504Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
17505This is the default when configured with @option{--with-cpu=arc700}@.
17506
17507@item arcem
17508Compile for ARC EM.
17509
17510@item archs
17511Compile for ARC HS.
17512
17513@item em
17514Compile for ARC EM CPU with no hardware extensions.
17515
17516@item em4
17517Compile for ARC EM4 CPU.
17518
17519@item em4_dmips
17520Compile for ARC EM4 DMIPS CPU.
17521
17522@item em4_fpus
17523Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17524extension.
17525
17526@item em4_fpuda
17527Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17528double assist instructions.
17529
17530@item hs
17531Compile for ARC HS CPU with no hardware extensions except the atomic
17532instructions.
17533
17534@item hs34
17535Compile for ARC HS34 CPU.
17536
17537@item hs38
17538Compile for ARC HS38 CPU.
17539
17540@item hs38_linux
17541Compile for ARC HS38 CPU with all hardware extensions on.
17542
17543@item arc600_norm
17544Compile for ARC 600 CPU with @code{norm} instructions enabled.
17545
17546@item arc600_mul32x16
17547Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17548instructions enabled.
17549
17550@item arc600_mul64
17551Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17552instructions enabled.
17553
17554@item arc601_norm
17555Compile for ARC 601 CPU with @code{norm} instructions enabled.
17556
17557@item arc601_mul32x16
17558Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17559instructions enabled.
17560
17561@item arc601_mul64
17562Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17563instructions enabled.
17564
17565@item nps400
17566Compile for ARC 700 on NPS400 chip.
17567
17568@item em_mini
17569Compile for ARC EM minimalist configuration featuring reduced register
17570set.
17571
17572@end table
17573
17574@item -mdpfp
17575@opindex mdpfp
17576@itemx -mdpfp-compact
17577@opindex mdpfp-compact
17578Generate double-precision FPX instructions, tuned for the compact
17579implementation.
17580
17581@item -mdpfp-fast
17582@opindex mdpfp-fast
17583Generate double-precision FPX instructions, tuned for the fast
17584implementation.
17585
17586@item -mno-dpfp-lrsr
17587@opindex mno-dpfp-lrsr
17588Disable @code{lr} and @code{sr} instructions from using FPX extension
17589aux registers.
17590
17591@item -mea
17592@opindex mea
17593Generate extended arithmetic instructions.  Currently only
17594@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17595supported.  Only valid for @option{-mcpu=ARC700}.
17596
17597@item -mno-mpy
17598@opindex mno-mpy
17599@opindex mmpy
17600Do not generate @code{mpy}-family instructions for ARC700.  This option is
17601deprecated.
17602
17603@item -mmul32x16
17604@opindex mmul32x16
17605Generate 32x16-bit multiply and multiply-accumulate instructions.
17606
17607@item -mmul64
17608@opindex mmul64
17609Generate @code{mul64} and @code{mulu64} instructions.
17610Only valid for @option{-mcpu=ARC600}.
17611
17612@item -mnorm
17613@opindex mnorm
17614Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
17615is in effect.
17616
17617@item -mspfp
17618@opindex mspfp
17619@itemx -mspfp-compact
17620@opindex mspfp-compact
17621Generate single-precision FPX instructions, tuned for the compact
17622implementation.
17623
17624@item -mspfp-fast
17625@opindex mspfp-fast
17626Generate single-precision FPX instructions, tuned for the fast
17627implementation.
17628
17629@item -msimd
17630@opindex msimd
17631Enable generation of ARC SIMD instructions via target-specific
17632builtins.  Only valid for @option{-mcpu=ARC700}.
17633
17634@item -msoft-float
17635@opindex msoft-float
17636This option ignored; it is provided for compatibility purposes only.
17637Software floating-point code is emitted by default, and this default
17638can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17639@option{-mspfp-fast} for single precision, and @option{-mdpfp},
17640@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17641
17642@item -mswap
17643@opindex mswap
17644Generate @code{swap} instructions.
17645
17646@item -matomic
17647@opindex matomic
17648This enables use of the locked load/store conditional extension to implement
17649atomic memory built-in functions.  Not available for ARC 6xx or ARC
17650EM cores.
17651
17652@item -mdiv-rem
17653@opindex mdiv-rem
17654Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17655
17656@item -mcode-density
17657@opindex mcode-density
17658Enable code density instructions for ARC EM.
17659This option is on by default for ARC HS.
17660
17661@item -mll64
17662@opindex mll64
17663Enable double load/store operations for ARC HS cores.
17664
17665@item -mtp-regno=@var{regno}
17666@opindex mtp-regno
17667Specify thread pointer register number.
17668
17669@item -mmpy-option=@var{multo}
17670@opindex mmpy-option
17671Compile ARCv2 code with a multiplier design option.  You can specify
17672the option using either a string or numeric value for @var{multo}.
17673@samp{wlh1} is the default value.  The recognized values are:
17674
17675@table @samp
17676@item 0
17677@itemx none
17678No multiplier available.
17679
17680@item 1
17681@itemx w
1768216x16 multiplier, fully pipelined.
17683The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17684
17685@item 2
17686@itemx wlh1
1768732x32 multiplier, fully
17688pipelined (1 stage).  The following instructions are additionally
17689enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17690
17691@item 3
17692@itemx wlh2
1769332x32 multiplier, fully pipelined
17694(2 stages).  The following instructions are additionally enabled: @code{mpy},
17695@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17696
17697@item 4
17698@itemx wlh3
17699Two 16x16 multipliers, blocking,
17700sequential.  The following instructions are additionally enabled: @code{mpy},
17701@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17702
17703@item 5
17704@itemx wlh4
17705One 16x16 multiplier, blocking,
17706sequential.  The following instructions are additionally enabled: @code{mpy},
17707@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17708
17709@item 6
17710@itemx wlh5
17711One 32x4 multiplier, blocking,
17712sequential.  The following instructions are additionally enabled: @code{mpy},
17713@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17714
17715@item 7
17716@itemx plus_dmpy
17717ARC HS SIMD support.
17718
17719@item 8
17720@itemx plus_macd
17721ARC HS SIMD support.
17722
17723@item 9
17724@itemx plus_qmacw
17725ARC HS SIMD support.
17726
17727@end table
17728
17729This option is only available for ARCv2 cores@.
17730
17731@item -mfpu=@var{fpu}
17732@opindex mfpu
17733Enables support for specific floating-point hardware extensions for ARCv2
17734cores.  Supported values for @var{fpu} are:
17735
17736@table @samp
17737
17738@item fpus
17739Enables support for single-precision floating-point hardware
17740extensions@.
17741
17742@item fpud
17743Enables support for double-precision floating-point hardware
17744extensions.  The single-precision floating-point extension is also
17745enabled.  Not available for ARC EM@.
17746
17747@item fpuda
17748Enables support for double-precision floating-point hardware
17749extensions using double-precision assist instructions.  The single-precision
17750floating-point extension is also enabled.  This option is
17751only available for ARC EM@.
17752
17753@item fpuda_div
17754Enables support for double-precision floating-point hardware
17755extensions using double-precision assist instructions.
17756The single-precision floating-point, square-root, and divide
17757extensions are also enabled.  This option is
17758only available for ARC EM@.
17759
17760@item fpuda_fma
17761Enables support for double-precision floating-point hardware
17762extensions using double-precision assist instructions.
17763The single-precision floating-point and fused multiply and add
17764hardware extensions are also enabled.  This option is
17765only available for ARC EM@.
17766
17767@item fpuda_all
17768Enables support for double-precision floating-point hardware
17769extensions using double-precision assist instructions.
17770All single-precision floating-point hardware extensions are also
17771enabled.  This option is only available for ARC EM@.
17772
17773@item fpus_div
17774Enables support for single-precision floating-point, square-root and divide
17775hardware extensions@.
17776
17777@item fpud_div
17778Enables support for double-precision floating-point, square-root and divide
17779hardware extensions.  This option
17780includes option @samp{fpus_div}. Not available for ARC EM@.
17781
17782@item fpus_fma
17783Enables support for single-precision floating-point and
17784fused multiply and add hardware extensions@.
17785
17786@item fpud_fma
17787Enables support for double-precision floating-point and
17788fused multiply and add hardware extensions.  This option
17789includes option @samp{fpus_fma}.  Not available for ARC EM@.
17790
17791@item fpus_all
17792Enables support for all single-precision floating-point hardware
17793extensions@.
17794
17795@item fpud_all
17796Enables support for all single- and double-precision floating-point
17797hardware extensions.  Not available for ARC EM@.
17798
17799@end table
17800
17801@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
17802@opindex mirq-ctrl-saved
17803Specifies general-purposes registers that the processor automatically
17804saves/restores on interrupt entry and exit.  @var{register-range} is
17805specified as two registers separated by a dash.  The register range
17806always starts with @code{r0}, the upper limit is @code{fp} register.
17807@var{blink} and @var{lp_count} are optional.  This option is only
17808valid for ARC EM and ARC HS cores.
17809
17810@item -mrgf-banked-regs=@var{number}
17811@opindex mrgf-banked-regs
17812Specifies the number of registers replicated in second register bank
17813on entry to fast interrupt.  Fast interrupts are interrupts with the
17814highest priority level P0.  These interrupts save only PC and STATUS32
17815registers to avoid memory transactions during interrupt entry and exit
17816sequences.  Use this option when you are using fast interrupts in an
17817ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
17818
17819@item -mlpc-width=@var{width}
17820@opindex mlpc-width
17821Specify the width of the @code{lp_count} register.  Valid values for
17822@var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
17823fixed to 32 bits.  If the width is less than 32, the compiler does not
17824attempt to transform loops in your program to use the zero-delay loop
17825mechanism unless it is known that the @code{lp_count} register can
17826hold the required loop-counter value.  Depending on the width
17827specified, the compiler and run-time library might continue to use the
17828loop mechanism for various needs.  This option defines macro
17829@code{__ARC_LPC_WIDTH__} with the value of @var{width}.
17830
17831@item -mrf16
17832@opindex mrf16
17833This option instructs the compiler to generate code for a 16-entry
17834register file.  This option defines the @code{__ARC_RF16__}
17835preprocessor macro.
17836
17837@item -mbranch-index
17838@opindex mbranch-index
17839Enable use of @code{bi} or @code{bih} instructions to implement jump
17840tables.
17841
17842@end table
17843
17844The following options are passed through to the assembler, and also
17845define preprocessor macro symbols.
17846
17847@c Flags used by the assembler, but for which we define preprocessor
17848@c macro symbols as well.
17849@table @gcctabopt
17850@item -mdsp-packa
17851@opindex mdsp-packa
17852Passed down to the assembler to enable the DSP Pack A extensions.
17853Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
17854deprecated.
17855
17856@item -mdvbf
17857@opindex mdvbf
17858Passed down to the assembler to enable the dual Viterbi butterfly
17859extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
17860option is deprecated.
17861
17862@c ARC700 4.10 extension instruction
17863@item -mlock
17864@opindex mlock
17865Passed down to the assembler to enable the locked load/store
17866conditional extension.  Also sets the preprocessor symbol
17867@code{__Xlock}.
17868
17869@item -mmac-d16
17870@opindex mmac-d16
17871Passed down to the assembler.  Also sets the preprocessor symbol
17872@code{__Xxmac_d16}.  This option is deprecated.
17873
17874@item -mmac-24
17875@opindex mmac-24
17876Passed down to the assembler.  Also sets the preprocessor symbol
17877@code{__Xxmac_24}.  This option is deprecated.
17878
17879@c ARC700 4.10 extension instruction
17880@item -mrtsc
17881@opindex mrtsc
17882Passed down to the assembler to enable the 64-bit time-stamp counter
17883extension instruction.  Also sets the preprocessor symbol
17884@code{__Xrtsc}.  This option is deprecated.
17885
17886@c ARC700 4.10 extension instruction
17887@item -mswape
17888@opindex mswape
17889Passed down to the assembler to enable the swap byte ordering
17890extension instruction.  Also sets the preprocessor symbol
17891@code{__Xswape}.
17892
17893@item -mtelephony
17894@opindex mtelephony
17895Passed down to the assembler to enable dual- and single-operand
17896instructions for telephony.  Also sets the preprocessor symbol
17897@code{__Xtelephony}.  This option is deprecated.
17898
17899@item -mxy
17900@opindex mxy
17901Passed down to the assembler to enable the XY memory extension.  Also
17902sets the preprocessor symbol @code{__Xxy}.
17903
17904@end table
17905
17906The following options control how the assembly code is annotated:
17907
17908@c Assembly annotation options
17909@table @gcctabopt
17910@item -misize
17911@opindex misize
17912Annotate assembler instructions with estimated addresses.
17913
17914@item -mannotate-align
17915@opindex mannotate-align
17916Explain what alignment considerations lead to the decision to make an
17917instruction short or long.
17918
17919@end table
17920
17921The following options are passed through to the linker:
17922
17923@c options passed through to the linker
17924@table @gcctabopt
17925@item -marclinux
17926@opindex marclinux
17927Passed through to the linker, to specify use of the @code{arclinux} emulation.
17928This option is enabled by default in tool chains built for
17929@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
17930when profiling is not requested.
17931
17932@item -marclinux_prof
17933@opindex marclinux_prof
17934Passed through to the linker, to specify use of the
17935@code{arclinux_prof} emulation.  This option is enabled by default in
17936tool chains built for @w{@code{arc-linux-uclibc}} and
17937@w{@code{arceb-linux-uclibc}} targets when profiling is requested.
17938
17939@end table
17940
17941The following options control the semantics of generated code:
17942
17943@c semantically relevant code generation options
17944@table @gcctabopt
17945@item -mlong-calls
17946@opindex mlong-calls
17947Generate calls as register indirect calls, thus providing access
17948to the full 32-bit address range.
17949
17950@item -mmedium-calls
17951@opindex mmedium-calls
17952Don't use less than 25-bit addressing range for calls, which is the
17953offset available for an unconditional branch-and-link
17954instruction.  Conditional execution of function calls is suppressed, to
17955allow use of the 25-bit range, rather than the 21-bit range with
17956conditional branch-and-link.  This is the default for tool chains built
17957for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17958
17959@item -G @var{num}
17960@opindex G
17961Put definitions of externally-visible data in a small data section if
17962that data is no bigger than @var{num} bytes.  The default value of
17963@var{num} is 4 for any ARC configuration, or 8 when we have double
17964load/store operations.
17965
17966@item -mno-sdata
17967@opindex mno-sdata
17968@opindex msdata
17969Do not generate sdata references.  This is the default for tool chains
17970built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17971targets.
17972
17973@item -mvolatile-cache
17974@opindex mvolatile-cache
17975Use ordinarily cached memory accesses for volatile references.  This is the
17976default.
17977
17978@item -mno-volatile-cache
17979@opindex mno-volatile-cache
17980@opindex mvolatile-cache
17981Enable cache bypass for volatile references.
17982
17983@end table
17984
17985The following options fine tune code generation:
17986@c code generation tuning options
17987@table @gcctabopt
17988@item -malign-call
17989@opindex malign-call
17990Do alignment optimizations for call instructions.
17991
17992@item -mauto-modify-reg
17993@opindex mauto-modify-reg
17994Enable the use of pre/post modify with register displacement.
17995
17996@item -mbbit-peephole
17997@opindex mbbit-peephole
17998Enable bbit peephole2.
17999
18000@item -mno-brcc
18001@opindex mno-brcc
18002This option disables a target-specific pass in @file{arc_reorg} to
18003generate compare-and-branch (@code{br@var{cc}}) instructions.
18004It has no effect on
18005generation of these instructions driven by the combiner pass.
18006
18007@item -mcase-vector-pcrel
18008@opindex mcase-vector-pcrel
18009Use PC-relative switch case tables to enable case table shortening.
18010This is the default for @option{-Os}.
18011
18012@item -mcompact-casesi
18013@opindex mcompact-casesi
18014Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
18015and only available for ARCv1 cores.  This option is deprecated.
18016
18017@item -mno-cond-exec
18018@opindex mno-cond-exec
18019Disable the ARCompact-specific pass to generate conditional
18020execution instructions.
18021
18022Due to delay slot scheduling and interactions between operand numbers,
18023literal sizes, instruction lengths, and the support for conditional execution,
18024the target-independent pass to generate conditional execution is often lacking,
18025so the ARC port has kept a special pass around that tries to find more
18026conditional execution generation opportunities after register allocation,
18027branch shortening, and delay slot scheduling have been done.  This pass
18028generally, but not always, improves performance and code size, at the cost of
18029extra compilation time, which is why there is an option to switch it off.
18030If you have a problem with call instructions exceeding their allowable
18031offset range because they are conditionalized, you should consider using
18032@option{-mmedium-calls} instead.
18033
18034@item -mearly-cbranchsi
18035@opindex mearly-cbranchsi
18036Enable pre-reload use of the @code{cbranchsi} pattern.
18037
18038@item -mexpand-adddi
18039@opindex mexpand-adddi
18040Expand @code{adddi3} and @code{subdi3} at RTL generation time into
18041@code{add.f}, @code{adc} etc.  This option is deprecated.
18042
18043@item -mindexed-loads
18044@opindex mindexed-loads
18045Enable the use of indexed loads.  This can be problematic because some
18046optimizers then assume that indexed stores exist, which is not
18047the case.
18048
18049@item -mlra
18050@opindex mlra
18051Enable Local Register Allocation.  This is still experimental for ARC,
18052so by default the compiler uses standard reload
18053(i.e.@: @option{-mno-lra}).
18054
18055@item -mlra-priority-none
18056@opindex mlra-priority-none
18057Don't indicate any priority for target registers.
18058
18059@item -mlra-priority-compact
18060@opindex mlra-priority-compact
18061Indicate target register priority for r0..r3 / r12..r15.
18062
18063@item -mlra-priority-noncompact
18064@opindex mlra-priority-noncompact
18065Reduce target register priority for r0..r3 / r12..r15.
18066
18067@item -mmillicode
18068@opindex mmillicode
18069When optimizing for size (using @option{-Os}), prologues and epilogues
18070that have to save or restore a large number of registers are often
18071shortened by using call to a special function in libgcc; this is
18072referred to as a @emph{millicode} call.  As these calls can pose
18073performance issues, and/or cause linking issues when linking in a
18074nonstandard way, this option is provided to turn on or off millicode
18075call generation.
18076
18077@item -mcode-density-frame
18078@opindex mcode-density-frame
18079This option enable the compiler to emit @code{enter} and @code{leave}
18080instructions.  These instructions are only valid for CPUs with
18081code-density feature.
18082
18083@item -mmixed-code
18084@opindex mmixed-code
18085Tweak register allocation to help 16-bit instruction generation.
18086This generally has the effect of decreasing the average instruction size
18087while increasing the instruction count.
18088
18089@item -mq-class
18090@opindex mq-class
18091Ths option is deprecated.  Enable @samp{q} instruction alternatives.
18092This is the default for @option{-Os}.
18093
18094@item -mRcq
18095@opindex mRcq
18096Enable @samp{Rcq} constraint handling.
18097Most short code generation depends on this.
18098This is the default.
18099
18100@item -mRcw
18101@opindex mRcw
18102Enable @samp{Rcw} constraint handling.
18103Most ccfsm condexec mostly depends on this.
18104This is the default.
18105
18106@item -msize-level=@var{level}
18107@opindex msize-level
18108Fine-tune size optimization with regards to instruction lengths and alignment.
18109The recognized values for @var{level} are:
18110@table @samp
18111@item 0
18112No size optimization.  This level is deprecated and treated like @samp{1}.
18113
18114@item 1
18115Short instructions are used opportunistically.
18116
18117@item 2
18118In addition, alignment of loops and of code after barriers are dropped.
18119
18120@item 3
18121In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18122
18123@end table
18124
18125This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
18126the behavior when this is not set is equivalent to level @samp{1}.
18127
18128@item -mtune=@var{cpu}
18129@opindex mtune
18130Set instruction scheduling parameters for @var{cpu}, overriding any implied
18131by @option{-mcpu=}.
18132
18133Supported values for @var{cpu} are
18134
18135@table @samp
18136@item ARC600
18137Tune for ARC600 CPU.
18138
18139@item ARC601
18140Tune for ARC601 CPU.
18141
18142@item ARC700
18143Tune for ARC700 CPU with standard multiplier block.
18144
18145@item ARC700-xmac
18146Tune for ARC700 CPU with XMAC block.
18147
18148@item ARC725D
18149Tune for ARC725D CPU.
18150
18151@item ARC750D
18152Tune for ARC750D CPU.
18153
18154@end table
18155
18156@item -mmultcost=@var{num}
18157@opindex mmultcost
18158Cost to assume for a multiply instruction, with @samp{4} being equal to a
18159normal instruction.
18160
18161@item -munalign-prob-threshold=@var{probability}
18162@opindex munalign-prob-threshold
18163Set probability threshold for unaligning branches.
18164When tuning for @samp{ARC700} and optimizing for speed, branches without
18165filled delay slot are preferably emitted unaligned and long, unless
18166profiling indicates that the probability for the branch to be taken
18167is below @var{probability}.  @xref{Cross-profiling}.
18168The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18169
18170@end table
18171
18172The following options are maintained for backward compatibility, but
18173are now deprecated and will be removed in a future release:
18174
18175@c Deprecated options
18176@table @gcctabopt
18177
18178@item -margonaut
18179@opindex margonaut
18180Obsolete FPX.
18181
18182@item -mbig-endian
18183@opindex mbig-endian
18184@itemx -EB
18185@opindex EB
18186Compile code for big-endian targets.  Use of these options is now
18187deprecated.  Big-endian code is supported by configuring GCC to build
18188@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18189for which big endian is the default.
18190
18191@item -mlittle-endian
18192@opindex mlittle-endian
18193@itemx -EL
18194@opindex EL
18195Compile code for little-endian targets.  Use of these options is now
18196deprecated.  Little-endian code is supported by configuring GCC to build
18197@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18198for which little endian is the default.
18199
18200@item -mbarrel_shifter
18201@opindex mbarrel_shifter
18202Replaced by @option{-mbarrel-shifter}.
18203
18204@item -mdpfp_compact
18205@opindex mdpfp_compact
18206Replaced by @option{-mdpfp-compact}.
18207
18208@item -mdpfp_fast
18209@opindex mdpfp_fast
18210Replaced by @option{-mdpfp-fast}.
18211
18212@item -mdsp_packa
18213@opindex mdsp_packa
18214Replaced by @option{-mdsp-packa}.
18215
18216@item -mEA
18217@opindex mEA
18218Replaced by @option{-mea}.
18219
18220@item -mmac_24
18221@opindex mmac_24
18222Replaced by @option{-mmac-24}.
18223
18224@item -mmac_d16
18225@opindex mmac_d16
18226Replaced by @option{-mmac-d16}.
18227
18228@item -mspfp_compact
18229@opindex mspfp_compact
18230Replaced by @option{-mspfp-compact}.
18231
18232@item -mspfp_fast
18233@opindex mspfp_fast
18234Replaced by @option{-mspfp-fast}.
18235
18236@item -mtune=@var{cpu}
18237@opindex mtune
18238Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18239@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18240@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18241
18242@item -multcost=@var{num}
18243@opindex multcost
18244Replaced by @option{-mmultcost}.
18245
18246@end table
18247
18248@node ARM Options
18249@subsection ARM Options
18250@cindex ARM options
18251
18252These @samp{-m} options are defined for the ARM port:
18253
18254@table @gcctabopt
18255@item -mabi=@var{name}
18256@opindex mabi
18257Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
18258@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18259
18260@item -mapcs-frame
18261@opindex mapcs-frame
18262Generate a stack frame that is compliant with the ARM Procedure Call
18263Standard for all functions, even if this is not strictly necessary for
18264correct execution of the code.  Specifying @option{-fomit-frame-pointer}
18265with this option causes the stack frames not to be generated for
18266leaf functions.  The default is @option{-mno-apcs-frame}.
18267This option is deprecated.
18268
18269@item -mapcs
18270@opindex mapcs
18271This is a synonym for @option{-mapcs-frame} and is deprecated.
18272
18273@ignore
18274@c not currently implemented
18275@item -mapcs-stack-check
18276@opindex mapcs-stack-check
18277Generate code to check the amount of stack space available upon entry to
18278every function (that actually uses some stack space).  If there is
18279insufficient space available then either the function
18280@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18281called, depending upon the amount of stack space required.  The runtime
18282system is required to provide these functions.  The default is
18283@option{-mno-apcs-stack-check}, since this produces smaller code.
18284
18285@c not currently implemented
18286@item -mapcs-reentrant
18287@opindex mapcs-reentrant
18288Generate reentrant, position-independent code.  The default is
18289@option{-mno-apcs-reentrant}.
18290@end ignore
18291
18292@item -mthumb-interwork
18293@opindex mthumb-interwork
18294Generate code that supports calling between the ARM and Thumb
18295instruction sets.  Without this option, on pre-v5 architectures, the
18296two instruction sets cannot be reliably used inside one program.  The
18297default is @option{-mno-thumb-interwork}, since slightly larger code
18298is generated when @option{-mthumb-interwork} is specified.  In AAPCS
18299configurations this option is meaningless.
18300
18301@item -mno-sched-prolog
18302@opindex mno-sched-prolog
18303@opindex msched-prolog
18304Prevent the reordering of instructions in the function prologue, or the
18305merging of those instruction with the instructions in the function's
18306body.  This means that all functions start with a recognizable set
18307of instructions (or in fact one of a choice from a small set of
18308different function prologues), and this information can be used to
18309locate the start of functions inside an executable piece of code.  The
18310default is @option{-msched-prolog}.
18311
18312@item -mfloat-abi=@var{name}
18313@opindex mfloat-abi
18314Specifies which floating-point ABI to use.  Permissible values
18315are: @samp{soft}, @samp{softfp} and @samp{hard}.
18316
18317Specifying @samp{soft} causes GCC to generate output containing
18318library calls for floating-point operations.
18319@samp{softfp} allows the generation of code using hardware floating-point
18320instructions, but still uses the soft-float calling conventions.
18321@samp{hard} allows generation of floating-point instructions
18322and uses FPU-specific calling conventions.
18323
18324The default depends on the specific target configuration.  Note that
18325the hard-float and soft-float ABIs are not link-compatible; you must
18326compile your entire program with the same ABI, and link with a
18327compatible set of libraries.
18328
18329@item -mgeneral-regs-only
18330@opindex mgeneral-regs-only
18331Generate code which uses only the general-purpose registers.  This will prevent
18332the compiler from using floating-point and Advanced SIMD registers but will not
18333impose any restrictions on the assembler.
18334
18335@item -mlittle-endian
18336@opindex mlittle-endian
18337Generate code for a processor running in little-endian mode.  This is
18338the default for all standard configurations.
18339
18340@item -mbig-endian
18341@opindex mbig-endian
18342Generate code for a processor running in big-endian mode; the default is
18343to compile code for a little-endian processor.
18344
18345@item -mbe8
18346@itemx -mbe32
18347@opindex mbe8
18348When linking a big-endian image select between BE8 and BE32 formats.
18349The option has no effect for little-endian images and is ignored.  The
18350default is dependent on the selected target architecture.  For ARMv6
18351and later architectures the default is BE8, for older architectures
18352the default is BE32.  BE32 format has been deprecated by ARM.
18353
18354@item -march=@var{name}@r{[}+extension@dots{}@r{]}
18355@opindex march
18356This specifies the name of the target ARM architecture.  GCC uses this
18357name to determine what kind of instructions it can emit when generating
18358assembly code.  This option can be used in conjunction with or instead
18359of the @option{-mcpu=} option.
18360
18361Permissible names are:
18362@samp{armv4t},
18363@samp{armv5t}, @samp{armv5te},
18364@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18365@samp{armv6z}, @samp{armv6zk},
18366@samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18367@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18368@samp{armv8.4-a},
18369@samp{armv8.5-a},
18370@samp{armv8.6-a},
18371@samp{armv7-r},
18372@samp{armv8-r},
18373@samp{armv6-m}, @samp{armv6s-m},
18374@samp{armv7-m}, @samp{armv7e-m},
18375@samp{armv8-m.base}, @samp{armv8-m.main},
18376@samp{armv8.1-m.main},
18377@samp{iwmmxt} and @samp{iwmmxt2}.
18378
18379Additionally, the following architectures, which lack support for the
18380Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18381
18382Many of the architectures support extensions.  These can be added by
18383appending @samp{+@var{extension}} to the architecture name.  Extension
18384options are processed in order and capabilities accumulate.  An extension
18385will also enable any necessary base extensions
18386upon which it depends.  For example, the @samp{+crypto} extension
18387will always enable the @samp{+simd} extension.  The exception to the
18388additive construction is for extensions that are prefixed with
18389@samp{+no@dots{}}: these extensions disable the specified option and
18390any other extensions that may depend on the presence of that
18391extension.
18392
18393For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18394writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18395entirely disabled by the @samp{+nofp} option that follows it.
18396
18397Most extension names are generically named, but have an effect that is
18398dependent upon the architecture to which it is applied.  For example,
18399the @samp{+simd} option can be applied to both @samp{armv7-a} and
18400@samp{armv8-a} architectures, but will enable the original ARMv7-A
18401Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18402variant for @samp{armv8-a}.
18403
18404The table below lists the supported extensions for each architecture.
18405Architectures not mentioned do not support any extensions.
18406
18407@table @samp
18408@item armv5te
18409@itemx armv6
18410@itemx armv6j
18411@itemx armv6k
18412@itemx armv6kz
18413@itemx armv6t2
18414@itemx armv6z
18415@itemx armv6zk
18416@table @samp
18417@item +fp
18418The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
18419used as an alias for this extension.
18420
18421@item +nofp
18422Disable the floating-point instructions.
18423@end table
18424
18425@item armv7
18426The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18427@table @samp
18428@item +fp
18429The VFPv3 floating-point instructions, with 16 double-precision
18430registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18431for this extension.  Note that floating-point is not supported by the
18432base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18433ARMv7-R architectures.
18434
18435@item +nofp
18436Disable the floating-point instructions.
18437@end table
18438
18439@item armv7-a
18440@table @samp
18441@item +mp
18442The multiprocessing extension.
18443
18444@item +sec
18445The security extension.
18446
18447@item +fp
18448The VFPv3 floating-point instructions, with 16 double-precision
18449registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18450for this extension.
18451
18452@item +simd
18453The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18454The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18455for this extension.
18456
18457@item +vfpv3
18458The VFPv3 floating-point instructions, with 32 double-precision
18459registers.
18460
18461@item +vfpv3-d16-fp16
18462The VFPv3 floating-point instructions, with 16 double-precision
18463registers and the half-precision floating-point conversion operations.
18464
18465@item +vfpv3-fp16
18466The VFPv3 floating-point instructions, with 32 double-precision
18467registers and the half-precision floating-point conversion operations.
18468
18469@item +vfpv4-d16
18470The VFPv4 floating-point instructions, with 16 double-precision
18471registers.
18472
18473@item +vfpv4
18474The VFPv4 floating-point instructions, with 32 double-precision
18475registers.
18476
18477@item +neon-fp16
18478The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18479the half-precision floating-point conversion operations.
18480
18481@item +neon-vfpv4
18482The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18483
18484@item +nosimd
18485Disable the Advanced SIMD instructions (does not disable floating point).
18486
18487@item +nofp
18488Disable the floating-point and Advanced SIMD instructions.
18489@end table
18490
18491@item armv7ve
18492The extended version of the ARMv7-A architecture with support for
18493virtualization.
18494@table @samp
18495@item +fp
18496The VFPv4 floating-point instructions, with 16 double-precision registers.
18497The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18498
18499@item +simd
18500The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
18501extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18502
18503@item +vfpv3-d16
18504The VFPv3 floating-point instructions, with 16 double-precision
18505registers.
18506
18507@item +vfpv3
18508The VFPv3 floating-point instructions, with 32 double-precision
18509registers.
18510
18511@item +vfpv3-d16-fp16
18512The VFPv3 floating-point instructions, with 16 double-precision
18513registers and the half-precision floating-point conversion operations.
18514
18515@item +vfpv3-fp16
18516The VFPv3 floating-point instructions, with 32 double-precision
18517registers and the half-precision floating-point conversion operations.
18518
18519@item +vfpv4-d16
18520The VFPv4 floating-point instructions, with 16 double-precision
18521registers.
18522
18523@item +vfpv4
18524The VFPv4 floating-point instructions, with 32 double-precision
18525registers.
18526
18527@item +neon
18528The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18529The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18530
18531@item +neon-fp16
18532The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18533the half-precision floating-point conversion operations.
18534
18535@item +nosimd
18536Disable the Advanced SIMD instructions (does not disable floating point).
18537
18538@item +nofp
18539Disable the floating-point and Advanced SIMD instructions.
18540@end table
18541
18542@item armv8-a
18543@table @samp
18544@item +crc
18545The Cyclic Redundancy Check (CRC) instructions.
18546@item +simd
18547The ARMv8-A Advanced SIMD and floating-point instructions.
18548@item +crypto
18549The cryptographic instructions.
18550@item +nocrypto
18551Disable the cryptographic instructions.
18552@item +nofp
18553Disable the floating-point, Advanced SIMD and cryptographic instructions.
18554@item +sb
18555Speculation Barrier Instruction.
18556@item +predres
18557Execution and Data Prediction Restriction Instructions.
18558@end table
18559
18560@item armv8.1-a
18561@table @samp
18562@item +simd
18563The ARMv8.1-A Advanced SIMD and floating-point instructions.
18564
18565@item +crypto
18566The cryptographic instructions.  This also enables the Advanced SIMD and
18567floating-point instructions.
18568
18569@item +nocrypto
18570Disable the cryptographic instructions.
18571
18572@item +nofp
18573Disable the floating-point, Advanced SIMD and cryptographic instructions.
18574
18575@item +sb
18576Speculation Barrier Instruction.
18577
18578@item +predres
18579Execution and Data Prediction Restriction Instructions.
18580@end table
18581
18582@item armv8.2-a
18583@itemx armv8.3-a
18584@table @samp
18585@item +fp16
18586The half-precision floating-point data processing instructions.
18587This also enables the Advanced SIMD and floating-point instructions.
18588
18589@item +fp16fml
18590The half-precision floating-point fmla extension.  This also enables
18591the half-precision floating-point extension and Advanced SIMD and
18592floating-point instructions.
18593
18594@item +simd
18595The ARMv8.1-A Advanced SIMD and floating-point instructions.
18596
18597@item +crypto
18598The cryptographic instructions.  This also enables the Advanced SIMD and
18599floating-point instructions.
18600
18601@item +dotprod
18602Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
18603
18604@item +nocrypto
18605Disable the cryptographic extension.
18606
18607@item +nofp
18608Disable the floating-point, Advanced SIMD and cryptographic instructions.
18609
18610@item +sb
18611Speculation Barrier Instruction.
18612
18613@item +predres
18614Execution and Data Prediction Restriction Instructions.
18615
18616@item +i8mm
186178-bit Integer Matrix Multiply instructions.
18618This also enables Advanced SIMD and floating-point instructions.
18619
18620@item +bf16
18621Brain half-precision floating-point instructions.
18622This also enables Advanced SIMD and floating-point instructions.
18623@end table
18624
18625@item armv8.4-a
18626@table @samp
18627@item +fp16
18628The half-precision floating-point data processing instructions.
18629This also enables the Advanced SIMD and floating-point instructions as well
18630as the Dot Product extension and the half-precision floating-point fmla
18631extension.
18632
18633@item +simd
18634The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18635Dot Product extension.
18636
18637@item +crypto
18638The cryptographic instructions.  This also enables the Advanced SIMD and
18639floating-point instructions as well as the Dot Product extension.
18640
18641@item +nocrypto
18642Disable the cryptographic extension.
18643
18644@item +nofp
18645Disable the floating-point, Advanced SIMD and cryptographic instructions.
18646
18647@item +sb
18648Speculation Barrier Instruction.
18649
18650@item +predres
18651Execution and Data Prediction Restriction Instructions.
18652
18653@item +i8mm
186548-bit Integer Matrix Multiply instructions.
18655This also enables Advanced SIMD and floating-point instructions.
18656
18657@item +bf16
18658Brain half-precision floating-point instructions.
18659This also enables Advanced SIMD and floating-point instructions.
18660@end table
18661
18662@item armv8.5-a
18663@table @samp
18664@item +fp16
18665The half-precision floating-point data processing instructions.
18666This also enables the Advanced SIMD and floating-point instructions as well
18667as the Dot Product extension and the half-precision floating-point fmla
18668extension.
18669
18670@item +simd
18671The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18672Dot Product extension.
18673
18674@item +crypto
18675The cryptographic instructions.  This also enables the Advanced SIMD and
18676floating-point instructions as well as the Dot Product extension.
18677
18678@item +nocrypto
18679Disable the cryptographic extension.
18680
18681@item +nofp
18682Disable the floating-point, Advanced SIMD and cryptographic instructions.
18683
18684@item +i8mm
186858-bit Integer Matrix Multiply instructions.
18686This also enables Advanced SIMD and floating-point instructions.
18687
18688@item +bf16
18689Brain half-precision floating-point instructions.
18690This also enables Advanced SIMD and floating-point instructions.
18691@end table
18692
18693@item armv8.6-a
18694@table @samp
18695@item +fp16
18696The half-precision floating-point data processing instructions.
18697This also enables the Advanced SIMD and floating-point instructions as well
18698as the Dot Product extension and the half-precision floating-point fmla
18699extension.
18700
18701@item +simd
18702The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18703Dot Product extension.
18704
18705@item +crypto
18706The cryptographic instructions.  This also enables the Advanced SIMD and
18707floating-point instructions as well as the Dot Product extension.
18708
18709@item +nocrypto
18710Disable the cryptographic extension.
18711
18712@item +nofp
18713Disable the floating-point, Advanced SIMD and cryptographic instructions.
18714
18715@item +i8mm
187168-bit Integer Matrix Multiply instructions.
18717This also enables Advanced SIMD and floating-point instructions.
18718
18719@item +bf16
18720Brain half-precision floating-point instructions.
18721This also enables Advanced SIMD and floating-point instructions.
18722@end table
18723
18724@item armv7-r
18725@table @samp
18726@item +fp.sp
18727The single-precision VFPv3 floating-point instructions.  The extension
18728@samp{+vfpv3xd} can be used as an alias for this extension.
18729
18730@item +fp
18731The VFPv3 floating-point instructions with 16 double-precision registers.
18732The extension +vfpv3-d16 can be used as an alias for this extension.
18733
18734@item +vfpv3xd-d16-fp16
18735The single-precision VFPv3 floating-point instructions with 16 double-precision
18736registers and the half-precision floating-point conversion operations.
18737
18738@item +vfpv3-d16-fp16
18739The VFPv3 floating-point instructions with 16 double-precision
18740registers and the half-precision floating-point conversion operations.
18741
18742@item +nofp
18743Disable the floating-point extension.
18744
18745@item +idiv
18746The ARM-state integer division instructions.
18747
18748@item +noidiv
18749Disable the ARM-state integer division extension.
18750@end table
18751
18752@item armv7e-m
18753@table @samp
18754@item +fp
18755The single-precision VFPv4 floating-point instructions.
18756
18757@item +fpv5
18758The single-precision FPv5 floating-point instructions.
18759
18760@item +fp.dp
18761The single- and double-precision FPv5 floating-point instructions.
18762
18763@item +nofp
18764Disable the floating-point extensions.
18765@end table
18766
18767@item  armv8.1-m.main
18768@table @samp
18769
18770@item +dsp
18771The DSP instructions.
18772
18773@item +mve
18774The M-Profile Vector Extension (MVE) integer instructions.
18775
18776@item +mve.fp
18777The M-Profile Vector Extension (MVE) integer and single precision
18778floating-point instructions.
18779
18780@item +fp
18781The single-precision floating-point instructions.
18782
18783@item +fp.dp
18784The single- and double-precision floating-point instructions.
18785
18786@item +nofp
18787Disable the floating-point extension.
18788
18789@item +cdecp0, +cdecp1, ... , +cdecp7
18790Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18791to the numbers given in the options in the range 0 to 7.
18792@end table
18793
18794@item  armv8-m.main
18795@table @samp
18796@item +dsp
18797The DSP instructions.
18798
18799@item +nodsp
18800Disable the DSP extension.
18801
18802@item +fp
18803The single-precision floating-point instructions.
18804
18805@item +fp.dp
18806The single- and double-precision floating-point instructions.
18807
18808@item +nofp
18809Disable the floating-point extension.
18810
18811@item +cdecp0, +cdecp1, ... , +cdecp7
18812Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18813to the numbers given in the options in the range 0 to 7.
18814@end table
18815
18816@item armv8-r
18817@table @samp
18818@item +crc
18819The Cyclic Redundancy Check (CRC) instructions.
18820@item +fp.sp
18821The single-precision FPv5 floating-point instructions.
18822@item +simd
18823The ARMv8-A Advanced SIMD and floating-point instructions.
18824@item +crypto
18825The cryptographic instructions.
18826@item +nocrypto
18827Disable the cryptographic instructions.
18828@item +nofp
18829Disable the floating-point, Advanced SIMD and cryptographic instructions.
18830@end table
18831
18832@end table
18833
18834@option{-march=native} causes the compiler to auto-detect the architecture
18835of the build computer.  At present, this feature is only supported on
18836GNU/Linux, and not all architectures are recognized.  If the auto-detect
18837is unsuccessful the option has no effect.
18838
18839@item -mtune=@var{name}
18840@opindex mtune
18841This option specifies the name of the target ARM processor for
18842which GCC should tune the performance of the code.
18843For some ARM implementations better performance can be obtained by using
18844this option.
18845Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
18846@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
18847@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
18848@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
18849@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
18850@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
18851@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
18852@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
18853@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
18854@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
18855@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
18856@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18857@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18858@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18859@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
18860@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
18861@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
18862@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
18863@samp{cortex-m35p}, @samp{cortex-m55},
18864@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
18865@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
18866@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
18867@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
18868@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
18869
18870Additionally, this option can specify that GCC should tune the performance
18871of the code for a big.LITTLE system.  Permissible names are:
18872@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
18873@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18874@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
18875@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
18876
18877@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
18878performance for a blend of processors within architecture @var{arch}.
18879The aim is to generate code that run well on the current most popular
18880processors, balancing between optimizations that benefit some CPUs in the
18881range, and avoiding performance pitfalls of other CPUs.  The effects of
18882this option may change in future GCC versions as CPU models come and go.
18883
18884@option{-mtune} permits the same extension options as @option{-mcpu}, but
18885the extension options do not affect the tuning of the generated code.
18886
18887@option{-mtune=native} causes the compiler to auto-detect the CPU
18888of the build computer.  At present, this feature is only supported on
18889GNU/Linux, and not all architectures are recognized.  If the auto-detect is
18890unsuccessful the option has no effect.
18891
18892@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
18893@opindex mcpu
18894This specifies the name of the target ARM processor.  GCC uses this name
18895to derive the name of the target ARM architecture (as if specified
18896by @option{-march}) and the ARM processor type for which to tune for
18897performance (as if specified by @option{-mtune}).  Where this option
18898is used in conjunction with @option{-march} or @option{-mtune},
18899those options take precedence over the appropriate part of this option.
18900
18901Many of the supported CPUs implement optional architectural
18902extensions.  Where this is so the architectural extensions are
18903normally enabled by default.  If implementations that lack the
18904extension exist, then the extension syntax can be used to disable
18905those extensions that have been omitted.  For floating-point and
18906Advanced SIMD (Neon) instructions, the settings of the options
18907@option{-mfloat-abi} and @option{-mfpu} must also be considered:
18908floating-point and Advanced SIMD instructions will only be used if
18909@option{-mfloat-abi} is not set to @samp{soft}; and any setting of
18910@option{-mfpu} other than @samp{auto} will override the available
18911floating-point and SIMD extension instructions.
18912
18913For example, @samp{cortex-a9} can be found in three major
18914configurations: integer only, with just a floating-point unit or with
18915floating-point and Advanced SIMD.  The default is to enable all the
18916instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
18917be used to disable just the SIMD or both the SIMD and floating-point
18918instructions respectively.
18919
18920Permissible names for this option are the same as those for
18921@option{-mtune}.
18922
18923The following extension options are common to the listed CPUs:
18924
18925@table @samp
18926@item +nodsp
18927Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
18928
18929@item  +nofp
18930Disables the floating-point instructions on @samp{arm9e},
18931@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
18932@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
18933@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
18934@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
18935Disables the floating-point and SIMD instructions on
18936@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
18937@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
18938@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
18939@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
18940@samp{cortex-a53} and @samp{cortex-a55}.
18941
18942@item +nofp.dp
18943Disables the double-precision component of the floating-point instructions
18944on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
18945@samp{cortex-m7}.
18946
18947@item +nosimd
18948Disables the SIMD (but not floating-point) instructions on
18949@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
18950and @samp{cortex-a9}.
18951
18952@item +crypto
18953Enables the cryptographic instructions on @samp{cortex-a32},
18954@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
18955@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
18956@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18957@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
18958@samp{cortex-a75.cortex-a55}.
18959@end table
18960
18961Additionally the @samp{generic-armv7-a} pseudo target defaults to
18962VFPv3 with 16 double-precision registers.  It supports the following
18963extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
18964@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
18965@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
18966@samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
18967the extensions to @option{-march=armv7-a}.
18968
18969@option{-mcpu=generic-@var{arch}} is also permissible, and is
18970equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
18971See @option{-mtune} for more information.
18972
18973@option{-mcpu=native} causes the compiler to auto-detect the CPU
18974of the build computer.  At present, this feature is only supported on
18975GNU/Linux, and not all architectures are recognized.  If the auto-detect
18976is unsuccessful the option has no effect.
18977
18978@item -mfpu=@var{name}
18979@opindex mfpu
18980This specifies what floating-point hardware (or hardware emulation) is
18981available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
18982@samp{vfpv3},
18983@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
18984@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
18985@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
18986@samp{fpv5-d16}, @samp{fpv5-sp-d16},
18987@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
18988Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
18989is an alias for @samp{vfpv2}.
18990
18991The setting @samp{auto} is the default and is special.  It causes the
18992compiler to select the floating-point and Advanced SIMD instructions
18993based on the settings of @option{-mcpu} and @option{-march}.
18994
18995If the selected floating-point hardware includes the NEON extension
18996(e.g.@: @option{-mfpu=neon}), note that floating-point
18997operations are not generated by GCC's auto-vectorization pass unless
18998@option{-funsafe-math-optimizations} is also specified.  This is
18999because NEON hardware does not fully implement the IEEE 754 standard for
19000floating-point arithmetic (in particular denormal values are treated as
19001zero), so the use of NEON instructions may lead to a loss of precision.
19002
19003You 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}).
19004
19005@item -mfp16-format=@var{name}
19006@opindex mfp16-format
19007Specify the format of the @code{__fp16} half-precision floating-point type.
19008Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
19009the default is @samp{none}, in which case the @code{__fp16} type is not
19010defined.  @xref{Half-Precision}, for more information.
19011
19012@item -mstructure-size-boundary=@var{n}
19013@opindex mstructure-size-boundary
19014The sizes of all structures and unions are rounded up to a multiple
19015of the number of bits set by this option.  Permissible values are 8, 32
19016and 64.  The default value varies for different toolchains.  For the COFF
19017targeted toolchain the default value is 8.  A value of 64 is only allowed
19018if the underlying ABI supports it.
19019
19020Specifying a larger number can produce faster, more efficient code, but
19021can also increase the size of the program.  Different values are potentially
19022incompatible.  Code compiled with one value cannot necessarily expect to
19023work with code or libraries compiled with another value, if they exchange
19024information using structures or unions.
19025
19026This option is deprecated.
19027
19028@item -mabort-on-noreturn
19029@opindex mabort-on-noreturn
19030Generate a call to the function @code{abort} at the end of a
19031@code{noreturn} function.  It is executed if the function tries to
19032return.
19033
19034@item -mlong-calls
19035@itemx -mno-long-calls
19036@opindex mlong-calls
19037@opindex mno-long-calls
19038Tells the compiler to perform function calls by first loading the
19039address of the function into a register and then performing a subroutine
19040call on this register.  This switch is needed if the target function
19041lies outside of the 64-megabyte addressing range of the offset-based
19042version of subroutine call instruction.
19043
19044Even if this switch is enabled, not all function calls are turned
19045into long calls.  The heuristic is that static functions, functions
19046that have the @code{short_call} attribute, functions that are inside
19047the scope of a @code{#pragma no_long_calls} directive, and functions whose
19048definitions have already been compiled within the current compilation
19049unit are not turned into long calls.  The exceptions to this rule are
19050that weak function definitions, functions with the @code{long_call}
19051attribute or the @code{section} attribute, and functions that are within
19052the scope of a @code{#pragma long_calls} directive are always
19053turned into long calls.
19054
19055This feature is not enabled by default.  Specifying
19056@option{-mno-long-calls} restores the default behavior, as does
19057placing the function calls within the scope of a @code{#pragma
19058long_calls_off} directive.  Note these switches have no effect on how
19059the compiler generates code to handle function calls via function
19060pointers.
19061
19062@item -msingle-pic-base
19063@opindex msingle-pic-base
19064Treat the register used for PIC addressing as read-only, rather than
19065loading it in the prologue for each function.  The runtime system is
19066responsible for initializing this register with an appropriate value
19067before execution begins.
19068
19069@item -mpic-register=@var{reg}
19070@opindex mpic-register
19071Specify the register to be used for PIC addressing.
19072For standard PIC base case, the default is any suitable register
19073determined by compiler.  For single PIC base case, the default is
19074@samp{R9} if target is EABI based or stack-checking is enabled,
19075otherwise the default is @samp{R10}.
19076
19077@item -mpic-data-is-text-relative
19078@opindex mpic-data-is-text-relative
19079Assume that the displacement between the text and data segments is fixed
19080at static link time.  This permits using PC-relative addressing
19081operations to access data known to be in the data segment.  For
19082non-VxWorks RTP targets, this option is enabled by default.  When
19083disabled on such targets, it will enable @option{-msingle-pic-base} by
19084default.
19085
19086@item -mpoke-function-name
19087@opindex mpoke-function-name
19088Write the name of each function into the text section, directly
19089preceding the function prologue.  The generated code is similar to this:
19090
19091@smallexample
19092     t0
19093         .ascii "arm_poke_function_name", 0
19094         .align
19095     t1
19096         .word 0xff000000 + (t1 - t0)
19097     arm_poke_function_name
19098         mov     ip, sp
19099         stmfd   sp!, @{fp, ip, lr, pc@}
19100         sub     fp, ip, #4
19101@end smallexample
19102
19103When performing a stack backtrace, code can inspect the value of
19104@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
19105location @code{pc - 12} and the top 8 bits are set, then we know that
19106there is a function name embedded immediately preceding this location
19107and has length @code{((pc[-3]) & 0xff000000)}.
19108
19109@item -mthumb
19110@itemx -marm
19111@opindex marm
19112@opindex mthumb
19113
19114Select between generating code that executes in ARM and Thumb
19115states.  The default for most configurations is to generate code
19116that executes in ARM state, but the default can be changed by
19117configuring GCC with the @option{--with-mode=}@var{state}
19118configure option.
19119
19120You can also override the ARM and Thumb mode for each function
19121by using the @code{target("thumb")} and @code{target("arm")} function attributes
19122(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
19123
19124@item -mflip-thumb
19125@opindex mflip-thumb
19126Switch ARM/Thumb modes on alternating functions.
19127This option is provided for regression testing of mixed Thumb/ARM code
19128generation, and is not intended for ordinary use in compiling code.
19129
19130@item -mtpcs-frame
19131@opindex mtpcs-frame
19132Generate a stack frame that is compliant with the Thumb Procedure Call
19133Standard for all non-leaf functions.  (A leaf function is one that does
19134not call any other functions.)  The default is @option{-mno-tpcs-frame}.
19135
19136@item -mtpcs-leaf-frame
19137@opindex mtpcs-leaf-frame
19138Generate a stack frame that is compliant with the Thumb Procedure Call
19139Standard for all leaf functions.  (A leaf function is one that does
19140not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
19141
19142@item -mcallee-super-interworking
19143@opindex mcallee-super-interworking
19144Gives all externally visible functions in the file being compiled an ARM
19145instruction set header which switches to Thumb mode before executing the
19146rest of the function.  This allows these functions to be called from
19147non-interworking code.  This option is not valid in AAPCS configurations
19148because interworking is enabled by default.
19149
19150@item -mcaller-super-interworking
19151@opindex mcaller-super-interworking
19152Allows calls via function pointers (including virtual functions) to
19153execute correctly regardless of whether the target code has been
19154compiled for interworking or not.  There is a small overhead in the cost
19155of executing a function pointer if this option is enabled.  This option
19156is not valid in AAPCS configurations because interworking is enabled
19157by default.
19158
19159@item -mtp=@var{name}
19160@opindex mtp
19161Specify the access model for the thread local storage pointer.  The valid
19162models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19163@samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19164(supported in the arm6k architecture), and @samp{auto}, which uses the
19165best available method for the selected processor.  The default setting is
19166@samp{auto}.
19167
19168@item -mtls-dialect=@var{dialect}
19169@opindex mtls-dialect
19170Specify the dialect to use for accessing thread local storage.  Two
19171@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
19172@samp{gnu} dialect selects the original GNU scheme for supporting
19173local and global dynamic TLS models.  The @samp{gnu2} dialect
19174selects the GNU descriptor scheme, which provides better performance
19175for shared libraries.  The GNU descriptor scheme is compatible with
19176the original scheme, but does require new assembler, linker and
19177library support.  Initial and local exec TLS models are unaffected by
19178this option and always use the original scheme.
19179
19180@item -mword-relocations
19181@opindex mword-relocations
19182Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19183This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19184loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19185is specified. This option conflicts with @option{-mslow-flash-data}.
19186
19187@item -mfix-cortex-m3-ldrd
19188@opindex mfix-cortex-m3-ldrd
19189Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19190with overlapping destination and base registers are used.  This option avoids
19191generating these instructions.  This option is enabled by default when
19192@option{-mcpu=cortex-m3} is specified.
19193
19194@item -munaligned-access
19195@itemx -mno-unaligned-access
19196@opindex munaligned-access
19197@opindex mno-unaligned-access
19198Enables (or disables) reading and writing of 16- and 32- bit values
19199from addresses that are not 16- or 32- bit aligned.  By default
19200unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19201ARMv8-M Baseline architectures, and enabled for all other
19202architectures.  If unaligned access is not enabled then words in packed
19203data structures are accessed a byte at a time.
19204
19205The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19206generated object file to either true or false, depending upon the
19207setting of this option.  If unaligned access is enabled then the
19208preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19209defined.
19210
19211@item -mneon-for-64bits
19212@opindex mneon-for-64bits
19213This option is deprecated and has no effect.
19214
19215@item -mslow-flash-data
19216@opindex mslow-flash-data
19217Assume loading data from flash is slower than fetching instruction.
19218Therefore literal load is minimized for better performance.
19219This option is only supported when compiling for ARMv7 M-profile and
19220off by default. It conflicts with @option{-mword-relocations}.
19221
19222@item -masm-syntax-unified
19223@opindex masm-syntax-unified
19224Assume inline assembler is using unified asm syntax.  The default is
19225currently off which implies divided syntax.  This option has no impact
19226on Thumb2. However, this may change in future releases of GCC.
19227Divided syntax should be considered deprecated.
19228
19229@item -mrestrict-it
19230@opindex mrestrict-it
19231Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19232IT blocks can only contain a single 16-bit instruction from a select
19233set of instructions. This option is on by default for ARMv8-A Thumb mode.
19234
19235@item -mprint-tune-info
19236@opindex mprint-tune-info
19237Print CPU tuning information as comment in assembler file.  This is
19238an option used only for regression testing of the compiler and not
19239intended for ordinary use in compiling code.  This option is disabled
19240by default.
19241
19242@item -mverbose-cost-dump
19243@opindex mverbose-cost-dump
19244Enable verbose cost model dumping in the debug dump files.  This option is
19245provided for use in debugging the compiler.
19246
19247@item -mpure-code
19248@opindex mpure-code
19249Do not allow constant data to be placed in code sections.
19250Additionally, when compiling for ELF object format give all text sections the
19251ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
19252is only available when generating non-pic code for M-profile targets.
19253
19254@item -mcmse
19255@opindex mcmse
19256Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19257Development Tools Engineering Specification", which can be found on
19258@url{https://developer.arm.com/documentation/ecm0359818/latest/}.
19259
19260@item -mfix-cmse-cve-2021-35465
19261@opindex mfix-cmse-cve-2021-35465
19262Mitigate against a potential security issue with the @code{VLLDM} instruction
19263in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
19264enabled by default when the option @option{-mcpu=} is used with
19265@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}.  The option
19266@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
19267
19268@item -mfdpic
19269@itemx -mno-fdpic
19270@opindex mfdpic
19271@opindex mno-fdpic
19272Select the FDPIC ABI, which uses 64-bit function descriptors to
19273represent pointers to functions.  When the compiler is configured for
19274@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19275and implies @option{-fPIE} if none of the PIC/PIE-related options is
19276provided.  On other targets, it only enables the FDPIC-specific code
19277generation features, and the user should explicitly provide the
19278PIC/PIE-related options as needed.
19279
19280Note that static linking is not supported because it would still
19281involve the dynamic linker when the program self-relocates.  If such
19282behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19283
19284The opposite @option{-mno-fdpic} option is useful (and required) to
19285build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19286toolchain as the one used to build the userland programs.
19287
19288@end table
19289
19290@node AVR Options
19291@subsection AVR Options
19292@cindex AVR Options
19293
19294These options are defined for AVR implementations:
19295
19296@table @gcctabopt
19297@item -mmcu=@var{mcu}
19298@opindex mmcu
19299Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19300
19301The default for this option is@tie{}@samp{avr2}.
19302
19303GCC supports the following AVR devices and ISAs:
19304
19305@include avr-mmcu.texi
19306
19307@item -mabsdata
19308@opindex mabsdata
19309
19310Assume that all data in static storage can be accessed by LDS / STS
19311instructions.  This option has only an effect on reduced Tiny devices like
19312ATtiny40.  See also the @code{absdata}
19313@ref{AVR Variable Attributes,variable attribute}.
19314
19315@item -maccumulate-args
19316@opindex maccumulate-args
19317Accumulate outgoing function arguments and acquire/release the needed
19318stack space for outgoing function arguments once in function
19319prologue/epilogue.  Without this option, outgoing arguments are pushed
19320before calling a function and popped afterwards.
19321
19322Popping the arguments after the function call can be expensive on
19323AVR so that accumulating the stack space might lead to smaller
19324executables because arguments need not be removed from the
19325stack after such a function call.
19326
19327This option can lead to reduced code size for functions that perform
19328several calls to functions that get their arguments on the stack like
19329calls to printf-like functions.
19330
19331@item -mbranch-cost=@var{cost}
19332@opindex mbranch-cost
19333Set the branch costs for conditional branch instructions to
19334@var{cost}.  Reasonable values for @var{cost} are small, non-negative
19335integers. The default branch cost is 0.
19336
19337@item -mcall-prologues
19338@opindex mcall-prologues
19339Functions prologues/epilogues are expanded as calls to appropriate
19340subroutines.  Code size is smaller.
19341
19342@item -mdouble=@var{bits}
19343@itemx -mlong-double=@var{bits}
19344@opindex mdouble
19345@opindex mlong-double
19346Set the size (in bits) of the @code{double} or @code{long double} type,
19347respectively.  Possible values for @var{bits} are 32 and 64.
19348Whether or not a specific value for @var{bits} is allowed depends on
19349the @code{--with-double=} and @code{--with-long-double=}
19350@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19351and the same applies for the default values of the options.
19352
19353@item -mgas-isr-prologues
19354@opindex mgas-isr-prologues
19355Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19356instruction supported by GNU Binutils.
19357If this option is on, the feature can still be disabled for individual
19358ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19359function attribute.  This feature is activated per default
19360if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19361and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19362
19363@item -mint8
19364@opindex mint8
19365Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
19366@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19367and @code{long long} is 4 bytes.  Please note that this option does not
19368conform to the C standards, but it results in smaller code
19369size.
19370
19371@item -mmain-is-OS_task
19372@opindex mmain-is-OS_task
19373Do not save registers in @code{main}.  The effect is the same like
19374attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19375to @code{main}. It is activated per default if optimization is on.
19376
19377@item -mn-flash=@var{num}
19378@opindex mn-flash
19379Assume that the flash memory has a size of
19380@var{num} times 64@tie{}KiB.
19381
19382@item -mno-interrupts
19383@opindex mno-interrupts
19384Generated code is not compatible with hardware interrupts.
19385Code size is smaller.
19386
19387@item -mrelax
19388@opindex mrelax
19389Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19390@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19391Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19392the assembler's command line and the @option{--relax} option to the
19393linker's command line.
19394
19395Jump relaxing is performed by the linker because jump offsets are not
19396known before code is located. Therefore, the assembler code generated by the
19397compiler is the same, but the instructions in the executable may
19398differ from instructions in the assembler code.
19399
19400Relaxing must be turned on if linker stubs are needed, see the
19401section on @code{EIND} and linker stubs below.
19402
19403@item -mrmw
19404@opindex mrmw
19405Assume that the device supports the Read-Modify-Write
19406instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19407
19408@item -mshort-calls
19409@opindex mshort-calls
19410
19411Assume that @code{RJMP} and @code{RCALL} can target the whole
19412program memory.
19413
19414This option is used internally for multilib selection.  It is
19415not an optimization option, and you don't need to set it by hand.
19416
19417@item -msp8
19418@opindex msp8
19419Treat the stack pointer register as an 8-bit register,
19420i.e.@: assume the high byte of the stack pointer is zero.
19421In general, you don't need to set this option by hand.
19422
19423This option is used internally by the compiler to select and
19424build multilibs for architectures @code{avr2} and @code{avr25}.
19425These architectures mix devices with and without @code{SPH}.
19426For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19427the compiler driver adds or removes this option from the compiler
19428proper's command line, because the compiler then knows if the device
19429or architecture has an 8-bit stack pointer and thus no @code{SPH}
19430register or not.
19431
19432@item -mstrict-X
19433@opindex mstrict-X
19434Use address register @code{X} in a way proposed by the hardware.  This means
19435that @code{X} is only used in indirect, post-increment or
19436pre-decrement addressing.
19437
19438Without this option, the @code{X} register may be used in the same way
19439as @code{Y} or @code{Z} which then is emulated by additional
19440instructions.
19441For example, loading a value with @code{X+const} addressing with a
19442small non-negative @code{const < 64} to a register @var{Rn} is
19443performed as
19444
19445@example
19446adiw r26, const   ; X += const
19447ld   @var{Rn}, X        ; @var{Rn} = *X
19448sbiw r26, const   ; X -= const
19449@end example
19450
19451@item -mtiny-stack
19452@opindex mtiny-stack
19453Only change the lower 8@tie{}bits of the stack pointer.
19454
19455@item -mfract-convert-truncate
19456@opindex mfract-convert-truncate
19457Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19458
19459@item -nodevicelib
19460@opindex nodevicelib
19461Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19462
19463@item -nodevicespecs
19464@opindex nodevicespecs
19465Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19466command line.  The user takes responsibility for supplying the sub-processes
19467like compiler proper, assembler and linker with appropriate command line
19468options.  This means that the user has to supply her private device specs
19469file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
19470more need for option @option{-mmcu=@var{mcu}}.
19471
19472This option can also serve as a replacement for the older way of
19473specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19474which contains a folder named @code{device-specs} which contains a specs file named
19475@code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19476
19477@item -Waddr-space-convert
19478@opindex Waddr-space-convert
19479@opindex Wno-addr-space-convert
19480Warn about conversions between address spaces in the case where the
19481resulting address space is not contained in the incoming address space.
19482
19483@item -Wmisspelled-isr
19484@opindex Wmisspelled-isr
19485@opindex Wno-misspelled-isr
19486Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19487Enabled by default.
19488@end table
19489
19490@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19491@cindex @code{EIND}
19492Pointers in the implementation are 16@tie{}bits wide.
19493The address of a function or label is represented as word address so
19494that indirect jumps and calls can target any code address in the
19495range of 64@tie{}Ki words.
19496
19497In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19498bytes of program memory space, there is a special function register called
19499@code{EIND} that serves as most significant part of the target address
19500when @code{EICALL} or @code{EIJMP} instructions are used.
19501
19502Indirect jumps and calls on these devices are handled as follows by
19503the compiler and are subject to some limitations:
19504
19505@itemize @bullet
19506
19507@item
19508The compiler never sets @code{EIND}.
19509
19510@item
19511The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19512instructions or might read @code{EIND} directly in order to emulate an
19513indirect call/jump by means of a @code{RET} instruction.
19514
19515@item
19516The compiler assumes that @code{EIND} never changes during the startup
19517code or during the application. In particular, @code{EIND} is not
19518saved/restored in function or interrupt service routine
19519prologue/epilogue.
19520
19521@item
19522For indirect calls to functions and computed goto, the linker
19523generates @emph{stubs}. Stubs are jump pads sometimes also called
19524@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19525The stub contains a direct jump to the desired address.
19526
19527@item
19528Linker relaxation must be turned on so that the linker generates
19529the stubs correctly in all situations. See the compiler option
19530@option{-mrelax} and the linker option @option{--relax}.
19531There are corner cases where the linker is supposed to generate stubs
19532but aborts without relaxation and without a helpful error message.
19533
19534@item
19535The default linker script is arranged for code with @code{EIND = 0}.
19536If code is supposed to work for a setup with @code{EIND != 0}, a custom
19537linker script has to be used in order to place the sections whose
19538name start with @code{.trampolines} into the segment where @code{EIND}
19539points to.
19540
19541@item
19542The startup code from libgcc never sets @code{EIND}.
19543Notice that startup code is a blend of code from libgcc and AVR-LibC.
19544For the impact of AVR-LibC on @code{EIND}, see the
19545@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19546
19547@item
19548It is legitimate for user-specific startup code to set up @code{EIND}
19549early, for example by means of initialization code located in
19550section @code{.init3}. Such code runs prior to general startup code
19551that initializes RAM and calls constructors, but after the bit
19552of startup code from AVR-LibC that sets @code{EIND} to the segment
19553where the vector table is located.
19554@example
19555#include <avr/io.h>
19556
19557static void
19558__attribute__((section(".init3"),naked,used,no_instrument_function))
19559init3_set_eind (void)
19560@{
19561  __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19562                  "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19563@}
19564@end example
19565
19566@noindent
19567The @code{__trampolines_start} symbol is defined in the linker script.
19568
19569@item
19570Stubs are generated automatically by the linker if
19571the following two conditions are met:
19572@itemize @minus
19573
19574@item The address of a label is taken by means of the @code{gs} modifier
19575(short for @emph{generate stubs}) like so:
19576@example
19577LDI r24, lo8(gs(@var{func}))
19578LDI r25, hi8(gs(@var{func}))
19579@end example
19580@item The final location of that label is in a code segment
19581@emph{outside} the segment where the stubs are located.
19582@end itemize
19583
19584@item
19585The compiler emits such @code{gs} modifiers for code labels in the
19586following situations:
19587@itemize @minus
19588@item Taking address of a function or code label.
19589@item Computed goto.
19590@item If prologue-save function is used, see @option{-mcall-prologues}
19591command-line option.
19592@item Switch/case dispatch tables. If you do not want such dispatch
19593tables you can specify the @option{-fno-jump-tables} command-line option.
19594@item C and C++ constructors/destructors called during startup/shutdown.
19595@item If the tools hit a @code{gs()} modifier explained above.
19596@end itemize
19597
19598@item
19599Jumping to non-symbolic addresses like so is @emph{not} supported:
19600
19601@example
19602int main (void)
19603@{
19604    /* Call function at word address 0x2 */
19605    return ((int(*)(void)) 0x2)();
19606@}
19607@end example
19608
19609Instead, a stub has to be set up, i.e.@: the function has to be called
19610through a symbol (@code{func_4} in the example):
19611
19612@example
19613int main (void)
19614@{
19615    extern int func_4 (void);
19616
19617    /* Call function at byte address 0x4 */
19618    return func_4();
19619@}
19620@end example
19621
19622and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19623Alternatively, @code{func_4} can be defined in the linker script.
19624@end itemize
19625
19626@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19627@cindex @code{RAMPD}
19628@cindex @code{RAMPX}
19629@cindex @code{RAMPY}
19630@cindex @code{RAMPZ}
19631Some AVR devices support memories larger than the 64@tie{}KiB range
19632that can be accessed with 16-bit pointers.  To access memory locations
19633outside this 64@tie{}KiB range, the content of a @code{RAMP}
19634register is used as high part of the address:
19635The @code{X}, @code{Y}, @code{Z} address register is concatenated
19636with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19637register, respectively, to get a wide address. Similarly,
19638@code{RAMPD} is used together with direct addressing.
19639
19640@itemize
19641@item
19642The startup code initializes the @code{RAMP} special function
19643registers with zero.
19644
19645@item
19646If a @ref{AVR Named Address Spaces,named address space} other than
19647generic or @code{__flash} is used, then @code{RAMPZ} is set
19648as needed before the operation.
19649
19650@item
19651If the device supports RAM larger than 64@tie{}KiB and the compiler
19652needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19653is reset to zero after the operation.
19654
19655@item
19656If the device comes with a specific @code{RAMP} register, the ISR
19657prologue/epilogue saves/restores that SFR and initializes it with
19658zero in case the ISR code might (implicitly) use it.
19659
19660@item
19661RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19662If you use inline assembler to read from locations outside the
1966316-bit address range and change one of the @code{RAMP} registers,
19664you must reset it to zero after the access.
19665
19666@end itemize
19667
19668@subsubsection AVR Built-in Macros
19669
19670GCC defines several built-in macros so that the user code can test
19671for the presence or absence of features.  Almost any of the following
19672built-in macros are deduced from device capabilities and thus
19673triggered by the @option{-mmcu=} command-line option.
19674
19675For even more AVR-specific built-in macros see
19676@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19677
19678@table @code
19679
19680@item __AVR_ARCH__
19681Build-in macro that resolves to a decimal number that identifies the
19682architecture and depends on the @option{-mmcu=@var{mcu}} option.
19683Possible values are:
19684
19685@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19686@code{4}, @code{5}, @code{51}, @code{6}
19687
19688for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19689@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19690
19691respectively and
19692
19693@code{100},
19694@code{102}, @code{103}, @code{104},
19695@code{105}, @code{106}, @code{107}
19696
19697for @var{mcu}=@code{avrtiny},
19698@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19699@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19700If @var{mcu} specifies a device, this built-in macro is set
19701accordingly. For example, with @option{-mmcu=atmega8} the macro is
19702defined to @code{4}.
19703
19704@item __AVR_@var{Device}__
19705Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19706the device's name. For example, @option{-mmcu=atmega8} defines the
19707built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19708@code{__AVR_ATtiny261A__}, etc.
19709
19710The built-in macros' names follow
19711the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19712the device name as from the AVR user manual. The difference between
19713@var{Device} in the built-in macro and @var{device} in
19714@option{-mmcu=@var{device}} is that the latter is always lowercase.
19715
19716If @var{device} is not a device but only a core architecture like
19717@samp{avr51}, this macro is not defined.
19718
19719@item __AVR_DEVICE_NAME__
19720Setting @option{-mmcu=@var{device}} defines this built-in macro to
19721the device's name. For example, with @option{-mmcu=atmega8} the macro
19722is defined to @code{atmega8}.
19723
19724If @var{device} is not a device but only a core architecture like
19725@samp{avr51}, this macro is not defined.
19726
19727@item __AVR_XMEGA__
19728The device / architecture belongs to the XMEGA family of devices.
19729
19730@item __AVR_HAVE_ELPM__
19731The device has the @code{ELPM} instruction.
19732
19733@item __AVR_HAVE_ELPMX__
19734The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19735R@var{n},Z+} instructions.
19736
19737@item __AVR_HAVE_MOVW__
19738The device has the @code{MOVW} instruction to perform 16-bit
19739register-register moves.
19740
19741@item __AVR_HAVE_LPMX__
19742The device has the @code{LPM R@var{n},Z} and
19743@code{LPM R@var{n},Z+} instructions.
19744
19745@item __AVR_HAVE_MUL__
19746The device has a hardware multiplier.
19747
19748@item __AVR_HAVE_JMP_CALL__
19749The device has the @code{JMP} and @code{CALL} instructions.
19750This is the case for devices with more than 8@tie{}KiB of program
19751memory.
19752
19753@item __AVR_HAVE_EIJMP_EICALL__
19754@itemx __AVR_3_BYTE_PC__
19755The device has the @code{EIJMP} and @code{EICALL} instructions.
19756This is the case for devices with more than 128@tie{}KiB of program memory.
19757This also means that the program counter
19758(PC) is 3@tie{}bytes wide.
19759
19760@item __AVR_2_BYTE_PC__
19761The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19762with up to 128@tie{}KiB of program memory.
19763
19764@item __AVR_HAVE_8BIT_SP__
19765@itemx __AVR_HAVE_16BIT_SP__
19766The stack pointer (SP) register is treated as 8-bit respectively
1976716-bit register by the compiler.
19768The definition of these macros is affected by @option{-mtiny-stack}.
19769
19770@item __AVR_HAVE_SPH__
19771@itemx __AVR_SP8__
19772The device has the SPH (high part of stack pointer) special function
19773register or has an 8-bit stack pointer, respectively.
19774The definition of these macros is affected by @option{-mmcu=} and
19775in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
19776by @option{-msp8}.
19777
19778@item __AVR_HAVE_RAMPD__
19779@itemx __AVR_HAVE_RAMPX__
19780@itemx __AVR_HAVE_RAMPY__
19781@itemx __AVR_HAVE_RAMPZ__
19782The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
19783@code{RAMPZ} special function register, respectively.
19784
19785@item __NO_INTERRUPTS__
19786This macro reflects the @option{-mno-interrupts} command-line option.
19787
19788@item __AVR_ERRATA_SKIP__
19789@itemx __AVR_ERRATA_SKIP_JMP_CALL__
19790Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19791instructions because of a hardware erratum.  Skip instructions are
19792@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
19793The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
19794set.
19795
19796@item __AVR_ISA_RMW__
19797The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
19798
19799@item __AVR_SFR_OFFSET__=@var{offset}
19800Instructions that can address I/O special function registers directly
19801like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
19802address as if addressed by an instruction to access RAM like @code{LD}
19803or @code{STS}. This offset depends on the device architecture and has
19804to be subtracted from the RAM address in order to get the
19805respective I/O@tie{}address.
19806
19807@item __AVR_SHORT_CALLS__
19808The @option{-mshort-calls} command line option is set.
19809
19810@item __AVR_PM_BASE_ADDRESS__=@var{addr}
19811Some devices support reading from flash memory by means of @code{LD*}
19812instructions.  The flash memory is seen in the data address space
19813at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
19814is not defined, this feature is not available.  If defined,
19815the address space is linear and there is no need to put
19816@code{.rodata} into RAM.  This is handled by the default linker
19817description file, and is currently available for
19818@code{avrtiny} and @code{avrxmega3}.  Even more convenient,
19819there is no need to use address spaces like @code{__flash} or
19820features like attribute @code{progmem} and @code{pgm_read_*}.
19821
19822@item __WITH_AVRLIBC__
19823The compiler is configured to be used together with AVR-Libc.
19824See the @option{--with-avrlibc} configure option.
19825
19826@item __HAVE_DOUBLE_MULTILIB__
19827Defined if @option{-mdouble=} acts as a multilib option.
19828
19829@item __HAVE_DOUBLE32__
19830@itemx __HAVE_DOUBLE64__
19831Defined if the compiler supports 32-bit double resp. 64-bit double.
19832The actual layout is specified by option @option{-mdouble=}.
19833
19834@item __DEFAULT_DOUBLE__
19835The size in bits of @code{double} if @option{-mdouble=} is not set.
19836To test the layout of @code{double} in a program, use the built-in
19837macro @code{__SIZEOF_DOUBLE__}.
19838
19839@item __HAVE_LONG_DOUBLE32__
19840@itemx __HAVE_LONG_DOUBLE64__
19841@itemx __HAVE_LONG_DOUBLE_MULTILIB__
19842@itemx __DEFAULT_LONG_DOUBLE__
19843Same as above, but for @code{long double} instead of @code{double}.
19844
19845@item __WITH_DOUBLE_COMPARISON__
19846Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
19847@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
19848and is defined to @code{2} or @code{3}.
19849
19850@item __WITH_LIBF7_LIBGCC__
19851@itemx __WITH_LIBF7_MATH__
19852@itemx __WITH_LIBF7_MATH_SYMBOLS__
19853Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
19854@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
19855
19856@end table
19857
19858@node Blackfin Options
19859@subsection Blackfin Options
19860@cindex Blackfin Options
19861
19862@table @gcctabopt
19863@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
19864@opindex mcpu=
19865Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
19866can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
19867@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
19868@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
19869@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
19870@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
19871@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
19872@samp{bf561}, @samp{bf592}.
19873
19874The optional @var{sirevision} specifies the silicon revision of the target
19875Blackfin processor.  Any workarounds available for the targeted silicon revision
19876are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
19877If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
19878are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
19879hexadecimal digits representing the major and minor numbers in the silicon
19880revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
19881is not defined.  If @var{sirevision} is @samp{any}, the
19882@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
19883If this optional @var{sirevision} is not used, GCC assumes the latest known
19884silicon revision of the targeted Blackfin processor.
19885
19886GCC defines a preprocessor macro for the specified @var{cpu}.
19887For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
19888provided by libgloss to be linked in if @option{-msim} is not given.
19889
19890Without this option, @samp{bf532} is used as the processor by default.
19891
19892Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
19893only the preprocessor macro is defined.
19894
19895@item -msim
19896@opindex msim
19897Specifies that the program will be run on the simulator.  This causes
19898the simulator BSP provided by libgloss to be linked in.  This option
19899has effect only for @samp{bfin-elf} toolchain.
19900Certain other options, such as @option{-mid-shared-library} and
19901@option{-mfdpic}, imply @option{-msim}.
19902
19903@item -momit-leaf-frame-pointer
19904@opindex momit-leaf-frame-pointer
19905Don't keep the frame pointer in a register for leaf functions.  This
19906avoids the instructions to save, set up and restore frame pointers and
19907makes an extra register available in leaf functions.
19908
19909@item -mspecld-anomaly
19910@opindex mspecld-anomaly
19911When enabled, the compiler ensures that the generated code does not
19912contain speculative loads after jump instructions. If this option is used,
19913@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
19914
19915@item -mno-specld-anomaly
19916@opindex mno-specld-anomaly
19917@opindex mspecld-anomaly
19918Don't generate extra code to prevent speculative loads from occurring.
19919
19920@item -mcsync-anomaly
19921@opindex mcsync-anomaly
19922When enabled, the compiler ensures that the generated code does not
19923contain CSYNC or SSYNC instructions too soon after conditional branches.
19924If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
19925
19926@item -mno-csync-anomaly
19927@opindex mno-csync-anomaly
19928@opindex mcsync-anomaly
19929Don't generate extra code to prevent CSYNC or SSYNC instructions from
19930occurring too soon after a conditional branch.
19931
19932@item -mlow64k
19933@opindex mlow64k
19934When enabled, the compiler is free to take advantage of the knowledge that
19935the entire program fits into the low 64k of memory.
19936
19937@item -mno-low64k
19938@opindex mno-low64k
19939Assume that the program is arbitrarily large.  This is the default.
19940
19941@item -mstack-check-l1
19942@opindex mstack-check-l1
19943Do stack checking using information placed into L1 scratchpad memory by the
19944uClinux kernel.
19945
19946@item -mid-shared-library
19947@opindex mid-shared-library
19948Generate code that supports shared libraries via the library ID method.
19949This allows for execute in place and shared libraries in an environment
19950without virtual memory management.  This option implies @option{-fPIC}.
19951With a @samp{bfin-elf} target, this option implies @option{-msim}.
19952
19953@item -mno-id-shared-library
19954@opindex mno-id-shared-library
19955@opindex mid-shared-library
19956Generate code that doesn't assume ID-based shared libraries are being used.
19957This is the default.
19958
19959@item -mleaf-id-shared-library
19960@opindex mleaf-id-shared-library
19961Generate code that supports shared libraries via the library ID method,
19962but assumes that this library or executable won't link against any other
19963ID shared libraries.  That allows the compiler to use faster code for jumps
19964and calls.
19965
19966@item -mno-leaf-id-shared-library
19967@opindex mno-leaf-id-shared-library
19968@opindex mleaf-id-shared-library
19969Do not assume that the code being compiled won't link against any ID shared
19970libraries.  Slower code is generated for jump and call insns.
19971
19972@item -mshared-library-id=n
19973@opindex mshared-library-id
19974Specifies the identification number of the ID-based shared library being
19975compiled.  Specifying a value of 0 generates more compact code; specifying
19976other values forces the allocation of that number to the current
19977library but is no more space- or time-efficient than omitting this option.
19978
19979@item -msep-data
19980@opindex msep-data
19981Generate code that allows the data segment to be located in a different
19982area of memory from the text segment.  This allows for execute in place in
19983an environment without virtual memory management by eliminating relocations
19984against the text section.
19985
19986@item -mno-sep-data
19987@opindex mno-sep-data
19988@opindex msep-data
19989Generate code that assumes that the data segment follows the text segment.
19990This is the default.
19991
19992@item -mlong-calls
19993@itemx -mno-long-calls
19994@opindex mlong-calls
19995@opindex mno-long-calls
19996Tells the compiler to perform function calls by first loading the
19997address of the function into a register and then performing a subroutine
19998call on this register.  This switch is needed if the target function
19999lies outside of the 24-bit addressing range of the offset-based
20000version of subroutine call instruction.
20001
20002This feature is not enabled by default.  Specifying
20003@option{-mno-long-calls} restores the default behavior.  Note these
20004switches have no effect on how the compiler generates code to handle
20005function calls via function pointers.
20006
20007@item -mfast-fp
20008@opindex mfast-fp
20009Link with the fast floating-point library. This library relaxes some of
20010the IEEE floating-point standard's rules for checking inputs against
20011Not-a-Number (NAN), in the interest of performance.
20012
20013@item -minline-plt
20014@opindex minline-plt
20015Enable inlining of PLT entries in function calls to functions that are
20016not known to bind locally.  It has no effect without @option{-mfdpic}.
20017
20018@item -mmulticore
20019@opindex mmulticore
20020Build a standalone application for multicore Blackfin processors.
20021This option causes proper start files and link scripts supporting
20022multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
20023It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
20024
20025This option can be used with @option{-mcorea} or @option{-mcoreb}, which
20026selects the one-application-per-core programming model.  Without
20027@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
20028programming model is used. In this model, the main function of Core B
20029should be named as @code{coreb_main}.
20030
20031If this option is not used, the single-core application programming
20032model is used.
20033
20034@item -mcorea
20035@opindex mcorea
20036Build a standalone application for Core A of BF561 when using
20037the one-application-per-core programming model. Proper start files
20038and link scripts are used to support Core A, and the macro
20039@code{__BFIN_COREA} is defined.
20040This option can only be used in conjunction with @option{-mmulticore}.
20041
20042@item -mcoreb
20043@opindex mcoreb
20044Build a standalone application for Core B of BF561 when using
20045the one-application-per-core programming model. Proper start files
20046and link scripts are used to support Core B, and the macro
20047@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
20048should be used instead of @code{main}.
20049This option can only be used in conjunction with @option{-mmulticore}.
20050
20051@item -msdram
20052@opindex msdram
20053Build a standalone application for SDRAM. Proper start files and
20054link scripts are used to put the application into SDRAM, and the macro
20055@code{__BFIN_SDRAM} is defined.
20056The loader should initialize SDRAM before loading the application.
20057
20058@item -micplb
20059@opindex micplb
20060Assume that ICPLBs are enabled at run time.  This has an effect on certain
20061anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
20062are enabled; for standalone applications the default is off.
20063@end table
20064
20065@node C6X Options
20066@subsection C6X Options
20067@cindex C6X Options
20068
20069@table @gcctabopt
20070@item -march=@var{name}
20071@opindex march
20072This specifies the name of the target architecture.  GCC uses this
20073name to determine what kind of instructions it can emit when generating
20074assembly code.  Permissible names are: @samp{c62x},
20075@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
20076
20077@item -mbig-endian
20078@opindex mbig-endian
20079Generate code for a big-endian target.
20080
20081@item -mlittle-endian
20082@opindex mlittle-endian
20083Generate code for a little-endian target.  This is the default.
20084
20085@item -msim
20086@opindex msim
20087Choose startup files and linker script suitable for the simulator.
20088
20089@item -msdata=default
20090@opindex msdata=default
20091Put small global and static data in the @code{.neardata} section,
20092which is pointed to by register @code{B14}.  Put small uninitialized
20093global and static data in the @code{.bss} section, which is adjacent
20094to the @code{.neardata} section.  Put small read-only data into the
20095@code{.rodata} section.  The corresponding sections used for large
20096pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
20097
20098@item -msdata=all
20099@opindex msdata=all
20100Put all data, not just small objects, into the sections reserved for
20101small data, and use addressing relative to the @code{B14} register to
20102access them.
20103
20104@item -msdata=none
20105@opindex msdata=none
20106Make no use of the sections reserved for small data, and use absolute
20107addresses to access all data.  Put all initialized global and static
20108data in the @code{.fardata} section, and all uninitialized data in the
20109@code{.far} section.  Put all constant data into the @code{.const}
20110section.
20111@end table
20112
20113@node CRIS Options
20114@subsection CRIS Options
20115@cindex CRIS Options
20116
20117These options are defined specifically for the CRIS ports.
20118
20119@table @gcctabopt
20120@item -march=@var{architecture-type}
20121@itemx -mcpu=@var{architecture-type}
20122@opindex march
20123@opindex mcpu
20124Generate code for the specified architecture.  The choices for
20125@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
20126respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
20127Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
20128@samp{v10}.
20129
20130@item -mtune=@var{architecture-type}
20131@opindex mtune
20132Tune to @var{architecture-type} everything applicable about the generated
20133code, except for the ABI and the set of available instructions.  The
20134choices for @var{architecture-type} are the same as for
20135@option{-march=@var{architecture-type}}.
20136
20137@item -mmax-stack-frame=@var{n}
20138@opindex mmax-stack-frame
20139Warn when the stack frame of a function exceeds @var{n} bytes.
20140
20141@item -metrax4
20142@itemx -metrax100
20143@opindex metrax4
20144@opindex metrax100
20145The options @option{-metrax4} and @option{-metrax100} are synonyms for
20146@option{-march=v3} and @option{-march=v8} respectively.
20147
20148@item -mmul-bug-workaround
20149@itemx -mno-mul-bug-workaround
20150@opindex mmul-bug-workaround
20151@opindex mno-mul-bug-workaround
20152Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20153models where it applies.  This option is active by default.
20154
20155@item -mpdebug
20156@opindex mpdebug
20157Enable CRIS-specific verbose debug-related information in the assembly
20158code.  This option also has the effect of turning off the @samp{#NO_APP}
20159formatted-code indicator to the assembler at the beginning of the
20160assembly file.
20161
20162@item -mcc-init
20163@opindex mcc-init
20164Do not use condition-code results from previous instruction; always emit
20165compare and test instructions before use of condition codes.
20166
20167@item -mno-side-effects
20168@opindex mno-side-effects
20169@opindex mside-effects
20170Do not emit instructions with side effects in addressing modes other than
20171post-increment.
20172
20173@item -mstack-align
20174@itemx -mno-stack-align
20175@itemx -mdata-align
20176@itemx -mno-data-align
20177@itemx -mconst-align
20178@itemx -mno-const-align
20179@opindex mstack-align
20180@opindex mno-stack-align
20181@opindex mdata-align
20182@opindex mno-data-align
20183@opindex mconst-align
20184@opindex mno-const-align
20185These options (@samp{no-} options) arrange (eliminate arrangements) for the
20186stack frame, individual data and constants to be aligned for the maximum
20187single data access size for the chosen CPU model.  The default is to
20188arrange for 32-bit alignment.  ABI details such as structure layout are
20189not affected by these options.
20190
20191@item -m32-bit
20192@itemx -m16-bit
20193@itemx -m8-bit
20194@opindex m32-bit
20195@opindex m16-bit
20196@opindex m8-bit
20197Similar to the stack- data- and const-align options above, these options
20198arrange for stack frame, writable data and constants to all be 32-bit,
2019916-bit or 8-bit aligned.  The default is 32-bit alignment.
20200
20201@item -mno-prologue-epilogue
20202@itemx -mprologue-epilogue
20203@opindex mno-prologue-epilogue
20204@opindex mprologue-epilogue
20205With @option{-mno-prologue-epilogue}, the normal function prologue and
20206epilogue which set up the stack frame are omitted and no return
20207instructions or return sequences are generated in the code.  Use this
20208option only together with visual inspection of the compiled code: no
20209warnings or errors are generated when call-saved registers must be saved,
20210or storage for local variables needs to be allocated.
20211
20212@item -mno-gotplt
20213@itemx -mgotplt
20214@opindex mno-gotplt
20215@opindex mgotplt
20216With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20217instruction sequences that load addresses for functions from the PLT part
20218of the GOT rather than (traditional on other architectures) calls to the
20219PLT@.  The default is @option{-mgotplt}.
20220
20221@item -melf
20222@opindex melf
20223Legacy no-op option only recognized with the cris-axis-elf and
20224cris-axis-linux-gnu targets.
20225
20226@item -mlinux
20227@opindex mlinux
20228Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20229
20230@item -sim
20231@opindex sim
20232This option, recognized for the cris-axis-elf, arranges
20233to link with input-output functions from a simulator library.  Code,
20234initialized data and zero-initialized data are allocated consecutively.
20235
20236@item -sim2
20237@opindex sim2
20238Like @option{-sim}, but pass linker options to locate initialized data at
202390x40000000 and zero-initialized data at 0x80000000.
20240@end table
20241
20242@node CR16 Options
20243@subsection CR16 Options
20244@cindex CR16 Options
20245
20246These options are defined specifically for the CR16 ports.
20247
20248@table @gcctabopt
20249
20250@item -mmac
20251@opindex mmac
20252Enable the use of multiply-accumulate instructions. Disabled by default.
20253
20254@item -mcr16cplus
20255@itemx -mcr16c
20256@opindex mcr16cplus
20257@opindex mcr16c
20258Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20259is default.
20260
20261@item -msim
20262@opindex msim
20263Links the library libsim.a which is in compatible with simulator. Applicable
20264to ELF compiler only.
20265
20266@item -mint32
20267@opindex mint32
20268Choose integer type as 32-bit wide.
20269
20270@item -mbit-ops
20271@opindex mbit-ops
20272Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20273
20274@item -mdata-model=@var{model}
20275@opindex mdata-model
20276Choose a data model. The choices for @var{model} are @samp{near},
20277@samp{far} or @samp{medium}. @samp{medium} is default.
20278However, @samp{far} is not valid with @option{-mcr16c}, as the
20279CR16C architecture does not support the far data model.
20280@end table
20281
20282@node C-SKY Options
20283@subsection C-SKY Options
20284@cindex C-SKY Options
20285
20286GCC supports these options when compiling for C-SKY V2 processors.
20287
20288@table @gcctabopt
20289
20290@item -march=@var{arch}
20291@opindex march=
20292Specify the C-SKY target architecture.  Valid values for @var{arch} are:
20293@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20294The default is @samp{ck810}.
20295
20296@item -mcpu=@var{cpu}
20297@opindex mcpu=
20298Specify the C-SKY target processor.  Valid values for @var{cpu} are:
20299@samp{ck801}, @samp{ck801t},
20300@samp{ck802}, @samp{ck802t}, @samp{ck802j},
20301@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20302@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20303@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20304@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20305@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20306@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20307@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20308@samp{ck803eftr1}, @samp{ck803efhtr1},
20309@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20310@samp{ck803sef}, @samp{ck803seft},
20311@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20312@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20313@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20314@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20315
20316@item -mbig-endian
20317@opindex mbig-endian
20318@itemx -EB
20319@opindex EB
20320@itemx -mlittle-endian
20321@opindex mlittle-endian
20322@itemx -EL
20323@opindex EL
20324
20325Select big- or little-endian code.  The default is little-endian.
20326
20327@item -mhard-float
20328@opindex mhard-float
20329@itemx -msoft-float
20330@opindex msoft-float
20331
20332Select hardware or software floating-point implementations.
20333The default is soft float.
20334
20335@item -mdouble-float
20336@itemx -mno-double-float
20337@opindex mdouble-float
20338When @option{-mhard-float} is in effect, enable generation of
20339double-precision float instructions.  This is the default except
20340when compiling for CK803.
20341
20342@item -mfdivdu
20343@itemx -mno-fdivdu
20344@opindex mfdivdu
20345When @option{-mhard-float} is in effect, enable generation of
20346@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20347This is the default except when compiling for CK803.
20348
20349@item -mfpu=@var{fpu}
20350@opindex mfpu=
20351Select the floating-point processor.  This option can only be used with
20352@option{-mhard-float}.
20353Values for @var{fpu} are
20354@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20355@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20356@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20357
20358@item -melrw
20359@itemx -mno-elrw
20360@opindex melrw
20361Enable the extended @code{lrw} instruction.  This option defaults to on
20362for CK801 and off otherwise.
20363
20364@item -mistack
20365@itemx -mno-istack
20366@opindex mistack
20367Enable interrupt stack instructions; the default is off.
20368
20369The @option{-mistack} option is required to handle the
20370@code{interrupt} and @code{isr} function attributes
20371(@pxref{C-SKY Function Attributes}).
20372
20373@item -mmp
20374@opindex mmp
20375Enable multiprocessor instructions; the default is off.
20376
20377@item -mcp
20378@opindex mcp
20379Enable coprocessor instructions; the default is off.
20380
20381@item -mcache
20382@opindex mcache
20383Enable coprocessor instructions; the default is off.
20384
20385@item -msecurity
20386@opindex msecurity
20387Enable C-SKY security instructions; the default is off.
20388
20389@item -mtrust
20390@opindex mtrust
20391Enable C-SKY trust instructions; the default is off.
20392
20393@item -mdsp
20394@opindex mdsp
20395@itemx -medsp
20396@opindex medsp
20397@itemx -mvdsp
20398@opindex mvdsp
20399Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20400All of these options default to off.
20401
20402@item -mdiv
20403@itemx -mno-div
20404@opindex mdiv
20405Generate divide instructions.  Default is off.
20406
20407@item -msmart
20408@itemx -mno-smart
20409@opindex msmart
20410Generate code for Smart Mode, using only registers numbered 0-7 to allow
20411use of 16-bit instructions.  This option is ignored for CK801 where this
20412is the required behavior, and it defaults to on for CK802.
20413For other targets, the default is off.
20414
20415@item -mhigh-registers
20416@itemx -mno-high-registers
20417@opindex mhigh-registers
20418Generate code using the high registers numbered 16-31.  This option
20419is not supported on CK801, CK802, or CK803, and is enabled by default
20420for other processors.
20421
20422@item -manchor
20423@itemx -mno-anchor
20424@opindex manchor
20425Generate code using global anchor symbol addresses.
20426
20427@item -mpushpop
20428@itemx -mno-pushpop
20429@opindex mpushpop
20430Generate code using @code{push} and @code{pop} instructions.  This option
20431defaults to on.
20432
20433@item -mmultiple-stld
20434@itemx -mstm
20435@itemx -mno-multiple-stld
20436@itemx -mno-stm
20437@opindex mmultiple-stld
20438Generate code using @code{stm} and @code{ldm} instructions.  This option
20439isn't supported on CK801 but is enabled by default on other processors.
20440
20441@item -mconstpool
20442@itemx -mno-constpool
20443@opindex mconstpool
20444Create constant pools in the compiler instead of deferring it to the
20445assembler.  This option is the default and required for correct code
20446generation on CK801 and CK802, and is optional on other processors.
20447
20448@item -mstack-size
20449@item -mno-stack-size
20450@opindex mstack-size
20451Emit @code{.stack_size} directives for each function in the assembly
20452output.  This option defaults to off.
20453
20454@item -mccrt
20455@itemx -mno-ccrt
20456@opindex mccrt
20457Generate code for the C-SKY compiler runtime instead of libgcc.  This
20458option defaults to off.
20459
20460@item -mbranch-cost=@var{n}
20461@opindex mbranch-cost=
20462Set the branch costs to roughly @code{n} instructions.  The default is 1.
20463
20464@item -msched-prolog
20465@itemx -mno-sched-prolog
20466@opindex msched-prolog
20467Permit scheduling of function prologue and epilogue sequences.  Using
20468this option can result in code that is not compliant with the C-SKY V2 ABI
20469prologue requirements and that cannot be debugged or backtraced.
20470It is disabled by default.
20471
20472@end table
20473
20474@node Darwin Options
20475@subsection Darwin Options
20476@cindex Darwin options
20477
20478These options are defined for all architectures running the Darwin operating
20479system.
20480
20481FSF GCC on Darwin does not create ``fat'' object files; it creates
20482an object file for the single architecture that GCC was built to
20483target.  Apple's GCC on Darwin does create ``fat'' files if multiple
20484@option{-arch} options are used; it does so by running the compiler or
20485linker multiple times and joining the results together with
20486@file{lipo}.
20487
20488The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20489@samp{i686}) is determined by the flags that specify the ISA
20490that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
20491@option{-force_cpusubtype_ALL} option can be used to override this.
20492
20493The Darwin tools vary in their behavior when presented with an ISA
20494mismatch.  The assembler, @file{as}, only permits instructions to
20495be used that are valid for the subtype of the file it is generating,
20496so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20497The linker for shared libraries, @file{/usr/bin/libtool}, fails
20498and prints an error if asked to create a shared library with a less
20499restrictive subtype than its input files (for instance, trying to put
20500a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
20501for executables, @command{ld}, quietly gives the executable the most
20502restrictive subtype of any of its input files.
20503
20504@table @gcctabopt
20505@item -F@var{dir}
20506@opindex F
20507Add the framework directory @var{dir} to the head of the list of
20508directories to be searched for header files.  These directories are
20509interleaved with those specified by @option{-I} options and are
20510scanned in a left-to-right order.
20511
20512A framework directory is a directory with frameworks in it.  A
20513framework is a directory with a @file{Headers} and/or
20514@file{PrivateHeaders} directory contained directly in it that ends
20515in @file{.framework}.  The name of a framework is the name of this
20516directory excluding the @file{.framework}.  Headers associated with
20517the framework are found in one of those two directories, with
20518@file{Headers} being searched first.  A subframework is a framework
20519directory that is in a framework's @file{Frameworks} directory.
20520Includes of subframework headers can only appear in a header of a
20521framework that contains the subframework, or in a sibling subframework
20522header.  Two subframeworks are siblings if they occur in the same
20523framework.  A subframework should not have the same name as a
20524framework; a warning is issued if this is violated.  Currently a
20525subframework cannot have subframeworks; in the future, the mechanism
20526may be extended to support this.  The standard frameworks can be found
20527in @file{/System/Library/Frameworks} and
20528@file{/Library/Frameworks}.  An example include looks like
20529@code{#include <Framework/header.h>}, where @file{Framework} denotes
20530the name of the framework and @file{header.h} is found in the
20531@file{PrivateHeaders} or @file{Headers} directory.
20532
20533@item -iframework@var{dir}
20534@opindex iframework
20535Like @option{-F} except the directory is a treated as a system
20536directory.  The main difference between this @option{-iframework} and
20537@option{-F} is that with @option{-iframework} the compiler does not
20538warn about constructs contained within header files found via
20539@var{dir}.  This option is valid only for the C family of languages.
20540
20541@item -gused
20542@opindex gused
20543Emit debugging information for symbols that are used.  For stabs
20544debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20545This is by default ON@.
20546
20547@item -gfull
20548@opindex gfull
20549Emit debugging information for all symbols and types.
20550
20551@item -mmacosx-version-min=@var{version}
20552The earliest version of MacOS X that this executable will run on
20553is @var{version}.  Typical values of @var{version} include @code{10.1},
20554@code{10.2}, and @code{10.3.9}.
20555
20556If the compiler was built to use the system's headers by default,
20557then the default for this option is the system version on which the
20558compiler is running, otherwise the default is to make choices that
20559are compatible with as many systems and code bases as possible.
20560
20561@item -mkernel
20562@opindex mkernel
20563Enable kernel development mode.  The @option{-mkernel} option sets
20564@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20565@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20566@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20567applicable.  This mode also sets @option{-mno-altivec},
20568@option{-msoft-float}, @option{-fno-builtin} and
20569@option{-mlong-branch} for PowerPC targets.
20570
20571@item -mone-byte-bool
20572@opindex mone-byte-bool
20573Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20574By default @code{sizeof(bool)} is @code{4} when compiling for
20575Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20576option has no effect on x86.
20577
20578@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20579to generate code that is not binary compatible with code generated
20580without that switch.  Using this switch may require recompiling all
20581other modules in a program, including system libraries.  Use this
20582switch to conform to a non-default data model.
20583
20584@item -mfix-and-continue
20585@itemx -ffix-and-continue
20586@itemx -findirect-data
20587@opindex mfix-and-continue
20588@opindex ffix-and-continue
20589@opindex findirect-data
20590Generate code suitable for fast turnaround development, such as to
20591allow GDB to dynamically load @file{.o} files into already-running
20592programs.  @option{-findirect-data} and @option{-ffix-and-continue}
20593are provided for backwards compatibility.
20594
20595@item -all_load
20596@opindex all_load
20597Loads all members of static archive libraries.
20598See man ld(1) for more information.
20599
20600@item -arch_errors_fatal
20601@opindex arch_errors_fatal
20602Cause the errors having to do with files that have the wrong architecture
20603to be fatal.
20604
20605@item -bind_at_load
20606@opindex bind_at_load
20607Causes the output file to be marked such that the dynamic linker will
20608bind all undefined references when the file is loaded or launched.
20609
20610@item -bundle
20611@opindex bundle
20612Produce a Mach-o bundle format file.
20613See man ld(1) for more information.
20614
20615@item -bundle_loader @var{executable}
20616@opindex bundle_loader
20617This option specifies the @var{executable} that will load the build
20618output file being linked.  See man ld(1) for more information.
20619
20620@item -dynamiclib
20621@opindex dynamiclib
20622When passed this option, GCC produces a dynamic library instead of
20623an executable when linking, using the Darwin @file{libtool} command.
20624
20625@item -force_cpusubtype_ALL
20626@opindex force_cpusubtype_ALL
20627This causes GCC's output file to have the @samp{ALL} subtype, instead of
20628one controlled by the @option{-mcpu} or @option{-march} option.
20629
20630@item -allowable_client  @var{client_name}
20631@itemx -client_name
20632@itemx -compatibility_version
20633@itemx -current_version
20634@itemx -dead_strip
20635@itemx -dependency-file
20636@itemx -dylib_file
20637@itemx -dylinker_install_name
20638@itemx -dynamic
20639@itemx -exported_symbols_list
20640@itemx -filelist
20641@need 800
20642@itemx -flat_namespace
20643@itemx -force_flat_namespace
20644@itemx -headerpad_max_install_names
20645@itemx -image_base
20646@itemx -init
20647@itemx -install_name
20648@itemx -keep_private_externs
20649@itemx -multi_module
20650@itemx -multiply_defined
20651@itemx -multiply_defined_unused
20652@need 800
20653@itemx -noall_load
20654@itemx -no_dead_strip_inits_and_terms
20655@itemx -nofixprebinding
20656@itemx -nomultidefs
20657@itemx -noprebind
20658@itemx -noseglinkedit
20659@itemx -pagezero_size
20660@itemx -prebind
20661@itemx -prebind_all_twolevel_modules
20662@itemx -private_bundle
20663@need 800
20664@itemx -read_only_relocs
20665@itemx -sectalign
20666@itemx -sectobjectsymbols
20667@itemx -whyload
20668@itemx -seg1addr
20669@itemx -sectcreate
20670@itemx -sectobjectsymbols
20671@itemx -sectorder
20672@itemx -segaddr
20673@itemx -segs_read_only_addr
20674@need 800
20675@itemx -segs_read_write_addr
20676@itemx -seg_addr_table
20677@itemx -seg_addr_table_filename
20678@itemx -seglinkedit
20679@itemx -segprot
20680@itemx -segs_read_only_addr
20681@itemx -segs_read_write_addr
20682@itemx -single_module
20683@itemx -static
20684@itemx -sub_library
20685@need 800
20686@itemx -sub_umbrella
20687@itemx -twolevel_namespace
20688@itemx -umbrella
20689@itemx -undefined
20690@itemx -unexported_symbols_list
20691@itemx -weak_reference_mismatches
20692@itemx -whatsloaded
20693@opindex allowable_client
20694@opindex client_name
20695@opindex compatibility_version
20696@opindex current_version
20697@opindex dead_strip
20698@opindex dependency-file
20699@opindex dylib_file
20700@opindex dylinker_install_name
20701@opindex dynamic
20702@opindex exported_symbols_list
20703@opindex filelist
20704@opindex flat_namespace
20705@opindex force_flat_namespace
20706@opindex headerpad_max_install_names
20707@opindex image_base
20708@opindex init
20709@opindex install_name
20710@opindex keep_private_externs
20711@opindex multi_module
20712@opindex multiply_defined
20713@opindex multiply_defined_unused
20714@opindex noall_load
20715@opindex no_dead_strip_inits_and_terms
20716@opindex nofixprebinding
20717@opindex nomultidefs
20718@opindex noprebind
20719@opindex noseglinkedit
20720@opindex pagezero_size
20721@opindex prebind
20722@opindex prebind_all_twolevel_modules
20723@opindex private_bundle
20724@opindex read_only_relocs
20725@opindex sectalign
20726@opindex sectobjectsymbols
20727@opindex whyload
20728@opindex seg1addr
20729@opindex sectcreate
20730@opindex sectobjectsymbols
20731@opindex sectorder
20732@opindex segaddr
20733@opindex segs_read_only_addr
20734@opindex segs_read_write_addr
20735@opindex seg_addr_table
20736@opindex seg_addr_table_filename
20737@opindex seglinkedit
20738@opindex segprot
20739@opindex segs_read_only_addr
20740@opindex segs_read_write_addr
20741@opindex single_module
20742@opindex static
20743@opindex sub_library
20744@opindex sub_umbrella
20745@opindex twolevel_namespace
20746@opindex umbrella
20747@opindex undefined
20748@opindex unexported_symbols_list
20749@opindex weak_reference_mismatches
20750@opindex whatsloaded
20751These options are passed to the Darwin linker.  The Darwin linker man page
20752describes them in detail.
20753@end table
20754
20755@node DEC Alpha Options
20756@subsection DEC Alpha Options
20757
20758These @samp{-m} options are defined for the DEC Alpha implementations:
20759
20760@table @gcctabopt
20761@item -mno-soft-float
20762@itemx -msoft-float
20763@opindex mno-soft-float
20764@opindex msoft-float
20765Use (do not use) the hardware floating-point instructions for
20766floating-point operations.  When @option{-msoft-float} is specified,
20767functions in @file{libgcc.a} are used to perform floating-point
20768operations.  Unless they are replaced by routines that emulate the
20769floating-point operations, or compiled in such a way as to call such
20770emulations routines, these routines issue floating-point
20771operations.   If you are compiling for an Alpha without floating-point
20772operations, you must ensure that the library is built so as not to call
20773them.
20774
20775Note that Alpha implementations without floating-point operations are
20776required to have floating-point registers.
20777
20778@item -mfp-reg
20779@itemx -mno-fp-regs
20780@opindex mfp-reg
20781@opindex mno-fp-regs
20782Generate code that uses (does not use) the floating-point register set.
20783@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
20784register set is not used, floating-point operands are passed in integer
20785registers as if they were integers and floating-point results are passed
20786in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
20787so any function with a floating-point argument or return value called by code
20788compiled with @option{-mno-fp-regs} must also be compiled with that
20789option.
20790
20791A typical use of this option is building a kernel that does not use,
20792and hence need not save and restore, any floating-point registers.
20793
20794@item -mieee
20795@opindex mieee
20796The Alpha architecture implements floating-point hardware optimized for
20797maximum performance.  It is mostly compliant with the IEEE floating-point
20798standard.  However, for full compliance, software assistance is
20799required.  This option generates code fully IEEE-compliant code
20800@emph{except} that the @var{inexact-flag} is not maintained (see below).
20801If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
20802defined during compilation.  The resulting code is less efficient but is
20803able to correctly support denormalized numbers and exceptional IEEE
20804values such as not-a-number and plus/minus infinity.  Other Alpha
20805compilers call this option @option{-ieee_with_no_inexact}.
20806
20807@item -mieee-with-inexact
20808@opindex mieee-with-inexact
20809This is like @option{-mieee} except the generated code also maintains
20810the IEEE @var{inexact-flag}.  Turning on this option causes the
20811generated code to implement fully-compliant IEEE math.  In addition to
20812@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
20813macro.  On some Alpha implementations the resulting code may execute
20814significantly slower than the code generated by default.  Since there is
20815very little code that depends on the @var{inexact-flag}, you should
20816normally not specify this option.  Other Alpha compilers call this
20817option @option{-ieee_with_inexact}.
20818
20819@item -mfp-trap-mode=@var{trap-mode}
20820@opindex mfp-trap-mode
20821This option controls what floating-point related traps are enabled.
20822Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
20823The trap mode can be set to one of four values:
20824
20825@table @samp
20826@item n
20827This is the default (normal) setting.  The only traps that are enabled
20828are the ones that cannot be disabled in software (e.g., division by zero
20829trap).
20830
20831@item u
20832In addition to the traps enabled by @samp{n}, underflow traps are enabled
20833as well.
20834
20835@item su
20836Like @samp{u}, but the instructions are marked to be safe for software
20837completion (see Alpha architecture manual for details).
20838
20839@item sui
20840Like @samp{su}, but inexact traps are enabled as well.
20841@end table
20842
20843@item -mfp-rounding-mode=@var{rounding-mode}
20844@opindex mfp-rounding-mode
20845Selects the IEEE rounding mode.  Other Alpha compilers call this option
20846@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
20847of:
20848
20849@table @samp
20850@item n
20851Normal IEEE rounding mode.  Floating-point numbers are rounded towards
20852the nearest machine number or towards the even machine number in case
20853of a tie.
20854
20855@item m
20856Round towards minus infinity.
20857
20858@item c
20859Chopped rounding mode.  Floating-point numbers are rounded towards zero.
20860
20861@item d
20862Dynamic rounding mode.  A field in the floating-point control register
20863(@var{fpcr}, see Alpha architecture reference manual) controls the
20864rounding mode in effect.  The C library initializes this register for
20865rounding towards plus infinity.  Thus, unless your program modifies the
20866@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
20867@end table
20868
20869@item -mtrap-precision=@var{trap-precision}
20870@opindex mtrap-precision
20871In the Alpha architecture, floating-point traps are imprecise.  This
20872means without software assistance it is impossible to recover from a
20873floating trap and program execution normally needs to be terminated.
20874GCC can generate code that can assist operating system trap handlers
20875in determining the exact location that caused a floating-point trap.
20876Depending on the requirements of an application, different levels of
20877precisions can be selected:
20878
20879@table @samp
20880@item p
20881Program precision.  This option is the default and means a trap handler
20882can only identify which program caused a floating-point exception.
20883
20884@item f
20885Function precision.  The trap handler can determine the function that
20886caused a floating-point exception.
20887
20888@item i
20889Instruction precision.  The trap handler can determine the exact
20890instruction that caused a floating-point exception.
20891@end table
20892
20893Other Alpha compilers provide the equivalent options called
20894@option{-scope_safe} and @option{-resumption_safe}.
20895
20896@item -mieee-conformant
20897@opindex mieee-conformant
20898This option marks the generated code as IEEE conformant.  You must not
20899use this option unless you also specify @option{-mtrap-precision=i} and either
20900@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
20901is to emit the line @samp{.eflag 48} in the function prologue of the
20902generated assembly file.
20903
20904@item -mbuild-constants
20905@opindex mbuild-constants
20906Normally GCC examines a 32- or 64-bit integer constant to
20907see if it can construct it from smaller constants in two or three
20908instructions.  If it cannot, it outputs the constant as a literal and
20909generates code to load it from the data segment at run time.
20910
20911Use this option to require GCC to construct @emph{all} integer constants
20912using code, even if it takes more instructions (the maximum is six).
20913
20914You typically use this option to build a shared library dynamic
20915loader.  Itself a shared library, it must relocate itself in memory
20916before it can find the variables and constants in its own data segment.
20917
20918@item -mbwx
20919@itemx -mno-bwx
20920@itemx -mcix
20921@itemx -mno-cix
20922@itemx -mfix
20923@itemx -mno-fix
20924@itemx -mmax
20925@itemx -mno-max
20926@opindex mbwx
20927@opindex mno-bwx
20928@opindex mcix
20929@opindex mno-cix
20930@opindex mfix
20931@opindex mno-fix
20932@opindex mmax
20933@opindex mno-max
20934Indicate whether GCC should generate code to use the optional BWX,
20935CIX, FIX and MAX instruction sets.  The default is to use the instruction
20936sets supported by the CPU type specified via @option{-mcpu=} option or that
20937of the CPU on which GCC was built if none is specified.
20938
20939@item -mfloat-vax
20940@itemx -mfloat-ieee
20941@opindex mfloat-vax
20942@opindex mfloat-ieee
20943Generate code that uses (does not use) VAX F and G floating-point
20944arithmetic instead of IEEE single and double precision.
20945
20946@item -mexplicit-relocs
20947@itemx -mno-explicit-relocs
20948@opindex mexplicit-relocs
20949@opindex mno-explicit-relocs
20950Older Alpha assemblers provided no way to generate symbol relocations
20951except via assembler macros.  Use of these macros does not allow
20952optimal instruction scheduling.  GNU binutils as of version 2.12
20953supports a new syntax that allows the compiler to explicitly mark
20954which relocations should apply to which instructions.  This option
20955is mostly useful for debugging, as GCC detects the capabilities of
20956the assembler when it is built and sets the default accordingly.
20957
20958@item -msmall-data
20959@itemx -mlarge-data
20960@opindex msmall-data
20961@opindex mlarge-data
20962When @option{-mexplicit-relocs} is in effect, static data is
20963accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
20964is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
20965(the @code{.sdata} and @code{.sbss} sections) and are accessed via
2096616-bit relocations off of the @code{$gp} register.  This limits the
20967size of the small data area to 64KB, but allows the variables to be
20968directly accessed via a single instruction.
20969
20970The default is @option{-mlarge-data}.  With this option the data area
20971is limited to just below 2GB@.  Programs that require more than 2GB of
20972data must use @code{malloc} or @code{mmap} to allocate the data in the
20973heap instead of in the program's data segment.
20974
20975When generating code for shared libraries, @option{-fpic} implies
20976@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
20977
20978@item -msmall-text
20979@itemx -mlarge-text
20980@opindex msmall-text
20981@opindex mlarge-text
20982When @option{-msmall-text} is used, the compiler assumes that the
20983code of the entire program (or shared library) fits in 4MB, and is
20984thus reachable with a branch instruction.  When @option{-msmall-data}
20985is used, the compiler can assume that all local symbols share the
20986same @code{$gp} value, and thus reduce the number of instructions
20987required for a function call from 4 to 1.
20988
20989The default is @option{-mlarge-text}.
20990
20991@item -mcpu=@var{cpu_type}
20992@opindex mcpu
20993Set the instruction set and instruction scheduling parameters for
20994machine type @var{cpu_type}.  You can specify either the @samp{EV}
20995style name or the corresponding chip number.  GCC supports scheduling
20996parameters for the EV4, EV5 and EV6 family of processors and
20997chooses the default values for the instruction set from the processor
20998you specify.  If you do not specify a processor type, GCC defaults
20999to the processor on which the compiler was built.
21000
21001Supported values for @var{cpu_type} are
21002
21003@table @samp
21004@item ev4
21005@itemx ev45
21006@itemx 21064
21007Schedules as an EV4 and has no instruction set extensions.
21008
21009@item ev5
21010@itemx 21164
21011Schedules as an EV5 and has no instruction set extensions.
21012
21013@item ev56
21014@itemx 21164a
21015Schedules as an EV5 and supports the BWX extension.
21016
21017@item pca56
21018@itemx 21164pc
21019@itemx 21164PC
21020Schedules as an EV5 and supports the BWX and MAX extensions.
21021
21022@item ev6
21023@itemx 21264
21024Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
21025
21026@item ev67
21027@itemx 21264a
21028Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
21029@end table
21030
21031Native toolchains also support the value @samp{native},
21032which selects the best architecture option for the host processor.
21033@option{-mcpu=native} has no effect if GCC does not recognize
21034the processor.
21035
21036@item -mtune=@var{cpu_type}
21037@opindex mtune
21038Set only the instruction scheduling parameters for machine type
21039@var{cpu_type}.  The instruction set is not changed.
21040
21041Native toolchains also support the value @samp{native},
21042which selects the best architecture option for the host processor.
21043@option{-mtune=native} has no effect if GCC does not recognize
21044the processor.
21045
21046@item -mmemory-latency=@var{time}
21047@opindex mmemory-latency
21048Sets the latency the scheduler should assume for typical memory
21049references as seen by the application.  This number is highly
21050dependent on the memory access patterns used by the application
21051and the size of the external cache on the machine.
21052
21053Valid options for @var{time} are
21054
21055@table @samp
21056@item @var{number}
21057A decimal number representing clock cycles.
21058
21059@item L1
21060@itemx L2
21061@itemx L3
21062@itemx main
21063The compiler contains estimates of the number of clock cycles for
21064``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21065(also called Dcache, Scache, and Bcache), as well as to main memory.
21066Note that L3 is only valid for EV5.
21067
21068@end table
21069@end table
21070
21071@node eBPF Options
21072@subsection eBPF Options
21073@cindex eBPF Options
21074
21075@table @gcctabopt
21076@item -mframe-limit=@var{bytes}
21077This specifies the hard limit for frame sizes, in bytes.  Currently,
21078the value that can be specified should be less than or equal to
21079@samp{32767}.  Defaults to whatever limit is imposed by the version of
21080the Linux kernel targeted.
21081
21082@item -mkernel=@var{version}
21083@opindex mkernel
21084This specifies the minimum version of the kernel that will run the
21085compiled program.  GCC uses this version to determine which
21086instructions to use, what kernel helpers to allow, etc.  Currently,
21087@var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
21088@samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
21089@samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
21090@samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
21091@samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
21092@samp{5.2}, @samp{latest} and @samp{native}.
21093
21094@item -mbig-endian
21095@opindex mbig-endian
21096Generate code for a big-endian target.
21097
21098@item -mlittle-endian
21099@opindex mlittle-endian
21100Generate code for a little-endian target.  This is the default.
21101
21102@item -mxbpf
21103Generate code for an expanded version of BPF, which relaxes some of
21104the restrictions imposed by the BPF architecture:
21105@itemize @minus
21106@item Save and restore callee-saved registers at function entry and
21107exit, respectively.
21108@end itemize
21109@end table
21110
21111@node FR30 Options
21112@subsection FR30 Options
21113@cindex FR30 Options
21114
21115These options are defined specifically for the FR30 port.
21116
21117@table @gcctabopt
21118
21119@item -msmall-model
21120@opindex msmall-model
21121Use the small address space model.  This can produce smaller code, but
21122it does assume that all symbolic values and addresses fit into a
2112320-bit range.
21124
21125@item -mno-lsim
21126@opindex mno-lsim
21127Assume that runtime support has been provided and so there is no need
21128to include the simulator library (@file{libsim.a}) on the linker
21129command line.
21130
21131@end table
21132
21133@node FT32 Options
21134@subsection FT32 Options
21135@cindex FT32 Options
21136
21137These options are defined specifically for the FT32 port.
21138
21139@table @gcctabopt
21140
21141@item -msim
21142@opindex msim
21143Specifies that the program will be run on the simulator.  This causes
21144an alternate runtime startup and library to be linked.
21145You must not use this option when generating programs that will run on
21146real hardware; you must provide your own runtime library for whatever
21147I/O functions are needed.
21148
21149@item -mlra
21150@opindex mlra
21151Enable Local Register Allocation.  This is still experimental for FT32,
21152so by default the compiler uses standard reload.
21153
21154@item -mnodiv
21155@opindex mnodiv
21156Do not use div and mod instructions.
21157
21158@item -mft32b
21159@opindex mft32b
21160Enable use of the extended instructions of the FT32B processor.
21161
21162@item -mcompress
21163@opindex mcompress
21164Compress all code using the Ft32B code compression scheme.
21165
21166@item -mnopm
21167@opindex  mnopm
21168Do not generate code that reads program memory.
21169
21170@end table
21171
21172@node FRV Options
21173@subsection FRV Options
21174@cindex FRV Options
21175
21176@table @gcctabopt
21177@item -mgpr-32
21178@opindex mgpr-32
21179
21180Only use the first 32 general-purpose registers.
21181
21182@item -mgpr-64
21183@opindex mgpr-64
21184
21185Use all 64 general-purpose registers.
21186
21187@item -mfpr-32
21188@opindex mfpr-32
21189
21190Use only the first 32 floating-point registers.
21191
21192@item -mfpr-64
21193@opindex mfpr-64
21194
21195Use all 64 floating-point registers.
21196
21197@item -mhard-float
21198@opindex mhard-float
21199
21200Use hardware instructions for floating-point operations.
21201
21202@item -msoft-float
21203@opindex msoft-float
21204
21205Use library routines for floating-point operations.
21206
21207@item -malloc-cc
21208@opindex malloc-cc
21209
21210Dynamically allocate condition code registers.
21211
21212@item -mfixed-cc
21213@opindex mfixed-cc
21214
21215Do not try to dynamically allocate condition code registers, only
21216use @code{icc0} and @code{fcc0}.
21217
21218@item -mdword
21219@opindex mdword
21220
21221Change ABI to use double word insns.
21222
21223@item -mno-dword
21224@opindex mno-dword
21225@opindex mdword
21226
21227Do not use double word instructions.
21228
21229@item -mdouble
21230@opindex mdouble
21231
21232Use floating-point double instructions.
21233
21234@item -mno-double
21235@opindex mno-double
21236
21237Do not use floating-point double instructions.
21238
21239@item -mmedia
21240@opindex mmedia
21241
21242Use media instructions.
21243
21244@item -mno-media
21245@opindex mno-media
21246
21247Do not use media instructions.
21248
21249@item -mmuladd
21250@opindex mmuladd
21251
21252Use multiply and add/subtract instructions.
21253
21254@item -mno-muladd
21255@opindex mno-muladd
21256
21257Do not use multiply and add/subtract instructions.
21258
21259@item -mfdpic
21260@opindex mfdpic
21261
21262Select the FDPIC ABI, which uses function descriptors to represent
21263pointers to functions.  Without any PIC/PIE-related options, it
21264implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
21265assumes GOT entries and small data are within a 12-bit range from the
21266GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21267are computed with 32 bits.
21268With a @samp{bfin-elf} target, this option implies @option{-msim}.
21269
21270@item -minline-plt
21271@opindex minline-plt
21272
21273Enable inlining of PLT entries in function calls to functions that are
21274not known to bind locally.  It has no effect without @option{-mfdpic}.
21275It's enabled by default if optimizing for speed and compiling for
21276shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21277optimization option such as @option{-O3} or above is present in the
21278command line.
21279
21280@item -mTLS
21281@opindex mTLS
21282
21283Assume a large TLS segment when generating thread-local code.
21284
21285@item -mtls
21286@opindex mtls
21287
21288Do not assume a large TLS segment when generating thread-local code.
21289
21290@item -mgprel-ro
21291@opindex mgprel-ro
21292
21293Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21294that is known to be in read-only sections.  It's enabled by default,
21295except for @option{-fpic} or @option{-fpie}: even though it may help
21296make the global offset table smaller, it trades 1 instruction for 4.
21297With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21298one of which may be shared by multiple symbols, and it avoids the need
21299for a GOT entry for the referenced symbol, so it's more likely to be a
21300win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
21301
21302@item -multilib-library-pic
21303@opindex multilib-library-pic
21304
21305Link with the (library, not FD) pic libraries.  It's implied by
21306@option{-mlibrary-pic}, as well as by @option{-fPIC} and
21307@option{-fpic} without @option{-mfdpic}.  You should never have to use
21308it explicitly.
21309
21310@item -mlinked-fp
21311@opindex mlinked-fp
21312
21313Follow the EABI requirement of always creating a frame pointer whenever
21314a stack frame is allocated.  This option is enabled by default and can
21315be disabled with @option{-mno-linked-fp}.
21316
21317@item -mlong-calls
21318@opindex mlong-calls
21319
21320Use indirect addressing to call functions outside the current
21321compilation unit.  This allows the functions to be placed anywhere
21322within the 32-bit address space.
21323
21324@item -malign-labels
21325@opindex malign-labels
21326
21327Try to align labels to an 8-byte boundary by inserting NOPs into the
21328previous packet.  This option only has an effect when VLIW packing
21329is enabled.  It doesn't create new packets; it merely adds NOPs to
21330existing ones.
21331
21332@item -mlibrary-pic
21333@opindex mlibrary-pic
21334
21335Generate position-independent EABI code.
21336
21337@item -macc-4
21338@opindex macc-4
21339
21340Use only the first four media accumulator registers.
21341
21342@item -macc-8
21343@opindex macc-8
21344
21345Use all eight media accumulator registers.
21346
21347@item -mpack
21348@opindex mpack
21349
21350Pack VLIW instructions.
21351
21352@item -mno-pack
21353@opindex mno-pack
21354
21355Do not pack VLIW instructions.
21356
21357@item -mno-eflags
21358@opindex mno-eflags
21359
21360Do not mark ABI switches in e_flags.
21361
21362@item -mcond-move
21363@opindex mcond-move
21364
21365Enable the use of conditional-move instructions (default).
21366
21367This switch is mainly for debugging the compiler and will likely be removed
21368in a future version.
21369
21370@item -mno-cond-move
21371@opindex mno-cond-move
21372
21373Disable the use of conditional-move instructions.
21374
21375This switch is mainly for debugging the compiler and will likely be removed
21376in a future version.
21377
21378@item -mscc
21379@opindex mscc
21380
21381Enable the use of conditional set instructions (default).
21382
21383This switch is mainly for debugging the compiler and will likely be removed
21384in a future version.
21385
21386@item -mno-scc
21387@opindex mno-scc
21388
21389Disable the use of conditional set instructions.
21390
21391This switch is mainly for debugging the compiler and will likely be removed
21392in a future version.
21393
21394@item -mcond-exec
21395@opindex mcond-exec
21396
21397Enable the use of conditional execution (default).
21398
21399This switch is mainly for debugging the compiler and will likely be removed
21400in a future version.
21401
21402@item -mno-cond-exec
21403@opindex mno-cond-exec
21404
21405Disable the use of conditional execution.
21406
21407This switch is mainly for debugging the compiler and will likely be removed
21408in a future version.
21409
21410@item -mvliw-branch
21411@opindex mvliw-branch
21412
21413Run a pass to pack branches into VLIW instructions (default).
21414
21415This switch is mainly for debugging the compiler and will likely be removed
21416in a future version.
21417
21418@item -mno-vliw-branch
21419@opindex mno-vliw-branch
21420
21421Do not run a pass to pack branches into VLIW instructions.
21422
21423This switch is mainly for debugging the compiler and will likely be removed
21424in a future version.
21425
21426@item -mmulti-cond-exec
21427@opindex mmulti-cond-exec
21428
21429Enable optimization of @code{&&} and @code{||} in conditional execution
21430(default).
21431
21432This switch is mainly for debugging the compiler and will likely be removed
21433in a future version.
21434
21435@item -mno-multi-cond-exec
21436@opindex mno-multi-cond-exec
21437
21438Disable optimization of @code{&&} and @code{||} in conditional execution.
21439
21440This switch is mainly for debugging the compiler and will likely be removed
21441in a future version.
21442
21443@item -mnested-cond-exec
21444@opindex mnested-cond-exec
21445
21446Enable nested conditional execution optimizations (default).
21447
21448This switch is mainly for debugging the compiler and will likely be removed
21449in a future version.
21450
21451@item -mno-nested-cond-exec
21452@opindex mno-nested-cond-exec
21453
21454Disable nested conditional execution optimizations.
21455
21456This switch is mainly for debugging the compiler and will likely be removed
21457in a future version.
21458
21459@item -moptimize-membar
21460@opindex moptimize-membar
21461
21462This switch removes redundant @code{membar} instructions from the
21463compiler-generated code.  It is enabled by default.
21464
21465@item -mno-optimize-membar
21466@opindex mno-optimize-membar
21467@opindex moptimize-membar
21468
21469This switch disables the automatic removal of redundant @code{membar}
21470instructions from the generated code.
21471
21472@item -mtomcat-stats
21473@opindex mtomcat-stats
21474
21475Cause gas to print out tomcat statistics.
21476
21477@item -mcpu=@var{cpu}
21478@opindex mcpu
21479
21480Select the processor type for which to generate code.  Possible values are
21481@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21482@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21483
21484@end table
21485
21486@node GNU/Linux Options
21487@subsection GNU/Linux Options
21488
21489These @samp{-m} options are defined for GNU/Linux targets:
21490
21491@table @gcctabopt
21492@item -mglibc
21493@opindex mglibc
21494Use the GNU C library.  This is the default except
21495on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21496@samp{*-*-linux-*android*} targets.
21497
21498@item -muclibc
21499@opindex muclibc
21500Use uClibc C library.  This is the default on
21501@samp{*-*-linux-*uclibc*} targets.
21502
21503@item -mmusl
21504@opindex mmusl
21505Use the musl C library.  This is the default on
21506@samp{*-*-linux-*musl*} targets.
21507
21508@item -mbionic
21509@opindex mbionic
21510Use Bionic C library.  This is the default on
21511@samp{*-*-linux-*android*} targets.
21512
21513@item -mandroid
21514@opindex mandroid
21515Compile code compatible with Android platform.  This is the default on
21516@samp{*-*-linux-*android*} targets.
21517
21518When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21519@option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
21520this option makes the GCC driver pass Android-specific options to the linker.
21521Finally, this option causes the preprocessor macro @code{__ANDROID__}
21522to be defined.
21523
21524@item -tno-android-cc
21525@opindex tno-android-cc
21526Disable compilation effects of @option{-mandroid}, i.e., do not enable
21527@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21528@option{-fno-rtti} by default.
21529
21530@item -tno-android-ld
21531@opindex tno-android-ld
21532Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21533linking options to the linker.
21534
21535@end table
21536
21537@node H8/300 Options
21538@subsection H8/300 Options
21539
21540These @samp{-m} options are defined for the H8/300 implementations:
21541
21542@table @gcctabopt
21543@item -mrelax
21544@opindex mrelax
21545Shorten some address references at link time, when possible; uses the
21546linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
21547ld, Using ld}, for a fuller description.
21548
21549@item -mh
21550@opindex mh
21551Generate code for the H8/300H@.
21552
21553@item -ms
21554@opindex ms
21555Generate code for the H8S@.
21556
21557@item -mn
21558@opindex mn
21559Generate code for the H8S and H8/300H in the normal mode.  This switch
21560must be used either with @option{-mh} or @option{-ms}.
21561
21562@item -ms2600
21563@opindex ms2600
21564Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
21565
21566@item -mexr
21567@opindex mexr
21568Extended registers are stored on stack before execution of function
21569with monitor attribute. Default option is @option{-mexr}.
21570This option is valid only for H8S targets.
21571
21572@item -mno-exr
21573@opindex mno-exr
21574@opindex mexr
21575Extended registers are not stored on stack before execution of function
21576with monitor attribute. Default option is @option{-mno-exr}.
21577This option is valid only for H8S targets.
21578
21579@item -mint32
21580@opindex mint32
21581Make @code{int} data 32 bits by default.
21582
21583@item -malign-300
21584@opindex malign-300
21585On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21586The default for the H8/300H and H8S is to align longs and floats on
215874-byte boundaries.
21588@option{-malign-300} causes them to be aligned on 2-byte boundaries.
21589This option has no effect on the H8/300.
21590@end table
21591
21592@node HPPA Options
21593@subsection HPPA Options
21594@cindex HPPA Options
21595
21596These @samp{-m} options are defined for the HPPA family of computers:
21597
21598@table @gcctabopt
21599@item -march=@var{architecture-type}
21600@opindex march
21601Generate code for the specified architecture.  The choices for
21602@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
216031.1, and @samp{2.0} for PA 2.0 processors.  Refer to
21604@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21605architecture option for your machine.  Code compiled for lower numbered
21606architectures runs on higher numbered architectures, but not the
21607other way around.
21608
21609@item -mpa-risc-1-0
21610@itemx -mpa-risc-1-1
21611@itemx -mpa-risc-2-0
21612@opindex mpa-risc-1-0
21613@opindex mpa-risc-1-1
21614@opindex mpa-risc-2-0
21615Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21616
21617@item -mcaller-copies
21618@opindex mcaller-copies
21619The caller copies function arguments passed by hidden reference.  This
21620option should be used with care as it is not compatible with the default
2162132-bit runtime.  However, only aggregates larger than eight bytes are
21622passed by hidden reference and the option provides better compatibility
21623with OpenMP.
21624
21625@item -mjump-in-delay
21626@opindex mjump-in-delay
21627This option is ignored and provided for compatibility purposes only.
21628
21629@item -mdisable-fpregs
21630@opindex mdisable-fpregs
21631Prevent floating-point registers from being used in any manner.  This is
21632necessary for compiling kernels that perform lazy context switching of
21633floating-point registers.  If you use this option and attempt to perform
21634floating-point operations, the compiler aborts.
21635
21636@item -mdisable-indexing
21637@opindex mdisable-indexing
21638Prevent the compiler from using indexing address modes.  This avoids some
21639rather obscure problems when compiling MIG generated code under MACH@.
21640
21641@item -mno-space-regs
21642@opindex mno-space-regs
21643@opindex mspace-regs
21644Generate code that assumes the target has no space registers.  This allows
21645GCC to generate faster indirect calls and use unscaled index address modes.
21646
21647Such code is suitable for level 0 PA systems and kernels.
21648
21649@item -mfast-indirect-calls
21650@opindex mfast-indirect-calls
21651Generate code that assumes calls never cross space boundaries.  This
21652allows GCC to emit code that performs faster indirect calls.
21653
21654This option does not work in the presence of shared libraries or nested
21655functions.
21656
21657@item -mfixed-range=@var{register-range}
21658@opindex mfixed-range
21659Generate code treating the given register range as fixed registers.
21660A fixed register is one that the register allocator cannot use.  This is
21661useful when compiling kernel code.  A register range is specified as
21662two registers separated by a dash.  Multiple register ranges can be
21663specified separated by a comma.
21664
21665@item -mlong-load-store
21666@opindex mlong-load-store
21667Generate 3-instruction load and store sequences as sometimes required by
21668the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
21669the HP compilers.
21670
21671@item -mportable-runtime
21672@opindex mportable-runtime
21673Use the portable calling conventions proposed by HP for ELF systems.
21674
21675@item -mgas
21676@opindex mgas
21677Enable the use of assembler directives only GAS understands.
21678
21679@item -mschedule=@var{cpu-type}
21680@opindex mschedule
21681Schedule code according to the constraints for the machine type
21682@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
21683@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
21684to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21685proper scheduling option for your machine.  The default scheduling is
21686@samp{8000}.
21687
21688@item -mlinker-opt
21689@opindex mlinker-opt
21690Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
21691debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
21692linkers in which they give bogus error messages when linking some programs.
21693
21694@item -msoft-float
21695@opindex msoft-float
21696Generate output containing library calls for floating point.
21697@strong{Warning:} the requisite libraries are not available for all HPPA
21698targets.  Normally the facilities of the machine's usual C compiler are
21699used, but this cannot be done directly in cross-compilation.  You must make
21700your own arrangements to provide suitable library functions for
21701cross-compilation.
21702
21703@option{-msoft-float} changes the calling convention in the output file;
21704therefore, it is only useful if you compile @emph{all} of a program with
21705this option.  In particular, you need to compile @file{libgcc.a}, the
21706library that comes with GCC, with @option{-msoft-float} in order for
21707this to work.
21708
21709@item -msio
21710@opindex msio
21711Generate the predefine, @code{_SIO}, for server IO@.  The default is
21712@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
21713@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
21714options are available under HP-UX and HI-UX@.
21715
21716@item -mgnu-ld
21717@opindex mgnu-ld
21718Use options specific to GNU @command{ld}.
21719This passes @option{-shared} to @command{ld} when
21720building a shared library.  It is the default when GCC is configured,
21721explicitly or implicitly, with the GNU linker.  This option does not
21722affect which @command{ld} is called; it only changes what parameters
21723are passed to that @command{ld}.
21724The @command{ld} that is called is determined by the
21725@option{--with-ld} configure option, GCC's program search path, and
21726finally by the user's @env{PATH}.  The linker used by GCC can be printed
21727using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
21728on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21729
21730@item -mhp-ld
21731@opindex mhp-ld
21732Use options specific to HP @command{ld}.
21733This passes @option{-b} to @command{ld} when building
21734a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21735links.  It is the default when GCC is configured, explicitly or
21736implicitly, with the HP linker.  This option does not affect
21737which @command{ld} is called; it only changes what parameters are passed to that
21738@command{ld}.
21739The @command{ld} that is called is determined by the @option{--with-ld}
21740configure option, GCC's program search path, and finally by the user's
21741@env{PATH}.  The linker used by GCC can be printed using @samp{which
21742`gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
21743HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21744
21745@item -mlong-calls
21746@opindex mno-long-calls
21747@opindex mlong-calls
21748Generate code that uses long call sequences.  This ensures that a call
21749is always able to reach linker generated stubs.  The default is to generate
21750long calls only when the distance from the call site to the beginning
21751of the function or translation unit, as the case may be, exceeds a
21752predefined limit set by the branch type being used.  The limits for
21753normal calls are 7,600,000 and 240,000 bytes, respectively for the
21754PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
21755240,000 bytes.
21756
21757Distances are measured from the beginning of functions when using the
21758@option{-ffunction-sections} option, or when using the @option{-mgas}
21759and @option{-mno-portable-runtime} options together under HP-UX with
21760the SOM linker.
21761
21762It is normally not desirable to use this option as it degrades
21763performance.  However, it may be useful in large applications,
21764particularly when partial linking is used to build the application.
21765
21766The types of long calls used depends on the capabilities of the
21767assembler and linker, and the type of code being generated.  The
21768impact on systems that support long absolute calls, and long pic
21769symbol-difference or pc-relative calls should be relatively small.
21770However, an indirect call is used on 32-bit ELF systems in pic code
21771and it is quite long.
21772
21773@item -munix=@var{unix-std}
21774@opindex march
21775Generate compiler predefines and select a startfile for the specified
21776UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
21777and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
21778is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
2177911.11 and later.  The default values are @samp{93} for HP-UX 10.00,
21780@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
21781and later.
21782
21783@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
21784@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
21785and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
21786@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
21787@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
21788@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
21789
21790It is @emph{important} to note that this option changes the interfaces
21791for various library routines.  It also affects the operational behavior
21792of the C library.  Thus, @emph{extreme} care is needed in using this
21793option.
21794
21795Library code that is intended to operate with more than one UNIX
21796standard must test, set and restore the variable @code{__xpg4_extended_mask}
21797as appropriate.  Most GNU software doesn't provide this capability.
21798
21799@item -nolibdld
21800@opindex nolibdld
21801Suppress the generation of link options to search libdld.sl when the
21802@option{-static} option is specified on HP-UX 10 and later.
21803
21804@item -static
21805@opindex static
21806The HP-UX implementation of setlocale in libc has a dependency on
21807libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
21808when the @option{-static} option is specified, special link options
21809are needed to resolve this dependency.
21810
21811On HP-UX 10 and later, the GCC driver adds the necessary options to
21812link with libdld.sl when the @option{-static} option is specified.
21813This causes the resulting binary to be dynamic.  On the 64-bit port,
21814the linkers generate dynamic binaries by default in any case.  The
21815@option{-nolibdld} option can be used to prevent the GCC driver from
21816adding these link options.
21817
21818@item -threads
21819@opindex threads
21820Add support for multithreading with the @dfn{dce thread} library
21821under HP-UX@.  This option sets flags for both the preprocessor and
21822linker.
21823@end table
21824
21825@node IA-64 Options
21826@subsection IA-64 Options
21827@cindex IA-64 Options
21828
21829These are the @samp{-m} options defined for the Intel IA-64 architecture.
21830
21831@table @gcctabopt
21832@item -mbig-endian
21833@opindex mbig-endian
21834Generate code for a big-endian target.  This is the default for HP-UX@.
21835
21836@item -mlittle-endian
21837@opindex mlittle-endian
21838Generate code for a little-endian target.  This is the default for AIX5
21839and GNU/Linux.
21840
21841@item -mgnu-as
21842@itemx -mno-gnu-as
21843@opindex mgnu-as
21844@opindex mno-gnu-as
21845Generate (or don't) code for the GNU assembler.  This is the default.
21846@c Also, this is the default if the configure option @option{--with-gnu-as}
21847@c is used.
21848
21849@item -mgnu-ld
21850@itemx -mno-gnu-ld
21851@opindex mgnu-ld
21852@opindex mno-gnu-ld
21853Generate (or don't) code for the GNU linker.  This is the default.
21854@c Also, this is the default if the configure option @option{--with-gnu-ld}
21855@c is used.
21856
21857@item -mno-pic
21858@opindex mno-pic
21859Generate code that does not use a global pointer register.  The result
21860is not position independent code, and violates the IA-64 ABI@.
21861
21862@item -mvolatile-asm-stop
21863@itemx -mno-volatile-asm-stop
21864@opindex mvolatile-asm-stop
21865@opindex mno-volatile-asm-stop
21866Generate (or don't) a stop bit immediately before and after volatile asm
21867statements.
21868
21869@item -mregister-names
21870@itemx -mno-register-names
21871@opindex mregister-names
21872@opindex mno-register-names
21873Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
21874the stacked registers.  This may make assembler output more readable.
21875
21876@item -mno-sdata
21877@itemx -msdata
21878@opindex mno-sdata
21879@opindex msdata
21880Disable (or enable) optimizations that use the small data section.  This may
21881be useful for working around optimizer bugs.
21882
21883@item -mconstant-gp
21884@opindex mconstant-gp
21885Generate code that uses a single constant global pointer value.  This is
21886useful when compiling kernel code.
21887
21888@item -mauto-pic
21889@opindex mauto-pic
21890Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
21891This is useful when compiling firmware code.
21892
21893@item -minline-float-divide-min-latency
21894@opindex minline-float-divide-min-latency
21895Generate code for inline divides of floating-point values
21896using the minimum latency algorithm.
21897
21898@item -minline-float-divide-max-throughput
21899@opindex minline-float-divide-max-throughput
21900Generate code for inline divides of floating-point values
21901using the maximum throughput algorithm.
21902
21903@item -mno-inline-float-divide
21904@opindex mno-inline-float-divide
21905Do not generate inline code for divides of floating-point values.
21906
21907@item -minline-int-divide-min-latency
21908@opindex minline-int-divide-min-latency
21909Generate code for inline divides of integer values
21910using the minimum latency algorithm.
21911
21912@item -minline-int-divide-max-throughput
21913@opindex minline-int-divide-max-throughput
21914Generate code for inline divides of integer values
21915using the maximum throughput algorithm.
21916
21917@item -mno-inline-int-divide
21918@opindex mno-inline-int-divide
21919@opindex minline-int-divide
21920Do not generate inline code for divides of integer values.
21921
21922@item -minline-sqrt-min-latency
21923@opindex minline-sqrt-min-latency
21924Generate code for inline square roots
21925using the minimum latency algorithm.
21926
21927@item -minline-sqrt-max-throughput
21928@opindex minline-sqrt-max-throughput
21929Generate code for inline square roots
21930using the maximum throughput algorithm.
21931
21932@item -mno-inline-sqrt
21933@opindex mno-inline-sqrt
21934Do not generate inline code for @code{sqrt}.
21935
21936@item -mfused-madd
21937@itemx -mno-fused-madd
21938@opindex mfused-madd
21939@opindex mno-fused-madd
21940Do (don't) generate code that uses the fused multiply/add or multiply/subtract
21941instructions.  The default is to use these instructions.
21942
21943@item -mno-dwarf2-asm
21944@itemx -mdwarf2-asm
21945@opindex mno-dwarf2-asm
21946@opindex mdwarf2-asm
21947Don't (or do) generate assembler code for the DWARF line number debugging
21948info.  This may be useful when not using the GNU assembler.
21949
21950@item -mearly-stop-bits
21951@itemx -mno-early-stop-bits
21952@opindex mearly-stop-bits
21953@opindex mno-early-stop-bits
21954Allow stop bits to be placed earlier than immediately preceding the
21955instruction that triggered the stop bit.  This can improve instruction
21956scheduling, but does not always do so.
21957
21958@item -mfixed-range=@var{register-range}
21959@opindex mfixed-range
21960Generate code treating the given register range as fixed registers.
21961A fixed register is one that the register allocator cannot use.  This is
21962useful when compiling kernel code.  A register range is specified as
21963two registers separated by a dash.  Multiple register ranges can be
21964specified separated by a comma.
21965
21966@item -mtls-size=@var{tls-size}
21967@opindex mtls-size
21968Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
2196964.
21970
21971@item -mtune=@var{cpu-type}
21972@opindex mtune
21973Tune the instruction scheduling for a particular CPU, Valid values are
21974@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
21975and @samp{mckinley}.
21976
21977@item -milp32
21978@itemx -mlp64
21979@opindex milp32
21980@opindex mlp64
21981Generate code for a 32-bit or 64-bit environment.
21982The 32-bit environment sets int, long and pointer to 32 bits.
21983The 64-bit environment sets int to 32 bits and long and pointer
21984to 64 bits.  These are HP-UX specific flags.
21985
21986@item -mno-sched-br-data-spec
21987@itemx -msched-br-data-spec
21988@opindex mno-sched-br-data-spec
21989@opindex msched-br-data-spec
21990(Dis/En)able data speculative scheduling before reload.
21991This results in generation of @code{ld.a} instructions and
21992the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21993The default setting is disabled.
21994
21995@item -msched-ar-data-spec
21996@itemx -mno-sched-ar-data-spec
21997@opindex msched-ar-data-spec
21998@opindex mno-sched-ar-data-spec
21999(En/Dis)able data speculative scheduling after reload.
22000This results in generation of @code{ld.a} instructions and
22001the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22002The default setting is enabled.
22003
22004@item -mno-sched-control-spec
22005@itemx -msched-control-spec
22006@opindex mno-sched-control-spec
22007@opindex msched-control-spec
22008(Dis/En)able control speculative scheduling.  This feature is
22009available only during region scheduling (i.e.@: before reload).
22010This results in generation of the @code{ld.s} instructions and
22011the corresponding check instructions @code{chk.s}.
22012The default setting is disabled.
22013
22014@item -msched-br-in-data-spec
22015@itemx -mno-sched-br-in-data-spec
22016@opindex msched-br-in-data-spec
22017@opindex mno-sched-br-in-data-spec
22018(En/Dis)able speculative scheduling of the instructions that
22019are dependent on the data speculative loads before reload.
22020This is effective only with @option{-msched-br-data-spec} enabled.
22021The default setting is enabled.
22022
22023@item -msched-ar-in-data-spec
22024@itemx -mno-sched-ar-in-data-spec
22025@opindex msched-ar-in-data-spec
22026@opindex mno-sched-ar-in-data-spec
22027(En/Dis)able speculative scheduling of the instructions that
22028are dependent on the data speculative loads after reload.
22029This is effective only with @option{-msched-ar-data-spec} enabled.
22030The default setting is enabled.
22031
22032@item -msched-in-control-spec
22033@itemx -mno-sched-in-control-spec
22034@opindex msched-in-control-spec
22035@opindex mno-sched-in-control-spec
22036(En/Dis)able speculative scheduling of the instructions that
22037are dependent on the control speculative loads.
22038This is effective only with @option{-msched-control-spec} enabled.
22039The default setting is enabled.
22040
22041@item -mno-sched-prefer-non-data-spec-insns
22042@itemx -msched-prefer-non-data-spec-insns
22043@opindex mno-sched-prefer-non-data-spec-insns
22044@opindex msched-prefer-non-data-spec-insns
22045If enabled, data-speculative instructions are chosen for schedule
22046only if there are no other choices at the moment.  This makes
22047the use of the data speculation much more conservative.
22048The default setting is disabled.
22049
22050@item -mno-sched-prefer-non-control-spec-insns
22051@itemx -msched-prefer-non-control-spec-insns
22052@opindex mno-sched-prefer-non-control-spec-insns
22053@opindex msched-prefer-non-control-spec-insns
22054If enabled, control-speculative instructions are chosen for schedule
22055only if there are no other choices at the moment.  This makes
22056the use of the control speculation much more conservative.
22057The default setting is disabled.
22058
22059@item -mno-sched-count-spec-in-critical-path
22060@itemx -msched-count-spec-in-critical-path
22061@opindex mno-sched-count-spec-in-critical-path
22062@opindex msched-count-spec-in-critical-path
22063If enabled, speculative dependencies are considered during
22064computation of the instructions priorities.  This makes the use of the
22065speculation a bit more conservative.
22066The default setting is disabled.
22067
22068@item -msched-spec-ldc
22069@opindex msched-spec-ldc
22070Use a simple data speculation check.  This option is on by default.
22071
22072@item -msched-control-spec-ldc
22073@opindex msched-spec-ldc
22074Use a simple check for control speculation.  This option is on by default.
22075
22076@item -msched-stop-bits-after-every-cycle
22077@opindex msched-stop-bits-after-every-cycle
22078Place a stop bit after every cycle when scheduling.  This option is on
22079by default.
22080
22081@item -msched-fp-mem-deps-zero-cost
22082@opindex msched-fp-mem-deps-zero-cost
22083Assume that floating-point stores and loads are not likely to cause a conflict
22084when placed into the same instruction group.  This option is disabled by
22085default.
22086
22087@item -msel-sched-dont-check-control-spec
22088@opindex msel-sched-dont-check-control-spec
22089Generate checks for control speculation in selective scheduling.
22090This flag is disabled by default.
22091
22092@item -msched-max-memory-insns=@var{max-insns}
22093@opindex msched-max-memory-insns
22094Limit on the number of memory insns per instruction group, giving lower
22095priority to subsequent memory insns attempting to schedule in the same
22096instruction group. Frequently useful to prevent cache bank conflicts.
22097The default value is 1.
22098
22099@item -msched-max-memory-insns-hard-limit
22100@opindex msched-max-memory-insns-hard-limit
22101Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
22102disallowing more than that number in an instruction group.
22103Otherwise, the limit is ``soft'', meaning that non-memory operations
22104are preferred when the limit is reached, but memory operations may still
22105be scheduled.
22106
22107@end table
22108
22109@node LM32 Options
22110@subsection LM32 Options
22111@cindex LM32 options
22112
22113These @option{-m} options are defined for the LatticeMico32 architecture:
22114
22115@table @gcctabopt
22116@item -mbarrel-shift-enabled
22117@opindex mbarrel-shift-enabled
22118Enable barrel-shift instructions.
22119
22120@item -mdivide-enabled
22121@opindex mdivide-enabled
22122Enable divide and modulus instructions.
22123
22124@item -mmultiply-enabled
22125@opindex multiply-enabled
22126Enable multiply instructions.
22127
22128@item -msign-extend-enabled
22129@opindex msign-extend-enabled
22130Enable sign extend instructions.
22131
22132@item -muser-enabled
22133@opindex muser-enabled
22134Enable user-defined instructions.
22135
22136@end table
22137
22138@node M32C Options
22139@subsection M32C Options
22140@cindex M32C options
22141
22142@table @gcctabopt
22143@item -mcpu=@var{name}
22144@opindex mcpu=
22145Select the CPU for which code is generated.  @var{name} may be one of
22146@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22147/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22148the M32C/80 series.
22149
22150@item -msim
22151@opindex msim
22152Specifies that the program will be run on the simulator.  This causes
22153an alternate runtime library to be linked in which supports, for
22154example, file I/O@.  You must not use this option when generating
22155programs that will run on real hardware; you must provide your own
22156runtime library for whatever I/O functions are needed.
22157
22158@item -memregs=@var{number}
22159@opindex memregs=
22160Specifies the number of memory-based pseudo-registers GCC uses
22161during code generation.  These pseudo-registers are used like real
22162registers, so there is a tradeoff between GCC's ability to fit the
22163code into available registers, and the performance penalty of using
22164memory instead of registers.  Note that all modules in a program must
22165be compiled with the same value for this option.  Because of that, you
22166must not use this option with GCC's default runtime libraries.
22167
22168@end table
22169
22170@node M32R/D Options
22171@subsection M32R/D Options
22172@cindex M32R/D options
22173
22174These @option{-m} options are defined for Renesas M32R/D architectures:
22175
22176@table @gcctabopt
22177@item -m32r2
22178@opindex m32r2
22179Generate code for the M32R/2@.
22180
22181@item -m32rx
22182@opindex m32rx
22183Generate code for the M32R/X@.
22184
22185@item -m32r
22186@opindex m32r
22187Generate code for the M32R@.  This is the default.
22188
22189@item -mmodel=small
22190@opindex mmodel=small
22191Assume all objects live in the lower 16MB of memory (so that their addresses
22192can be loaded with the @code{ld24} instruction), and assume all subroutines
22193are reachable with the @code{bl} instruction.
22194This is the default.
22195
22196The addressability of a particular object can be set with the
22197@code{model} attribute.
22198
22199@item -mmodel=medium
22200@opindex mmodel=medium
22201Assume objects may be anywhere in the 32-bit address space (the compiler
22202generates @code{seth/add3} instructions to load their addresses), and
22203assume all subroutines are reachable with the @code{bl} instruction.
22204
22205@item -mmodel=large
22206@opindex mmodel=large
22207Assume objects may be anywhere in the 32-bit address space (the compiler
22208generates @code{seth/add3} instructions to load their addresses), and
22209assume subroutines may not be reachable with the @code{bl} instruction
22210(the compiler generates the much slower @code{seth/add3/jl}
22211instruction sequence).
22212
22213@item -msdata=none
22214@opindex msdata=none
22215Disable use of the small data area.  Variables are put into
22216one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22217@code{section} attribute has been specified).
22218This is the default.
22219
22220The small data area consists of sections @code{.sdata} and @code{.sbss}.
22221Objects may be explicitly put in the small data area with the
22222@code{section} attribute using one of these sections.
22223
22224@item -msdata=sdata
22225@opindex msdata=sdata
22226Put small global and static data in the small data area, but do not
22227generate special code to reference them.
22228
22229@item -msdata=use
22230@opindex msdata=use
22231Put small global and static data in the small data area, and generate
22232special instructions to reference them.
22233
22234@item -G @var{num}
22235@opindex G
22236@cindex smaller data references
22237Put global and static objects less than or equal to @var{num} bytes
22238into the small data or BSS sections instead of the normal data or BSS
22239sections.  The default value of @var{num} is 8.
22240The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22241for this option to have any effect.
22242
22243All modules should be compiled with the same @option{-G @var{num}} value.
22244Compiling with different values of @var{num} may or may not work; if it
22245doesn't the linker gives an error message---incorrect code is not
22246generated.
22247
22248@item -mdebug
22249@opindex mdebug
22250Makes the M32R-specific code in the compiler display some statistics
22251that might help in debugging programs.
22252
22253@item -malign-loops
22254@opindex malign-loops
22255Align all loops to a 32-byte boundary.
22256
22257@item -mno-align-loops
22258@opindex mno-align-loops
22259Do not enforce a 32-byte alignment for loops.  This is the default.
22260
22261@item -missue-rate=@var{number}
22262@opindex missue-rate=@var{number}
22263Issue @var{number} instructions per cycle.  @var{number} can only be 1
22264or 2.
22265
22266@item -mbranch-cost=@var{number}
22267@opindex mbranch-cost=@var{number}
22268@var{number} can only be 1 or 2.  If it is 1 then branches are
22269preferred over conditional code, if it is 2, then the opposite applies.
22270
22271@item -mflush-trap=@var{number}
22272@opindex mflush-trap=@var{number}
22273Specifies the trap number to use to flush the cache.  The default is
2227412.  Valid numbers are between 0 and 15 inclusive.
22275
22276@item -mno-flush-trap
22277@opindex mno-flush-trap
22278Specifies that the cache cannot be flushed by using a trap.
22279
22280@item -mflush-func=@var{name}
22281@opindex mflush-func=@var{name}
22282Specifies the name of the operating system function to call to flush
22283the cache.  The default is @samp{_flush_cache}, but a function call
22284is only used if a trap is not available.
22285
22286@item -mno-flush-func
22287@opindex mno-flush-func
22288Indicates that there is no OS function for flushing the cache.
22289
22290@end table
22291
22292@node M680x0 Options
22293@subsection M680x0 Options
22294@cindex M680x0 options
22295
22296These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22297The default settings depend on which architecture was selected when
22298the compiler was configured; the defaults for the most common choices
22299are given below.
22300
22301@table @gcctabopt
22302@item -march=@var{arch}
22303@opindex march
22304Generate code for a specific M680x0 or ColdFire instruction set
22305architecture.  Permissible values of @var{arch} for M680x0
22306architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22307@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
22308architectures are selected according to Freescale's ISA classification
22309and the permissible values are: @samp{isaa}, @samp{isaaplus},
22310@samp{isab} and @samp{isac}.
22311
22312GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22313code for a ColdFire target.  The @var{arch} in this macro is one of the
22314@option{-march} arguments given above.
22315
22316When used together, @option{-march} and @option{-mtune} select code
22317that runs on a family of similar processors but that is optimized
22318for a particular microarchitecture.
22319
22320@item -mcpu=@var{cpu}
22321@opindex mcpu
22322Generate code for a specific M680x0 or ColdFire processor.
22323The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22324@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22325and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
22326below, which also classifies the CPUs into families:
22327
22328@multitable @columnfractions 0.20 0.80
22329@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22330@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}
22331@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22332@item @samp{5206e} @tab @samp{5206e}
22333@item @samp{5208} @tab @samp{5207} @samp{5208}
22334@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22335@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22336@item @samp{5216} @tab @samp{5214} @samp{5216}
22337@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22338@item @samp{5225} @tab @samp{5224} @samp{5225}
22339@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22340@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22341@item @samp{5249} @tab @samp{5249}
22342@item @samp{5250} @tab @samp{5250}
22343@item @samp{5271} @tab @samp{5270} @samp{5271}
22344@item @samp{5272} @tab @samp{5272}
22345@item @samp{5275} @tab @samp{5274} @samp{5275}
22346@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22347@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22348@item @samp{5307} @tab @samp{5307}
22349@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22350@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22351@item @samp{5407} @tab @samp{5407}
22352@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}
22353@end multitable
22354
22355@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22356@var{arch} is compatible with @var{cpu}.  Other combinations of
22357@option{-mcpu} and @option{-march} are rejected.
22358
22359GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22360@var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
22361where the value of @var{family} is given by the table above.
22362
22363@item -mtune=@var{tune}
22364@opindex mtune
22365Tune the code for a particular microarchitecture within the
22366constraints set by @option{-march} and @option{-mcpu}.
22367The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22368@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22369and @samp{cpu32}.  The ColdFire microarchitectures
22370are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22371
22372You can also use @option{-mtune=68020-40} for code that needs
22373to run relatively well on 68020, 68030 and 68040 targets.
22374@option{-mtune=68020-60} is similar but includes 68060 targets
22375as well.  These two options select the same tuning decisions as
22376@option{-m68020-40} and @option{-m68020-60} respectively.
22377
22378GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22379when tuning for 680x0 architecture @var{arch}.  It also defines
22380@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22381option is used.  If GCC is tuning for a range of architectures,
22382as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22383it defines the macros for every architecture in the range.
22384
22385GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22386ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22387of the arguments given above.
22388
22389@item -m68000
22390@itemx -mc68000
22391@opindex m68000
22392@opindex mc68000
22393Generate output for a 68000.  This is the default
22394when the compiler is configured for 68000-based systems.
22395It is equivalent to @option{-march=68000}.
22396
22397Use this option for microcontrollers with a 68000 or EC000 core,
22398including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22399
22400@item -m68010
22401@opindex m68010
22402Generate output for a 68010.  This is the default
22403when the compiler is configured for 68010-based systems.
22404It is equivalent to @option{-march=68010}.
22405
22406@item -m68020
22407@itemx -mc68020
22408@opindex m68020
22409@opindex mc68020
22410Generate output for a 68020.  This is the default
22411when the compiler is configured for 68020-based systems.
22412It is equivalent to @option{-march=68020}.
22413
22414@item -m68030
22415@opindex m68030
22416Generate output for a 68030.  This is the default when the compiler is
22417configured for 68030-based systems.  It is equivalent to
22418@option{-march=68030}.
22419
22420@item -m68040
22421@opindex m68040
22422Generate output for a 68040.  This is the default when the compiler is
22423configured for 68040-based systems.  It is equivalent to
22424@option{-march=68040}.
22425
22426This option inhibits the use of 68881/68882 instructions that have to be
22427emulated by software on the 68040.  Use this option if your 68040 does not
22428have code to emulate those instructions.
22429
22430@item -m68060
22431@opindex m68060
22432Generate output for a 68060.  This is the default when the compiler is
22433configured for 68060-based systems.  It is equivalent to
22434@option{-march=68060}.
22435
22436This option inhibits the use of 68020 and 68881/68882 instructions that
22437have to be emulated by software on the 68060.  Use this option if your 68060
22438does not have code to emulate those instructions.
22439
22440@item -mcpu32
22441@opindex mcpu32
22442Generate output for a CPU32.  This is the default
22443when the compiler is configured for CPU32-based systems.
22444It is equivalent to @option{-march=cpu32}.
22445
22446Use this option for microcontrollers with a
22447CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
2244868336, 68340, 68341, 68349 and 68360.
22449
22450@item -m5200
22451@opindex m5200
22452Generate output for a 520X ColdFire CPU@.  This is the default
22453when the compiler is configured for 520X-based systems.
22454It is equivalent to @option{-mcpu=5206}, and is now deprecated
22455in favor of that option.
22456
22457Use this option for microcontroller with a 5200 core, including
22458the MCF5202, MCF5203, MCF5204 and MCF5206.
22459
22460@item -m5206e
22461@opindex m5206e
22462Generate output for a 5206e ColdFire CPU@.  The option is now
22463deprecated in favor of the equivalent @option{-mcpu=5206e}.
22464
22465@item -m528x
22466@opindex m528x
22467Generate output for a member of the ColdFire 528X family.
22468The option is now deprecated in favor of the equivalent
22469@option{-mcpu=528x}.
22470
22471@item -m5307
22472@opindex m5307
22473Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
22474in favor of the equivalent @option{-mcpu=5307}.
22475
22476@item -m5407
22477@opindex m5407
22478Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
22479in favor of the equivalent @option{-mcpu=5407}.
22480
22481@item -mcfv4e
22482@opindex mcfv4e
22483Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22484This includes use of hardware floating-point instructions.
22485The option is equivalent to @option{-mcpu=547x}, and is now
22486deprecated in favor of that option.
22487
22488@item -m68020-40
22489@opindex m68020-40
22490Generate output for a 68040, without using any of the new instructions.
22491This results in code that can run relatively efficiently on either a
2249268020/68881 or a 68030 or a 68040.  The generated code does use the
2249368881 instructions that are emulated on the 68040.
22494
22495The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22496
22497@item -m68020-60
22498@opindex m68020-60
22499Generate output for a 68060, without using any of the new instructions.
22500This results in code that can run relatively efficiently on either a
2250168020/68881 or a 68030 or a 68040.  The generated code does use the
2250268881 instructions that are emulated on the 68060.
22503
22504The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22505
22506@item -mhard-float
22507@itemx -m68881
22508@opindex mhard-float
22509@opindex m68881
22510Generate floating-point instructions.  This is the default for 68020
22511and above, and for ColdFire devices that have an FPU@.  It defines the
22512macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22513on ColdFire targets.
22514
22515@item -msoft-float
22516@opindex msoft-float
22517Do not generate floating-point instructions; use library calls instead.
22518This is the default for 68000, 68010, and 68832 targets.  It is also
22519the default for ColdFire devices that have no FPU.
22520
22521@item -mdiv
22522@itemx -mno-div
22523@opindex mdiv
22524@opindex mno-div
22525Generate (do not generate) ColdFire hardware divide and remainder
22526instructions.  If @option{-march} is used without @option{-mcpu},
22527the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22528architectures.  Otherwise, the default is taken from the target CPU
22529(either the default CPU, or the one specified by @option{-mcpu}).  For
22530example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22531@option{-mcpu=5206e}.
22532
22533GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22534
22535@item -mshort
22536@opindex mshort
22537Consider type @code{int} to be 16 bits wide, like @code{short int}.
22538Additionally, parameters passed on the stack are also aligned to a
2253916-bit boundary even on targets whose API mandates promotion to 32-bit.
22540
22541@item -mno-short
22542@opindex mno-short
22543Do not consider type @code{int} to be 16 bits wide.  This is the default.
22544
22545@item -mnobitfield
22546@itemx -mno-bitfield
22547@opindex mnobitfield
22548@opindex mno-bitfield
22549Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
22550and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22551
22552@item -mbitfield
22553@opindex mbitfield
22554Do use the bit-field instructions.  The @option{-m68020} option implies
22555@option{-mbitfield}.  This is the default if you use a configuration
22556designed for a 68020.
22557
22558@item -mrtd
22559@opindex mrtd
22560Use a different function-calling convention, in which functions
22561that take a fixed number of arguments return with the @code{rtd}
22562instruction, which pops their arguments while returning.  This
22563saves one instruction in the caller since there is no need to pop
22564the arguments there.
22565
22566This calling convention is incompatible with the one normally
22567used on Unix, so you cannot use it if you need to call libraries
22568compiled with the Unix compiler.
22569
22570Also, you must provide function prototypes for all functions that
22571take variable numbers of arguments (including @code{printf});
22572otherwise incorrect code is generated for calls to those
22573functions.
22574
22575In addition, seriously incorrect code results if you call a
22576function with too many arguments.  (Normally, extra arguments are
22577harmlessly ignored.)
22578
22579The @code{rtd} instruction is supported by the 68010, 68020, 68030,
2258068040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22581
22582The default is @option{-mno-rtd}.
22583
22584@item -malign-int
22585@itemx -mno-align-int
22586@opindex malign-int
22587@opindex mno-align-int
22588Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22589@code{float}, @code{double}, and @code{long double} variables on a 32-bit
22590boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22591Aligning variables on 32-bit boundaries produces code that runs somewhat
22592faster on processors with 32-bit busses at the expense of more memory.
22593
22594@strong{Warning:} if you use the @option{-malign-int} switch, GCC
22595aligns structures containing the above types differently than
22596most published application binary interface specifications for the m68k.
22597
22598@opindex mpcrel
22599Use the pc-relative addressing mode of the 68000 directly, instead of
22600using a global offset table.  At present, this option implies @option{-fpic},
22601allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
22602not presently supported with @option{-mpcrel}, though this could be supported for
2260368020 and higher processors.
22604
22605@item -mno-strict-align
22606@itemx -mstrict-align
22607@opindex mno-strict-align
22608@opindex mstrict-align
22609Do not (do) assume that unaligned memory references are handled by
22610the system.
22611
22612@item -msep-data
22613Generate code that allows the data segment to be located in a different
22614area of memory from the text segment.  This allows for execute-in-place in
22615an environment without virtual memory management.  This option implies
22616@option{-fPIC}.
22617
22618@item -mno-sep-data
22619Generate code that assumes that the data segment follows the text segment.
22620This is the default.
22621
22622@item -mid-shared-library
22623Generate code that supports shared libraries via the library ID method.
22624This allows for execute-in-place and shared libraries in an environment
22625without virtual memory management.  This option implies @option{-fPIC}.
22626
22627@item -mno-id-shared-library
22628Generate code that doesn't assume ID-based shared libraries are being used.
22629This is the default.
22630
22631@item -mshared-library-id=n
22632Specifies the identification number of the ID-based shared library being
22633compiled.  Specifying a value of 0 generates more compact code; specifying
22634other values forces the allocation of that number to the current
22635library, but is no more space- or time-efficient than omitting this option.
22636
22637@item -mxgot
22638@itemx -mno-xgot
22639@opindex mxgot
22640@opindex mno-xgot
22641When generating position-independent code for ColdFire, generate code
22642that works if the GOT has more than 8192 entries.  This code is
22643larger and slower than code generated without this option.  On M680x0
22644processors, this option is not needed; @option{-fPIC} suffices.
22645
22646GCC normally uses a single instruction to load values from the GOT@.
22647While this is relatively efficient, it only works if the GOT
22648is smaller than about 64k.  Anything larger causes the linker
22649to report an error such as:
22650
22651@cindex relocation truncated to fit (ColdFire)
22652@smallexample
22653relocation truncated to fit: R_68K_GOT16O foobar
22654@end smallexample
22655
22656If this happens, you should recompile your code with @option{-mxgot}.
22657It should then work with very large GOTs.  However, code generated with
22658@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22659the value of a global symbol.
22660
22661Note that some linkers, including newer versions of the GNU linker,
22662can create multiple GOTs and sort GOT entries.  If you have such a linker,
22663you should only need to use @option{-mxgot} when compiling a single
22664object file that accesses more than 8192 GOT entries.  Very few do.
22665
22666These options have no effect unless GCC is generating
22667position-independent code.
22668
22669@item -mlong-jump-table-offsets
22670@opindex mlong-jump-table-offsets
22671Use 32-bit offsets in @code{switch} tables.  The default is to use
2267216-bit offsets.
22673
22674@end table
22675
22676@node MCore Options
22677@subsection MCore Options
22678@cindex MCore options
22679
22680These are the @samp{-m} options defined for the Motorola M*Core
22681processors.
22682
22683@table @gcctabopt
22684
22685@item -mhardlit
22686@itemx -mno-hardlit
22687@opindex mhardlit
22688@opindex mno-hardlit
22689Inline constants into the code stream if it can be done in two
22690instructions or less.
22691
22692@item -mdiv
22693@itemx -mno-div
22694@opindex mdiv
22695@opindex mno-div
22696Use the divide instruction.  (Enabled by default).
22697
22698@item -mrelax-immediate
22699@itemx -mno-relax-immediate
22700@opindex mrelax-immediate
22701@opindex mno-relax-immediate
22702Allow arbitrary-sized immediates in bit operations.
22703
22704@item -mwide-bitfields
22705@itemx -mno-wide-bitfields
22706@opindex mwide-bitfields
22707@opindex mno-wide-bitfields
22708Always treat bit-fields as @code{int}-sized.
22709
22710@item -m4byte-functions
22711@itemx -mno-4byte-functions
22712@opindex m4byte-functions
22713@opindex mno-4byte-functions
22714Force all functions to be aligned to a 4-byte boundary.
22715
22716@item -mcallgraph-data
22717@itemx -mno-callgraph-data
22718@opindex mcallgraph-data
22719@opindex mno-callgraph-data
22720Emit callgraph information.
22721
22722@item -mslow-bytes
22723@itemx -mno-slow-bytes
22724@opindex mslow-bytes
22725@opindex mno-slow-bytes
22726Prefer word access when reading byte quantities.
22727
22728@item -mlittle-endian
22729@itemx -mbig-endian
22730@opindex mlittle-endian
22731@opindex mbig-endian
22732Generate code for a little-endian target.
22733
22734@item -m210
22735@itemx -m340
22736@opindex m210
22737@opindex m340
22738Generate code for the 210 processor.
22739
22740@item -mno-lsim
22741@opindex mno-lsim
22742Assume that runtime support has been provided and so omit the
22743simulator library (@file{libsim.a)} from the linker command line.
22744
22745@item -mstack-increment=@var{size}
22746@opindex mstack-increment
22747Set the maximum amount for a single stack increment operation.  Large
22748values can increase the speed of programs that contain functions
22749that need a large amount of stack space, but they can also trigger a
22750segmentation fault if the stack is extended too much.  The default
22751value is 0x1000.
22752
22753@end table
22754
22755@node MeP Options
22756@subsection MeP Options
22757@cindex MeP options
22758
22759@table @gcctabopt
22760
22761@item -mabsdiff
22762@opindex mabsdiff
22763Enables the @code{abs} instruction, which is the absolute difference
22764between two registers.
22765
22766@item -mall-opts
22767@opindex mall-opts
22768Enables all the optional instructions---average, multiply, divide, bit
22769operations, leading zero, absolute difference, min/max, clip, and
22770saturation.
22771
22772
22773@item -maverage
22774@opindex maverage
22775Enables the @code{ave} instruction, which computes the average of two
22776registers.
22777
22778@item -mbased=@var{n}
22779@opindex mbased=
22780Variables of size @var{n} bytes or smaller are placed in the
22781@code{.based} section by default.  Based variables use the @code{$tp}
22782register as a base register, and there is a 128-byte limit to the
22783@code{.based} section.
22784
22785@item -mbitops
22786@opindex mbitops
22787Enables the bit operation instructions---bit test (@code{btstm}), set
22788(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
22789test-and-set (@code{tas}).
22790
22791@item -mc=@var{name}
22792@opindex mc=
22793Selects which section constant data is placed in.  @var{name} may
22794be @samp{tiny}, @samp{near}, or @samp{far}.
22795
22796@item -mclip
22797@opindex mclip
22798Enables the @code{clip} instruction.  Note that @option{-mclip} is not
22799useful unless you also provide @option{-mminmax}.
22800
22801@item -mconfig=@var{name}
22802@opindex mconfig=
22803Selects one of the built-in core configurations.  Each MeP chip has
22804one or more modules in it; each module has a core CPU and a variety of
22805coprocessors, optional instructions, and peripherals.  The
22806@code{MeP-Integrator} tool, not part of GCC, provides these
22807configurations through this option; using this option is the same as
22808using all the corresponding command-line options.  The default
22809configuration is @samp{default}.
22810
22811@item -mcop
22812@opindex mcop
22813Enables the coprocessor instructions.  By default, this is a 32-bit
22814coprocessor.  Note that the coprocessor is normally enabled via the
22815@option{-mconfig=} option.
22816
22817@item -mcop32
22818@opindex mcop32
22819Enables the 32-bit coprocessor's instructions.
22820
22821@item -mcop64
22822@opindex mcop64
22823Enables the 64-bit coprocessor's instructions.
22824
22825@item -mivc2
22826@opindex mivc2
22827Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
22828
22829@item -mdc
22830@opindex mdc
22831Causes constant variables to be placed in the @code{.near} section.
22832
22833@item -mdiv
22834@opindex mdiv
22835Enables the @code{div} and @code{divu} instructions.
22836
22837@item -meb
22838@opindex meb
22839Generate big-endian code.
22840
22841@item -mel
22842@opindex mel
22843Generate little-endian code.
22844
22845@item -mio-volatile
22846@opindex mio-volatile
22847Tells the compiler that any variable marked with the @code{io}
22848attribute is to be considered volatile.
22849
22850@item -ml
22851@opindex ml
22852Causes variables to be assigned to the @code{.far} section by default.
22853
22854@item -mleadz
22855@opindex mleadz
22856Enables the @code{leadz} (leading zero) instruction.
22857
22858@item -mm
22859@opindex mm
22860Causes variables to be assigned to the @code{.near} section by default.
22861
22862@item -mminmax
22863@opindex mminmax
22864Enables the @code{min} and @code{max} instructions.
22865
22866@item -mmult
22867@opindex mmult
22868Enables the multiplication and multiply-accumulate instructions.
22869
22870@item -mno-opts
22871@opindex mno-opts
22872Disables all the optional instructions enabled by @option{-mall-opts}.
22873
22874@item -mrepeat
22875@opindex mrepeat
22876Enables the @code{repeat} and @code{erepeat} instructions, used for
22877low-overhead looping.
22878
22879@item -ms
22880@opindex ms
22881Causes all variables to default to the @code{.tiny} section.  Note
22882that there is a 65536-byte limit to this section.  Accesses to these
22883variables use the @code{%gp} base register.
22884
22885@item -msatur
22886@opindex msatur
22887Enables the saturation instructions.  Note that the compiler does not
22888currently generate these itself, but this option is included for
22889compatibility with other tools, like @code{as}.
22890
22891@item -msdram
22892@opindex msdram
22893Link the SDRAM-based runtime instead of the default ROM-based runtime.
22894
22895@item -msim
22896@opindex msim
22897Link the simulator run-time libraries.
22898
22899@item -msimnovec
22900@opindex msimnovec
22901Link the simulator runtime libraries, excluding built-in support
22902for reset and exception vectors and tables.
22903
22904@item -mtf
22905@opindex mtf
22906Causes all functions to default to the @code{.far} section.  Without
22907this option, functions default to the @code{.near} section.
22908
22909@item -mtiny=@var{n}
22910@opindex mtiny=
22911Variables that are @var{n} bytes or smaller are allocated to the
22912@code{.tiny} section.  These variables use the @code{$gp} base
22913register.  The default for this option is 4, but note that there's a
2291465536-byte limit to the @code{.tiny} section.
22915
22916@end table
22917
22918@node MicroBlaze Options
22919@subsection MicroBlaze Options
22920@cindex MicroBlaze Options
22921
22922@table @gcctabopt
22923
22924@item -msoft-float
22925@opindex msoft-float
22926Use software emulation for floating point (default).
22927
22928@item -mhard-float
22929@opindex mhard-float
22930Use hardware floating-point instructions.
22931
22932@item -mmemcpy
22933@opindex mmemcpy
22934Do not optimize block moves, use @code{memcpy}.
22935
22936@item -mno-clearbss
22937@opindex mno-clearbss
22938This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
22939
22940@item -mcpu=@var{cpu-type}
22941@opindex mcpu=
22942Use features of, and schedule code for, the given CPU.
22943Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
22944where @var{X} is a major version, @var{YY} is the minor version, and
22945@var{Z} is compatibility code.  Example values are @samp{v3.00.a},
22946@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
22947
22948@item -mxl-soft-mul
22949@opindex mxl-soft-mul
22950Use software multiply emulation (default).
22951
22952@item -mxl-soft-div
22953@opindex mxl-soft-div
22954Use software emulation for divides (default).
22955
22956@item -mxl-barrel-shift
22957@opindex mxl-barrel-shift
22958Use the hardware barrel shifter.
22959
22960@item -mxl-pattern-compare
22961@opindex mxl-pattern-compare
22962Use pattern compare instructions.
22963
22964@item -msmall-divides
22965@opindex msmall-divides
22966Use table lookup optimization for small signed integer divisions.
22967
22968@item -mxl-stack-check
22969@opindex mxl-stack-check
22970This option is deprecated.  Use @option{-fstack-check} instead.
22971
22972@item -mxl-gp-opt
22973@opindex mxl-gp-opt
22974Use GP-relative @code{.sdata}/@code{.sbss} sections.
22975
22976@item -mxl-multiply-high
22977@opindex mxl-multiply-high
22978Use multiply high instructions for high part of 32x32 multiply.
22979
22980@item -mxl-float-convert
22981@opindex mxl-float-convert
22982Use hardware floating-point conversion instructions.
22983
22984@item -mxl-float-sqrt
22985@opindex mxl-float-sqrt
22986Use hardware floating-point square root instruction.
22987
22988@item -mbig-endian
22989@opindex mbig-endian
22990Generate code for a big-endian target.
22991
22992@item -mlittle-endian
22993@opindex mlittle-endian
22994Generate code for a little-endian target.
22995
22996@item -mxl-reorder
22997@opindex mxl-reorder
22998Use reorder instructions (swap and byte reversed load/store).
22999
23000@item -mxl-mode-@var{app-model}
23001Select application model @var{app-model}.  Valid models are
23002@table @samp
23003@item executable
23004normal executable (default), uses startup code @file{crt0.o}.
23005
23006@item -mpic-data-is-text-relative
23007@opindex mpic-data-is-text-relative
23008Assume that the displacement between the text and data segments is fixed
23009at static link time.  This allows data to be referenced by offset from start of
23010text address instead of GOT since PC-relative addressing is not supported.
23011
23012@item xmdstub
23013for use with Xilinx Microprocessor Debugger (XMD) based
23014software intrusive debug agent called xmdstub. This uses startup file
23015@file{crt1.o} and sets the start address of the program to 0x800.
23016
23017@item bootstrap
23018for applications that are loaded using a bootloader.
23019This model uses startup file @file{crt2.o} which does not contain a processor
23020reset vector handler. This is suitable for transferring control on a
23021processor reset to the bootloader rather than the application.
23022
23023@item novectors
23024for applications that do not require any of the
23025MicroBlaze vectors. This option may be useful for applications running
23026within a monitoring application. This model uses @file{crt3.o} as a startup file.
23027@end table
23028
23029Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
23030@option{-mxl-mode-@var{app-model}}.
23031
23032@end table
23033
23034@node MIPS Options
23035@subsection MIPS Options
23036@cindex MIPS options
23037
23038@table @gcctabopt
23039
23040@item -EB
23041@opindex EB
23042Generate big-endian code.
23043
23044@item -EL
23045@opindex EL
23046Generate little-endian code.  This is the default for @samp{mips*el-*-*}
23047configurations.
23048
23049@item -march=@var{arch}
23050@opindex march
23051Generate code that runs on @var{arch}, which can be the name of a
23052generic MIPS ISA, or the name of a particular processor.
23053The ISA names are:
23054@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
23055@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
23056@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
23057@samp{mips64r5} and @samp{mips64r6}.
23058The processor names are:
23059@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
23060@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
23061@samp{5kc}, @samp{5kf},
23062@samp{20kc},
23063@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
23064@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
23065@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
23066@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
23067@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
23068@samp{i6400}, @samp{i6500},
23069@samp{interaptiv},
23070@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
23071@samp{gs464e}, @samp{gs264e},
23072@samp{m4k},
23073@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
23074@samp{m5100}, @samp{m5101},
23075@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
23076@samp{orion},
23077@samp{p5600}, @samp{p6600},
23078@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
23079@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
23080@samp{r6000}, @samp{r8000},
23081@samp{rm7000}, @samp{rm9000},
23082@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
23083@samp{sb1},
23084@samp{sr71000},
23085@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
23086@samp{vr5000}, @samp{vr5400}, @samp{vr5500},
23087@samp{xlr} and @samp{xlp}.
23088The special value @samp{from-abi} selects the
23089most compatible architecture for the selected ABI (that is,
23090@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
23091
23092The native Linux/GNU toolchain also supports the value @samp{native},
23093which selects the best architecture option for the host processor.
23094@option{-march=native} has no effect if GCC does not recognize
23095the processor.
23096
23097In processor names, a final @samp{000} can be abbreviated as @samp{k}
23098(for example, @option{-march=r2k}).  Prefixes are optional, and
23099@samp{vr} may be written @samp{r}.
23100
23101Names of the form @samp{@var{n}f2_1} refer to processors with
23102FPUs clocked at half the rate of the core, names of the form
23103@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
23104rate as the core, and names of the form @samp{@var{n}f3_2} refer to
23105processors with FPUs clocked a ratio of 3:2 with respect to the core.
23106For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
23107for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
23108accepted as synonyms for @samp{@var{n}f1_1}.
23109
23110GCC defines two macros based on the value of this option.  The first
23111is @code{_MIPS_ARCH}, which gives the name of target architecture, as
23112a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
23113where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
23114For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
23115to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
23116
23117Note that the @code{_MIPS_ARCH} macro uses the processor names given
23118above.  In other words, it has the full prefix and does not
23119abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
23120the macro names the resolved architecture (either @code{"mips1"} or
23121@code{"mips3"}).  It names the default architecture when no
23122@option{-march} option is given.
23123
23124@item -mtune=@var{arch}
23125@opindex mtune
23126Optimize for @var{arch}.  Among other things, this option controls
23127the way instructions are scheduled, and the perceived cost of arithmetic
23128operations.  The list of @var{arch} values is the same as for
23129@option{-march}.
23130
23131When this option is not used, GCC optimizes for the processor
23132specified by @option{-march}.  By using @option{-march} and
23133@option{-mtune} together, it is possible to generate code that
23134runs on a family of processors, but optimize the code for one
23135particular member of that family.
23136
23137@option{-mtune} defines the macros @code{_MIPS_TUNE} and
23138@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
23139@option{-march} ones described above.
23140
23141@item -mips1
23142@opindex mips1
23143Equivalent to @option{-march=mips1}.
23144
23145@item -mips2
23146@opindex mips2
23147Equivalent to @option{-march=mips2}.
23148
23149@item -mips3
23150@opindex mips3
23151Equivalent to @option{-march=mips3}.
23152
23153@item -mips4
23154@opindex mips4
23155Equivalent to @option{-march=mips4}.
23156
23157@item -mips32
23158@opindex mips32
23159Equivalent to @option{-march=mips32}.
23160
23161@item -mips32r3
23162@opindex mips32r3
23163Equivalent to @option{-march=mips32r3}.
23164
23165@item -mips32r5
23166@opindex mips32r5
23167Equivalent to @option{-march=mips32r5}.
23168
23169@item -mips32r6
23170@opindex mips32r6
23171Equivalent to @option{-march=mips32r6}.
23172
23173@item -mips64
23174@opindex mips64
23175Equivalent to @option{-march=mips64}.
23176
23177@item -mips64r2
23178@opindex mips64r2
23179Equivalent to @option{-march=mips64r2}.
23180
23181@item -mips64r3
23182@opindex mips64r3
23183Equivalent to @option{-march=mips64r3}.
23184
23185@item -mips64r5
23186@opindex mips64r5
23187Equivalent to @option{-march=mips64r5}.
23188
23189@item -mips64r6
23190@opindex mips64r6
23191Equivalent to @option{-march=mips64r6}.
23192
23193@item -mips16
23194@itemx -mno-mips16
23195@opindex mips16
23196@opindex mno-mips16
23197Generate (do not generate) MIPS16 code.  If GCC is targeting a
23198MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23199
23200MIPS16 code generation can also be controlled on a per-function basis
23201by means of @code{mips16} and @code{nomips16} attributes.
23202@xref{Function Attributes}, for more information.
23203
23204@item -mflip-mips16
23205@opindex mflip-mips16
23206Generate MIPS16 code on alternating functions.  This option is provided
23207for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23208not intended for ordinary use in compiling user code.
23209
23210@item -minterlink-compressed
23211@itemx -mno-interlink-compressed
23212@opindex minterlink-compressed
23213@opindex mno-interlink-compressed
23214Require (do not require) that code using the standard (uncompressed) MIPS ISA
23215be link-compatible with MIPS16 and microMIPS code, and vice versa.
23216
23217For example, code using the standard ISA encoding cannot jump directly
23218to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23219@option{-minterlink-compressed} therefore disables direct jumps unless GCC
23220knows that the target of the jump is not compressed.
23221
23222@item -minterlink-mips16
23223@itemx -mno-interlink-mips16
23224@opindex minterlink-mips16
23225@opindex mno-interlink-mips16
23226Aliases of @option{-minterlink-compressed} and
23227@option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
23228and are retained for backwards compatibility.
23229
23230@item -mabi=32
23231@itemx -mabi=o64
23232@itemx -mabi=n32
23233@itemx -mabi=64
23234@itemx -mabi=eabi
23235@opindex mabi=32
23236@opindex mabi=o64
23237@opindex mabi=n32
23238@opindex mabi=64
23239@opindex mabi=eabi
23240Generate code for the given ABI@.
23241
23242Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
23243generates 64-bit code when you select a 64-bit architecture, but you
23244can use @option{-mgp32} to get 32-bit code instead.
23245
23246For information about the O64 ABI, see
23247@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23248
23249GCC supports a variant of the o32 ABI in which floating-point registers
23250are 64 rather than 32 bits wide.  You can select this combination with
23251@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
23252and @code{mfhc1} instructions and is therefore only supported for
23253MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23254
23255The register assignments for arguments and return values remain the
23256same, but each scalar value is passed in a single 64-bit register
23257rather than a pair of 32-bit registers.  For example, scalar
23258floating-point values are returned in @samp{$f0} only, not a
23259@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
23260remains the same in that the even-numbered double-precision registers
23261are saved.
23262
23263Two additional variants of the o32 ABI are supported to enable
23264a transition from 32-bit to 64-bit registers.  These are FPXX
23265(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23266The FPXX extension mandates that all code must execute correctly
23267when run using 32-bit or 64-bit registers.  The code can be interlinked
23268with either FP32 or FP64, but not both.
23269The FP64A extension is similar to the FP64 extension but forbids the
23270use of odd-numbered single-precision registers.  This can be used
23271in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23272processors and allows both FP32 and FP64A code to interlink and
23273run in the same process without changing FPU modes.
23274
23275@item -mabicalls
23276@itemx -mno-abicalls
23277@opindex mabicalls
23278@opindex mno-abicalls
23279Generate (do not generate) code that is suitable for SVR4-style
23280dynamic objects.  @option{-mabicalls} is the default for SVR4-based
23281systems.
23282
23283@item -mshared
23284@itemx -mno-shared
23285Generate (do not generate) code that is fully position-independent,
23286and that can therefore be linked into shared libraries.  This option
23287only affects @option{-mabicalls}.
23288
23289All @option{-mabicalls} code has traditionally been position-independent,
23290regardless of options like @option{-fPIC} and @option{-fpic}.  However,
23291as an extension, the GNU toolchain allows executables to use absolute
23292accesses for locally-binding symbols.  It can also use shorter GP
23293initialization sequences and generate direct calls to locally-defined
23294functions.  This mode is selected by @option{-mno-shared}.
23295
23296@option{-mno-shared} depends on binutils 2.16 or higher and generates
23297objects that can only be linked by the GNU linker.  However, the option
23298does not affect the ABI of the final executable; it only affects the ABI
23299of relocatable objects.  Using @option{-mno-shared} generally makes
23300executables both smaller and quicker.
23301
23302@option{-mshared} is the default.
23303
23304@item -mplt
23305@itemx -mno-plt
23306@opindex mplt
23307@opindex mno-plt
23308Assume (do not assume) that the static and dynamic linkers
23309support PLTs and copy relocations.  This option only affects
23310@option{-mno-shared -mabicalls}.  For the n64 ABI, this option
23311has no effect without @option{-msym32}.
23312
23313You can make @option{-mplt} the default by configuring
23314GCC with @option{--with-mips-plt}.  The default is
23315@option{-mno-plt} otherwise.
23316
23317@item -mxgot
23318@itemx -mno-xgot
23319@opindex mxgot
23320@opindex mno-xgot
23321Lift (do not lift) the usual restrictions on the size of the global
23322offset table.
23323
23324GCC normally uses a single instruction to load values from the GOT@.
23325While this is relatively efficient, it only works if the GOT
23326is smaller than about 64k.  Anything larger causes the linker
23327to report an error such as:
23328
23329@cindex relocation truncated to fit (MIPS)
23330@smallexample
23331relocation truncated to fit: R_MIPS_GOT16 foobar
23332@end smallexample
23333
23334If this happens, you should recompile your code with @option{-mxgot}.
23335This works with very large GOTs, although the code is also
23336less efficient, since it takes three instructions to fetch the
23337value of a global symbol.
23338
23339Note that some linkers can create multiple GOTs.  If you have such a
23340linker, you should only need to use @option{-mxgot} when a single object
23341file accesses more than 64k's worth of GOT entries.  Very few do.
23342
23343These options have no effect unless GCC is generating position
23344independent code.
23345
23346@item -mgp32
23347@opindex mgp32
23348Assume that general-purpose registers are 32 bits wide.
23349
23350@item -mgp64
23351@opindex mgp64
23352Assume that general-purpose registers are 64 bits wide.
23353
23354@item -mfp32
23355@opindex mfp32
23356Assume that floating-point registers are 32 bits wide.
23357
23358@item -mfp64
23359@opindex mfp64
23360Assume that floating-point registers are 64 bits wide.
23361
23362@item -mfpxx
23363@opindex mfpxx
23364Do not assume the width of floating-point registers.
23365
23366@item -mhard-float
23367@opindex mhard-float
23368Use floating-point coprocessor instructions.
23369
23370@item -msoft-float
23371@opindex msoft-float
23372Do not use floating-point coprocessor instructions.  Implement
23373floating-point calculations using library calls instead.
23374
23375@item -mno-float
23376@opindex mno-float
23377Equivalent to @option{-msoft-float}, but additionally asserts that the
23378program being compiled does not perform any floating-point operations.
23379This option is presently supported only by some bare-metal MIPS
23380configurations, where it may select a special set of libraries
23381that lack all floating-point support (including, for example, the
23382floating-point @code{printf} formats).
23383If code compiled with @option{-mno-float} accidentally contains
23384floating-point operations, it is likely to suffer a link-time
23385or run-time failure.
23386
23387@item -msingle-float
23388@opindex msingle-float
23389Assume that the floating-point coprocessor only supports single-precision
23390operations.
23391
23392@item -mdouble-float
23393@opindex mdouble-float
23394Assume that the floating-point coprocessor supports double-precision
23395operations.  This is the default.
23396
23397@item -modd-spreg
23398@itemx -mno-odd-spreg
23399@opindex modd-spreg
23400@opindex mno-odd-spreg
23401Enable the use of odd-numbered single-precision floating-point registers
23402for the o32 ABI.  This is the default for processors that are known to
23403support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23404is set by default.
23405
23406@item -mabs=2008
23407@itemx -mabs=legacy
23408@opindex mabs=2008
23409@opindex mabs=legacy
23410These options control the treatment of the special not-a-number (NaN)
23411IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23412@code{neg.@i{fmt}} machine instructions.
23413
23414By default or when @option{-mabs=legacy} is used the legacy
23415treatment is selected.  In this case these instructions are considered
23416arithmetic and avoided where correct operation is required and the
23417input operand might be a NaN.  A longer sequence of instructions that
23418manipulate the sign bit of floating-point datum manually is used
23419instead unless the @option{-ffinite-math-only} option has also been
23420specified.
23421
23422The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
23423this case these instructions are considered non-arithmetic and therefore
23424operating correctly in all cases, including in particular where the
23425input operand is a NaN.  These instructions are therefore always used
23426for the respective operations.
23427
23428@item -mnan=2008
23429@itemx -mnan=legacy
23430@opindex mnan=2008
23431@opindex mnan=legacy
23432These options control the encoding of the special not-a-number (NaN)
23433IEEE 754 floating-point data.
23434
23435The @option{-mnan=legacy} option selects the legacy encoding.  In this
23436case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23437significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23438by the first bit of their trailing significand field being 1.
23439
23440The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
23441this case qNaNs are denoted by the first bit of their trailing
23442significand field being 1, whereas sNaNs are denoted by the first bit of
23443their trailing significand field being 0.
23444
23445The default is @option{-mnan=legacy} unless GCC has been configured with
23446@option{--with-nan=2008}.
23447
23448@item -mllsc
23449@itemx -mno-llsc
23450@opindex mllsc
23451@opindex mno-llsc
23452Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23453implement atomic memory built-in functions.  When neither option is
23454specified, GCC uses the instructions if the target architecture
23455supports them.
23456
23457@option{-mllsc} is useful if the runtime environment can emulate the
23458instructions and @option{-mno-llsc} can be useful when compiling for
23459nonstandard ISAs.  You can make either option the default by
23460configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23461respectively.  @option{--with-llsc} is the default for some
23462configurations; see the installation documentation for details.
23463
23464@item -mdsp
23465@itemx -mno-dsp
23466@opindex mdsp
23467@opindex mno-dsp
23468Use (do not use) revision 1 of the MIPS DSP ASE@.
23469@xref{MIPS DSP Built-in Functions}.  This option defines the
23470preprocessor macro @code{__mips_dsp}.  It also defines
23471@code{__mips_dsp_rev} to 1.
23472
23473@item -mdspr2
23474@itemx -mno-dspr2
23475@opindex mdspr2
23476@opindex mno-dspr2
23477Use (do not use) revision 2 of the MIPS DSP ASE@.
23478@xref{MIPS DSP Built-in Functions}.  This option defines the
23479preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23480It also defines @code{__mips_dsp_rev} to 2.
23481
23482@item -msmartmips
23483@itemx -mno-smartmips
23484@opindex msmartmips
23485@opindex mno-smartmips
23486Use (do not use) the MIPS SmartMIPS ASE.
23487
23488@item -mpaired-single
23489@itemx -mno-paired-single
23490@opindex mpaired-single
23491@opindex mno-paired-single
23492Use (do not use) paired-single floating-point instructions.
23493@xref{MIPS Paired-Single Support}.  This option requires
23494hardware floating-point support to be enabled.
23495
23496@item -mdmx
23497@itemx -mno-mdmx
23498@opindex mdmx
23499@opindex mno-mdmx
23500Use (do not use) MIPS Digital Media Extension instructions.
23501This option can only be used when generating 64-bit code and requires
23502hardware floating-point support to be enabled.
23503
23504@item -mips3d
23505@itemx -mno-mips3d
23506@opindex mips3d
23507@opindex mno-mips3d
23508Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
23509The option @option{-mips3d} implies @option{-mpaired-single}.
23510
23511@item -mmicromips
23512@itemx -mno-micromips
23513@opindex mmicromips
23514@opindex mno-mmicromips
23515Generate (do not generate) microMIPS code.
23516
23517MicroMIPS code generation can also be controlled on a per-function basis
23518by means of @code{micromips} and @code{nomicromips} attributes.
23519@xref{Function Attributes}, for more information.
23520
23521@item -mmt
23522@itemx -mno-mt
23523@opindex mmt
23524@opindex mno-mt
23525Use (do not use) MT Multithreading instructions.
23526
23527@item -mmcu
23528@itemx -mno-mcu
23529@opindex mmcu
23530@opindex mno-mcu
23531Use (do not use) the MIPS MCU ASE instructions.
23532
23533@item -meva
23534@itemx -mno-eva
23535@opindex meva
23536@opindex mno-eva
23537Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23538
23539@item -mvirt
23540@itemx -mno-virt
23541@opindex mvirt
23542@opindex mno-virt
23543Use (do not use) the MIPS Virtualization (VZ) instructions.
23544
23545@item -mxpa
23546@itemx -mno-xpa
23547@opindex mxpa
23548@opindex mno-xpa
23549Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23550
23551@item -mcrc
23552@itemx -mno-crc
23553@opindex mcrc
23554@opindex mno-crc
23555Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23556
23557@item -mginv
23558@itemx -mno-ginv
23559@opindex mginv
23560@opindex mno-ginv
23561Use (do not use) the MIPS Global INValidate (GINV) instructions.
23562
23563@item -mloongson-mmi
23564@itemx -mno-loongson-mmi
23565@opindex mloongson-mmi
23566@opindex mno-loongson-mmi
23567Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23568
23569@item -mloongson-ext
23570@itemx -mno-loongson-ext
23571@opindex mloongson-ext
23572@opindex mno-loongson-ext
23573Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23574
23575@item -mloongson-ext2
23576@itemx -mno-loongson-ext2
23577@opindex mloongson-ext2
23578@opindex mno-loongson-ext2
23579Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23580
23581@item -mlong64
23582@opindex mlong64
23583Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
23584an explanation of the default and the way that the pointer size is
23585determined.
23586
23587@item -mlong32
23588@opindex mlong32
23589Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23590
23591The default size of @code{int}s, @code{long}s and pointers depends on
23592the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
23593uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
2359432-bit @code{long}s.  Pointers are the same size as @code{long}s,
23595or the same size as integer registers, whichever is smaller.
23596
23597@item -msym32
23598@itemx -mno-sym32
23599@opindex msym32
23600@opindex mno-sym32
23601Assume (do not assume) that all symbols have 32-bit values, regardless
23602of the selected ABI@.  This option is useful in combination with
23603@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23604to generate shorter and faster references to symbolic addresses.
23605
23606@item -G @var{num}
23607@opindex G
23608Put definitions of externally-visible data in a small data section
23609if that data is no bigger than @var{num} bytes.  GCC can then generate
23610more efficient accesses to the data; see @option{-mgpopt} for details.
23611
23612The default @option{-G} option depends on the configuration.
23613
23614@item -mlocal-sdata
23615@itemx -mno-local-sdata
23616@opindex mlocal-sdata
23617@opindex mno-local-sdata
23618Extend (do not extend) the @option{-G} behavior to local data too,
23619such as to static variables in C@.  @option{-mlocal-sdata} is the
23620default for all configurations.
23621
23622If the linker complains that an application is using too much small data,
23623you might want to try rebuilding the less performance-critical parts with
23624@option{-mno-local-sdata}.  You might also want to build large
23625libraries with @option{-mno-local-sdata}, so that the libraries leave
23626more room for the main program.
23627
23628@item -mextern-sdata
23629@itemx -mno-extern-sdata
23630@opindex mextern-sdata
23631@opindex mno-extern-sdata
23632Assume (do not assume) that externally-defined data is in
23633a small data section if the size of that data is within the @option{-G} limit.
23634@option{-mextern-sdata} is the default for all configurations.
23635
23636If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23637@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23638that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23639is placed in a small data section.  If @var{Var} is defined by another
23640module, you must either compile that module with a high-enough
23641@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23642definition.  If @var{Var} is common, you must link the application
23643with a high-enough @option{-G} setting.
23644
23645The easiest way of satisfying these restrictions is to compile
23646and link every module with the same @option{-G} option.  However,
23647you may wish to build a library that supports several different
23648small data limits.  You can do this by compiling the library with
23649the highest supported @option{-G} setting and additionally using
23650@option{-mno-extern-sdata} to stop the library from making assumptions
23651about externally-defined data.
23652
23653@item -mgpopt
23654@itemx -mno-gpopt
23655@opindex mgpopt
23656@opindex mno-gpopt
23657Use (do not use) GP-relative accesses for symbols that are known to be
23658in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23659@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
23660configurations.
23661
23662@option{-mno-gpopt} is useful for cases where the @code{$gp} register
23663might not hold the value of @code{_gp}.  For example, if the code is
23664part of a library that might be used in a boot monitor, programs that
23665call boot monitor routines pass an unknown value in @code{$gp}.
23666(In such situations, the boot monitor itself is usually compiled
23667with @option{-G0}.)
23668
23669@option{-mno-gpopt} implies @option{-mno-local-sdata} and
23670@option{-mno-extern-sdata}.
23671
23672@item -membedded-data
23673@itemx -mno-embedded-data
23674@opindex membedded-data
23675@opindex mno-embedded-data
23676Allocate variables to the read-only data section first if possible, then
23677next in the small data section if possible, otherwise in data.  This gives
23678slightly slower code than the default, but reduces the amount of RAM required
23679when executing, and thus may be preferred for some embedded systems.
23680
23681@item -muninit-const-in-rodata
23682@itemx -mno-uninit-const-in-rodata
23683@opindex muninit-const-in-rodata
23684@opindex mno-uninit-const-in-rodata
23685Put uninitialized @code{const} variables in the read-only data section.
23686This option is only meaningful in conjunction with @option{-membedded-data}.
23687
23688@item -mcode-readable=@var{setting}
23689@opindex mcode-readable
23690Specify whether GCC may generate code that reads from executable sections.
23691There are three possible settings:
23692
23693@table @gcctabopt
23694@item -mcode-readable=yes
23695Instructions may freely access executable sections.  This is the
23696default setting.
23697
23698@item -mcode-readable=pcrel
23699MIPS16 PC-relative load instructions can access executable sections,
23700but other instructions must not do so.  This option is useful on 4KSc
23701and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23702It is also useful on processors that can be configured to have a dual
23703instruction/data SRAM interface and that, like the M4K, automatically
23704redirect PC-relative loads to the instruction RAM.
23705
23706@item -mcode-readable=no
23707Instructions must not access executable sections.  This option can be
23708useful on targets that are configured to have a dual instruction/data
23709SRAM interface but that (unlike the M4K) do not automatically redirect
23710PC-relative loads to the instruction RAM.
23711@end table
23712
23713@item -msplit-addresses
23714@itemx -mno-split-addresses
23715@opindex msplit-addresses
23716@opindex mno-split-addresses
23717Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23718relocation operators.  This option has been superseded by
23719@option{-mexplicit-relocs} but is retained for backwards compatibility.
23720
23721@item -mexplicit-relocs
23722@itemx -mno-explicit-relocs
23723@opindex mexplicit-relocs
23724@opindex mno-explicit-relocs
23725Use (do not use) assembler relocation operators when dealing with symbolic
23726addresses.  The alternative, selected by @option{-mno-explicit-relocs},
23727is to use assembler macros instead.
23728
23729@option{-mexplicit-relocs} is the default if GCC was configured
23730to use an assembler that supports relocation operators.
23731
23732@item -mcheck-zero-division
23733@itemx -mno-check-zero-division
23734@opindex mcheck-zero-division
23735@opindex mno-check-zero-division
23736Trap (do not trap) on integer division by zero.
23737
23738The default is @option{-mcheck-zero-division}.
23739
23740@item -mdivide-traps
23741@itemx -mdivide-breaks
23742@opindex mdivide-traps
23743@opindex mdivide-breaks
23744MIPS systems check for division by zero by generating either a
23745conditional trap or a break instruction.  Using traps results in
23746smaller code, but is only supported on MIPS II and later.  Also, some
23747versions of the Linux kernel have a bug that prevents trap from
23748generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
23749allow conditional traps on architectures that support them and
23750@option{-mdivide-breaks} to force the use of breaks.
23751
23752The default is usually @option{-mdivide-traps}, but this can be
23753overridden at configure time using @option{--with-divide=breaks}.
23754Divide-by-zero checks can be completely disabled using
23755@option{-mno-check-zero-division}.
23756
23757@item -mload-store-pairs
23758@itemx -mno-load-store-pairs
23759@opindex mload-store-pairs
23760@opindex mno-load-store-pairs
23761Enable (disable) an optimization that pairs consecutive load or store
23762instructions to enable load/store bonding.  This option is enabled by
23763default but only takes effect when the selected architecture is known
23764to support bonding.
23765
23766@item -mmemcpy
23767@itemx -mno-memcpy
23768@opindex mmemcpy
23769@opindex mno-memcpy
23770Force (do not force) the use of @code{memcpy} for non-trivial block
23771moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
23772most constant-sized copies.
23773
23774@item -mlong-calls
23775@itemx -mno-long-calls
23776@opindex mlong-calls
23777@opindex mno-long-calls
23778Disable (do not disable) use of the @code{jal} instruction.  Calling
23779functions using @code{jal} is more efficient but requires the caller
23780and callee to be in the same 256 megabyte segment.
23781
23782This option has no effect on abicalls code.  The default is
23783@option{-mno-long-calls}.
23784
23785@item -mmad
23786@itemx -mno-mad
23787@opindex mmad
23788@opindex mno-mad
23789Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
23790instructions, as provided by the R4650 ISA@.
23791
23792@item -mimadd
23793@itemx -mno-imadd
23794@opindex mimadd
23795@opindex mno-imadd
23796Enable (disable) use of the @code{madd} and @code{msub} integer
23797instructions.  The default is @option{-mimadd} on architectures
23798that support @code{madd} and @code{msub} except for the 74k
23799architecture where it was found to generate slower code.
23800
23801@item -mfused-madd
23802@itemx -mno-fused-madd
23803@opindex mfused-madd
23804@opindex mno-fused-madd
23805Enable (disable) use of the floating-point multiply-accumulate
23806instructions, when they are available.  The default is
23807@option{-mfused-madd}.
23808
23809On the R8000 CPU when multiply-accumulate instructions are used,
23810the intermediate product is calculated to infinite precision
23811and is not subject to the FCSR Flush to Zero bit.  This may be
23812undesirable in some circumstances.  On other processors the result
23813is numerically identical to the equivalent computation using
23814separate multiply, add, subtract and negate instructions.
23815
23816@item -nocpp
23817@opindex nocpp
23818Tell the MIPS assembler to not run its preprocessor over user
23819assembler files (with a @samp{.s} suffix) when assembling them.
23820
23821@item -mfix-24k
23822@itemx -mno-fix-24k
23823@opindex mfix-24k
23824@opindex mno-fix-24k
23825Work around the 24K E48 (lost data on stores during refill) errata.
23826The workarounds are implemented by the assembler rather than by GCC@.
23827
23828@item -mfix-r4000
23829@itemx -mno-fix-r4000
23830@opindex mfix-r4000
23831@opindex mno-fix-r4000
23832Work around certain R4000 CPU errata:
23833@itemize @minus
23834@item
23835A double-word or a variable shift may give an incorrect result if executed
23836immediately after starting an integer division.
23837@item
23838A double-word or a variable shift may give an incorrect result if executed
23839while an integer multiplication is in progress.
23840@item
23841An integer division may give an incorrect result if started in a delay slot
23842of a taken branch or a jump.
23843@end itemize
23844
23845@item -mfix-r4400
23846@itemx -mno-fix-r4400
23847@opindex mfix-r4400
23848@opindex mno-fix-r4400
23849Work around certain R4400 CPU errata:
23850@itemize @minus
23851@item
23852A double-word or a variable shift may give an incorrect result if executed
23853immediately after starting an integer division.
23854@end itemize
23855
23856@item -mfix-r10000
23857@itemx -mno-fix-r10000
23858@opindex mfix-r10000
23859@opindex mno-fix-r10000
23860Work around certain R10000 errata:
23861@itemize @minus
23862@item
23863@code{ll}/@code{sc} sequences may not behave atomically on revisions
23864prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
23865@end itemize
23866
23867This option can only be used if the target architecture supports
23868branch-likely instructions.  @option{-mfix-r10000} is the default when
23869@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
23870otherwise.
23871
23872@item -mfix-r5900
23873@itemx -mno-fix-r5900
23874@opindex mfix-r5900
23875Do not attempt to schedule the preceding instruction into the delay slot
23876of a branch instruction placed at the end of a short loop of six
23877instructions or fewer and always schedule a @code{nop} instruction there
23878instead.  The short loop bug under certain conditions causes loops to
23879execute only once or twice, due to a hardware bug in the R5900 chip.  The
23880workaround is implemented by the assembler rather than by GCC@.
23881
23882@item -mfix-rm7000
23883@itemx -mno-fix-rm7000
23884@opindex mfix-rm7000
23885Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
23886workarounds are implemented by the assembler rather than by GCC@.
23887
23888@item -mfix-vr4120
23889@itemx -mno-fix-vr4120
23890@opindex mfix-vr4120
23891Work around certain VR4120 errata:
23892@itemize @minus
23893@item
23894@code{dmultu} does not always produce the correct result.
23895@item
23896@code{div} and @code{ddiv} do not always produce the correct result if one
23897of the operands is negative.
23898@end itemize
23899The workarounds for the division errata rely on special functions in
23900@file{libgcc.a}.  At present, these functions are only provided by
23901the @code{mips64vr*-elf} configurations.
23902
23903Other VR4120 errata require a NOP to be inserted between certain pairs of
23904instructions.  These errata are handled by the assembler, not by GCC itself.
23905
23906@item -mfix-vr4130
23907@opindex mfix-vr4130
23908Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
23909workarounds are implemented by the assembler rather than by GCC,
23910although GCC avoids using @code{mflo} and @code{mfhi} if the
23911VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
23912instructions are available instead.
23913
23914@item -mfix-sb1
23915@itemx -mno-fix-sb1
23916@opindex mfix-sb1
23917Work around certain SB-1 CPU core errata.
23918(This flag currently works around the SB-1 revision 2
23919``F1'' and ``F2'' floating-point errata.)
23920
23921@item -mr10k-cache-barrier=@var{setting}
23922@opindex mr10k-cache-barrier
23923Specify whether GCC should insert cache barriers to avoid the
23924side effects of speculation on R10K processors.
23925
23926In common with many processors, the R10K tries to predict the outcome
23927of a conditional branch and speculatively executes instructions from
23928the ``taken'' branch.  It later aborts these instructions if the
23929predicted outcome is wrong.  However, on the R10K, even aborted
23930instructions can have side effects.
23931
23932This problem only affects kernel stores and, depending on the system,
23933kernel loads.  As an example, a speculatively-executed store may load
23934the target memory into cache and mark the cache line as dirty, even if
23935the store itself is later aborted.  If a DMA operation writes to the
23936same area of memory before the ``dirty'' line is flushed, the cached
23937data overwrites the DMA-ed data.  See the R10K processor manual
23938for a full description, including other potential problems.
23939
23940One workaround is to insert cache barrier instructions before every memory
23941access that might be speculatively executed and that might have side
23942effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
23943controls GCC's implementation of this workaround.  It assumes that
23944aborted accesses to any byte in the following regions does not have
23945side effects:
23946
23947@enumerate
23948@item
23949the memory occupied by the current function's stack frame;
23950
23951@item
23952the memory occupied by an incoming stack argument;
23953
23954@item
23955the memory occupied by an object with a link-time-constant address.
23956@end enumerate
23957
23958It is the kernel's responsibility to ensure that speculative
23959accesses to these regions are indeed safe.
23960
23961If the input program contains a function declaration such as:
23962
23963@smallexample
23964void foo (void);
23965@end smallexample
23966
23967then the implementation of @code{foo} must allow @code{j foo} and
23968@code{jal foo} to be executed speculatively.  GCC honors this
23969restriction for functions it compiles itself.  It expects non-GCC
23970functions (such as hand-written assembly code) to do the same.
23971
23972The option has three forms:
23973
23974@table @gcctabopt
23975@item -mr10k-cache-barrier=load-store
23976Insert a cache barrier before a load or store that might be
23977speculatively executed and that might have side effects even
23978if aborted.
23979
23980@item -mr10k-cache-barrier=store
23981Insert a cache barrier before a store that might be speculatively
23982executed and that might have side effects even if aborted.
23983
23984@item -mr10k-cache-barrier=none
23985Disable the insertion of cache barriers.  This is the default setting.
23986@end table
23987
23988@item -mflush-func=@var{func}
23989@itemx -mno-flush-func
23990@opindex mflush-func
23991Specifies the function to call to flush the I and D caches, or to not
23992call any such function.  If called, the function must take the same
23993arguments as the common @code{_flush_func}, that is, the address of the
23994memory range for which the cache is being flushed, the size of the
23995memory range, and the number 3 (to flush both caches).  The default
23996depends on the target GCC was configured for, but commonly is either
23997@code{_flush_func} or @code{__cpu_flush}.
23998
23999@item mbranch-cost=@var{num}
24000@opindex mbranch-cost
24001Set the cost of branches to roughly @var{num} ``simple'' instructions.
24002This cost is only a heuristic and is not guaranteed to produce
24003consistent results across releases.  A zero cost redundantly selects
24004the default, which is based on the @option{-mtune} setting.
24005
24006@item -mbranch-likely
24007@itemx -mno-branch-likely
24008@opindex mbranch-likely
24009@opindex mno-branch-likely
24010Enable or disable use of Branch Likely instructions, regardless of the
24011default for the selected architecture.  By default, Branch Likely
24012instructions may be generated if they are supported by the selected
24013architecture.  An exception is for the MIPS32 and MIPS64 architectures
24014and processors that implement those architectures; for those, Branch
24015Likely instructions are not be generated by default because the MIPS32
24016and MIPS64 architectures specifically deprecate their use.
24017
24018@item -mcompact-branches=never
24019@itemx -mcompact-branches=optimal
24020@itemx -mcompact-branches=always
24021@opindex mcompact-branches=never
24022@opindex mcompact-branches=optimal
24023@opindex mcompact-branches=always
24024These options control which form of branches will be generated.  The
24025default is @option{-mcompact-branches=optimal}.
24026
24027The @option{-mcompact-branches=never} option ensures that compact branch
24028instructions will never be generated.
24029
24030The @option{-mcompact-branches=always} option ensures that a compact
24031branch instruction will be generated if available.  If a compact branch
24032instruction is not available, a delay slot form of the branch will be
24033used instead.
24034
24035This option is supported from MIPS Release 6 onwards.
24036
24037The @option{-mcompact-branches=optimal} option will cause a delay slot
24038branch to be used if one is available in the current ISA and the delay
24039slot is successfully filled.  If the delay slot is not filled, a compact
24040branch will be chosen if one is available.
24041
24042@item -mfp-exceptions
24043@itemx -mno-fp-exceptions
24044@opindex mfp-exceptions
24045Specifies whether FP exceptions are enabled.  This affects how
24046FP instructions are scheduled for some processors.
24047The default is that FP exceptions are
24048enabled.
24049
24050For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
2405164-bit code, then we can use both FP pipes.  Otherwise, we can only use one
24052FP pipe.
24053
24054@item -mvr4130-align
24055@itemx -mno-vr4130-align
24056@opindex mvr4130-align
24057The VR4130 pipeline is two-way superscalar, but can only issue two
24058instructions together if the first one is 8-byte aligned.  When this
24059option is enabled, GCC aligns pairs of instructions that it
24060thinks should execute in parallel.
24061
24062This option only has an effect when optimizing for the VR4130.
24063It normally makes code faster, but at the expense of making it bigger.
24064It is enabled by default at optimization level @option{-O3}.
24065
24066@item -msynci
24067@itemx -mno-synci
24068@opindex msynci
24069Enable (disable) generation of @code{synci} instructions on
24070architectures that support it.  The @code{synci} instructions (if
24071enabled) are generated when @code{__builtin___clear_cache} is
24072compiled.
24073
24074This option defaults to @option{-mno-synci}, but the default can be
24075overridden by configuring GCC with @option{--with-synci}.
24076
24077When compiling code for single processor systems, it is generally safe
24078to use @code{synci}.  However, on many multi-core (SMP) systems, it
24079does not invalidate the instruction caches on all cores and may lead
24080to undefined behavior.
24081
24082@item -mrelax-pic-calls
24083@itemx -mno-relax-pic-calls
24084@opindex mrelax-pic-calls
24085Try to turn PIC calls that are normally dispatched via register
24086@code{$25} into direct calls.  This is only possible if the linker can
24087resolve the destination at link time and if the destination is within
24088range for a direct call.
24089
24090@option{-mrelax-pic-calls} is the default if GCC was configured to use
24091an assembler and a linker that support the @code{.reloc} assembly
24092directive and @option{-mexplicit-relocs} is in effect.  With
24093@option{-mno-explicit-relocs}, this optimization can be performed by the
24094assembler and the linker alone without help from the compiler.
24095
24096@item -mmcount-ra-address
24097@itemx -mno-mcount-ra-address
24098@opindex mmcount-ra-address
24099@opindex mno-mcount-ra-address
24100Emit (do not emit) code that allows @code{_mcount} to modify the
24101calling function's return address.  When enabled, this option extends
24102the usual @code{_mcount} interface with a new @var{ra-address}
24103parameter, which has type @code{intptr_t *} and is passed in register
24104@code{$12}.  @code{_mcount} can then modify the return address by
24105doing both of the following:
24106@itemize
24107@item
24108Returning the new address in register @code{$31}.
24109@item
24110Storing the new address in @code{*@var{ra-address}},
24111if @var{ra-address} is nonnull.
24112@end itemize
24113
24114The default is @option{-mno-mcount-ra-address}.
24115
24116@item -mframe-header-opt
24117@itemx -mno-frame-header-opt
24118@opindex mframe-header-opt
24119Enable (disable) frame header optimization in the o32 ABI.  When using the
24120o32 ABI, calling functions will allocate 16 bytes on the stack for the called
24121function to write out register arguments.  When enabled, this optimization
24122will suppress the allocation of the frame header if it can be determined that
24123it is unused.
24124
24125This optimization is off by default at all optimization levels.
24126
24127@item -mlxc1-sxc1
24128@itemx -mno-lxc1-sxc1
24129@opindex mlxc1-sxc1
24130When applicable, enable (disable) the generation of @code{lwxc1},
24131@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
24132
24133@item -mmadd4
24134@itemx -mno-madd4
24135@opindex mmadd4
24136When applicable, enable (disable) the generation of 4-operand @code{madd.s},
24137@code{madd.d} and related instructions.  Enabled by default.
24138
24139@end table
24140
24141@node MMIX Options
24142@subsection MMIX Options
24143@cindex MMIX Options
24144
24145These options are defined for the MMIX:
24146
24147@table @gcctabopt
24148@item -mlibfuncs
24149@itemx -mno-libfuncs
24150@opindex mlibfuncs
24151@opindex mno-libfuncs
24152Specify that intrinsic library functions are being compiled, passing all
24153values in registers, no matter the size.
24154
24155@item -mepsilon
24156@itemx -mno-epsilon
24157@opindex mepsilon
24158@opindex mno-epsilon
24159Generate floating-point comparison instructions that compare with respect
24160to the @code{rE} epsilon register.
24161
24162@item -mabi=mmixware
24163@itemx -mabi=gnu
24164@opindex mabi=mmixware
24165@opindex mabi=gnu
24166Generate code that passes function parameters and return values that (in
24167the called function) are seen as registers @code{$0} and up, as opposed to
24168the GNU ABI which uses global registers @code{$231} and up.
24169
24170@item -mzero-extend
24171@itemx -mno-zero-extend
24172@opindex mzero-extend
24173@opindex mno-zero-extend
24174When reading data from memory in sizes shorter than 64 bits, use (do not
24175use) zero-extending load instructions by default, rather than
24176sign-extending ones.
24177
24178@item -mknuthdiv
24179@itemx -mno-knuthdiv
24180@opindex mknuthdiv
24181@opindex mno-knuthdiv
24182Make the result of a division yielding a remainder have the same sign as
24183the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
24184remainder follows the sign of the dividend.  Both methods are
24185arithmetically valid, the latter being almost exclusively used.
24186
24187@item -mtoplevel-symbols
24188@itemx -mno-toplevel-symbols
24189@opindex mtoplevel-symbols
24190@opindex mno-toplevel-symbols
24191Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24192code can be used with the @code{PREFIX} assembly directive.
24193
24194@item -melf
24195@opindex melf
24196Generate an executable in the ELF format, rather than the default
24197@samp{mmo} format used by the @command{mmix} simulator.
24198
24199@item -mbranch-predict
24200@itemx -mno-branch-predict
24201@opindex mbranch-predict
24202@opindex mno-branch-predict
24203Use (do not use) the probable-branch instructions, when static branch
24204prediction indicates a probable branch.
24205
24206@item -mbase-addresses
24207@itemx -mno-base-addresses
24208@opindex mbase-addresses
24209@opindex mno-base-addresses
24210Generate (do not generate) code that uses @emph{base addresses}.  Using a
24211base address automatically generates a request (handled by the assembler
24212and the linker) for a constant to be set up in a global register.  The
24213register is used for one or more base address requests within the range 0
24214to 255 from the value held in the register.  The generally leads to short
24215and fast code, but the number of different data items that can be
24216addressed is limited.  This means that a program that uses lots of static
24217data may require @option{-mno-base-addresses}.
24218
24219@item -msingle-exit
24220@itemx -mno-single-exit
24221@opindex msingle-exit
24222@opindex mno-single-exit
24223Force (do not force) generated code to have a single exit point in each
24224function.
24225@end table
24226
24227@node MN10300 Options
24228@subsection MN10300 Options
24229@cindex MN10300 options
24230
24231These @option{-m} options are defined for Matsushita MN10300 architectures:
24232
24233@table @gcctabopt
24234@item -mmult-bug
24235@opindex mmult-bug
24236Generate code to avoid bugs in the multiply instructions for the MN10300
24237processors.  This is the default.
24238
24239@item -mno-mult-bug
24240@opindex mno-mult-bug
24241Do not generate code to avoid bugs in the multiply instructions for the
24242MN10300 processors.
24243
24244@item -mam33
24245@opindex mam33
24246Generate code using features specific to the AM33 processor.
24247
24248@item -mno-am33
24249@opindex mno-am33
24250Do not generate code using features specific to the AM33 processor.  This
24251is the default.
24252
24253@item -mam33-2
24254@opindex mam33-2
24255Generate code using features specific to the AM33/2.0 processor.
24256
24257@item -mam34
24258@opindex mam34
24259Generate code using features specific to the AM34 processor.
24260
24261@item -mtune=@var{cpu-type}
24262@opindex mtune
24263Use the timing characteristics of the indicated CPU type when
24264scheduling instructions.  This does not change the targeted processor
24265type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
24266@samp{am33-2} or @samp{am34}.
24267
24268@item -mreturn-pointer-on-d0
24269@opindex mreturn-pointer-on-d0
24270When generating a function that returns a pointer, return the pointer
24271in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
24272only in @code{a0}, and attempts to call such functions without a prototype
24273result in errors.  Note that this option is on by default; use
24274@option{-mno-return-pointer-on-d0} to disable it.
24275
24276@item -mno-crt0
24277@opindex mno-crt0
24278Do not link in the C run-time initialization object file.
24279
24280@item -mrelax
24281@opindex mrelax
24282Indicate to the linker that it should perform a relaxation optimization pass
24283to shorten branches, calls and absolute memory addresses.  This option only
24284has an effect when used on the command line for the final link step.
24285
24286This option makes symbolic debugging impossible.
24287
24288@item -mliw
24289@opindex mliw
24290Allow the compiler to generate @emph{Long Instruction Word}
24291instructions if the target is the @samp{AM33} or later.  This is the
24292default.  This option defines the preprocessor macro @code{__LIW__}.
24293
24294@item -mno-liw
24295@opindex mno-liw
24296Do not allow the compiler to generate @emph{Long Instruction Word}
24297instructions.  This option defines the preprocessor macro
24298@code{__NO_LIW__}.
24299
24300@item -msetlb
24301@opindex msetlb
24302Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24303instructions if the target is the @samp{AM33} or later.  This is the
24304default.  This option defines the preprocessor macro @code{__SETLB__}.
24305
24306@item -mno-setlb
24307@opindex mno-setlb
24308Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24309instructions.  This option defines the preprocessor macro
24310@code{__NO_SETLB__}.
24311
24312@end table
24313
24314@node Moxie Options
24315@subsection Moxie Options
24316@cindex Moxie Options
24317
24318@table @gcctabopt
24319
24320@item -meb
24321@opindex meb
24322Generate big-endian code.  This is the default for @samp{moxie-*-*}
24323configurations.
24324
24325@item -mel
24326@opindex mel
24327Generate little-endian code.
24328
24329@item -mmul.x
24330@opindex mmul.x
24331Generate mul.x and umul.x instructions.  This is the default for
24332@samp{moxiebox-*-*} configurations.
24333
24334@item -mno-crt0
24335@opindex mno-crt0
24336Do not link in the C run-time initialization object file.
24337
24338@end table
24339
24340@node MSP430 Options
24341@subsection MSP430 Options
24342@cindex MSP430 Options
24343
24344These options are defined for the MSP430:
24345
24346@table @gcctabopt
24347
24348@item -masm-hex
24349@opindex masm-hex
24350Force assembly output to always use hex constants.  Normally such
24351constants are signed decimals, but this option is available for
24352testsuite and/or aesthetic purposes.
24353
24354@item -mmcu=
24355@opindex mmcu=
24356Select the MCU to target.  This is used to create a C preprocessor
24357symbol based upon the MCU name, converted to upper case and pre- and
24358post-fixed with @samp{__}.  This in turn is used by the
24359@file{msp430.h} header file to select an MCU-specific supplementary
24360header file.
24361
24362The option also sets the ISA to use.  If the MCU name is one that is
24363known to only support the 430 ISA then that is selected, otherwise the
24364430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
24365used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
24366name selects the 430X ISA.
24367
24368In addition an MCU-specific linker script is added to the linker
24369command line.  The script's name is the name of the MCU with
24370@file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24371command line defines the C preprocessor symbol @code{__XXX__} and
24372cause the linker to search for a script called @file{xxx.ld}.
24373
24374The ISA and hardware multiply supported for the different MCUs is hard-coded
24375into GCC.  However, an external @samp{devices.csv} file can be used to
24376extend device support beyond those that have been hard-coded.
24377
24378GCC searches for the @samp{devices.csv} file using the following methods in the
24379given precedence order, where the first method takes precendence over the
24380second which takes precedence over the third.
24381
24382@table @asis
24383@item Include path specified with @code{-I} and @code{-L}
24384@samp{devices.csv} will be searched for in each of the directories specified by
24385include paths and linker library search paths.
24386@item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24387Define the value of the global environment variable
24388@samp{MSP430_GCC_INCLUDE_DIR}
24389to the full path to the directory containing devices.csv, and GCC will search
24390this directory for devices.csv.  If devices.csv is found, this directory will
24391also be registered as an include path, and linker library path.  Header files
24392and linker scripts in this directory can therefore be used without manually
24393specifying @code{-I} and @code{-L} on the command line.
24394@item The @samp{msp430-elf@{,bare@}/include/devices} directory
24395Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24396toolchain root directory.  This directory does not exist in a default
24397installation, but if the user has created it and copied @samp{devices.csv}
24398there, then the MCU data will be read.  As above, this directory will
24399also be registered as an include path, and linker library path.
24400
24401@end table
24402If none of the above search methods find @samp{devices.csv}, then the
24403hard-coded MCU data is used.
24404
24405
24406@item -mwarn-mcu
24407@itemx -mno-warn-mcu
24408@opindex mwarn-mcu
24409@opindex mno-warn-mcu
24410This option enables or disables warnings about conflicts between the
24411MCU name specified by the @option{-mmcu} option and the ISA set by the
24412@option{-mcpu} option and/or the hardware multiply support set by the
24413@option{-mhwmult} option.  It also toggles warnings about unrecognized
24414MCU names.  This option is on by default.
24415
24416@item -mcpu=
24417@opindex mcpu=
24418Specifies the ISA to use.  Accepted values are @samp{msp430},
24419@samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
24420@option{-mmcu=} option should be used to select the ISA.
24421
24422@item -msim
24423@opindex msim
24424Link to the simulator runtime libraries and linker script.  Overrides
24425any scripts that would be selected by the @option{-mmcu=} option.
24426
24427@item -mlarge
24428@opindex mlarge
24429Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24430
24431@item -msmall
24432@opindex msmall
24433Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24434
24435@item -mrelax
24436@opindex mrelax
24437This option is passed to the assembler and linker, and allows the
24438linker to perform certain optimizations that cannot be done until
24439the final link.
24440
24441@item mhwmult=
24442@opindex mhwmult=
24443Describes the type of hardware multiply supported by the target.
24444Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24445for the original 16-bit-only multiply supported by early MCUs.
24446@samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24447@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24448A value of @samp{auto} can also be given.  This tells GCC to deduce
24449the hardware multiply support based upon the MCU name provided by the
24450@option{-mmcu} option.  If no @option{-mmcu} option is specified or if
24451the MCU name is not recognized then no hardware multiply support is
24452assumed.  @code{auto} is the default setting.
24453
24454Hardware multiplies are normally performed by calling a library
24455routine.  This saves space in the generated code.  When compiling at
24456@option{-O3} or higher however the hardware multiplier is invoked
24457inline.  This makes for bigger, but faster code.
24458
24459The hardware multiply routines disable interrupts whilst running and
24460restore the previous interrupt state when they finish.  This makes
24461them safe to use inside interrupt handlers as well as in normal code.
24462
24463@item -minrt
24464@opindex minrt
24465Enable the use of a minimum runtime environment - no static
24466initializers or constructors.  This is intended for memory-constrained
24467devices.  The compiler includes special symbols in some objects
24468that tell the linker and runtime which code fragments are required.
24469
24470@item -mtiny-printf
24471@opindex mtiny-printf
24472Enable reduced code size @code{printf} and @code{puts} library functions.
24473The @samp{tiny} implementations of these functions are not reentrant, so
24474must be used with caution in multi-threaded applications.
24475
24476Support for streams has been removed and the string to be printed will
24477always be sent to stdout via the @code{write} syscall.  The string is not
24478buffered before it is sent to write.
24479
24480This option requires Newlib Nano IO, so GCC must be configured with
24481@samp{--enable-newlib-nano-formatted-io}.
24482
24483@item -mcode-region=
24484@itemx -mdata-region=
24485@opindex mcode-region
24486@opindex mdata-region
24487These options tell the compiler where to place functions and data that
24488do not have one of the @code{lower}, @code{upper}, @code{either} or
24489@code{section} attributes.  Possible values are @code{lower},
24490@code{upper}, @code{either} or @code{any}.  The first three behave
24491like the corresponding attribute.  The fourth possible value -
24492@code{any} - is the default.  It leaves placement entirely up to the
24493linker script and how it assigns the standard sections
24494(@code{.text}, @code{.data}, etc) to the memory regions.
24495
24496@item -msilicon-errata=
24497@opindex msilicon-errata
24498This option passes on a request to assembler to enable the fixes for
24499the named silicon errata.
24500
24501@item -msilicon-errata-warn=
24502@opindex msilicon-errata-warn
24503This option passes on a request to the assembler to enable warning
24504messages when a silicon errata might need to be applied.
24505
24506@item -mwarn-devices-csv
24507@itemx -mno-warn-devices-csv
24508@opindex mwarn-devices-csv
24509@opindex mno-warn-devices-csv
24510Warn if @samp{devices.csv} is not found or there are problem parsing it
24511(default: on).
24512
24513@end table
24514
24515@node NDS32 Options
24516@subsection NDS32 Options
24517@cindex NDS32 Options
24518
24519These options are defined for NDS32 implementations:
24520
24521@table @gcctabopt
24522
24523@item -mbig-endian
24524@opindex mbig-endian
24525Generate code in big-endian mode.
24526
24527@item -mlittle-endian
24528@opindex mlittle-endian
24529Generate code in little-endian mode.
24530
24531@item -mreduced-regs
24532@opindex mreduced-regs
24533Use reduced-set registers for register allocation.
24534
24535@item -mfull-regs
24536@opindex mfull-regs
24537Use full-set registers for register allocation.
24538
24539@item -mcmov
24540@opindex mcmov
24541Generate conditional move instructions.
24542
24543@item -mno-cmov
24544@opindex mno-cmov
24545Do not generate conditional move instructions.
24546
24547@item -mext-perf
24548@opindex mext-perf
24549Generate performance extension instructions.
24550
24551@item -mno-ext-perf
24552@opindex mno-ext-perf
24553Do not generate performance extension instructions.
24554
24555@item -mext-perf2
24556@opindex mext-perf2
24557Generate performance extension 2 instructions.
24558
24559@item -mno-ext-perf2
24560@opindex mno-ext-perf2
24561Do not generate performance extension 2 instructions.
24562
24563@item -mext-string
24564@opindex mext-string
24565Generate string extension instructions.
24566
24567@item -mno-ext-string
24568@opindex mno-ext-string
24569Do not generate string extension instructions.
24570
24571@item -mv3push
24572@opindex mv3push
24573Generate v3 push25/pop25 instructions.
24574
24575@item -mno-v3push
24576@opindex mno-v3push
24577Do not generate v3 push25/pop25 instructions.
24578
24579@item -m16-bit
24580@opindex m16-bit
24581Generate 16-bit instructions.
24582
24583@item -mno-16-bit
24584@opindex mno-16-bit
24585Do not generate 16-bit instructions.
24586
24587@item -misr-vector-size=@var{num}
24588@opindex misr-vector-size
24589Specify the size of each interrupt vector, which must be 4 or 16.
24590
24591@item -mcache-block-size=@var{num}
24592@opindex mcache-block-size
24593Specify the size of each cache block,
24594which must be a power of 2 between 4 and 512.
24595
24596@item -march=@var{arch}
24597@opindex march
24598Specify the name of the target architecture.
24599
24600@item -mcmodel=@var{code-model}
24601@opindex mcmodel
24602Set the code model to one of
24603@table @asis
24604@item @samp{small}
24605All the data and read-only data segments must be within 512KB addressing space.
24606The text segment must be within 16MB addressing space.
24607@item @samp{medium}
24608The data segment must be within 512KB while the read-only data segment can be
24609within 4GB addressing space.  The text segment should be still within 16MB
24610addressing space.
24611@item @samp{large}
24612All the text and data segments can be within 4GB addressing space.
24613@end table
24614
24615@item -mctor-dtor
24616@opindex mctor-dtor
24617Enable constructor/destructor feature.
24618
24619@item -mrelax
24620@opindex mrelax
24621Guide linker to relax instructions.
24622
24623@end table
24624
24625@node Nios II Options
24626@subsection Nios II Options
24627@cindex Nios II options
24628@cindex Altera Nios II options
24629
24630These are the options defined for the Altera Nios II processor.
24631
24632@table @gcctabopt
24633
24634@item -G @var{num}
24635@opindex G
24636@cindex smaller data references
24637Put global and static objects less than or equal to @var{num} bytes
24638into the small data or BSS sections instead of the normal data or BSS
24639sections.  The default value of @var{num} is 8.
24640
24641@item -mgpopt=@var{option}
24642@itemx -mgpopt
24643@itemx -mno-gpopt
24644@opindex mgpopt
24645@opindex mno-gpopt
24646Generate (do not generate) GP-relative accesses.  The following
24647@var{option} names are recognized:
24648
24649@table @samp
24650
24651@item none
24652Do not generate GP-relative accesses.
24653
24654@item local
24655Generate GP-relative accesses for small data objects that are not
24656external, weak, or uninitialized common symbols.
24657Also use GP-relative addressing for objects that
24658have been explicitly placed in a small data section via a @code{section}
24659attribute.
24660
24661@item global
24662As for @samp{local}, but also generate GP-relative accesses for
24663small data objects that are external, weak, or common.  If you use this option,
24664you must ensure that all parts of your program (including libraries) are
24665compiled with the same @option{-G} setting.
24666
24667@item data
24668Generate GP-relative accesses for all data objects in the program.  If you
24669use this option, the entire data and BSS segments
24670of your program must fit in 64K of memory and you must use an appropriate
24671linker script to allocate them within the addressable range of the
24672global pointer.
24673
24674@item all
24675Generate GP-relative addresses for function pointers as well as data
24676pointers.  If you use this option, the entire text, data, and BSS segments
24677of your program must fit in 64K of memory and you must use an appropriate
24678linker script to allocate them within the addressable range of the
24679global pointer.
24680
24681@end table
24682
24683@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24684@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24685
24686The default is @option{-mgpopt} except when @option{-fpic} or
24687@option{-fPIC} is specified to generate position-independent code.
24688Note that the Nios II ABI does not permit GP-relative accesses from
24689shared libraries.
24690
24691You may need to specify @option{-mno-gpopt} explicitly when building
24692programs that include large amounts of small data, including large
24693GOT data sections.  In this case, the 16-bit offset for GP-relative
24694addressing may not be large enough to allow access to the entire
24695small data section.
24696
24697@item -mgprel-sec=@var{regexp}
24698@opindex mgprel-sec
24699This option specifies additional section names that can be accessed via
24700GP-relative addressing.  It is most useful in conjunction with
24701@code{section} attributes on variable declarations
24702(@pxref{Common Variable Attributes}) and a custom linker script.
24703The @var{regexp} is a POSIX Extended Regular Expression.
24704
24705This option does not affect the behavior of the @option{-G} option, and
24706the specified sections are in addition to the standard @code{.sdata}
24707and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24708
24709@item -mr0rel-sec=@var{regexp}
24710@opindex mr0rel-sec
24711This option specifies names of sections that can be accessed via a
2471216-bit offset from @code{r0}; that is, in the low 32K or high 32K
24713of the 32-bit address space.  It is most useful in conjunction with
24714@code{section} attributes on variable declarations
24715(@pxref{Common Variable Attributes}) and a custom linker script.
24716The @var{regexp} is a POSIX Extended Regular Expression.
24717
24718In contrast to the use of GP-relative addressing for small data,
24719zero-based addressing is never generated by default and there are no
24720conventional section names used in standard linker scripts for sections
24721in the low or high areas of memory.
24722
24723@item -mel
24724@itemx -meb
24725@opindex mel
24726@opindex meb
24727Generate little-endian (default) or big-endian (experimental) code,
24728respectively.
24729
24730@item -march=@var{arch}
24731@opindex march
24732This specifies the name of the target Nios II architecture.  GCC uses this
24733name to determine what kind of instructions it can emit when generating
24734assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
24735
24736The preprocessor macro @code{__nios2_arch__} is available to programs,
24737with value 1 or 2, indicating the targeted ISA level.
24738
24739@item -mbypass-cache
24740@itemx -mno-bypass-cache
24741@opindex mno-bypass-cache
24742@opindex mbypass-cache
24743Force all load and store instructions to always bypass cache by
24744using I/O variants of the instructions. The default is not to
24745bypass the cache.
24746
24747@item -mno-cache-volatile
24748@itemx -mcache-volatile
24749@opindex mcache-volatile
24750@opindex mno-cache-volatile
24751Volatile memory access bypass the cache using the I/O variants of
24752the load and store instructions. The default is not to bypass the cache.
24753
24754@item -mno-fast-sw-div
24755@itemx -mfast-sw-div
24756@opindex mno-fast-sw-div
24757@opindex mfast-sw-div
24758Do not use table-based fast divide for small numbers. The default
24759is to use the fast divide at @option{-O3} and above.
24760
24761@item -mno-hw-mul
24762@itemx -mhw-mul
24763@itemx -mno-hw-mulx
24764@itemx -mhw-mulx
24765@itemx -mno-hw-div
24766@itemx -mhw-div
24767@opindex mno-hw-mul
24768@opindex mhw-mul
24769@opindex mno-hw-mulx
24770@opindex mhw-mulx
24771@opindex mno-hw-div
24772@opindex mhw-div
24773Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
24774instructions by the compiler. The default is to emit @code{mul}
24775and not emit @code{div} and @code{mulx}.
24776
24777@item -mbmx
24778@itemx -mno-bmx
24779@itemx -mcdx
24780@itemx -mno-cdx
24781Enable or disable generation of Nios II R2 BMX (bit manipulation) and
24782CDX (code density) instructions.  Enabling these instructions also
24783requires @option{-march=r2}.  Since these instructions are optional
24784extensions to the R2 architecture, the default is not to emit them.
24785
24786@item -mcustom-@var{insn}=@var{N}
24787@itemx -mno-custom-@var{insn}
24788@opindex mcustom-@var{insn}
24789@opindex mno-custom-@var{insn}
24790Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
24791custom instruction with encoding @var{N} when generating code that uses
24792@var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
24793instruction 253 for single-precision floating-point add operations instead
24794of the default behavior of using a library call.
24795
24796The following values of @var{insn} are supported.  Except as otherwise
24797noted, floating-point operations are expected to be implemented with
24798normal IEEE 754 semantics and correspond directly to the C operators or the
24799equivalent GCC built-in functions (@pxref{Other Builtins}).
24800
24801Single-precision floating point:
24802@table @asis
24803
24804@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
24805Binary arithmetic operations.
24806
24807@item @samp{fnegs}
24808Unary negation.
24809
24810@item @samp{fabss}
24811Unary absolute value.
24812
24813@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
24814Comparison operations.
24815
24816@item @samp{fmins}, @samp{fmaxs}
24817Floating-point minimum and maximum.  These instructions are only
24818generated if @option{-ffinite-math-only} is specified.
24819
24820@item @samp{fsqrts}
24821Unary square root operation.
24822
24823@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
24824Floating-point trigonometric and exponential functions.  These instructions
24825are only generated if @option{-funsafe-math-optimizations} is also specified.
24826
24827@end table
24828
24829Double-precision floating point:
24830@table @asis
24831
24832@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
24833Binary arithmetic operations.
24834
24835@item @samp{fnegd}
24836Unary negation.
24837
24838@item @samp{fabsd}
24839Unary absolute value.
24840
24841@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
24842Comparison operations.
24843
24844@item @samp{fmind}, @samp{fmaxd}
24845Double-precision minimum and maximum.  These instructions are only
24846generated if @option{-ffinite-math-only} is specified.
24847
24848@item @samp{fsqrtd}
24849Unary square root operation.
24850
24851@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
24852Double-precision trigonometric and exponential functions.  These instructions
24853are only generated if @option{-funsafe-math-optimizations} is also specified.
24854
24855@end table
24856
24857Conversions:
24858@table @asis
24859@item @samp{fextsd}
24860Conversion from single precision to double precision.
24861
24862@item @samp{ftruncds}
24863Conversion from double precision to single precision.
24864
24865@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
24866Conversion from floating point to signed or unsigned integer types, with
24867truncation towards zero.
24868
24869@item @samp{round}
24870Conversion from single-precision floating point to signed integer,
24871rounding to the nearest integer and ties away from zero.
24872This corresponds to the @code{__builtin_lroundf} function when
24873@option{-fno-math-errno} is used.
24874
24875@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
24876Conversion from signed or unsigned integer types to floating-point types.
24877
24878@end table
24879
24880In addition, all of the following transfer instructions for internal
24881registers X and Y must be provided to use any of the double-precision
24882floating-point instructions.  Custom instructions taking two
24883double-precision source operands expect the first operand in the
2488464-bit register X.  The other operand (or only operand of a unary
24885operation) is given to the custom arithmetic instruction with the
24886least significant half in source register @var{src1} and the most
24887significant half in @var{src2}.  A custom instruction that returns a
24888double-precision result returns the most significant 32 bits in the
24889destination register and the other half in 32-bit register Y.
24890GCC automatically generates the necessary code sequences to write
24891register X and/or read register Y when double-precision floating-point
24892instructions are used.
24893
24894@table @asis
24895
24896@item @samp{fwrx}
24897Write @var{src1} into the least significant half of X and @var{src2} into
24898the most significant half of X.
24899
24900@item @samp{fwry}
24901Write @var{src1} into Y.
24902
24903@item @samp{frdxhi}, @samp{frdxlo}
24904Read the most or least (respectively) significant half of X and store it in
24905@var{dest}.
24906
24907@item @samp{frdy}
24908Read the value of Y and store it into @var{dest}.
24909@end table
24910
24911Note that you can gain more local control over generation of Nios II custom
24912instructions by using the @code{target("custom-@var{insn}=@var{N}")}
24913and @code{target("no-custom-@var{insn}")} function attributes
24914(@pxref{Function Attributes})
24915or pragmas (@pxref{Function Specific Option Pragmas}).
24916
24917@item -mcustom-fpu-cfg=@var{name}
24918@opindex mcustom-fpu-cfg
24919
24920This option enables a predefined, named set of custom instruction encodings
24921(see @option{-mcustom-@var{insn}} above).
24922Currently, the following sets are defined:
24923
24924@option{-mcustom-fpu-cfg=60-1} is equivalent to:
24925@gccoptlist{-mcustom-fmuls=252 @gol
24926-mcustom-fadds=253 @gol
24927-mcustom-fsubs=254 @gol
24928-fsingle-precision-constant}
24929
24930@option{-mcustom-fpu-cfg=60-2} is equivalent to:
24931@gccoptlist{-mcustom-fmuls=252 @gol
24932-mcustom-fadds=253 @gol
24933-mcustom-fsubs=254 @gol
24934-mcustom-fdivs=255 @gol
24935-fsingle-precision-constant}
24936
24937@option{-mcustom-fpu-cfg=72-3} is equivalent to:
24938@gccoptlist{-mcustom-floatus=243 @gol
24939-mcustom-fixsi=244 @gol
24940-mcustom-floatis=245 @gol
24941-mcustom-fcmpgts=246 @gol
24942-mcustom-fcmples=249 @gol
24943-mcustom-fcmpeqs=250 @gol
24944-mcustom-fcmpnes=251 @gol
24945-mcustom-fmuls=252 @gol
24946-mcustom-fadds=253 @gol
24947-mcustom-fsubs=254 @gol
24948-mcustom-fdivs=255 @gol
24949-fsingle-precision-constant}
24950
24951Custom instruction assignments given by individual
24952@option{-mcustom-@var{insn}=} options override those given by
24953@option{-mcustom-fpu-cfg=}, regardless of the
24954order of the options on the command line.
24955
24956Note that you can gain more local control over selection of a FPU
24957configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
24958function attribute (@pxref{Function Attributes})
24959or pragma (@pxref{Function Specific Option Pragmas}).
24960
24961@end table
24962
24963These additional @samp{-m} options are available for the Altera Nios II
24964ELF (bare-metal) target:
24965
24966@table @gcctabopt
24967
24968@item -mhal
24969@opindex mhal
24970Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
24971startup and termination code, and is typically used in conjunction with
24972@option{-msys-crt0=} to specify the location of the alternate startup code
24973provided by the HAL BSP.
24974
24975@item -msmallc
24976@opindex msmallc
24977Link with a limited version of the C library, @option{-lsmallc}, rather than
24978Newlib.
24979
24980@item -msys-crt0=@var{startfile}
24981@opindex msys-crt0
24982@var{startfile} is the file name of the startfile (crt0) to use
24983when linking.  This option is only useful in conjunction with @option{-mhal}.
24984
24985@item -msys-lib=@var{systemlib}
24986@opindex msys-lib
24987@var{systemlib} is the library name of the library that provides
24988low-level system calls required by the C library,
24989e.g.@: @code{read} and @code{write}.
24990This option is typically used to link with a library provided by a HAL BSP.
24991
24992@end table
24993
24994@node Nvidia PTX Options
24995@subsection Nvidia PTX Options
24996@cindex Nvidia PTX options
24997@cindex nvptx options
24998
24999These options are defined for Nvidia PTX:
25000
25001@table @gcctabopt
25002
25003@item -m32
25004@itemx -m64
25005@opindex m32
25006@opindex m64
25007Generate code for 32-bit or 64-bit ABI.
25008
25009@item -misa=@var{ISA-string}
25010@opindex march
25011Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
25012strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
25013@samp{sm_35}.  The default ISA is sm_30.
25014
25015@item -mmainkernel
25016@opindex mmainkernel
25017Link in code for a __main kernel.  This is for stand-alone instead of
25018offloading execution.
25019
25020@item -moptimize
25021@opindex moptimize
25022Apply partitioned execution optimizations.  This is the default when any
25023level of optimization is selected.
25024
25025@item -msoft-stack
25026@opindex msoft-stack
25027Generate code that does not use @code{.local} memory
25028directly for stack storage. Instead, a per-warp stack pointer is
25029maintained explicitly. This enables variable-length stack allocation (with
25030variable-length arrays or @code{alloca}), and when global memory is used for
25031underlying storage, makes it possible to access automatic variables from other
25032threads, or with atomic instructions. This code generation variant is used
25033for OpenMP offloading, but the option is exposed on its own for the purpose
25034of testing the compiler; to generate code suitable for linking into programs
25035using OpenMP offloading, use option @option{-mgomp}.
25036
25037@item -muniform-simt
25038@opindex muniform-simt
25039Switch to code generation variant that allows to execute all threads in each
25040warp, while maintaining memory state and side effects as if only one thread
25041in each warp was active outside of OpenMP SIMD regions.  All atomic operations
25042and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
25043current lane index equals the master lane index), and the register being
25044assigned is copied via a shuffle instruction from the master lane.  Outside of
25045SIMD regions lane 0 is the master; inside, each thread sees itself as the
25046master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
25047all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
25048regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
25049with current lane index to compute the master lane index.
25050
25051@item -mgomp
25052@opindex mgomp
25053Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
25054@option{-muniform-simt} options, and selects corresponding multilib variant.
25055
25056@end table
25057
25058@node OpenRISC Options
25059@subsection OpenRISC Options
25060@cindex OpenRISC Options
25061
25062These options are defined for OpenRISC:
25063
25064@table @gcctabopt
25065
25066@item -mboard=@var{name}
25067@opindex mboard
25068Configure a board specific runtime.  This will be passed to the linker for
25069newlib board library linking.  The default is @code{or1ksim}.
25070
25071@item -mnewlib
25072@opindex mnewlib
25073This option is ignored; it is for compatibility purposes only.  This used to
25074select linker and preprocessor options for use with newlib.
25075
25076@item -msoft-div
25077@itemx -mhard-div
25078@opindex msoft-div
25079@opindex mhard-div
25080Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
25081This default is hardware divide.
25082
25083@item -msoft-mul
25084@itemx -mhard-mul
25085@opindex msoft-mul
25086@opindex mhard-mul
25087Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
25088This default is hardware multiply.
25089
25090@item -msoft-float
25091@itemx -mhard-float
25092@opindex msoft-float
25093@opindex mhard-float
25094Select software or hardware for floating point operations.
25095The default is software.
25096
25097@item -mdouble-float
25098@opindex mdouble-float
25099When @option{-mhard-float} is selected, enables generation of double-precision
25100floating point instructions.  By default functions from @file{libgcc} are used
25101to perform double-precision floating point operations.
25102
25103@item -munordered-float
25104@opindex munordered-float
25105When @option{-mhard-float} is selected, enables generation of unordered
25106floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
25107functions from @file{libgcc} are used to perform unordered floating point
25108compare and set flag operations.
25109
25110@item -mcmov
25111@opindex mcmov
25112Enable generation of conditional move (@code{l.cmov}) instructions.  By
25113default the equivalent will be generated using set and branch.
25114
25115@item -mror
25116@opindex mror
25117Enable generation of rotate right (@code{l.ror}) instructions.  By default
25118functions from @file{libgcc} are used to perform rotate right operations.
25119
25120@item -mrori
25121@opindex mrori
25122Enable generation of rotate right with immediate (@code{l.rori}) instructions.
25123By default functions from @file{libgcc} are used to perform rotate right with
25124immediate operations.
25125
25126@item -msext
25127@opindex msext
25128Enable generation of sign extension (@code{l.ext*}) instructions.  By default
25129memory loads are used to perform sign extension.
25130
25131@item -msfimm
25132@opindex msfimm
25133Enable generation of compare and set flag with immediate (@code{l.sf*i})
25134instructions.  By default extra instructions will be generated to store the
25135immediate to a register first.
25136
25137@item -mshftimm
25138@opindex mshftimm
25139Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
25140@code{l.slli}) instructions.  By default extra instructions will be generated
25141to store the immediate to a register first.
25142
25143
25144@end table
25145
25146@node PDP-11 Options
25147@subsection PDP-11 Options
25148@cindex PDP-11 Options
25149
25150These options are defined for the PDP-11:
25151
25152@table @gcctabopt
25153@item -mfpu
25154@opindex mfpu
25155Use hardware FPP floating point.  This is the default.  (FIS floating
25156point on the PDP-11/40 is not supported.)  Implies -m45.
25157
25158@item -msoft-float
25159@opindex msoft-float
25160Do not use hardware floating point.
25161
25162@item -mac0
25163@opindex mac0
25164Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25165
25166@item -mno-ac0
25167@opindex mno-ac0
25168Return floating-point results in memory.  This is the default.
25169
25170@item -m40
25171@opindex m40
25172Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
25173
25174@item -m45
25175@opindex m45
25176Generate code for a PDP-11/45.  This is the default.
25177
25178@item -m10
25179@opindex m10
25180Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
25181
25182@item -mint16
25183@itemx -mno-int32
25184@opindex mint16
25185@opindex mno-int32
25186Use 16-bit @code{int}.  This is the default.
25187
25188@item -mint32
25189@itemx -mno-int16
25190@opindex mint32
25191@opindex mno-int16
25192Use 32-bit @code{int}.
25193
25194@item -msplit
25195@opindex msplit
25196Target has split instruction and data space.  Implies -m45.
25197
25198@item -munix-asm
25199@opindex munix-asm
25200Use Unix assembler syntax.
25201
25202@item -mdec-asm
25203@opindex mdec-asm
25204Use DEC assembler syntax.
25205
25206@item -mgnu-asm
25207@opindex mgnu-asm
25208Use GNU assembler syntax.  This is the default.
25209
25210@item -mlra
25211@opindex mlra
25212Use the new LRA register allocator.  By default, the old ``reload''
25213allocator is used.
25214@end table
25215
25216@node picoChip Options
25217@subsection picoChip Options
25218@cindex picoChip options
25219
25220These @samp{-m} options are defined for picoChip implementations:
25221
25222@table @gcctabopt
25223
25224@item -mae=@var{ae_type}
25225@opindex mcpu
25226Set the instruction set, register set, and instruction scheduling
25227parameters for array element type @var{ae_type}.  Supported values
25228for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25229
25230@option{-mae=ANY} selects a completely generic AE type.  Code
25231generated with this option runs on any of the other AE types.  The
25232code is not as efficient as it would be if compiled for a specific
25233AE type, and some types of operation (e.g., multiplication) do not
25234work properly on all types of AE.
25235
25236@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
25237for compiled code, and is the default.
25238
25239@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
25240option may suffer from poor performance of byte (char) manipulation,
25241since the DSP AE does not provide hardware support for byte load/stores.
25242
25243@item -msymbol-as-address
25244Enable the compiler to directly use a symbol name as an address in a
25245load/store instruction, without first loading it into a
25246register.  Typically, the use of this option generates larger
25247programs, which run faster than when the option isn't used.  However, the
25248results vary from program to program, so it is left as a user option,
25249rather than being permanently enabled.
25250
25251@item -mno-inefficient-warnings
25252Disables warnings about the generation of inefficient code.  These
25253warnings can be generated, for example, when compiling code that
25254performs byte-level memory operations on the MAC AE type.  The MAC AE has
25255no hardware support for byte-level memory operations, so all byte
25256load/stores must be synthesized from word load/store operations.  This is
25257inefficient and a warning is generated to indicate
25258that you should rewrite the code to avoid byte operations, or to target
25259an AE type that has the necessary hardware support.  This option disables
25260these warnings.
25261
25262@end table
25263
25264@node PowerPC Options
25265@subsection PowerPC Options
25266@cindex PowerPC options
25267
25268These are listed under @xref{RS/6000 and PowerPC Options}.
25269
25270@node PRU Options
25271@subsection PRU Options
25272@cindex PRU Options
25273
25274These command-line options are defined for PRU target:
25275
25276@table @gcctabopt
25277@item -minrt
25278@opindex minrt
25279Link with a minimum runtime environment, with no support for static
25280initializers and constructors.  Using this option can significantly reduce
25281the size of the final ELF binary.  Beware that the compiler could still
25282generate code with static initializers and constructors.  It is up to the
25283programmer to ensure that the source program will not use those features.
25284
25285@item -mmcu=@var{mcu}
25286@opindex mmcu
25287Specify the PRU MCU variant to use.  Check Newlib for the exact list of
25288supported MCUs.
25289
25290@item -mno-relax
25291@opindex mno-relax
25292Make GCC pass the @option{--no-relax} command-line option to the linker
25293instead of the @option{--relax} option.
25294
25295@item -mloop
25296@opindex mloop
25297Allow (or do not allow) GCC to use the LOOP instruction.
25298
25299@item -mabi=@var{variant}
25300@opindex mabi
25301Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
25302unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25303more naturally with certain GCC assumptions.  These are the differences:
25304
25305@table @samp
25306@item Function Pointer Size
25307TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25308supports only 32-bit data and code pointers.
25309
25310@item Optional Return Value Pointer
25311Function return values larger than 64 bits are passed by using a hidden
25312pointer as the first argument of the function.  TI ABI, though, mandates that
25313the pointer can be NULL in case the caller is not using the returned value.
25314GNU always passes and expects a valid return value pointer.
25315
25316@end table
25317
25318The current @option{-mabi=ti} implementation simply raises a compile error
25319when any of the above code constructs is detected.  As a consequence
25320the standard C library cannot be built and it is omitted when linking with
25321@option{-mabi=ti}.
25322
25323Relaxation is a GNU feature and for safety reasons is disabled when using
25324@option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
25325instructions, so the GNU linker cannot adjust them when shortening adjacent
25326LDI32 pseudo instructions.
25327
25328@end table
25329
25330@node RISC-V Options
25331@subsection RISC-V Options
25332@cindex RISC-V Options
25333
25334These command-line options are defined for RISC-V targets:
25335
25336@table @gcctabopt
25337@item -mbranch-cost=@var{n}
25338@opindex mbranch-cost
25339Set the cost of branches to roughly @var{n} instructions.
25340
25341@item -mplt
25342@itemx -mno-plt
25343@opindex plt
25344When generating PIC code, do or don't allow the use of PLTs. Ignored for
25345non-PIC.  The default is @option{-mplt}.
25346
25347@item -mabi=@var{ABI-string}
25348@opindex mabi
25349Specify integer and floating-point calling convention.  @var{ABI-string}
25350contains two parts: the size of integer types and the registers used for
25351floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
25352@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
2535332-bit), and that floating-point values up to 64 bits wide are passed in F
25354registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25355allows the compiler to generate code that uses the F and D extensions but only
25356allows floating-point values up to 32 bits long to be passed in registers; or
25357@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25358passed in registers.
25359
25360The default for this argument is system dependent, users who want a specific
25361calling convention should specify one explicitly.  The valid calling
25362conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25363@samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
25364implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25365invalid because the ABI requires 64-bit values be passed in F registers, but F
25366registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
25367only be used with the @samp{rv32e} architecture.  This ABI is not well
25368specified at present, and is subject to change.
25369
25370@item -mfdiv
25371@itemx -mno-fdiv
25372@opindex mfdiv
25373Do or don't use hardware floating-point divide and square root instructions.
25374This requires the F or D extensions for floating-point registers.  The default
25375is to use them if the specified architecture has these instructions.
25376
25377@item -mdiv
25378@itemx -mno-div
25379@opindex mdiv
25380Do or don't use hardware instructions for integer division.  This requires the
25381M extension.  The default is to use them if the specified architecture has
25382these instructions.
25383
25384@item -march=@var{ISA-string}
25385@opindex march
25386Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
25387lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25388@samp{rv32imaf}.
25389
25390@item -mtune=@var{processor-string}
25391@opindex mtune
25392Optimize the output for the given processor, specified by microarchitecture
25393name.  Permissible values for this option are: @samp{rocket},
25394@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25395and @samp{size}.
25396
25397When @option{-mtune=} is not specified, the default is @samp{rocket}.
25398
25399The @samp{size} choice is not intended for use by end-users.  This is used
25400when @option{-Os} is specified.  It overrides the instruction cost info
25401provided by @option{-mtune=}, but does not override the pipeline info.  This
25402helps reduce code size while still giving good performance.
25403
25404@item -mpreferred-stack-boundary=@var{num}
25405@opindex mpreferred-stack-boundary
25406Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25407byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
25408the default is 4 (16 bytes or 128-bits).
25409
25410@strong{Warning:} If you use this switch, then you must build all modules with
25411the same value, including any libraries.  This includes the system libraries
25412and startup modules.
25413
25414@item -msmall-data-limit=@var{n}
25415@opindex msmall-data-limit
25416Put global and static data smaller than @var{n} bytes into a special section
25417(on some targets).
25418
25419@item -msave-restore
25420@itemx -mno-save-restore
25421@opindex msave-restore
25422Do or don't use smaller but slower prologue and epilogue code that uses
25423library function calls.  The default is to use fast inline prologues and
25424epilogues.
25425
25426@item -mstrict-align
25427@itemx -mno-strict-align
25428@opindex mstrict-align
25429Do not or do generate unaligned memory accesses.  The default is set depending
25430on whether the processor we are optimizing for supports fast unaligned access
25431or not.
25432
25433@item -mcmodel=medlow
25434@opindex mcmodel=medlow
25435Generate code for the medium-low code model. The program and its statically
25436defined symbols must lie within a single 2 GiB address range and must lie
25437between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25438statically or dynamically linked. This is the default code model.
25439
25440@item -mcmodel=medany
25441@opindex mcmodel=medany
25442Generate code for the medium-any code model. The program and its statically
25443defined symbols must be within any single 2 GiB address range. Programs can be
25444statically or dynamically linked.
25445
25446@item -mexplicit-relocs
25447@itemx -mno-exlicit-relocs
25448Use or do not use assembler relocation operators when dealing with symbolic
25449addresses.  The alternative is to use assembler macros instead, which may
25450limit optimization.
25451
25452@item -mrelax
25453@itemx -mno-relax
25454Take advantage of linker relaxations to reduce the number of instructions
25455required to materialize symbol addresses. The default is to take advantage of
25456linker relaxations.
25457
25458@item -memit-attribute
25459@itemx -mno-emit-attribute
25460Emit (do not emit) RISC-V attribute to record extra information into ELF
25461objects.  This feature requires at least binutils 2.32.
25462
25463@item -malign-data=@var{type}
25464@opindex malign-data
25465Control how GCC aligns variables and constants of array, structure, or union
25466types.  Supported values for @var{type} are @samp{xlen} which uses x register
25467width as the alignment value, and @samp{natural} which uses natural alignment.
25468@samp{xlen} is the default.
25469@end table
25470
25471@node RL78 Options
25472@subsection RL78 Options
25473@cindex RL78 Options
25474
25475@table @gcctabopt
25476
25477@item -msim
25478@opindex msim
25479Links in additional target libraries to support operation within a
25480simulator.
25481
25482@item -mmul=none
25483@itemx -mmul=g10
25484@itemx -mmul=g13
25485@itemx -mmul=g14
25486@itemx -mmul=rl78
25487@opindex mmul
25488Specifies the type of hardware multiplication and division support to
25489be used.  The simplest is @code{none}, which uses software for both
25490multiplication and division.  This is the default.  The @code{g13}
25491value is for the hardware multiply/divide peripheral found on the
25492RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
25493the multiplication and division instructions supported by the RL78/G14
25494(S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
25495the value @code{mg10} is an alias for @code{none}.
25496
25497In addition a C preprocessor macro is defined, based upon the setting
25498of this option.  Possible values are: @code{__RL78_MUL_NONE__},
25499@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25500
25501@item -mcpu=g10
25502@itemx -mcpu=g13
25503@itemx -mcpu=g14
25504@itemx -mcpu=rl78
25505@opindex mcpu
25506Specifies the RL78 core to target.  The default is the G14 core, also
25507known as an S3 core or just RL78.  The G13 or S2 core does not have
25508multiply or divide instructions, instead it uses a hardware peripheral
25509for these operations.  The G10 or S1 core does not have register
25510banks, so it uses a different calling convention.
25511
25512If this option is set it also selects the type of hardware multiply
25513support to use, unless this is overridden by an explicit
25514@option{-mmul=none} option on the command line.  Thus specifying
25515@option{-mcpu=g13} enables the use of the G13 hardware multiply
25516peripheral and specifying @option{-mcpu=g10} disables the use of
25517hardware multiplications altogether.
25518
25519Note, although the RL78/G14 core is the default target, specifying
25520@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25521change the behavior of the toolchain since it also enables G14
25522hardware multiply support.  If these options are not specified on the
25523command line then software multiplication routines will be used even
25524though the code targets the RL78 core.  This is for backwards
25525compatibility with older toolchains which did not have hardware
25526multiply and divide support.
25527
25528In addition a C preprocessor macro is defined, based upon the setting
25529of this option.  Possible values are: @code{__RL78_G10__},
25530@code{__RL78_G13__} or @code{__RL78_G14__}.
25531
25532@item -mg10
25533@itemx -mg13
25534@itemx -mg14
25535@itemx -mrl78
25536@opindex mg10
25537@opindex mg13
25538@opindex mg14
25539@opindex mrl78
25540These are aliases for the corresponding @option{-mcpu=} option.  They
25541are provided for backwards compatibility.
25542
25543@item -mallregs
25544@opindex mallregs
25545Allow the compiler to use all of the available registers.  By default
25546registers @code{r24..r31} are reserved for use in interrupt handlers.
25547With this option enabled these registers can be used in ordinary
25548functions as well.
25549
25550@item -m64bit-doubles
25551@itemx -m32bit-doubles
25552@opindex m64bit-doubles
25553@opindex m32bit-doubles
25554Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25555or 32 bits (@option{-m32bit-doubles}) in size.  The default is
25556@option{-m32bit-doubles}.
25557
25558@item -msave-mduc-in-interrupts
25559@itemx -mno-save-mduc-in-interrupts
25560@opindex msave-mduc-in-interrupts
25561@opindex mno-save-mduc-in-interrupts
25562Specifies that interrupt handler functions should preserve the
25563MDUC registers.  This is only necessary if normal code might use
25564the MDUC registers, for example because it performs multiplication
25565and division operations.  The default is to ignore the MDUC registers
25566as this makes the interrupt handlers faster.  The target option -mg13
25567needs to be passed for this to work as this feature is only available
25568on the G13 target (S2 core).  The MDUC registers will only be saved
25569if the interrupt handler performs a multiplication or division
25570operation or it calls another function.
25571
25572@end table
25573
25574@node RS/6000 and PowerPC Options
25575@subsection IBM RS/6000 and PowerPC Options
25576@cindex RS/6000 and PowerPC Options
25577@cindex IBM RS/6000 and PowerPC Options
25578
25579These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25580@table @gcctabopt
25581@item -mpowerpc-gpopt
25582@itemx -mno-powerpc-gpopt
25583@itemx -mpowerpc-gfxopt
25584@itemx -mno-powerpc-gfxopt
25585@need 800
25586@itemx -mpowerpc64
25587@itemx -mno-powerpc64
25588@itemx -mmfcrf
25589@itemx -mno-mfcrf
25590@itemx -mpopcntb
25591@itemx -mno-popcntb
25592@itemx -mpopcntd
25593@itemx -mno-popcntd
25594@itemx -mfprnd
25595@itemx -mno-fprnd
25596@need 800
25597@itemx -mcmpb
25598@itemx -mno-cmpb
25599@itemx -mhard-dfp
25600@itemx -mno-hard-dfp
25601@opindex mpowerpc-gpopt
25602@opindex mno-powerpc-gpopt
25603@opindex mpowerpc-gfxopt
25604@opindex mno-powerpc-gfxopt
25605@opindex mpowerpc64
25606@opindex mno-powerpc64
25607@opindex mmfcrf
25608@opindex mno-mfcrf
25609@opindex mpopcntb
25610@opindex mno-popcntb
25611@opindex mpopcntd
25612@opindex mno-popcntd
25613@opindex mfprnd
25614@opindex mno-fprnd
25615@opindex mcmpb
25616@opindex mno-cmpb
25617@opindex mhard-dfp
25618@opindex mno-hard-dfp
25619You use these options to specify which instructions are available on the
25620processor you are using.  The default value of these options is
25621determined when configuring GCC@.  Specifying the
25622@option{-mcpu=@var{cpu_type}} overrides the specification of these
25623options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
25624rather than the options listed above.
25625
25626Specifying @option{-mpowerpc-gpopt} allows
25627GCC to use the optional PowerPC architecture instructions in the
25628General Purpose group, including floating-point square root.  Specifying
25629@option{-mpowerpc-gfxopt} allows GCC to
25630use the optional PowerPC architecture instructions in the Graphics
25631group, including floating-point select.
25632
25633The @option{-mmfcrf} option allows GCC to generate the move from
25634condition register field instruction implemented on the POWER4
25635processor and other processors that support the PowerPC V2.01
25636architecture.
25637The @option{-mpopcntb} option allows GCC to generate the popcount and
25638double-precision FP reciprocal estimate instruction implemented on the
25639POWER5 processor and other processors that support the PowerPC V2.02
25640architecture.
25641The @option{-mpopcntd} option allows GCC to generate the popcount
25642instruction implemented on the POWER7 processor and other processors
25643that support the PowerPC V2.06 architecture.
25644The @option{-mfprnd} option allows GCC to generate the FP round to
25645integer instructions implemented on the POWER5+ processor and other
25646processors that support the PowerPC V2.03 architecture.
25647The @option{-mcmpb} option allows GCC to generate the compare bytes
25648instruction implemented on the POWER6 processor and other processors
25649that support the PowerPC V2.05 architecture.
25650The @option{-mhard-dfp} option allows GCC to generate the decimal
25651floating-point instructions implemented on some POWER processors.
25652
25653The @option{-mpowerpc64} option allows GCC to generate the additional
2565464-bit instructions that are found in the full PowerPC64 architecture
25655and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
25656@option{-mno-powerpc64}.
25657
25658@item -mcpu=@var{cpu_type}
25659@opindex mcpu
25660Set architecture type, register usage, and
25661instruction scheduling parameters for machine type @var{cpu_type}.
25662Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25663@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25664@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25665@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25666@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25667@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25668@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25669@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25670@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25671@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25672@samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
25673@samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25674
25675@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25676@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25677endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25678architecture machine types, with an appropriate, generic processor
25679model assumed for scheduling purposes.
25680
25681Specifying @samp{native} as cpu type detects and selects the
25682architecture option that corresponds to the host processor of the
25683system performing the compilation.
25684@option{-mcpu=native} has no effect if GCC does not recognize the
25685processor.
25686
25687The other options specify a specific processor.  Code generated under
25688those options runs best on that processor, and may not run at all on
25689others.
25690
25691The @option{-mcpu} options automatically enable or disable the
25692following options:
25693
25694@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
25695-mpopcntb  -mpopcntd  -mpowerpc64 @gol
25696-mpowerpc-gpopt  -mpowerpc-gfxopt @gol
25697-mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
25698-mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
25699-mquad-memory  -mquad-memory-atomic  -mfloat128 @gol
25700-mfloat128-hardware -mprefixed -mpcrel -mmma}
25701
25702The particular options set for any particular CPU varies between
25703compiler versions, depending on what setting seems to produce optimal
25704code for that CPU; it doesn't necessarily reflect the actual hardware's
25705capabilities.  If you wish to set an individual option to a particular
25706value, you may specify it after the @option{-mcpu} option, like
25707@option{-mcpu=970 -mno-altivec}.
25708
25709On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25710not enabled or disabled by the @option{-mcpu} option at present because
25711AIX does not have full support for these options.  You may still
25712enable or disable them individually if you're sure it'll work in your
25713environment.
25714
25715@item -mtune=@var{cpu_type}
25716@opindex mtune
25717Set the instruction scheduling parameters for machine type
25718@var{cpu_type}, but do not set the architecture type or register usage,
25719as @option{-mcpu=@var{cpu_type}} does.  The same
25720values for @var{cpu_type} are used for @option{-mtune} as for
25721@option{-mcpu}.  If both are specified, the code generated uses the
25722architecture and registers set by @option{-mcpu}, but the
25723scheduling parameters set by @option{-mtune}.
25724
25725@item -mcmodel=small
25726@opindex mcmodel=small
25727Generate PowerPC64 code for the small model: The TOC is limited to
2572864k.
25729
25730@item -mcmodel=medium
25731@opindex mcmodel=medium
25732Generate PowerPC64 code for the medium model: The TOC and other static
25733data may be up to a total of 4G in size.  This is the default for 64-bit
25734Linux.
25735
25736@item -mcmodel=large
25737@opindex mcmodel=large
25738Generate PowerPC64 code for the large model: The TOC may be up to 4G
25739in size.  Other data and code is only limited by the 64-bit address
25740space.
25741
25742@item -maltivec
25743@itemx -mno-altivec
25744@opindex maltivec
25745@opindex mno-altivec
25746Generate code that uses (does not use) AltiVec instructions, and also
25747enable the use of built-in functions that allow more direct access to
25748the AltiVec instruction set.  You may also need to set
25749@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25750enhancements.
25751
25752When @option{-maltivec} is used, the element order for AltiVec intrinsics
25753such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
25754match array element order corresponding to the endianness of the
25755target.  That is, element zero identifies the leftmost element in a
25756vector register when targeting a big-endian platform, and identifies
25757the rightmost element in a vector register when targeting a
25758little-endian platform.
25759
25760@item -mvrsave
25761@itemx -mno-vrsave
25762@opindex mvrsave
25763@opindex mno-vrsave
25764Generate VRSAVE instructions when generating AltiVec code.
25765
25766@item -msecure-plt
25767@opindex msecure-plt
25768Generate code that allows @command{ld} and @command{ld.so}
25769to build executables and shared
25770libraries with non-executable @code{.plt} and @code{.got} sections.
25771This is a PowerPC
2577232-bit SYSV ABI option.
25773
25774@item -mbss-plt
25775@opindex mbss-plt
25776Generate code that uses a BSS @code{.plt} section that @command{ld.so}
25777fills in, and
25778requires @code{.plt} and @code{.got}
25779sections that are both writable and executable.
25780This is a PowerPC 32-bit SYSV ABI option.
25781
25782@item -misel
25783@itemx -mno-isel
25784@opindex misel
25785@opindex mno-isel
25786This switch enables or disables the generation of ISEL instructions.
25787
25788@item -mvsx
25789@itemx -mno-vsx
25790@opindex mvsx
25791@opindex mno-vsx
25792Generate code that uses (does not use) vector/scalar (VSX)
25793instructions, and also enable the use of built-in functions that allow
25794more direct access to the VSX instruction set.
25795
25796@item -mcrypto
25797@itemx -mno-crypto
25798@opindex mcrypto
25799@opindex mno-crypto
25800Enable the use (disable) of the built-in functions that allow direct
25801access to the cryptographic instructions that were added in version
258022.07 of the PowerPC ISA.
25803
25804@item -mhtm
25805@itemx -mno-htm
25806@opindex mhtm
25807@opindex mno-htm
25808Enable (disable) the use of the built-in functions that allow direct
25809access to the Hardware Transactional Memory (HTM) instructions that
25810were added in version 2.07 of the PowerPC ISA.
25811
25812@item -mpower8-fusion
25813@itemx -mno-power8-fusion
25814@opindex mpower8-fusion
25815@opindex mno-power8-fusion
25816Generate code that keeps (does not keeps) some integer operations
25817adjacent so that the instructions can be fused together on power8 and
25818later processors.
25819
25820@item -mpower8-vector
25821@itemx -mno-power8-vector
25822@opindex mpower8-vector
25823@opindex mno-power8-vector
25824Generate code that uses (does not use) the vector and scalar
25825instructions that were added in version 2.07 of the PowerPC ISA.  Also
25826enable the use of built-in functions that allow more direct access to
25827the vector instructions.
25828
25829@item -mquad-memory
25830@itemx -mno-quad-memory
25831@opindex mquad-memory
25832@opindex mno-quad-memory
25833Generate code that uses (does not use) the non-atomic quad word memory
25834instructions.  The @option{-mquad-memory} option requires use of
2583564-bit mode.
25836
25837@item -mquad-memory-atomic
25838@itemx -mno-quad-memory-atomic
25839@opindex mquad-memory-atomic
25840@opindex mno-quad-memory-atomic
25841Generate code that uses (does not use) the atomic quad word memory
25842instructions.  The @option{-mquad-memory-atomic} option requires use of
2584364-bit mode.
25844
25845@item -mfloat128
25846@itemx -mno-float128
25847@opindex mfloat128
25848@opindex mno-float128
25849Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
25850and use either software emulation for IEEE 128-bit floating point or
25851hardware instructions.
25852
25853The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
25854@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
25855use the IEEE 128-bit floating point support.  The IEEE 128-bit
25856floating point support only works on PowerPC Linux systems.
25857
25858The default for @option{-mfloat128} is enabled on PowerPC Linux
25859systems using the VSX instruction set, and disabled on other systems.
25860
25861If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
25862@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
25863point support will also enable the generation of ISA 3.0 IEEE 128-bit
25864floating point instructions.  Otherwise, if you do not specify to
25865generate ISA 3.0 instructions or you are targeting a 32-bit big endian
25866system, IEEE 128-bit floating point will be done with software
25867emulation.
25868
25869@item -mfloat128-hardware
25870@itemx -mno-float128-hardware
25871@opindex mfloat128-hardware
25872@opindex mno-float128-hardware
25873Enable/disable using ISA 3.0 hardware instructions to support the
25874@var{__float128} data type.
25875
25876The default for @option{-mfloat128-hardware} is enabled on PowerPC
25877Linux systems using the ISA 3.0 instruction set, and disabled on other
25878systems.
25879
25880@item -m32
25881@itemx -m64
25882@opindex m32
25883@opindex m64
25884Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25885targets (including GNU/Linux).  The 32-bit environment sets int, long
25886and pointer to 32 bits and generates code that runs on any PowerPC
25887variant.  The 64-bit environment sets int to 32 bits and long and
25888pointer to 64 bits, and generates code for PowerPC64, as for
25889@option{-mpowerpc64}.
25890
25891@item -mfull-toc
25892@itemx -mno-fp-in-toc
25893@itemx -mno-sum-in-toc
25894@itemx -mminimal-toc
25895@opindex mfull-toc
25896@opindex mno-fp-in-toc
25897@opindex mno-sum-in-toc
25898@opindex mminimal-toc
25899Modify generation of the TOC (Table Of Contents), which is created for
25900every executable file.  The @option{-mfull-toc} option is selected by
25901default.  In that case, GCC allocates at least one TOC entry for
25902each unique non-automatic variable reference in your program.  GCC
25903also places floating-point constants in the TOC@.  However, only
2590416,384 entries are available in the TOC@.
25905
25906If you receive a linker error message that saying you have overflowed
25907the available TOC space, you can reduce the amount of TOC space used
25908with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
25909@option{-mno-fp-in-toc} prevents GCC from putting floating-point
25910constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
25911generate code to calculate the sum of an address and a constant at
25912run time instead of putting that sum into the TOC@.  You may specify one
25913or both of these options.  Each causes GCC to produce very slightly
25914slower and larger code at the expense of conserving TOC space.
25915
25916If you still run out of space in the TOC even when you specify both of
25917these options, specify @option{-mminimal-toc} instead.  This option causes
25918GCC to make only one TOC entry for every file.  When you specify this
25919option, GCC produces code that is slower and larger but which
25920uses extremely little TOC space.  You may wish to use this option
25921only on files that contain less frequently-executed code.
25922
25923@item -maix64
25924@itemx -maix32
25925@opindex maix64
25926@opindex maix32
25927Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
25928@code{long} type, and the infrastructure needed to support them.
25929Specifying @option{-maix64} implies @option{-mpowerpc64},
25930while @option{-maix32} disables the 64-bit ABI and
25931implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
25932
25933@item -mxl-compat
25934@itemx -mno-xl-compat
25935@opindex mxl-compat
25936@opindex mno-xl-compat
25937Produce code that conforms more closely to IBM XL compiler semantics
25938when using AIX-compatible ABI@.  Pass floating-point arguments to
25939prototyped functions beyond the register save area (RSA) on the stack
25940in addition to argument FPRs.  Do not assume that most significant
25941double in 128-bit long double value is properly rounded when comparing
25942values and converting to double.  Use XL symbol names for long double
25943support routines.
25944
25945The AIX calling convention was extended but not initially documented to
25946handle an obscure K&R C case of calling a function that takes the
25947address of its arguments with fewer arguments than declared.  IBM XL
25948compilers access floating-point arguments that do not fit in the
25949RSA from the stack when a subroutine is compiled without
25950optimization.  Because always storing floating-point arguments on the
25951stack is inefficient and rarely needed, this option is not enabled by
25952default and only is necessary when calling subroutines compiled by IBM
25953XL compilers without optimization.
25954
25955@item -mpe
25956@opindex mpe
25957Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
25958application written to use message passing with special startup code to
25959enable the application to run.  The system must have PE installed in the
25960standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
25961must be overridden with the @option{-specs=} option to specify the
25962appropriate directory location.  The Parallel Environment does not
25963support threads, so the @option{-mpe} option and the @option{-pthread}
25964option are incompatible.
25965
25966@item -malign-natural
25967@itemx -malign-power
25968@opindex malign-natural
25969@opindex malign-power
25970On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25971@option{-malign-natural} overrides the ABI-defined alignment of larger
25972types, such as floating-point doubles, on their natural size-based boundary.
25973The option @option{-malign-power} instructs GCC to follow the ABI-specified
25974alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
25975
25976On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
25977is not supported.
25978
25979@item -msoft-float
25980@itemx -mhard-float
25981@opindex msoft-float
25982@opindex mhard-float
25983Generate code that does not use (uses) the floating-point register set.
25984Software floating-point emulation is provided if you use the
25985@option{-msoft-float} option, and pass the option to GCC when linking.
25986
25987@item -mmultiple
25988@itemx -mno-multiple
25989@opindex mmultiple
25990@opindex mno-multiple
25991Generate code that uses (does not use) the load multiple word
25992instructions and the store multiple word instructions.  These
25993instructions are generated by default on POWER systems, and not
25994generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
25995PowerPC systems, since those instructions do not work when the
25996processor is in little-endian mode.  The exceptions are PPC740 and
25997PPC750 which permit these instructions in little-endian mode.
25998
25999@item -mupdate
26000@itemx -mno-update
26001@opindex mupdate
26002@opindex mno-update
26003Generate code that uses (does not use) the load or store instructions
26004that update the base register to the address of the calculated memory
26005location.  These instructions are generated by default.  If you use
26006@option{-mno-update}, there is a small window between the time that the
26007stack pointer is updated and the address of the previous frame is
26008stored, which means code that walks the stack frame across interrupts or
26009signals may get corrupted data.
26010
26011@item -mavoid-indexed-addresses
26012@itemx -mno-avoid-indexed-addresses
26013@opindex mavoid-indexed-addresses
26014@opindex mno-avoid-indexed-addresses
26015Generate code that tries to avoid (not avoid) the use of indexed load
26016or store instructions. These instructions can incur a performance
26017penalty on Power6 processors in certain situations, such as when
26018stepping through large arrays that cross a 16M boundary.  This option
26019is enabled by default when targeting Power6 and disabled otherwise.
26020
26021@item -mfused-madd
26022@itemx -mno-fused-madd
26023@opindex mfused-madd
26024@opindex mno-fused-madd
26025Generate code that uses (does not use) the floating-point multiply and
26026accumulate instructions.  These instructions are generated by default
26027if hardware floating point is used.  The machine-dependent
26028@option{-mfused-madd} option is now mapped to the machine-independent
26029@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26030mapped to @option{-ffp-contract=off}.
26031
26032@item -mmulhw
26033@itemx -mno-mulhw
26034@opindex mmulhw
26035@opindex mno-mulhw
26036Generate code that uses (does not use) the half-word multiply and
26037multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
26038These instructions are generated by default when targeting those
26039processors.
26040
26041@item -mdlmzb
26042@itemx -mno-dlmzb
26043@opindex mdlmzb
26044@opindex mno-dlmzb
26045Generate code that uses (does not use) the string-search @samp{dlmzb}
26046instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
26047generated by default when targeting those processors.
26048
26049@item -mno-bit-align
26050@itemx -mbit-align
26051@opindex mno-bit-align
26052@opindex mbit-align
26053On System V.4 and embedded PowerPC systems do not (do) force structures
26054and unions that contain bit-fields to be aligned to the base type of the
26055bit-field.
26056
26057For example, by default a structure containing nothing but 8
26058@code{unsigned} bit-fields of length 1 is aligned to a 4-byte
26059boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
26060the structure is aligned to a 1-byte boundary and is 1 byte in
26061size.
26062
26063@item -mno-strict-align
26064@itemx -mstrict-align
26065@opindex mno-strict-align
26066@opindex mstrict-align
26067On System V.4 and embedded PowerPC systems do not (do) assume that
26068unaligned memory references are handled by the system.
26069
26070@item -mrelocatable
26071@itemx -mno-relocatable
26072@opindex mrelocatable
26073@opindex mno-relocatable
26074Generate code that allows (does not allow) a static executable to be
26075relocated to a different address at run time.  A simple embedded
26076PowerPC system loader should relocate the entire contents of
26077@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
26078a table of 32-bit addresses generated by this option.  For this to
26079work, all objects linked together must be compiled with
26080@option{-mrelocatable} or @option{-mrelocatable-lib}.
26081@option{-mrelocatable} code aligns the stack to an 8-byte boundary.
26082
26083@item -mrelocatable-lib
26084@itemx -mno-relocatable-lib
26085@opindex mrelocatable-lib
26086@opindex mno-relocatable-lib
26087Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
26088@code{.fixup} section to allow static executables to be relocated at
26089run time, but @option{-mrelocatable-lib} does not use the smaller stack
26090alignment of @option{-mrelocatable}.  Objects compiled with
26091@option{-mrelocatable-lib} may be linked with objects compiled with
26092any combination of the @option{-mrelocatable} options.
26093
26094@item -mno-toc
26095@itemx -mtoc
26096@opindex mno-toc
26097@opindex mtoc
26098On System V.4 and embedded PowerPC systems do not (do) assume that
26099register 2 contains a pointer to a global area pointing to the addresses
26100used in the program.
26101
26102@item -mlittle
26103@itemx -mlittle-endian
26104@opindex mlittle
26105@opindex mlittle-endian
26106On System V.4 and embedded PowerPC systems compile code for the
26107processor in little-endian mode.  The @option{-mlittle-endian} option is
26108the same as @option{-mlittle}.
26109
26110@item -mbig
26111@itemx -mbig-endian
26112@opindex mbig
26113@opindex mbig-endian
26114On System V.4 and embedded PowerPC systems compile code for the
26115processor in big-endian mode.  The @option{-mbig-endian} option is
26116the same as @option{-mbig}.
26117
26118@item -mdynamic-no-pic
26119@opindex mdynamic-no-pic
26120On Darwin and Mac OS X systems, compile code so that it is not
26121relocatable, but that its external references are relocatable.  The
26122resulting code is suitable for applications, but not shared
26123libraries.
26124
26125@item -msingle-pic-base
26126@opindex msingle-pic-base
26127Treat the register used for PIC addressing as read-only, rather than
26128loading it in the prologue for each function.  The runtime system is
26129responsible for initializing this register with an appropriate value
26130before execution begins.
26131
26132@item -mprioritize-restricted-insns=@var{priority}
26133@opindex mprioritize-restricted-insns
26134This option controls the priority that is assigned to
26135dispatch-slot restricted instructions during the second scheduling
26136pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
26137or @samp{2} to assign no, highest, or second-highest (respectively)
26138priority to dispatch-slot restricted
26139instructions.
26140
26141@item -msched-costly-dep=@var{dependence_type}
26142@opindex msched-costly-dep
26143This option controls which dependences are considered costly
26144by the target during instruction scheduling.  The argument
26145@var{dependence_type} takes one of the following values:
26146
26147@table @asis
26148@item @samp{no}
26149No dependence is costly.
26150
26151@item @samp{all}
26152All dependences are costly.
26153
26154@item @samp{true_store_to_load}
26155A true dependence from store to load is costly.
26156
26157@item @samp{store_to_load}
26158Any dependence from store to load is costly.
26159
26160@item @var{number}
26161Any dependence for which the latency is greater than or equal to
26162@var{number} is costly.
26163@end table
26164
26165@item -minsert-sched-nops=@var{scheme}
26166@opindex minsert-sched-nops
26167This option controls which NOP insertion scheme is used during
26168the second scheduling pass.  The argument @var{scheme} takes one of the
26169following values:
26170
26171@table @asis
26172@item @samp{no}
26173Don't insert NOPs.
26174
26175@item @samp{pad}
26176Pad with NOPs any dispatch group that has vacant issue slots,
26177according to the scheduler's grouping.
26178
26179@item @samp{regroup_exact}
26180Insert NOPs to force costly dependent insns into
26181separate groups.  Insert exactly as many NOPs as needed to force an insn
26182to a new group, according to the estimated processor grouping.
26183
26184@item @var{number}
26185Insert NOPs to force costly dependent insns into
26186separate groups.  Insert @var{number} NOPs to force an insn to a new group.
26187@end table
26188
26189@item -mcall-sysv
26190@opindex mcall-sysv
26191On System V.4 and embedded PowerPC systems compile code using calling
26192conventions that adhere to the March 1995 draft of the System V
26193Application Binary Interface, PowerPC processor supplement.  This is the
26194default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26195
26196@item -mcall-sysv-eabi
26197@itemx -mcall-eabi
26198@opindex mcall-sysv-eabi
26199@opindex mcall-eabi
26200Specify both @option{-mcall-sysv} and @option{-meabi} options.
26201
26202@item -mcall-sysv-noeabi
26203@opindex mcall-sysv-noeabi
26204Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26205
26206@item -mcall-aixdesc
26207@opindex m
26208On System V.4 and embedded PowerPC systems compile code for the AIX
26209operating system.
26210
26211@item -mcall-linux
26212@opindex mcall-linux
26213On System V.4 and embedded PowerPC systems compile code for the
26214Linux-based GNU system.
26215
26216@item -mcall-freebsd
26217@opindex mcall-freebsd
26218On System V.4 and embedded PowerPC systems compile code for the
26219FreeBSD operating system.
26220
26221@item -mcall-netbsd
26222@opindex mcall-netbsd
26223On System V.4 and embedded PowerPC systems compile code for the
26224NetBSD operating system.
26225
26226@item -mcall-openbsd
26227@opindex mcall-netbsd
26228On System V.4 and embedded PowerPC systems compile code for the
26229OpenBSD operating system.
26230
26231@item -mtraceback=@var{traceback_type}
26232@opindex mtraceback
26233Select the type of traceback table. Valid values for @var{traceback_type}
26234are @samp{full}, @samp{part}, and @samp{no}.
26235
26236@item -maix-struct-return
26237@opindex maix-struct-return
26238Return all structures in memory (as specified by the AIX ABI)@.
26239
26240@item -msvr4-struct-return
26241@opindex msvr4-struct-return
26242Return structures smaller than 8 bytes in registers (as specified by the
26243SVR4 ABI)@.
26244
26245@item -mabi=@var{abi-type}
26246@opindex mabi
26247Extend the current ABI with a particular extension, or remove such extension.
26248Valid values are: @samp{altivec}, @samp{no-altivec},
26249@samp{ibmlongdouble}, @samp{ieeelongdouble},
26250@samp{elfv1}, @samp{elfv2},
26251and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
26252
26253@item -mabi=ibmlongdouble
26254@opindex mabi=ibmlongdouble
26255Change the current ABI to use IBM extended-precision long double.
26256This is not likely to work if your system defaults to using IEEE
26257extended-precision long double.  If you change the long double type
26258from IEEE extended-precision, the compiler will issue a warning unless
26259you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26260to be enabled.
26261
26262@item -mabi=ieeelongdouble
26263@opindex mabi=ieeelongdouble
26264Change the current ABI to use IEEE extended-precision long double.
26265This is not likely to work if your system defaults to using IBM
26266extended-precision long double.  If you change the long double type
26267from IBM extended-precision, the compiler will issue a warning unless
26268you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26269to be enabled.
26270
26271@item -mabi=elfv1
26272@opindex mabi=elfv1
26273Change the current ABI to use the ELFv1 ABI.
26274This is the default ABI for big-endian PowerPC 64-bit Linux.
26275Overriding the default ABI requires special system support and is
26276likely to fail in spectacular ways.
26277
26278@item -mabi=elfv2
26279@opindex mabi=elfv2
26280Change the current ABI to use the ELFv2 ABI.
26281This is the default ABI for little-endian PowerPC 64-bit Linux.
26282Overriding the default ABI requires special system support and is
26283likely to fail in spectacular ways.
26284
26285@item -mgnu-attribute
26286@itemx -mno-gnu-attribute
26287@opindex mgnu-attribute
26288@opindex mno-gnu-attribute
26289Emit .gnu_attribute assembly directives to set tag/value pairs in a
26290.gnu.attributes section that specify ABI variations in function
26291parameters or return values.
26292
26293@item -mprototype
26294@itemx -mno-prototype
26295@opindex mprototype
26296@opindex mno-prototype
26297On System V.4 and embedded PowerPC systems assume that all calls to
26298variable argument functions are properly prototyped.  Otherwise, the
26299compiler must insert an instruction before every non-prototyped call to
26300set or clear bit 6 of the condition code register (@code{CR}) to
26301indicate whether floating-point values are passed in the floating-point
26302registers in case the function takes variable arguments.  With
26303@option{-mprototype}, only calls to prototyped variable argument functions
26304set or clear the bit.
26305
26306@item -msim
26307@opindex msim
26308On embedded PowerPC systems, assume that the startup module is called
26309@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26310@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
26311configurations.
26312
26313@item -mmvme
26314@opindex mmvme
26315On embedded PowerPC systems, assume that the startup module is called
26316@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26317@file{libc.a}.
26318
26319@item -mads
26320@opindex mads
26321On embedded PowerPC systems, assume that the startup module is called
26322@file{crt0.o} and the standard C libraries are @file{libads.a} and
26323@file{libc.a}.
26324
26325@item -myellowknife
26326@opindex myellowknife
26327On embedded PowerPC systems, assume that the startup module is called
26328@file{crt0.o} and the standard C libraries are @file{libyk.a} and
26329@file{libc.a}.
26330
26331@item -mvxworks
26332@opindex mvxworks
26333On System V.4 and embedded PowerPC systems, specify that you are
26334compiling for a VxWorks system.
26335
26336@item -memb
26337@opindex memb
26338On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26339header to indicate that @samp{eabi} extended relocations are used.
26340
26341@item -meabi
26342@itemx -mno-eabi
26343@opindex meabi
26344@opindex mno-eabi
26345On System V.4 and embedded PowerPC systems do (do not) adhere to the
26346Embedded Applications Binary Interface (EABI), which is a set of
26347modifications to the System V.4 specifications.  Selecting @option{-meabi}
26348means that the stack is aligned to an 8-byte boundary, a function
26349@code{__eabi} is called from @code{main} to set up the EABI
26350environment, and the @option{-msdata} option can use both @code{r2} and
26351@code{r13} to point to two separate small data areas.  Selecting
26352@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26353no EABI initialization function is called from @code{main}, and the
26354@option{-msdata} option only uses @code{r13} to point to a single
26355small data area.  The @option{-meabi} option is on by default if you
26356configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26357
26358@item -msdata=eabi
26359@opindex msdata=eabi
26360On System V.4 and embedded PowerPC systems, put small initialized
26361@code{const} global and static data in the @code{.sdata2} section, which
26362is pointed to by register @code{r2}.  Put small initialized
26363non-@code{const} global and static data in the @code{.sdata} section,
26364which is pointed to by register @code{r13}.  Put small uninitialized
26365global and static data in the @code{.sbss} section, which is adjacent to
26366the @code{.sdata} section.  The @option{-msdata=eabi} option is
26367incompatible with the @option{-mrelocatable} option.  The
26368@option{-msdata=eabi} option also sets the @option{-memb} option.
26369
26370@item -msdata=sysv
26371@opindex msdata=sysv
26372On System V.4 and embedded PowerPC systems, put small global and static
26373data in the @code{.sdata} section, which is pointed to by register
26374@code{r13}.  Put small uninitialized global and static data in the
26375@code{.sbss} section, which is adjacent to the @code{.sdata} section.
26376The @option{-msdata=sysv} option is incompatible with the
26377@option{-mrelocatable} option.
26378
26379@item -msdata=default
26380@itemx -msdata
26381@opindex msdata=default
26382@opindex msdata
26383On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26384compile code the same as @option{-msdata=eabi}, otherwise compile code the
26385same as @option{-msdata=sysv}.
26386
26387@item -msdata=data
26388@opindex msdata=data
26389On System V.4 and embedded PowerPC systems, put small global
26390data in the @code{.sdata} section.  Put small uninitialized global
26391data in the @code{.sbss} section.  Do not use register @code{r13}
26392to address small data however.  This is the default behavior unless
26393other @option{-msdata} options are used.
26394
26395@item -msdata=none
26396@itemx -mno-sdata
26397@opindex msdata=none
26398@opindex mno-sdata
26399On embedded PowerPC systems, put all initialized global and static data
26400in the @code{.data} section, and all uninitialized data in the
26401@code{.bss} section.
26402
26403@item -mreadonly-in-sdata
26404@opindex mreadonly-in-sdata
26405@opindex mno-readonly-in-sdata
26406Put read-only objects in the @code{.sdata} section as well.  This is the
26407default.
26408
26409@item -mblock-move-inline-limit=@var{num}
26410@opindex mblock-move-inline-limit
26411Inline all block moves (such as calls to @code{memcpy} or structure
26412copies) less than or equal to @var{num} bytes.  The minimum value for
26413@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26414targets.  The default value is target-specific.
26415
26416@item -mblock-compare-inline-limit=@var{num}
26417@opindex mblock-compare-inline-limit
26418Generate non-looping inline code for all block compares (such as calls
26419to @code{memcmp} or structure compares) less than or equal to @var{num}
26420bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26421block compare is disabled. The default value is target-specific.
26422
26423@item -mblock-compare-inline-loop-limit=@var{num}
26424@opindex mblock-compare-inline-loop-limit
26425Generate an inline expansion using loop code for all block compares that
26426are less than or equal to @var{num} bytes, but greater than the limit
26427for non-loop inline block compare expansion. If the block length is not
26428constant, at most @var{num} bytes will be compared before @code{memcmp}
26429is called to compare the remainder of the block. The default value is
26430target-specific.
26431
26432@item -mstring-compare-inline-limit=@var{num}
26433@opindex mstring-compare-inline-limit
26434Compare at most @var{num} string bytes with inline code.
26435If the difference or end of string is not found at the
26436end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26437take care of the rest of the comparison. The default is 64 bytes.
26438
26439@item -G @var{num}
26440@opindex G
26441@cindex smaller data references (PowerPC)
26442@cindex .sdata/.sdata2 references (PowerPC)
26443On embedded PowerPC systems, put global and static items less than or
26444equal to @var{num} bytes into the small data or BSS sections instead of
26445the normal data or BSS section.  By default, @var{num} is 8.  The
26446@option{-G @var{num}} switch is also passed to the linker.
26447All modules should be compiled with the same @option{-G @var{num}} value.
26448
26449@item -mregnames
26450@itemx -mno-regnames
26451@opindex mregnames
26452@opindex mno-regnames
26453On System V.4 and embedded PowerPC systems do (do not) emit register
26454names in the assembly language output using symbolic forms.
26455
26456@item -mlongcall
26457@itemx -mno-longcall
26458@opindex mlongcall
26459@opindex mno-longcall
26460By default assume that all calls are far away so that a longer and more
26461expensive calling sequence is required.  This is required for calls
26462farther than 32 megabytes (33,554,432 bytes) from the current location.
26463A short call is generated if the compiler knows
26464the call cannot be that far away.  This setting can be overridden by
26465the @code{shortcall} function attribute, or by @code{#pragma
26466longcall(0)}.
26467
26468Some linkers are capable of detecting out-of-range calls and generating
26469glue code on the fly.  On these systems, long calls are unnecessary and
26470generate slower code.  As of this writing, the AIX linker can do this,
26471as can the GNU linker for PowerPC/64.  It is planned to add this feature
26472to the GNU linker for 32-bit PowerPC systems as well.
26473
26474On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26475GCC can generate long calls using an inline PLT call sequence (see
26476@option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
26477ELFv1 (big-endian) do not support inline PLT calls.
26478
26479On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26480callee, L42}, plus a @dfn{branch island} (glue code).  The two target
26481addresses represent the callee and the branch island.  The
26482Darwin/PPC linker prefers the first address and generates a @code{bl
26483callee} if the PPC @code{bl} instruction reaches the callee directly;
26484otherwise, the linker generates @code{bl L42} to call the branch
26485island.  The branch island is appended to the body of the
26486calling function; it computes the full 32-bit address of the callee
26487and jumps to it.
26488
26489On Mach-O (Darwin) systems, this option directs the compiler emit to
26490the glue for every direct call, and the Darwin linker decides whether
26491to use or discard it.
26492
26493In the future, GCC may ignore all longcall specifications
26494when the linker is known to generate glue.
26495
26496@item -mpltseq
26497@itemx -mno-pltseq
26498@opindex mpltseq
26499@opindex mno-pltseq
26500Implement (do not implement) -fno-plt and long calls using an inline
26501PLT call sequence that supports lazy linking and long calls to
26502functions in dlopen'd shared libraries.  Inline PLT calls are only
26503supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26504linkers, and are enabled by default if the support is detected when
26505configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26506configured with @option{--enable-secureplt}.  @option{-mpltseq} code
26507and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26508linked together.
26509
26510@item -mtls-markers
26511@itemx -mno-tls-markers
26512@opindex mtls-markers
26513@opindex mno-tls-markers
26514Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26515specifying the function argument.  The relocation allows the linker to
26516reliably associate function call with argument setup instructions for
26517TLS optimization, which in turn allows GCC to better schedule the
26518sequence.
26519
26520@item -mrecip
26521@itemx -mno-recip
26522@opindex mrecip
26523This option enables use of the reciprocal estimate and
26524reciprocal square root estimate instructions with additional
26525Newton-Raphson steps to increase precision instead of doing a divide or
26526square root and divide for floating-point arguments.  You should use
26527the @option{-ffast-math} option when using @option{-mrecip} (or at
26528least @option{-funsafe-math-optimizations},
26529@option{-ffinite-math-only}, @option{-freciprocal-math} and
26530@option{-fno-trapping-math}).  Note that while the throughput of the
26531sequence is generally higher than the throughput of the non-reciprocal
26532instruction, the precision of the sequence can be decreased by up to 2
26533ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26534roots.
26535
26536@item -mrecip=@var{opt}
26537@opindex mrecip=opt
26538This option controls which reciprocal estimate instructions
26539may be used.  @var{opt} is a comma-separated list of options, which may
26540be preceded by a @code{!} to invert the option:
26541
26542@table @samp
26543
26544@item all
26545Enable all estimate instructions.
26546
26547@item default
26548Enable the default instructions, equivalent to @option{-mrecip}.
26549
26550@item none
26551Disable all estimate instructions, equivalent to @option{-mno-recip}.
26552
26553@item div
26554Enable the reciprocal approximation instructions for both
26555single and double precision.
26556
26557@item divf
26558Enable the single-precision reciprocal approximation instructions.
26559
26560@item divd
26561Enable the double-precision reciprocal approximation instructions.
26562
26563@item rsqrt
26564Enable the reciprocal square root approximation instructions for both
26565single and double precision.
26566
26567@item rsqrtf
26568Enable the single-precision reciprocal square root approximation instructions.
26569
26570@item rsqrtd
26571Enable the double-precision reciprocal square root approximation instructions.
26572
26573@end table
26574
26575So, for example, @option{-mrecip=all,!rsqrtd} enables
26576all of the reciprocal estimate instructions, except for the
26577@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26578which handle the double-precision reciprocal square root calculations.
26579
26580@item -mrecip-precision
26581@itemx -mno-recip-precision
26582@opindex mrecip-precision
26583Assume (do not assume) that the reciprocal estimate instructions
26584provide higher-precision estimates than is mandated by the PowerPC
26585ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26586@option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26587The double-precision square root estimate instructions are not generated by
26588default on low-precision machines, since they do not provide an
26589estimate that converges after three steps.
26590
26591@item -mveclibabi=@var{type}
26592@opindex mveclibabi
26593Specifies the ABI type to use for vectorizing intrinsics using an
26594external library.  The only type supported at present is @samp{mass},
26595which specifies to use IBM's Mathematical Acceleration Subsystem
26596(MASS) libraries for vectorizing intrinsics using external libraries.
26597GCC currently emits calls to @code{acosd2}, @code{acosf4},
26598@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26599@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26600@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26601@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26602@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26603@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26604@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26605@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26606@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26607@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26608@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26609@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26610@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26611for power7.  Both @option{-ftree-vectorize} and
26612@option{-funsafe-math-optimizations} must also be enabled.  The MASS
26613libraries must be specified at link time.
26614
26615@item -mfriz
26616@itemx -mno-friz
26617@opindex mfriz
26618Generate (do not generate) the @code{friz} instruction when the
26619@option{-funsafe-math-optimizations} option is used to optimize
26620rounding of floating-point values to 64-bit integer and back to floating
26621point.  The @code{friz} instruction does not return the same value if
26622the floating-point number is too large to fit in an integer.
26623
26624@item -mpointers-to-nested-functions
26625@itemx -mno-pointers-to-nested-functions
26626@opindex mpointers-to-nested-functions
26627Generate (do not generate) code to load up the static chain register
26628(@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26629systems where a function pointer points to a 3-word descriptor giving
26630the function address, TOC value to be loaded in register @code{r2}, and
26631static chain value to be loaded in register @code{r11}.  The
26632@option{-mpointers-to-nested-functions} is on by default.  You cannot
26633call through pointers to nested functions or pointers
26634to functions compiled in other languages that use the static chain if
26635you use @option{-mno-pointers-to-nested-functions}.
26636
26637@item -msave-toc-indirect
26638@itemx -mno-save-toc-indirect
26639@opindex msave-toc-indirect
26640Generate (do not generate) code to save the TOC value in the reserved
26641stack location in the function prologue if the function calls through
26642a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
26643saved in the prologue, it is saved just before the call through the
26644pointer.  The @option{-mno-save-toc-indirect} option is the default.
26645
26646@item -mcompat-align-parm
26647@itemx -mno-compat-align-parm
26648@opindex mcompat-align-parm
26649Generate (do not generate) code to pass structure parameters with a
26650maximum alignment of 64 bits, for compatibility with older versions
26651of GCC.
26652
26653Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26654structure parameter on a 128-bit boundary when that structure contained
26655a member requiring 128-bit alignment.  This is corrected in more
26656recent versions of GCC.  This option may be used to generate code
26657that is compatible with functions compiled with older versions of
26658GCC.
26659
26660The @option{-mno-compat-align-parm} option is the default.
26661
26662@item -mstack-protector-guard=@var{guard}
26663@itemx -mstack-protector-guard-reg=@var{reg}
26664@itemx -mstack-protector-guard-offset=@var{offset}
26665@itemx -mstack-protector-guard-symbol=@var{symbol}
26666@opindex mstack-protector-guard
26667@opindex mstack-protector-guard-reg
26668@opindex mstack-protector-guard-offset
26669@opindex mstack-protector-guard-symbol
26670Generate stack protection code using canary at @var{guard}.  Supported
26671locations are @samp{global} for global canary or @samp{tls} for per-thread
26672canary in the TLS block (the default with GNU libc version 2.4 or later).
26673
26674With the latter choice the options
26675@option{-mstack-protector-guard-reg=@var{reg}} and
26676@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26677which register to use as base register for reading the canary, and from what
26678offset from that base register. The default for those is as specified in the
26679relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26680the offset with a symbol reference to a canary in the TLS block.
26681
26682@item -mpcrel
26683@itemx -mno-pcrel
26684@opindex mpcrel
26685@opindex mno-pcrel
26686Generate (do not generate) pc-relative addressing when the option
26687@option{-mcpu=future} is used.  The @option{-mpcrel} option requires
26688that the medium code model (@option{-mcmodel=medium}) and prefixed
26689addressing (@option{-mprefixed}) options are enabled.
26690
26691@item -mprefixed
26692@itemx -mno-prefixed
26693@opindex mprefixed
26694@opindex mno-prefixed
26695Generate (do not generate) addressing modes using prefixed load and
26696store instructions when the option @option{-mcpu=future} is used.
26697
26698@item -mmma
26699@itemx -mno-mma
26700@opindex mmma
26701@opindex mno-mma
26702Generate (do not generate) the MMA instructions when the option
26703@option{-mcpu=future} is used.
26704@end table
26705
26706@node RX Options
26707@subsection RX Options
26708@cindex RX Options
26709
26710These command-line options are defined for RX targets:
26711
26712@table @gcctabopt
26713@item -m64bit-doubles
26714@itemx -m32bit-doubles
26715@opindex m64bit-doubles
26716@opindex m32bit-doubles
26717Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26718or 32 bits (@option{-m32bit-doubles}) in size.  The default is
26719@option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
26720works on 32-bit values, which is why the default is
26721@option{-m32bit-doubles}.
26722
26723@item -fpu
26724@itemx -nofpu
26725@opindex fpu
26726@opindex nofpu
26727Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26728floating-point hardware.  The default is enabled for the RX600
26729series and disabled for the RX200 series.
26730
26731Floating-point instructions are only generated for 32-bit floating-point
26732values, however, so the FPU hardware is not used for doubles if the
26733@option{-m64bit-doubles} option is used.
26734
26735@emph{Note} If the @option{-fpu} option is enabled then
26736@option{-funsafe-math-optimizations} is also enabled automatically.
26737This is because the RX FPU instructions are themselves unsafe.
26738
26739@item -mcpu=@var{name}
26740@opindex mcpu
26741Selects the type of RX CPU to be targeted.  Currently three types are
26742supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26743the specific @samp{RX610} CPU.  The default is @samp{RX600}.
26744
26745The only difference between @samp{RX600} and @samp{RX610} is that the
26746@samp{RX610} does not support the @code{MVTIPL} instruction.
26747
26748The @samp{RX200} series does not have a hardware floating-point unit
26749and so @option{-nofpu} is enabled by default when this type is
26750selected.
26751
26752@item -mbig-endian-data
26753@itemx -mlittle-endian-data
26754@opindex mbig-endian-data
26755@opindex mlittle-endian-data
26756Store data (but not code) in the big-endian format.  The default is
26757@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26758format.
26759
26760@item -msmall-data-limit=@var{N}
26761@opindex msmall-data-limit
26762Specifies the maximum size in bytes of global and static variables
26763which can be placed into the small data area.  Using the small data
26764area can lead to smaller and faster code, but the size of area is
26765limited and it is up to the programmer to ensure that the area does
26766not overflow.  Also when the small data area is used one of the RX's
26767registers (usually @code{r13}) is reserved for use pointing to this
26768area, so it is no longer available for use by the compiler.  This
26769could result in slower and/or larger code if variables are pushed onto
26770the stack instead of being held in this register.
26771
26772Note, common variables (variables that have not been initialized) and
26773constants are not placed into the small data area as they are assigned
26774to other sections in the output executable.
26775
26776The default value is zero, which disables this feature.  Note, this
26777feature is not enabled by default with higher optimization levels
26778(@option{-O2} etc) because of the potentially detrimental effects of
26779reserving a register.  It is up to the programmer to experiment and
26780discover whether this feature is of benefit to their program.  See the
26781description of the @option{-mpid} option for a description of how the
26782actual register to hold the small data area pointer is chosen.
26783
26784@item -msim
26785@itemx -mno-sim
26786@opindex msim
26787@opindex mno-sim
26788Use the simulator runtime.  The default is to use the libgloss
26789board-specific runtime.
26790
26791@item -mas100-syntax
26792@itemx -mno-as100-syntax
26793@opindex mas100-syntax
26794@opindex mno-as100-syntax
26795When generating assembler output use a syntax that is compatible with
26796Renesas's AS100 assembler.  This syntax can also be handled by the GAS
26797assembler, but it has some restrictions so it is not generated by default.
26798
26799@item -mmax-constant-size=@var{N}
26800@opindex mmax-constant-size
26801Specifies the maximum size, in bytes, of a constant that can be used as
26802an operand in a RX instruction.  Although the RX instruction set does
26803allow constants of up to 4 bytes in length to be used in instructions,
26804a longer value equates to a longer instruction.  Thus in some
26805circumstances it can be beneficial to restrict the size of constants
26806that are used in instructions.  Constants that are too big are instead
26807placed into a constant pool and referenced via register indirection.
26808
26809The value @var{N} can be between 0 and 4.  A value of 0 (the default)
26810or 4 means that constants of any size are allowed.
26811
26812@item -mrelax
26813@opindex mrelax
26814Enable linker relaxation.  Linker relaxation is a process whereby the
26815linker attempts to reduce the size of a program by finding shorter
26816versions of various instructions.  Disabled by default.
26817
26818@item -mint-register=@var{N}
26819@opindex mint-register
26820Specify the number of registers to reserve for fast interrupt handler
26821functions.  The value @var{N} can be between 0 and 4.  A value of 1
26822means that register @code{r13} is reserved for the exclusive use
26823of fast interrupt handlers.  A value of 2 reserves @code{r13} and
26824@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
26825@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
26826A value of 0, the default, does not reserve any registers.
26827
26828@item -msave-acc-in-interrupts
26829@opindex msave-acc-in-interrupts
26830Specifies that interrupt handler functions should preserve the
26831accumulator register.  This is only necessary if normal code might use
26832the accumulator register, for example because it performs 64-bit
26833multiplications.  The default is to ignore the accumulator as this
26834makes the interrupt handlers faster.
26835
26836@item -mpid
26837@itemx -mno-pid
26838@opindex mpid
26839@opindex mno-pid
26840Enables the generation of position independent data.  When enabled any
26841access to constant data is done via an offset from a base address
26842held in a register.  This allows the location of constant data to be
26843determined at run time without requiring the executable to be
26844relocated, which is a benefit to embedded applications with tight
26845memory constraints.  Data that can be modified is not affected by this
26846option.
26847
26848Note, using this feature reserves a register, usually @code{r13}, for
26849the constant data base address.  This can result in slower and/or
26850larger code, especially in complicated functions.
26851
26852The actual register chosen to hold the constant data base address
26853depends upon whether the @option{-msmall-data-limit} and/or the
26854@option{-mint-register} command-line options are enabled.  Starting
26855with register @code{r13} and proceeding downwards, registers are
26856allocated first to satisfy the requirements of @option{-mint-register},
26857then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
26858is possible for the small data area register to be @code{r8} if both
26859@option{-mint-register=4} and @option{-mpid} are specified on the
26860command line.
26861
26862By default this feature is not enabled.  The default can be restored
26863via the @option{-mno-pid} command-line option.
26864
26865@item -mno-warn-multiple-fast-interrupts
26866@itemx -mwarn-multiple-fast-interrupts
26867@opindex mno-warn-multiple-fast-interrupts
26868@opindex mwarn-multiple-fast-interrupts
26869Prevents GCC from issuing a warning message if it finds more than one
26870fast interrupt handler when it is compiling a file.  The default is to
26871issue a warning for each extra fast interrupt handler found, as the RX
26872only supports one such interrupt.
26873
26874@item -mallow-string-insns
26875@itemx -mno-allow-string-insns
26876@opindex mallow-string-insns
26877@opindex mno-allow-string-insns
26878Enables or disables the use of the string manipulation instructions
26879@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
26880@code{SWHILE} and also the @code{RMPA} instruction.  These
26881instructions may prefetch data, which is not safe to do if accessing
26882an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
26883for more information).
26884
26885The default is to allow these instructions, but it is not possible for
26886GCC to reliably detect all circumstances where a string instruction
26887might be used to access an I/O register, so their use cannot be
26888disabled automatically.  Instead it is reliant upon the programmer to
26889use the @option{-mno-allow-string-insns} option if their program
26890accesses I/O space.
26891
26892When the instructions are enabled GCC defines the C preprocessor
26893symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
26894symbol @code{__RX_DISALLOW_STRING_INSNS__}.
26895
26896@item -mjsr
26897@itemx -mno-jsr
26898@opindex mjsr
26899@opindex mno-jsr
26900Use only (or not only) @code{JSR} instructions to access functions.
26901This option can be used when code size exceeds the range of @code{BSR}
26902instructions.  Note that @option{-mno-jsr} does not mean to not use
26903@code{JSR} but instead means that any type of branch may be used.
26904@end table
26905
26906@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
26907has special significance to the RX port when used with the
26908@code{interrupt} function attribute.  This attribute indicates a
26909function intended to process fast interrupts.  GCC ensures
26910that it only uses the registers @code{r10}, @code{r11}, @code{r12}
26911and/or @code{r13} and only provided that the normal use of the
26912corresponding registers have been restricted via the
26913@option{-ffixed-@var{reg}} or @option{-mint-register} command-line
26914options.
26915
26916@node S/390 and zSeries Options
26917@subsection S/390 and zSeries Options
26918@cindex S/390 and zSeries Options
26919
26920These are the @samp{-m} options defined for the S/390 and zSeries architecture.
26921
26922@table @gcctabopt
26923@item -mhard-float
26924@itemx -msoft-float
26925@opindex mhard-float
26926@opindex msoft-float
26927Use (do not use) the hardware floating-point instructions and registers
26928for floating-point operations.  When @option{-msoft-float} is specified,
26929functions in @file{libgcc.a} are used to perform floating-point
26930operations.  When @option{-mhard-float} is specified, the compiler
26931generates IEEE floating-point instructions.  This is the default.
26932
26933@item -mhard-dfp
26934@itemx -mno-hard-dfp
26935@opindex mhard-dfp
26936@opindex mno-hard-dfp
26937Use (do not use) the hardware decimal-floating-point instructions for
26938decimal-floating-point operations.  When @option{-mno-hard-dfp} is
26939specified, functions in @file{libgcc.a} are used to perform
26940decimal-floating-point operations.  When @option{-mhard-dfp} is
26941specified, the compiler generates decimal-floating-point hardware
26942instructions.  This is the default for @option{-march=z9-ec} or higher.
26943
26944@item -mlong-double-64
26945@itemx -mlong-double-128
26946@opindex mlong-double-64
26947@opindex mlong-double-128
26948These switches control the size of @code{long double} type. A size
26949of 64 bits makes the @code{long double} type equivalent to the @code{double}
26950type. This is the default.
26951
26952@item -mbackchain
26953@itemx -mno-backchain
26954@opindex mbackchain
26955@opindex mno-backchain
26956Store (do not store) the address of the caller's frame as backchain pointer
26957into the callee's stack frame.
26958A backchain may be needed to allow debugging using tools that do not understand
26959DWARF call frame information.
26960When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
26961at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
26962the backchain is placed into the topmost word of the 96/160 byte register
26963save area.
26964
26965In general, code compiled with @option{-mbackchain} is call-compatible with
26966code compiled with @option{-mmo-backchain}; however, use of the backchain
26967for debugging purposes usually requires that the whole binary is built with
26968@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
26969@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
26970to build a linux kernel use @option{-msoft-float}.
26971
26972The default is to not maintain the backchain.
26973
26974@item -mpacked-stack
26975@itemx -mno-packed-stack
26976@opindex mpacked-stack
26977@opindex mno-packed-stack
26978Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
26979specified, the compiler uses the all fields of the 96/160 byte register save
26980area only for their default purpose; unused fields still take up stack space.
26981When @option{-mpacked-stack} is specified, register save slots are densely
26982packed at the top of the register save area; unused space is reused for other
26983purposes, allowing for more efficient use of the available stack space.
26984However, when @option{-mbackchain} is also in effect, the topmost word of
26985the save area is always used to store the backchain, and the return address
26986register is always saved two words below the backchain.
26987
26988As long as the stack frame backchain is not used, code generated with
26989@option{-mpacked-stack} is call-compatible with code generated with
26990@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
26991S/390 or zSeries generated code that uses the stack frame backchain at run
26992time, not just for debugging purposes.  Such code is not call-compatible
26993with code compiled with @option{-mpacked-stack}.  Also, note that the
26994combination of @option{-mbackchain},
26995@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
26996to build a linux kernel use @option{-msoft-float}.
26997
26998The default is to not use the packed stack layout.
26999
27000@item -msmall-exec
27001@itemx -mno-small-exec
27002@opindex msmall-exec
27003@opindex mno-small-exec
27004Generate (or do not generate) code using the @code{bras} instruction
27005to do subroutine calls.
27006This only works reliably if the total executable size does not
27007exceed 64k.  The default is to use the @code{basr} instruction instead,
27008which does not have this limitation.
27009
27010@item -m64
27011@itemx -m31
27012@opindex m64
27013@opindex m31
27014When @option{-m31} is specified, generate code compliant to the
27015GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
27016code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
27017particular to generate 64-bit instructions.  For the @samp{s390}
27018targets, the default is @option{-m31}, while the @samp{s390x}
27019targets default to @option{-m64}.
27020
27021@item -mzarch
27022@itemx -mesa
27023@opindex mzarch
27024@opindex mesa
27025When @option{-mzarch} is specified, generate code using the
27026instructions available on z/Architecture.
27027When @option{-mesa} is specified, generate code using the
27028instructions available on ESA/390.  Note that @option{-mesa} is
27029not possible with @option{-m64}.
27030When generating code compliant to the GNU/Linux for S/390 ABI,
27031the default is @option{-mesa}.  When generating code compliant
27032to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
27033
27034@item -mhtm
27035@itemx -mno-htm
27036@opindex mhtm
27037@opindex mno-htm
27038The @option{-mhtm} option enables a set of builtins making use of
27039instructions available with the transactional execution facility
27040introduced with the IBM zEnterprise EC12 machine generation
27041@ref{S/390 System z Built-in Functions}.
27042@option{-mhtm} is enabled by default when using @option{-march=zEC12}.
27043
27044@item -mvx
27045@itemx -mno-vx
27046@opindex mvx
27047@opindex mno-vx
27048When @option{-mvx} is specified, generate code using the instructions
27049available with the vector extension facility introduced with the IBM
27050z13 machine generation.
27051This option changes the ABI for some vector type values with regard to
27052alignment and calling conventions.  In case vector type values are
27053being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
27054command will be added to mark the resulting binary with the ABI used.
27055@option{-mvx} is enabled by default when using @option{-march=z13}.
27056
27057@item -mzvector
27058@itemx -mno-zvector
27059@opindex mzvector
27060@opindex mno-zvector
27061The @option{-mzvector} option enables vector language extensions and
27062builtins using instructions available with the vector extension
27063facility introduced with the IBM z13 machine generation.
27064This option adds support for @samp{vector} to be used as a keyword to
27065define vector type variables and arguments.  @samp{vector} is only
27066available when GNU extensions are enabled.  It will not be expanded
27067when requesting strict standard compliance e.g.@: with @option{-std=c99}.
27068In addition to the GCC low-level builtins @option{-mzvector} enables
27069a set of builtins added for compatibility with AltiVec-style
27070implementations like Power and Cell.  In order to make use of these
27071builtins the header file @file{vecintrin.h} needs to be included.
27072@option{-mzvector} is disabled by default.
27073
27074@item -mmvcle
27075@itemx -mno-mvcle
27076@opindex mmvcle
27077@opindex mno-mvcle
27078Generate (or do not generate) code using the @code{mvcle} instruction
27079to perform block moves.  When @option{-mno-mvcle} is specified,
27080use a @code{mvc} loop instead.  This is the default unless optimizing for
27081size.
27082
27083@item -mdebug
27084@itemx -mno-debug
27085@opindex mdebug
27086@opindex mno-debug
27087Print (or do not print) additional debug information when compiling.
27088The default is to not print debug information.
27089
27090@item -march=@var{cpu-type}
27091@opindex march
27092Generate code that runs on @var{cpu-type}, which is the name of a
27093system representing a certain processor type.  Possible values for
27094@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
27095@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
27096@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
27097@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
27098
27099The default is @option{-march=z900}.
27100
27101Specifying @samp{native} as cpu type can be used to select the best
27102architecture option for the host processor.
27103@option{-march=native} has no effect if GCC does not recognize the
27104processor.
27105
27106@item -mtune=@var{cpu-type}
27107@opindex mtune
27108Tune to @var{cpu-type} everything applicable about the generated code,
27109except for the ABI and the set of available instructions.
27110The list of @var{cpu-type} values is the same as for @option{-march}.
27111The default is the value used for @option{-march}.
27112
27113@item -mtpf-trace
27114@itemx -mno-tpf-trace
27115@opindex mtpf-trace
27116@opindex mno-tpf-trace
27117Generate code that adds (does not add) in TPF OS specific branches to trace
27118routines in the operating system.  This option is off by default, even
27119when compiling for the TPF OS@.
27120
27121@item -mtpf-trace-skip
27122@itemx -mno-tpf-trace-skip
27123@opindex mtpf-trace-skip
27124@opindex mno-tpf-trace-skip
27125Generate code that changes (does not change) the default branch
27126targets enabled by @option{-mtpf-trace} to point to specialized trace
27127routines providing the ability of selectively skipping function trace
27128entries for the TPF OS.  This option is off by default, even when
27129compiling for the TPF OS and specifying @option{-mtpf-trace}.
27130
27131@item -mfused-madd
27132@itemx -mno-fused-madd
27133@opindex mfused-madd
27134@opindex mno-fused-madd
27135Generate code that uses (does not use) the floating-point multiply and
27136accumulate instructions.  These instructions are generated by default if
27137hardware floating point is used.
27138
27139@item -mwarn-framesize=@var{framesize}
27140@opindex mwarn-framesize
27141Emit a warning if the current function exceeds the given frame size.  Because
27142this is a compile-time check it doesn't need to be a real problem when the program
27143runs.  It is intended to identify functions that most probably cause
27144a stack overflow.  It is useful to be used in an environment with limited stack
27145size e.g.@: the linux kernel.
27146
27147@item -mwarn-dynamicstack
27148@opindex mwarn-dynamicstack
27149Emit a warning if the function calls @code{alloca} or uses dynamically-sized
27150arrays.  This is generally a bad idea with a limited stack size.
27151
27152@item -mstack-guard=@var{stack-guard}
27153@itemx -mstack-size=@var{stack-size}
27154@opindex mstack-guard
27155@opindex mstack-size
27156If these options are provided the S/390 back end emits additional instructions in
27157the function prologue that trigger a trap if the stack size is @var{stack-guard}
27158bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27159If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27160the frame size of the compiled function is chosen.
27161These options are intended to be used to help debugging stack overflow problems.
27162The additionally emitted code causes only little overhead and hence can also be
27163used in production-like systems without greater performance degradation.  The given
27164values have to be exact powers of 2 and @var{stack-size} has to be greater than
27165@var{stack-guard} without exceeding 64k.
27166In order to be efficient the extra code makes the assumption that the stack starts
27167at an address aligned to the value given by @var{stack-size}.
27168The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27169
27170@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27171@opindex mhotpatch
27172If the hotpatch option is enabled, a ``hot-patching'' function
27173prologue is generated for all functions in the compilation unit.
27174The funtion label is prepended with the given number of two-byte
27175NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
27176the label, 2 * @var{post-halfwords} bytes are appended, using the
27177largest NOP like instructions the architecture allows (maximum
271781000000).
27179
27180If both arguments are zero, hotpatching is disabled.
27181
27182This option can be overridden for individual functions with the
27183@code{hotpatch} attribute.
27184@end table
27185
27186@node Score Options
27187@subsection Score Options
27188@cindex Score Options
27189
27190These options are defined for Score implementations:
27191
27192@table @gcctabopt
27193@item -meb
27194@opindex meb
27195Compile code for big-endian mode.  This is the default.
27196
27197@item -mel
27198@opindex mel
27199Compile code for little-endian mode.
27200
27201@item -mnhwloop
27202@opindex mnhwloop
27203Disable generation of @code{bcnz} instructions.
27204
27205@item -muls
27206@opindex muls
27207Enable generation of unaligned load and store instructions.
27208
27209@item -mmac
27210@opindex mmac
27211Enable the use of multiply-accumulate instructions. Disabled by default.
27212
27213@item -mscore5
27214@opindex mscore5
27215Specify the SCORE5 as the target architecture.
27216
27217@item -mscore5u
27218@opindex mscore5u
27219Specify the SCORE5U of the target architecture.
27220
27221@item -mscore7
27222@opindex mscore7
27223Specify the SCORE7 as the target architecture. This is the default.
27224
27225@item -mscore7d
27226@opindex mscore7d
27227Specify the SCORE7D as the target architecture.
27228@end table
27229
27230@node SH Options
27231@subsection SH Options
27232
27233These @samp{-m} options are defined for the SH implementations:
27234
27235@table @gcctabopt
27236@item -m1
27237@opindex m1
27238Generate code for the SH1.
27239
27240@item -m2
27241@opindex m2
27242Generate code for the SH2.
27243
27244@item -m2e
27245Generate code for the SH2e.
27246
27247@item -m2a-nofpu
27248@opindex m2a-nofpu
27249Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27250that the floating-point unit is not used.
27251
27252@item -m2a-single-only
27253@opindex m2a-single-only
27254Generate code for the SH2a-FPU, in such a way that no double-precision
27255floating-point operations are used.
27256
27257@item -m2a-single
27258@opindex m2a-single
27259Generate code for the SH2a-FPU assuming the floating-point unit is in
27260single-precision mode by default.
27261
27262@item -m2a
27263@opindex m2a
27264Generate code for the SH2a-FPU assuming the floating-point unit is in
27265double-precision mode by default.
27266
27267@item -m3
27268@opindex m3
27269Generate code for the SH3.
27270
27271@item -m3e
27272@opindex m3e
27273Generate code for the SH3e.
27274
27275@item -m4-nofpu
27276@opindex m4-nofpu
27277Generate code for the SH4 without a floating-point unit.
27278
27279@item -m4-single-only
27280@opindex m4-single-only
27281Generate code for the SH4 with a floating-point unit that only
27282supports single-precision arithmetic.
27283
27284@item -m4-single
27285@opindex m4-single
27286Generate code for the SH4 assuming the floating-point unit is in
27287single-precision mode by default.
27288
27289@item -m4
27290@opindex m4
27291Generate code for the SH4.
27292
27293@item -m4-100
27294@opindex m4-100
27295Generate code for SH4-100.
27296
27297@item -m4-100-nofpu
27298@opindex m4-100-nofpu
27299Generate code for SH4-100 in such a way that the
27300floating-point unit is not used.
27301
27302@item -m4-100-single
27303@opindex m4-100-single
27304Generate code for SH4-100 assuming the floating-point unit is in
27305single-precision mode by default.
27306
27307@item -m4-100-single-only
27308@opindex m4-100-single-only
27309Generate code for SH4-100 in such a way that no double-precision
27310floating-point operations are used.
27311
27312@item -m4-200
27313@opindex m4-200
27314Generate code for SH4-200.
27315
27316@item -m4-200-nofpu
27317@opindex m4-200-nofpu
27318Generate code for SH4-200 without in such a way that the
27319floating-point unit is not used.
27320
27321@item -m4-200-single
27322@opindex m4-200-single
27323Generate code for SH4-200 assuming the floating-point unit is in
27324single-precision mode by default.
27325
27326@item -m4-200-single-only
27327@opindex m4-200-single-only
27328Generate code for SH4-200 in such a way that no double-precision
27329floating-point operations are used.
27330
27331@item -m4-300
27332@opindex m4-300
27333Generate code for SH4-300.
27334
27335@item -m4-300-nofpu
27336@opindex m4-300-nofpu
27337Generate code for SH4-300 without in such a way that the
27338floating-point unit is not used.
27339
27340@item -m4-300-single
27341@opindex m4-300-single
27342Generate code for SH4-300 in such a way that no double-precision
27343floating-point operations are used.
27344
27345@item -m4-300-single-only
27346@opindex m4-300-single-only
27347Generate code for SH4-300 in such a way that no double-precision
27348floating-point operations are used.
27349
27350@item -m4-340
27351@opindex m4-340
27352Generate code for SH4-340 (no MMU, no FPU).
27353
27354@item -m4-500
27355@opindex m4-500
27356Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
27357assembler.
27358
27359@item -m4a-nofpu
27360@opindex m4a-nofpu
27361Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27362floating-point unit is not used.
27363
27364@item -m4a-single-only
27365@opindex m4a-single-only
27366Generate code for the SH4a, in such a way that no double-precision
27367floating-point operations are used.
27368
27369@item -m4a-single
27370@opindex m4a-single
27371Generate code for the SH4a assuming the floating-point unit is in
27372single-precision mode by default.
27373
27374@item -m4a
27375@opindex m4a
27376Generate code for the SH4a.
27377
27378@item -m4al
27379@opindex m4al
27380Same as @option{-m4a-nofpu}, except that it implicitly passes
27381@option{-dsp} to the assembler.  GCC doesn't generate any DSP
27382instructions at the moment.
27383
27384@item -mb
27385@opindex mb
27386Compile code for the processor in big-endian mode.
27387
27388@item -ml
27389@opindex ml
27390Compile code for the processor in little-endian mode.
27391
27392@item -mdalign
27393@opindex mdalign
27394Align doubles at 64-bit boundaries.  Note that this changes the calling
27395conventions, and thus some functions from the standard C library do
27396not work unless you recompile it first with @option{-mdalign}.
27397
27398@item -mrelax
27399@opindex mrelax
27400Shorten some address references at link time, when possible; uses the
27401linker option @option{-relax}.
27402
27403@item -mbigtable
27404@opindex mbigtable
27405Use 32-bit offsets in @code{switch} tables.  The default is to use
2740616-bit offsets.
27407
27408@item -mbitops
27409@opindex mbitops
27410Enable the use of bit manipulation instructions on SH2A.
27411
27412@item -mfmovd
27413@opindex mfmovd
27414Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
27415alignment constraints.
27416
27417@item -mrenesas
27418@opindex mrenesas
27419Comply with the calling conventions defined by Renesas.
27420
27421@item -mno-renesas
27422@opindex mno-renesas
27423Comply with the calling conventions defined for GCC before the Renesas
27424conventions were available.  This option is the default for all
27425targets of the SH toolchain.
27426
27427@item -mnomacsave
27428@opindex mnomacsave
27429Mark the @code{MAC} register as call-clobbered, even if
27430@option{-mrenesas} is given.
27431
27432@item -mieee
27433@itemx -mno-ieee
27434@opindex mieee
27435@opindex mno-ieee
27436Control the IEEE compliance of floating-point comparisons, which affects the
27437handling of cases where the result of a comparison is unordered.  By default
27438@option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
27439enabled @option{-mno-ieee} is implicitly set, which results in faster
27440floating-point greater-equal and less-equal comparisons.  The implicit settings
27441can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27442
27443@item -minline-ic_invalidate
27444@opindex minline-ic_invalidate
27445Inline code to invalidate instruction cache entries after setting up
27446nested function trampolines.
27447This option has no effect if @option{-musermode} is in effect and the selected
27448code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27449instruction.
27450If the selected code generation option does not allow the use of the @code{icbi}
27451instruction, and @option{-musermode} is not in effect, the inlined code
27452manipulates the instruction cache address array directly with an associative
27453write.  This not only requires privileged mode at run time, but it also
27454fails if the cache line had been mapped via the TLB and has become unmapped.
27455
27456@item -misize
27457@opindex misize
27458Dump instruction size and location in the assembly code.
27459
27460@item -mpadstruct
27461@opindex mpadstruct
27462This option is deprecated.  It pads structures to multiple of 4 bytes,
27463which is incompatible with the SH ABI@.
27464
27465@item -matomic-model=@var{model}
27466@opindex matomic-model=@var{model}
27467Sets the model of atomic operations and additional parameters as a comma
27468separated list.  For details on the atomic built-in functions see
27469@ref{__atomic Builtins}.  The following models and parameters are supported:
27470
27471@table @samp
27472
27473@item none
27474Disable compiler generated atomic sequences and emit library calls for atomic
27475operations.  This is the default if the target is not @code{sh*-*-linux*}.
27476
27477@item soft-gusa
27478Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27479built-in functions.  The generated atomic sequences require additional support
27480from the interrupt/exception handling code of the system and are only suitable
27481for SH3* and SH4* single-core systems.  This option is enabled by default when
27482the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
27483this option also partially utilizes the hardware atomic instructions
27484@code{movli.l} and @code{movco.l} to create more efficient code, unless
27485@samp{strict} is specified.
27486
27487@item soft-tcb
27488Generate software atomic sequences that use a variable in the thread control
27489block.  This is a variation of the gUSA sequences which can also be used on
27490SH1* and SH2* targets.  The generated atomic sequences require additional
27491support from the interrupt/exception handling code of the system and are only
27492suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
27493parameter has to be specified as well.
27494
27495@item soft-imask
27496Generate software atomic sequences that temporarily disable interrupts by
27497setting @code{SR.IMASK = 1111}.  This model works only when the program runs
27498in privileged mode and is only suitable for single-core systems.  Additional
27499support from the interrupt/exception handling code of the system is not
27500required.  This model is enabled by default when the target is
27501@code{sh*-*-linux*} and SH1* or SH2*.
27502
27503@item hard-llcs
27504Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27505instructions only.  This is only available on SH4A and is suitable for
27506multi-core systems.  Since the hardware instructions support only 32 bit atomic
27507variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27508Code compiled with this option is also compatible with other software
27509atomic model interrupt/exception handling systems if executed on an SH4A
27510system.  Additional support from the interrupt/exception handling code of the
27511system is not required for this model.
27512
27513@item gbr-offset=
27514This parameter specifies the offset in bytes of the variable in the thread
27515control block structure that should be used by the generated atomic sequences
27516when the @samp{soft-tcb} model has been selected.  For other models this
27517parameter is ignored.  The specified value must be an integer multiple of four
27518and in the range 0-1020.
27519
27520@item strict
27521This parameter prevents mixed usage of multiple atomic models, even if they
27522are compatible, and makes the compiler generate atomic sequences of the
27523specified model only.
27524
27525@end table
27526
27527@item -mtas
27528@opindex mtas
27529Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27530Notice that depending on the particular hardware and software configuration
27531this can degrade overall performance due to the operand cache line flushes
27532that are implied by the @code{tas.b} instruction.  On multi-core SH4A
27533processors the @code{tas.b} instruction must be used with caution since it
27534can result in data corruption for certain cache configurations.
27535
27536@item -mprefergot
27537@opindex mprefergot
27538When generating position-independent code, emit function calls using
27539the Global Offset Table instead of the Procedure Linkage Table.
27540
27541@item -musermode
27542@itemx -mno-usermode
27543@opindex musermode
27544@opindex mno-usermode
27545Don't allow (allow) the compiler generating privileged mode code.  Specifying
27546@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27547inlined code would not work in user mode.  @option{-musermode} is the default
27548when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
27549@option{-musermode} has no effect, since there is no user mode.
27550
27551@item -multcost=@var{number}
27552@opindex multcost=@var{number}
27553Set the cost to assume for a multiply insn.
27554
27555@item -mdiv=@var{strategy}
27556@opindex mdiv=@var{strategy}
27557Set the division strategy to be used for integer division operations.
27558@var{strategy} can be one of:
27559
27560@table @samp
27561
27562@item call-div1
27563Calls a library function that uses the single-step division instruction
27564@code{div1} to perform the operation.  Division by zero calculates an
27565unspecified result and does not trap.  This is the default except for SH4,
27566SH2A and SHcompact.
27567
27568@item call-fp
27569Calls a library function that performs the operation in double precision
27570floating point.  Division by zero causes a floating-point exception.  This is
27571the default for SHcompact with FPU.  Specifying this for targets that do not
27572have a double precision FPU defaults to @code{call-div1}.
27573
27574@item call-table
27575Calls a library function that uses a lookup table for small divisors and
27576the @code{div1} instruction with case distinction for larger divisors.  Division
27577by zero calculates an unspecified result and does not trap.  This is the default
27578for SH4.  Specifying this for targets that do not have dynamic shift
27579instructions defaults to @code{call-div1}.
27580
27581@end table
27582
27583When a division strategy has not been specified the default strategy is
27584selected based on the current target.  For SH2A the default strategy is to
27585use the @code{divs} and @code{divu} instructions instead of library function
27586calls.
27587
27588@item -maccumulate-outgoing-args
27589@opindex maccumulate-outgoing-args
27590Reserve space once for outgoing arguments in the function prologue rather
27591than around each call.  Generally beneficial for performance and size.  Also
27592needed for unwinding to avoid changing the stack frame around conditional code.
27593
27594@item -mdivsi3_libfunc=@var{name}
27595@opindex mdivsi3_libfunc=@var{name}
27596Set the name of the library function used for 32-bit signed division to
27597@var{name}.
27598This only affects the name used in the @samp{call} division strategies, and
27599the compiler still expects the same sets of input/output/clobbered registers as
27600if this option were not present.
27601
27602@item -mfixed-range=@var{register-range}
27603@opindex mfixed-range
27604Generate code treating the given register range as fixed registers.
27605A fixed register is one that the register allocator cannot use.  This is
27606useful when compiling kernel code.  A register range is specified as
27607two registers separated by a dash.  Multiple register ranges can be
27608specified separated by a comma.
27609
27610@item -mbranch-cost=@var{num}
27611@opindex mbranch-cost=@var{num}
27612Assume @var{num} to be the cost for a branch instruction.  Higher numbers
27613make the compiler try to generate more branch-free code if possible.
27614If not specified the value is selected depending on the processor type that
27615is being compiled for.
27616
27617@item -mzdcbranch
27618@itemx -mno-zdcbranch
27619@opindex mzdcbranch
27620@opindex mno-zdcbranch
27621Assume (do not assume) that zero displacement conditional branch instructions
27622@code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
27623compiler prefers zero displacement branch code sequences.  This is
27624enabled by default when generating code for SH4 and SH4A.  It can be explicitly
27625disabled by specifying @option{-mno-zdcbranch}.
27626
27627@item -mcbranch-force-delay-slot
27628@opindex mcbranch-force-delay-slot
27629Force the usage of delay slots for conditional branches, which stuffs the delay
27630slot with a @code{nop} if a suitable instruction cannot be found.  By default
27631this option is disabled.  It can be enabled to work around hardware bugs as
27632found in the original SH7055.
27633
27634@item -mfused-madd
27635@itemx -mno-fused-madd
27636@opindex mfused-madd
27637@opindex mno-fused-madd
27638Generate code that uses (does not use) the floating-point multiply and
27639accumulate instructions.  These instructions are generated by default
27640if hardware floating point is used.  The machine-dependent
27641@option{-mfused-madd} option is now mapped to the machine-independent
27642@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27643mapped to @option{-ffp-contract=off}.
27644
27645@item -mfsca
27646@itemx -mno-fsca
27647@opindex mfsca
27648@opindex mno-fsca
27649Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27650and cosine approximations.  The option @option{-mfsca} must be used in
27651combination with @option{-funsafe-math-optimizations}.  It is enabled by default
27652when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
27653approximations even if @option{-funsafe-math-optimizations} is in effect.
27654
27655@item -mfsrra
27656@itemx -mno-fsrra
27657@opindex mfsrra
27658@opindex mno-fsrra
27659Allow or disallow the compiler to emit the @code{fsrra} instruction for
27660reciprocal square root approximations.  The option @option{-mfsrra} must be used
27661in combination with @option{-funsafe-math-optimizations} and
27662@option{-ffinite-math-only}.  It is enabled by default when generating code for
27663SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
27664even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27665in effect.
27666
27667@item -mpretend-cmove
27668@opindex mpretend-cmove
27669Prefer zero-displacement conditional branches for conditional move instruction
27670patterns.  This can result in faster code on the SH4 processor.
27671
27672@item -mfdpic
27673@opindex fdpic
27674Generate code using the FDPIC ABI.
27675
27676@end table
27677
27678@node Solaris 2 Options
27679@subsection Solaris 2 Options
27680@cindex Solaris 2 options
27681
27682These @samp{-m} options are supported on Solaris 2:
27683
27684@table @gcctabopt
27685@item -mclear-hwcap
27686@opindex mclear-hwcap
27687@option{-mclear-hwcap} tells the compiler to remove the hardware
27688capabilities generated by the Solaris assembler.  This is only necessary
27689when object files use ISA extensions not supported by the current
27690machine, but check at runtime whether or not to use them.
27691
27692@item -mimpure-text
27693@opindex mimpure-text
27694@option{-mimpure-text}, used in addition to @option{-shared}, tells
27695the compiler to not pass @option{-z text} to the linker when linking a
27696shared object.  Using this option, you can link position-dependent
27697code into a shared object.
27698
27699@option{-mimpure-text} suppresses the ``relocations remain against
27700allocatable but non-writable sections'' linker error message.
27701However, the necessary relocations trigger copy-on-write, and the
27702shared object is not actually shared across processes.  Instead of
27703using @option{-mimpure-text}, you should compile all source code with
27704@option{-fpic} or @option{-fPIC}.
27705
27706@end table
27707
27708These switches are supported in addition to the above on Solaris 2:
27709
27710@table @gcctabopt
27711@item -pthreads
27712@opindex pthreads
27713This is a synonym for @option{-pthread}.
27714@end table
27715
27716@node SPARC Options
27717@subsection SPARC Options
27718@cindex SPARC options
27719
27720These @samp{-m} options are supported on the SPARC:
27721
27722@table @gcctabopt
27723@item -mno-app-regs
27724@itemx -mapp-regs
27725@opindex mno-app-regs
27726@opindex mapp-regs
27727Specify @option{-mapp-regs} to generate output using the global registers
277282 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
27729global register 1, each global register 2 through 4 is then treated as an
27730allocable register that is clobbered by function calls.  This is the default.
27731
27732To be fully SVR4 ABI-compliant at the cost of some performance loss,
27733specify @option{-mno-app-regs}.  You should compile libraries and system
27734software with this option.
27735
27736@item -mflat
27737@itemx -mno-flat
27738@opindex mflat
27739@opindex mno-flat
27740With @option{-mflat}, the compiler does not generate save/restore instructions
27741and uses a ``flat'' or single register window model.  This model is compatible
27742with the regular register window model.  The local registers and the input
27743registers (0--5) are still treated as ``call-saved'' registers and are
27744saved on the stack as needed.
27745
27746With @option{-mno-flat} (the default), the compiler generates save/restore
27747instructions (except for leaf functions).  This is the normal operating mode.
27748
27749@item -mfpu
27750@itemx -mhard-float
27751@opindex mfpu
27752@opindex mhard-float
27753Generate output containing floating-point instructions.  This is the
27754default.
27755
27756@item -mno-fpu
27757@itemx -msoft-float
27758@opindex mno-fpu
27759@opindex msoft-float
27760Generate output containing library calls for floating point.
27761@strong{Warning:} the requisite libraries are not available for all SPARC
27762targets.  Normally the facilities of the machine's usual C compiler are
27763used, but this cannot be done directly in cross-compilation.  You must make
27764your own arrangements to provide suitable library functions for
27765cross-compilation.  The embedded targets @samp{sparc-*-aout} and
27766@samp{sparclite-*-*} do provide software floating-point support.
27767
27768@option{-msoft-float} changes the calling convention in the output file;
27769therefore, it is only useful if you compile @emph{all} of a program with
27770this option.  In particular, you need to compile @file{libgcc.a}, the
27771library that comes with GCC, with @option{-msoft-float} in order for
27772this to work.
27773
27774@item -mhard-quad-float
27775@opindex mhard-quad-float
27776Generate output containing quad-word (long double) floating-point
27777instructions.
27778
27779@item -msoft-quad-float
27780@opindex msoft-quad-float
27781Generate output containing library calls for quad-word (long double)
27782floating-point instructions.  The functions called are those specified
27783in the SPARC ABI@.  This is the default.
27784
27785As of this writing, there are no SPARC implementations that have hardware
27786support for the quad-word floating-point instructions.  They all invoke
27787a trap handler for one of these instructions, and then the trap handler
27788emulates the effect of the instruction.  Because of the trap handler overhead,
27789this is much slower than calling the ABI library routines.  Thus the
27790@option{-msoft-quad-float} option is the default.
27791
27792@item -mno-unaligned-doubles
27793@itemx -munaligned-doubles
27794@opindex mno-unaligned-doubles
27795@opindex munaligned-doubles
27796Assume that doubles have 8-byte alignment.  This is the default.
27797
27798With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
27799alignment only if they are contained in another type, or if they have an
27800absolute address.  Otherwise, it assumes they have 4-byte alignment.
27801Specifying this option avoids some rare compatibility problems with code
27802generated by other compilers.  It is not the default because it results
27803in a performance loss, especially for floating-point code.
27804
27805@item -muser-mode
27806@itemx -mno-user-mode
27807@opindex muser-mode
27808@opindex mno-user-mode
27809Do not generate code that can only run in supervisor mode.  This is relevant
27810only for the @code{casa} instruction emitted for the LEON3 processor.  This
27811is the default.
27812
27813@item -mfaster-structs
27814@itemx -mno-faster-structs
27815@opindex mfaster-structs
27816@opindex mno-faster-structs
27817With @option{-mfaster-structs}, the compiler assumes that structures
27818should have 8-byte alignment.  This enables the use of pairs of
27819@code{ldd} and @code{std} instructions for copies in structure
27820assignment, in place of twice as many @code{ld} and @code{st} pairs.
27821However, the use of this changed alignment directly violates the SPARC
27822ABI@.  Thus, it's intended only for use on targets where the developer
27823acknowledges that their resulting code is not directly in line with
27824the rules of the ABI@.
27825
27826@item -mstd-struct-return
27827@itemx -mno-std-struct-return
27828@opindex mstd-struct-return
27829@opindex mno-std-struct-return
27830With @option{-mstd-struct-return}, the compiler generates checking code
27831in functions returning structures or unions to detect size mismatches
27832between the two sides of function calls, as per the 32-bit ABI@.
27833
27834The default is @option{-mno-std-struct-return}.  This option has no effect
27835in 64-bit mode.
27836
27837@item -mlra
27838@itemx -mno-lra
27839@opindex mlra
27840@opindex mno-lra
27841Enable Local Register Allocation.  This is the default for SPARC since GCC 7
27842so @option{-mno-lra} needs to be passed to get old Reload.
27843
27844@item -mcpu=@var{cpu_type}
27845@opindex mcpu
27846Set the instruction set, register set, and instruction scheduling parameters
27847for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
27848@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
27849@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
27850@samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
27851@samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
27852@samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
27853@samp{m8}.
27854
27855Native Solaris and GNU/Linux toolchains also support the value @samp{native},
27856which selects the best architecture option for the host processor.
27857@option{-mcpu=native} has no effect if GCC does not recognize
27858the processor.
27859
27860Default instruction scheduling parameters are used for values that select
27861an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
27862@samp{sparclite}, @samp{sparclet}, @samp{v9}.
27863
27864Here is a list of each supported architecture and their supported
27865implementations.
27866
27867@table @asis
27868@item v7
27869cypress, leon3v7
27870
27871@item v8
27872supersparc, hypersparc, leon, leon3, leon5
27873
27874@item sparclite
27875f930, f934, sparclite86x
27876
27877@item sparclet
27878tsc701
27879
27880@item v9
27881ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27882niagara7, m8
27883@end table
27884
27885By default (unless configured otherwise), GCC generates code for the V7
27886variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
27887additionally optimizes it for the Cypress CY7C602 chip, as used in the
27888SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
27889SPARCStation 1, 2, IPX etc.
27890
27891With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
27892architecture.  The only difference from V7 code is that the compiler emits
27893the integer multiply and integer divide instructions which exist in SPARC-V8
27894but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
27895optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
278962000 series.
27897
27898With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
27899the SPARC architecture.  This adds the integer multiply, integer divide step
27900and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
27901With @option{-mcpu=f930}, the compiler additionally optimizes it for the
27902Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
27903@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
27904MB86934 chip, which is the more recent SPARClite with FPU@.
27905
27906With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
27907the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
27908integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
27909but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
27910optimizes it for the TEMIC SPARClet chip.
27911
27912With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
27913architecture.  This adds 64-bit integer and floating-point move instructions,
279143 additional floating-point condition code registers and conditional move
27915instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
27916optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
27917@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
27918Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
27919@option{-mcpu=niagara}, the compiler additionally optimizes it for
27920Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
27921additionally optimizes it for Sun UltraSPARC T2 chips. With
27922@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
27923UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
27924additionally optimizes it for Sun UltraSPARC T4 chips.  With
27925@option{-mcpu=niagara7}, the compiler additionally optimizes it for
27926Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
27927additionally optimizes it for Oracle M8 chips.
27928
27929@item -mtune=@var{cpu_type}
27930@opindex mtune
27931Set the instruction scheduling parameters for machine type
27932@var{cpu_type}, but do not set the instruction set or register set that the
27933option @option{-mcpu=@var{cpu_type}} does.
27934
27935The same values for @option{-mcpu=@var{cpu_type}} can be used for
27936@option{-mtune=@var{cpu_type}}, but the only useful values are those
27937that select a particular CPU implementation.  Those are
27938@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
27939@samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
27940@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
27941@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
27942@samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
27943and GNU/Linux toolchains, @samp{native} can also be used.
27944
27945@item -mv8plus
27946@itemx -mno-v8plus
27947@opindex mv8plus
27948@opindex mno-v8plus
27949With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
27950difference from the V8 ABI is that the global and out registers are
27951considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
27952mode for all SPARC-V9 processors.
27953
27954@item -mvis
27955@itemx -mno-vis
27956@opindex mvis
27957@opindex mno-vis
27958With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
27959Visual Instruction Set extensions.  The default is @option{-mno-vis}.
27960
27961@item -mvis2
27962@itemx -mno-vis2
27963@opindex mvis2
27964@opindex mno-vis2
27965With @option{-mvis2}, GCC generates code that takes advantage of
27966version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
27967default is @option{-mvis2} when targeting a cpu that supports such
27968instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
27969also sets @option{-mvis}.
27970
27971@item -mvis3
27972@itemx -mno-vis3
27973@opindex mvis3
27974@opindex mno-vis3
27975With @option{-mvis3}, GCC generates code that takes advantage of
27976version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
27977default is @option{-mvis3} when targeting a cpu that supports such
27978instructions, such as niagara-3 and later.  Setting @option{-mvis3}
27979also sets @option{-mvis2} and @option{-mvis}.
27980
27981@item -mvis4
27982@itemx -mno-vis4
27983@opindex mvis4
27984@opindex mno-vis4
27985With @option{-mvis4}, GCC generates code that takes advantage of
27986version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
27987default is @option{-mvis4} when targeting a cpu that supports such
27988instructions, such as niagara-7 and later.  Setting @option{-mvis4}
27989also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
27990
27991@item -mvis4b
27992@itemx -mno-vis4b
27993@opindex mvis4b
27994@opindex mno-vis4b
27995With @option{-mvis4b}, GCC generates code that takes advantage of
27996version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
27997the additional VIS instructions introduced in the Oracle SPARC
27998Architecture 2017.  The default is @option{-mvis4b} when targeting a
27999cpu that supports such instructions, such as m8 and later.  Setting
28000@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
28001@option{-mvis2} and @option{-mvis}.
28002
28003@item -mcbcond
28004@itemx -mno-cbcond
28005@opindex mcbcond
28006@opindex mno-cbcond
28007With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
28008Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
28009when targeting a CPU that supports such instructions, such as Niagara-4 and
28010later.
28011
28012@item -mfmaf
28013@itemx -mno-fmaf
28014@opindex mfmaf
28015@opindex mno-fmaf
28016With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
28017Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
28018when targeting a CPU that supports such instructions, such as Niagara-3 and
28019later.
28020
28021@item -mfsmuld
28022@itemx -mno-fsmuld
28023@opindex mfsmuld
28024@opindex mno-fsmuld
28025With @option{-mfsmuld}, GCC generates code that takes advantage of the
28026Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
28027@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
28028or V9 with FPU except @option{-mcpu=leon}.
28029
28030@item -mpopc
28031@itemx -mno-popc
28032@opindex mpopc
28033@opindex mno-popc
28034With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
28035Population Count instruction.  The default is @option{-mpopc}
28036when targeting a CPU that supports such an instruction, such as Niagara-2 and
28037later.
28038
28039@item -msubxc
28040@itemx -mno-subxc
28041@opindex msubxc
28042@opindex mno-subxc
28043With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
28044Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
28045when targeting a CPU that supports such an instruction, such as Niagara-7 and
28046later.
28047
28048@item -mfix-at697f
28049@opindex mfix-at697f
28050Enable the documented workaround for the single erratum of the Atmel AT697F
28051processor (which corresponds to erratum #13 of the AT697E processor).
28052
28053@item -mfix-ut699
28054@opindex mfix-ut699
28055Enable the documented workarounds for the floating-point errata and the data
28056cache nullify errata of the UT699 processor.
28057
28058@item -mfix-ut700
28059@opindex mfix-ut700
28060Enable the documented workaround for the back-to-back store errata of
28061the UT699E/UT700 processor.
28062
28063@item -mfix-gr712rc
28064@opindex mfix-gr712rc
28065Enable the documented workaround for the back-to-back store errata of
28066the GR712RC processor.
28067@end table
28068
28069These @samp{-m} options are supported in addition to the above
28070on SPARC-V9 processors in 64-bit environments:
28071
28072@table @gcctabopt
28073@item -m32
28074@itemx -m64
28075@opindex m32
28076@opindex m64
28077Generate code for a 32-bit or 64-bit environment.
28078The 32-bit environment sets int, long and pointer to 32 bits.
28079The 64-bit environment sets int to 32 bits and long and pointer
28080to 64 bits.
28081
28082@item -mcmodel=@var{which}
28083@opindex mcmodel
28084Set the code model to one of
28085
28086@table @samp
28087@item medlow
28088The Medium/Low code model: 64-bit addresses, programs
28089must be linked in the low 32 bits of memory.  Programs can be statically
28090or dynamically linked.
28091
28092@item medmid
28093The Medium/Middle code model: 64-bit addresses, programs
28094must be linked in the low 44 bits of memory, the text and data segments must
28095be less than 2GB in size and the data segment must be located within 2GB of
28096the text segment.
28097
28098@item medany
28099The Medium/Anywhere code model: 64-bit addresses, programs
28100may be linked anywhere in memory, the text and data segments must be less
28101than 2GB in size and the data segment must be located within 2GB of the
28102text segment.
28103
28104@item embmedany
28105The Medium/Anywhere code model for embedded systems:
2810664-bit addresses, the text and data segments must be less than 2GB in
28107size, both starting anywhere in memory (determined at link time).  The
28108global register %g4 points to the base of the data segment.  Programs
28109are statically linked and PIC is not supported.
28110@end table
28111
28112@item -mmemory-model=@var{mem-model}
28113@opindex mmemory-model
28114Set the memory model in force on the processor to one of
28115
28116@table @samp
28117@item default
28118The default memory model for the processor and operating system.
28119
28120@item rmo
28121Relaxed Memory Order
28122
28123@item pso
28124Partial Store Order
28125
28126@item tso
28127Total Store Order
28128
28129@item sc
28130Sequential Consistency
28131@end table
28132
28133These memory models are formally defined in Appendix D of the SPARC-V9
28134architecture manual, as set in the processor's @code{PSTATE.MM} field.
28135
28136@item -mstack-bias
28137@itemx -mno-stack-bias
28138@opindex mstack-bias
28139@opindex mno-stack-bias
28140With @option{-mstack-bias}, GCC assumes that the stack pointer, and
28141frame pointer if present, are offset by @minus{}2047 which must be added back
28142when making stack frame references.  This is the default in 64-bit mode.
28143Otherwise, assume no such offset is present.
28144@end table
28145
28146@node System V Options
28147@subsection Options for System V
28148
28149These additional options are available on System V Release 4 for
28150compatibility with other compilers on those systems:
28151
28152@table @gcctabopt
28153@item -G
28154@opindex G
28155Create a shared object.
28156It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28157
28158@item -Qy
28159@opindex Qy
28160Identify the versions of each tool used by the compiler, in a
28161@code{.ident} assembler directive in the output.
28162
28163@item -Qn
28164@opindex Qn
28165Refrain from adding @code{.ident} directives to the output file (this is
28166the default).
28167
28168@item -YP,@var{dirs}
28169@opindex YP
28170Search the directories @var{dirs}, and no others, for libraries
28171specified with @option{-l}.
28172
28173@item -Ym,@var{dir}
28174@opindex Ym
28175Look in the directory @var{dir} to find the M4 preprocessor.
28176The assembler uses this option.
28177@c This is supposed to go with a -Yd for predefined M4 macro files, but
28178@c the generic assembler that comes with Solaris takes just -Ym.
28179@end table
28180
28181@node TILE-Gx Options
28182@subsection TILE-Gx Options
28183@cindex TILE-Gx options
28184
28185These @samp{-m} options are supported on the TILE-Gx:
28186
28187@table @gcctabopt
28188@item -mcmodel=small
28189@opindex mcmodel=small
28190Generate code for the small model.  The distance for direct calls is
28191limited to 500M in either direction.  PC-relative addresses are 32
28192bits.  Absolute addresses support the full address range.
28193
28194@item -mcmodel=large
28195@opindex mcmodel=large
28196Generate code for the large model.  There is no limitation on call
28197distance, pc-relative addresses, or absolute addresses.
28198
28199@item -mcpu=@var{name}
28200@opindex mcpu
28201Selects the type of CPU to be targeted.  Currently the only supported
28202type is @samp{tilegx}.
28203
28204@item -m32
28205@itemx -m64
28206@opindex m32
28207@opindex m64
28208Generate code for a 32-bit or 64-bit environment.  The 32-bit
28209environment sets int, long, and pointer to 32 bits.  The 64-bit
28210environment sets int to 32 bits and long and pointer to 64 bits.
28211
28212@item -mbig-endian
28213@itemx -mlittle-endian
28214@opindex mbig-endian
28215@opindex mlittle-endian
28216Generate code in big/little endian mode, respectively.
28217@end table
28218
28219@node TILEPro Options
28220@subsection TILEPro Options
28221@cindex TILEPro options
28222
28223These @samp{-m} options are supported on the TILEPro:
28224
28225@table @gcctabopt
28226@item -mcpu=@var{name}
28227@opindex mcpu
28228Selects the type of CPU to be targeted.  Currently the only supported
28229type is @samp{tilepro}.
28230
28231@item -m32
28232@opindex m32
28233Generate code for a 32-bit environment, which sets int, long, and
28234pointer to 32 bits.  This is the only supported behavior so the flag
28235is essentially ignored.
28236@end table
28237
28238@node V850 Options
28239@subsection V850 Options
28240@cindex V850 Options
28241
28242These @samp{-m} options are defined for V850 implementations:
28243
28244@table @gcctabopt
28245@item -mlong-calls
28246@itemx -mno-long-calls
28247@opindex mlong-calls
28248@opindex mno-long-calls
28249Treat all calls as being far away (near).  If calls are assumed to be
28250far away, the compiler always loads the function's address into a
28251register, and calls indirect through the pointer.
28252
28253@item -mno-ep
28254@itemx -mep
28255@opindex mno-ep
28256@opindex mep
28257Do not optimize (do optimize) basic blocks that use the same index
28258pointer 4 or more times to copy pointer into the @code{ep} register, and
28259use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
28260option is on by default if you optimize.
28261
28262@item -mno-prolog-function
28263@itemx -mprolog-function
28264@opindex mno-prolog-function
28265@opindex mprolog-function
28266Do not use (do use) external functions to save and restore registers
28267at the prologue and epilogue of a function.  The external functions
28268are slower, but use less code space if more than one function saves
28269the same number of registers.  The @option{-mprolog-function} option
28270is on by default if you optimize.
28271
28272@item -mspace
28273@opindex mspace
28274Try to make the code as small as possible.  At present, this just turns
28275on the @option{-mep} and @option{-mprolog-function} options.
28276
28277@item -mtda=@var{n}
28278@opindex mtda
28279Put static or global variables whose size is @var{n} bytes or less into
28280the tiny data area that register @code{ep} points to.  The tiny data
28281area can hold up to 256 bytes in total (128 bytes for byte references).
28282
28283@item -msda=@var{n}
28284@opindex msda
28285Put static or global variables whose size is @var{n} bytes or less into
28286the small data area that register @code{gp} points to.  The small data
28287area can hold up to 64 kilobytes.
28288
28289@item -mzda=@var{n}
28290@opindex mzda
28291Put static or global variables whose size is @var{n} bytes or less into
28292the first 32 kilobytes of memory.
28293
28294@item -mv850
28295@opindex mv850
28296Specify that the target processor is the V850.
28297
28298@item -mv850e3v5
28299@opindex mv850e3v5
28300Specify that the target processor is the V850E3V5.  The preprocessor
28301constant @code{__v850e3v5__} is defined if this option is used.
28302
28303@item -mv850e2v4
28304@opindex mv850e2v4
28305Specify that the target processor is the V850E3V5.  This is an alias for
28306the @option{-mv850e3v5} option.
28307
28308@item -mv850e2v3
28309@opindex mv850e2v3
28310Specify that the target processor is the V850E2V3.  The preprocessor
28311constant @code{__v850e2v3__} is defined if this option is used.
28312
28313@item -mv850e2
28314@opindex mv850e2
28315Specify that the target processor is the V850E2.  The preprocessor
28316constant @code{__v850e2__} is defined if this option is used.
28317
28318@item -mv850e1
28319@opindex mv850e1
28320Specify that the target processor is the V850E1.  The preprocessor
28321constants @code{__v850e1__} and @code{__v850e__} are defined if
28322this option is used.
28323
28324@item -mv850es
28325@opindex mv850es
28326Specify that the target processor is the V850ES.  This is an alias for
28327the @option{-mv850e1} option.
28328
28329@item -mv850e
28330@opindex mv850e
28331Specify that the target processor is the V850E@.  The preprocessor
28332constant @code{__v850e__} is defined if this option is used.
28333
28334If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28335nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28336are defined then a default target processor is chosen and the
28337relevant @samp{__v850*__} preprocessor constant is defined.
28338
28339The preprocessor constants @code{__v850} and @code{__v851__} are always
28340defined, regardless of which processor variant is the target.
28341
28342@item -mdisable-callt
28343@itemx -mno-disable-callt
28344@opindex mdisable-callt
28345@opindex mno-disable-callt
28346This option suppresses generation of the @code{CALLT} instruction for the
28347v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28348architecture.
28349
28350This option is enabled by default when the RH850 ABI is
28351in use (see @option{-mrh850-abi}), and disabled by default when the
28352GCC ABI is in use.  If @code{CALLT} instructions are being generated
28353then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28354
28355@item -mrelax
28356@itemx -mno-relax
28357@opindex mrelax
28358@opindex mno-relax
28359Pass on (or do not pass on) the @option{-mrelax} command-line option
28360to the assembler.
28361
28362@item -mlong-jumps
28363@itemx -mno-long-jumps
28364@opindex mlong-jumps
28365@opindex mno-long-jumps
28366Disable (or re-enable) the generation of PC-relative jump instructions.
28367
28368@item -msoft-float
28369@itemx -mhard-float
28370@opindex msoft-float
28371@opindex mhard-float
28372Disable (or re-enable) the generation of hardware floating point
28373instructions.  This option is only significant when the target
28374architecture is @samp{V850E2V3} or higher.  If hardware floating point
28375instructions are being generated then the C preprocessor symbol
28376@code{__FPU_OK__} is defined, otherwise the symbol
28377@code{__NO_FPU__} is defined.
28378
28379@item -mloop
28380@opindex mloop
28381Enables the use of the e3v5 LOOP instruction.  The use of this
28382instruction is not enabled by default when the e3v5 architecture is
28383selected because its use is still experimental.
28384
28385@item -mrh850-abi
28386@itemx -mghs
28387@opindex mrh850-abi
28388@opindex mghs
28389Enables support for the RH850 version of the V850 ABI.  This is the
28390default.  With this version of the ABI the following rules apply:
28391
28392@itemize
28393@item
28394Integer sized structures and unions are returned via a memory pointer
28395rather than a register.
28396
28397@item
28398Large structures and unions (more than 8 bytes in size) are passed by
28399value.
28400
28401@item
28402Functions are aligned to 16-bit boundaries.
28403
28404@item
28405The @option{-m8byte-align} command-line option is supported.
28406
28407@item
28408The @option{-mdisable-callt} command-line option is enabled by
28409default.  The @option{-mno-disable-callt} command-line option is not
28410supported.
28411@end itemize
28412
28413When this version of the ABI is enabled the C preprocessor symbol
28414@code{__V850_RH850_ABI__} is defined.
28415
28416@item -mgcc-abi
28417@opindex mgcc-abi
28418Enables support for the old GCC version of the V850 ABI.  With this
28419version of the ABI the following rules apply:
28420
28421@itemize
28422@item
28423Integer sized structures and unions are returned in register @code{r10}.
28424
28425@item
28426Large structures and unions (more than 8 bytes in size) are passed by
28427reference.
28428
28429@item
28430Functions are aligned to 32-bit boundaries, unless optimizing for
28431size.
28432
28433@item
28434The @option{-m8byte-align} command-line option is not supported.
28435
28436@item
28437The @option{-mdisable-callt} command-line option is supported but not
28438enabled by default.
28439@end itemize
28440
28441When this version of the ABI is enabled the C preprocessor symbol
28442@code{__V850_GCC_ABI__} is defined.
28443
28444@item -m8byte-align
28445@itemx -mno-8byte-align
28446@opindex m8byte-align
28447@opindex mno-8byte-align
28448Enables support for @code{double} and @code{long long} types to be
28449aligned on 8-byte boundaries.  The default is to restrict the
28450alignment of all objects to at most 4-bytes.  When
28451@option{-m8byte-align} is in effect the C preprocessor symbol
28452@code{__V850_8BYTE_ALIGN__} is defined.
28453
28454@item -mbig-switch
28455@opindex mbig-switch
28456Generate code suitable for big switch tables.  Use this option only if
28457the assembler/linker complain about out of range branches within a switch
28458table.
28459
28460@item -mapp-regs
28461@opindex mapp-regs
28462This option causes r2 and r5 to be used in the code generated by
28463the compiler.  This setting is the default.
28464
28465@item -mno-app-regs
28466@opindex mno-app-regs
28467This option causes r2 and r5 to be treated as fixed registers.
28468
28469@end table
28470
28471@node VAX Options
28472@subsection VAX Options
28473@cindex VAX options
28474
28475These @samp{-m} options are defined for the VAX:
28476
28477@table @gcctabopt
28478@item -munix
28479@opindex munix
28480Do not output certain jump instructions (@code{aobleq} and so on)
28481that the Unix assembler for the VAX cannot handle across long
28482ranges.
28483
28484@item -mgnu
28485@opindex mgnu
28486Do output those jump instructions, on the assumption that the
28487GNU assembler is being used.
28488
28489@item -mg
28490@opindex mg
28491Output code for G-format floating-point numbers instead of D-format.
28492@end table
28493
28494@node Visium Options
28495@subsection Visium Options
28496@cindex Visium options
28497
28498@table @gcctabopt
28499
28500@item -mdebug
28501@opindex mdebug
28502A program which performs file I/O and is destined to run on an MCM target
28503should be linked with this option.  It causes the libraries libc.a and
28504libdebug.a to be linked.  The program should be run on the target under
28505the control of the GDB remote debugging stub.
28506
28507@item -msim
28508@opindex msim
28509A program which performs file I/O and is destined to run on the simulator
28510should be linked with option.  This causes libraries libc.a and libsim.a to
28511be linked.
28512
28513@item -mfpu
28514@itemx -mhard-float
28515@opindex mfpu
28516@opindex mhard-float
28517Generate code containing floating-point instructions.  This is the
28518default.
28519
28520@item -mno-fpu
28521@itemx -msoft-float
28522@opindex mno-fpu
28523@opindex msoft-float
28524Generate code containing library calls for floating-point.
28525
28526@option{-msoft-float} changes the calling convention in the output file;
28527therefore, it is only useful if you compile @emph{all} of a program with
28528this option.  In particular, you need to compile @file{libgcc.a}, the
28529library that comes with GCC, with @option{-msoft-float} in order for
28530this to work.
28531
28532@item -mcpu=@var{cpu_type}
28533@opindex mcpu
28534Set the instruction set, register set, and instruction scheduling parameters
28535for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
28536@samp{mcm}, @samp{gr5} and @samp{gr6}.
28537
28538@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28539
28540By default (unless configured otherwise), GCC generates code for the GR5
28541variant of the Visium architecture.
28542
28543With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28544architecture.  The only difference from GR5 code is that the compiler will
28545generate block move instructions.
28546
28547@item -mtune=@var{cpu_type}
28548@opindex mtune
28549Set the instruction scheduling parameters for machine type @var{cpu_type},
28550but do not set the instruction set or register set that the option
28551@option{-mcpu=@var{cpu_type}} would.
28552
28553@item -msv-mode
28554@opindex msv-mode
28555Generate code for the supervisor mode, where there are no restrictions on
28556the access to general registers.  This is the default.
28557
28558@item -muser-mode
28559@opindex muser-mode
28560Generate code for the user mode, where the access to some general registers
28561is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28562mode; on the GR6, only registers r29 to r31 are affected.
28563@end table
28564
28565@node VMS Options
28566@subsection VMS Options
28567
28568These @samp{-m} options are defined for the VMS implementations:
28569
28570@table @gcctabopt
28571@item -mvms-return-codes
28572@opindex mvms-return-codes
28573Return VMS condition codes from @code{main}. The default is to return POSIX-style
28574condition (e.g.@: error) codes.
28575
28576@item -mdebug-main=@var{prefix}
28577@opindex mdebug-main=@var{prefix}
28578Flag the first routine whose name starts with @var{prefix} as the main
28579routine for the debugger.
28580
28581@item -mmalloc64
28582@opindex mmalloc64
28583Default to 64-bit memory allocation routines.
28584
28585@item -mpointer-size=@var{size}
28586@opindex mpointer-size=@var{size}
28587Set the default size of pointers. Possible options for @var{size} are
28588@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28589for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28590The later option disables @code{pragma pointer_size}.
28591@end table
28592
28593@node VxWorks Options
28594@subsection VxWorks Options
28595@cindex VxWorks Options
28596
28597The options in this section are defined for all VxWorks targets.
28598Options specific to the target hardware are listed with the other
28599options for that target.
28600
28601@table @gcctabopt
28602@item -mrtp
28603@opindex mrtp
28604GCC can generate code for both VxWorks kernels and real time processes
28605(RTPs).  This option switches from the former to the latter.  It also
28606defines the preprocessor macro @code{__RTP__}.
28607
28608@item -non-static
28609@opindex non-static
28610Link an RTP executable against shared libraries rather than static
28611libraries.  The options @option{-static} and @option{-shared} can
28612also be used for RTPs (@pxref{Link Options}); @option{-static}
28613is the default.
28614
28615@item -Bstatic
28616@itemx -Bdynamic
28617@opindex Bstatic
28618@opindex Bdynamic
28619These options are passed down to the linker.  They are defined for
28620compatibility with Diab.
28621
28622@item -Xbind-lazy
28623@opindex Xbind-lazy
28624Enable lazy binding of function calls.  This option is equivalent to
28625@option{-Wl,-z,now} and is defined for compatibility with Diab.
28626
28627@item -Xbind-now
28628@opindex Xbind-now
28629Disable lazy binding of function calls.  This option is the default and
28630is defined for compatibility with Diab.
28631@end table
28632
28633@node x86 Options
28634@subsection x86 Options
28635@cindex x86 Options
28636
28637These @samp{-m} options are defined for the x86 family of computers.
28638
28639@table @gcctabopt
28640
28641@item -march=@var{cpu-type}
28642@opindex march
28643Generate instructions for the machine type @var{cpu-type}.  In contrast to
28644@option{-mtune=@var{cpu-type}}, which merely tunes the generated code
28645for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28646to generate code that may not run at all on processors other than the one
28647indicated.  Specifying @option{-march=@var{cpu-type}} implies
28648@option{-mtune=@var{cpu-type}}.
28649
28650The choices for @var{cpu-type} are:
28651
28652@table @samp
28653@item native
28654This selects the CPU to generate code for at compilation time by determining
28655the processor type of the compiling machine.  Using @option{-march=native}
28656enables all instruction subsets supported by the local machine (hence
28657the result might not run on different machines).  Using @option{-mtune=native}
28658produces code optimized for the local machine under the constraints
28659of the selected instruction set.
28660
28661@item x86-64
28662A generic CPU with 64-bit extensions.
28663
28664@item i386
28665Original Intel i386 CPU@.
28666
28667@item i486
28668Intel i486 CPU@.  (No scheduling is implemented for this chip.)
28669
28670@item i586
28671@itemx pentium
28672Intel Pentium CPU with no MMX support.
28673
28674@item lakemont
28675Intel Lakemont MCU, based on Intel Pentium CPU.
28676
28677@item pentium-mmx
28678Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28679
28680@item pentiumpro
28681Intel Pentium Pro CPU@.
28682
28683@item i686
28684When used with @option{-march}, the Pentium Pro
28685instruction set is used, so the code runs on all i686 family chips.
28686When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28687
28688@item pentium2
28689Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28690support.
28691
28692@item pentium3
28693@itemx pentium3m
28694Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28695set support.
28696
28697@item pentium-m
28698Intel Pentium M; low-power version of Intel Pentium III CPU
28699with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
28700
28701@item pentium4
28702@itemx pentium4m
28703Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28704
28705@item prescott
28706Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28707set support.
28708
28709@item nocona
28710Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28711SSE2 and SSE3 instruction set support.
28712
28713@item core2
28714Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28715instruction set support.
28716
28717@item nehalem
28718Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28719SSE4.1, SSE4.2 and POPCNT instruction set support.
28720
28721@item westmere
28722Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28723SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28724
28725@item sandybridge
28726Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28727SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28728
28729@item ivybridge
28730Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28731SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28732instruction set support.
28733
28734@item haswell
28735Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28736SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28737BMI, BMI2 and F16C instruction set support.
28738
28739@item broadwell
28740Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28741SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
28742F16C, RDSEED ADCX and PREFETCHW instruction set support.
28743
28744@item skylake
28745Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28746SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28747BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
28748instruction set support.
28749
28750@item bonnell
28751Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28752instruction set support.
28753
28754@item silvermont
28755Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28756SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
28757
28758@item goldmont
28759Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28760SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
28761XSAVEOPT and FSGSBASE instruction set support.
28762
28763@item goldmont-plus
28764Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28765SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
28766XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
28767
28768@item tremont
28769Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28770SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
28771XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
28772MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
28773
28774@item knl
28775Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28776SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28777BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
28778AVX512ER and AVX512CD instruction set support.
28779
28780@item knm
28781Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28782SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28783BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
28784AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
28785set support.
28786
28787@item skylake-avx512
28788Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28789SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28790BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28791CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
28792
28793@item cannonlake
28794Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28795SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28796RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28797XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28798AVX512IFMA, SHA and UMIP instruction set support.
28799
28800@item icelake-client
28801Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28802SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28803RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28804XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28805AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28806AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
28807
28808@item icelake-server
28809Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28810SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28811RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28812XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28813AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28814AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
28815set support.
28816
28817@item cascadelake
28818Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28819SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28820BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28821AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
28822
28823@item cooperlake
28824Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28825SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28826BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28827AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
28828set support.
28829
28830@item tigerlake
28831Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28832SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28833BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28834AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
28835RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
28836VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
28837instruction set support.
28838
28839@item k6
28840AMD K6 CPU with MMX instruction set support.
28841
28842@item k6-2
28843@itemx k6-3
28844Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
28845
28846@item athlon
28847@itemx athlon-tbird
28848AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
28849support.
28850
28851@item athlon-4
28852@itemx athlon-xp
28853@itemx athlon-mp
28854Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
28855instruction set support.
28856
28857@item k8
28858@itemx opteron
28859@itemx athlon64
28860@itemx athlon-fx
28861Processors based on the AMD K8 core with x86-64 instruction set support,
28862including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
28863(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
28864instruction set extensions.)
28865
28866@item k8-sse3
28867@itemx opteron-sse3
28868@itemx athlon64-sse3
28869Improved versions of AMD K8 cores with SSE3 instruction set support.
28870
28871@item amdfam10
28872@itemx barcelona
28873CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
28874supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
28875instruction set extensions.)
28876
28877@item bdver1
28878CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
28879supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28880SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28881
28882@item bdver2
28883AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28884supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
28885SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
28886extensions.)
28887
28888@item bdver3
28889AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28890supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
28891PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
2889264-bit instruction set extensions.)
28893
28894@item bdver4
28895AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28896supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
28897AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28898SSE4.2, ABM and 64-bit instruction set extensions.)
28899
28900@item znver1
28901AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
28902supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
28903SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28904SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
28905instruction set extensions.)
28906
28907@item znver2
28908AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28909supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28910MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28911SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28912WBNOINVD, and 64-bit instruction set extensions.)
28913
28914@item znver3
28915AMD Family 19h core based CPUs with x86-64 instruction set support. (This
28916supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28917MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28918SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28919WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
28920
28921@item btver1
28922CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
28923supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
28924instruction set extensions.)
28925
28926@item btver2
28927CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
28928includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
28929SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
28930
28931@item winchip-c6
28932IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
28933set support.
28934
28935@item winchip2
28936IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
28937instruction set support.
28938
28939@item c3
28940VIA C3 CPU with MMX and 3DNow!@: instruction set support.
28941(No scheduling is implemented for this chip.)
28942
28943@item c3-2
28944VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
28945(No scheduling is implemented for this chip.)
28946
28947@item c7
28948VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28949(No scheduling is implemented for this chip.)
28950
28951@item samuel-2
28952VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
28953(No scheduling is implemented for this chip.)
28954
28955@item nehemiah
28956VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28957(No scheduling is implemented for this chip.)
28958
28959@item esther
28960VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28961(No scheduling is implemented for this chip.)
28962
28963@item eden-x2
28964VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
28965(No scheduling is implemented for this chip.)
28966
28967@item eden-x4
28968VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
28969AVX and AVX2 instruction set support.
28970(No scheduling is implemented for this chip.)
28971
28972@item nano
28973Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28974instruction set support.
28975(No scheduling is implemented for this chip.)
28976
28977@item nano-1000
28978VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28979instruction set support.
28980(No scheduling is implemented for this chip.)
28981
28982@item nano-2000
28983VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28984instruction set support.
28985(No scheduling is implemented for this chip.)
28986
28987@item nano-3000
28988VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28989instruction set support.
28990(No scheduling is implemented for this chip.)
28991
28992@item nano-x2
28993VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28994instruction set support.
28995(No scheduling is implemented for this chip.)
28996
28997@item nano-x4
28998VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28999instruction set support.
29000(No scheduling is implemented for this chip.)
29001
29002@item geode
29003AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
29004@end table
29005
29006@item -mtune=@var{cpu-type}
29007@opindex mtune
29008Tune to @var{cpu-type} everything applicable about the generated code, except
29009for the ABI and the set of available instructions.
29010While picking a specific @var{cpu-type} schedules things appropriately
29011for that particular chip, the compiler does not generate any code that
29012cannot run on the default machine type unless you use a
29013@option{-march=@var{cpu-type}} option.
29014For example, if GCC is configured for i686-pc-linux-gnu
29015then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
29016but still runs on i686 machines.
29017
29018The choices for @var{cpu-type} are the same as for @option{-march}.
29019In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
29020
29021@table @samp
29022@item generic
29023Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
29024If you know the CPU on which your code will run, then you should use
29025the corresponding @option{-mtune} or @option{-march} option instead of
29026@option{-mtune=generic}.  But, if you do not know exactly what CPU users
29027of your application will have, then you should use this option.
29028
29029As new processors are deployed in the marketplace, the behavior of this
29030option will change.  Therefore, if you upgrade to a newer version of
29031GCC, code generation controlled by this option will change to reflect
29032the processors
29033that are most common at the time that version of GCC is released.
29034
29035There is no @option{-march=generic} option because @option{-march}
29036indicates the instruction set the compiler can use, and there is no
29037generic instruction set applicable to all processors.  In contrast,
29038@option{-mtune} indicates the processor (or, in this case, collection of
29039processors) for which the code is optimized.
29040
29041@item intel
29042Produce code optimized for the most current Intel processors, which are
29043Haswell and Silvermont for this version of GCC.  If you know the CPU
29044on which your code will run, then you should use the corresponding
29045@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
29046But, if you want your application performs better on both Haswell and
29047Silvermont, then you should use this option.
29048
29049As new Intel processors are deployed in the marketplace, the behavior of
29050this option will change.  Therefore, if you upgrade to a newer version of
29051GCC, code generation controlled by this option will change to reflect
29052the most current Intel processors at the time that version of GCC is
29053released.
29054
29055There is no @option{-march=intel} option because @option{-march} indicates
29056the instruction set the compiler can use, and there is no common
29057instruction set applicable to all processors.  In contrast,
29058@option{-mtune} indicates the processor (or, in this case, collection of
29059processors) for which the code is optimized.
29060@end table
29061
29062@item -mcpu=@var{cpu-type}
29063@opindex mcpu
29064A deprecated synonym for @option{-mtune}.
29065
29066@item -mfpmath=@var{unit}
29067@opindex mfpmath
29068Generate floating-point arithmetic for selected unit @var{unit}.  The choices
29069for @var{unit} are:
29070
29071@table @samp
29072@item 387
29073Use the standard 387 floating-point coprocessor present on the majority of chips and
29074emulated otherwise.  Code compiled with this option runs almost everywhere.
29075The temporary results are computed in 80-bit precision instead of the precision
29076specified by the type, resulting in slightly different results compared to most
29077of other chips.  See @option{-ffloat-store} for more detailed description.
29078
29079This is the default choice for non-Darwin x86-32 targets.
29080
29081@item sse
29082Use scalar floating-point instructions present in the SSE instruction set.
29083This instruction set is supported by Pentium III and newer chips,
29084and in the AMD line
29085by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
29086instruction set supports only single-precision arithmetic, thus the double and
29087extended-precision arithmetic are still done using 387.  A later version, present
29088only in Pentium 4 and AMD x86-64 chips, supports double-precision
29089arithmetic too.
29090
29091For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
29092or @option{-msse2} switches to enable SSE extensions and make this option
29093effective.  For the x86-64 compiler, these extensions are enabled by default.
29094
29095The resulting code should be considerably faster in the majority of cases and avoid
29096the numerical instability problems of 387 code, but may break some existing
29097code that expects temporaries to be 80 bits.
29098
29099This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
29100and the default choice for x86-32 targets with the SSE2 instruction set
29101when @option{-ffast-math} is enabled.
29102
29103@item sse,387
29104@itemx sse+387
29105@itemx both
29106Attempt to utilize both instruction sets at once.  This effectively doubles the
29107amount of available registers, and on chips with separate execution units for
29108387 and SSE the execution resources too.  Use this option with care, as it is
29109still experimental, because the GCC register allocator does not model separate
29110functional units well, resulting in unstable performance.
29111@end table
29112
29113@item -masm=@var{dialect}
29114@opindex masm=@var{dialect}
29115Output assembly instructions using selected @var{dialect}.  Also affects
29116which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
29117extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
29118order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
29119not support @samp{intel}.
29120
29121@item -mieee-fp
29122@itemx -mno-ieee-fp
29123@opindex mieee-fp
29124@opindex mno-ieee-fp
29125Control whether or not the compiler uses IEEE floating-point
29126comparisons.  These correctly handle the case where the result of a
29127comparison is unordered.
29128
29129@item -m80387
29130@itemx -mhard-float
29131@opindex 80387
29132@opindex mhard-float
29133Generate output containing 80387 instructions for floating point.
29134
29135@item -mno-80387
29136@itemx -msoft-float
29137@opindex no-80387
29138@opindex msoft-float
29139Generate output containing library calls for floating point.
29140
29141@strong{Warning:} the requisite libraries are not part of GCC@.
29142Normally the facilities of the machine's usual C compiler are used, but
29143this cannot be done directly in cross-compilation.  You must make your
29144own arrangements to provide suitable library functions for
29145cross-compilation.
29146
29147On machines where a function returns floating-point results in the 80387
29148register stack, some floating-point opcodes may be emitted even if
29149@option{-msoft-float} is used.
29150
29151@item -mno-fp-ret-in-387
29152@opindex mno-fp-ret-in-387
29153@opindex mfp-ret-in-387
29154Do not use the FPU registers for return values of functions.
29155
29156The usual calling convention has functions return values of types
29157@code{float} and @code{double} in an FPU register, even if there
29158is no FPU@.  The idea is that the operating system should emulate
29159an FPU@.
29160
29161The option @option{-mno-fp-ret-in-387} causes such values to be returned
29162in ordinary CPU registers instead.
29163
29164@item -mno-fancy-math-387
29165@opindex mno-fancy-math-387
29166@opindex mfancy-math-387
29167Some 387 emulators do not support the @code{sin}, @code{cos} and
29168@code{sqrt} instructions for the 387.  Specify this option to avoid
29169generating those instructions.
29170This option is overridden when @option{-march}
29171indicates that the target CPU always has an FPU and so the
29172instruction does not need emulation.  These
29173instructions are not generated unless you also use the
29174@option{-funsafe-math-optimizations} switch.
29175
29176@item -malign-double
29177@itemx -mno-align-double
29178@opindex malign-double
29179@opindex mno-align-double
29180Control whether GCC aligns @code{double}, @code{long double}, and
29181@code{long long} variables on a two-word boundary or a one-word
29182boundary.  Aligning @code{double} variables on a two-word boundary
29183produces code that runs somewhat faster on a Pentium at the
29184expense of more memory.
29185
29186On x86-64, @option{-malign-double} is enabled by default.
29187
29188@strong{Warning:} if you use the @option{-malign-double} switch,
29189structures containing the above types are aligned differently than
29190the published application binary interface specifications for the x86-32
29191and are not binary compatible with structures in code compiled
29192without that switch.
29193
29194@item -m96bit-long-double
29195@itemx -m128bit-long-double
29196@opindex m96bit-long-double
29197@opindex m128bit-long-double
29198These switches control the size of @code{long double} type.  The x86-32
29199application binary interface specifies the size to be 96 bits,
29200so @option{-m96bit-long-double} is the default in 32-bit mode.
29201
29202Modern architectures (Pentium and newer) prefer @code{long double}
29203to be aligned to an 8- or 16-byte boundary.  In arrays or structures
29204conforming to the ABI, this is not possible.  So specifying
29205@option{-m128bit-long-double} aligns @code{long double}
29206to a 16-byte boundary by padding the @code{long double} with an additional
2920732-bit zero.
29208
29209In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29210its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29211
29212Notice that neither of these options enable any extra precision over the x87
29213standard of 80 bits for a @code{long double}.
29214
29215@strong{Warning:} if you override the default value for your target ABI, this
29216changes the size of
29217structures and arrays containing @code{long double} variables,
29218as well as modifying the function calling convention for functions taking
29219@code{long double}.  Hence they are not binary-compatible
29220with code compiled without that switch.
29221
29222@item -mlong-double-64
29223@itemx -mlong-double-80
29224@itemx -mlong-double-128
29225@opindex mlong-double-64
29226@opindex mlong-double-80
29227@opindex mlong-double-128
29228These switches control the size of @code{long double} type. A size
29229of 64 bits makes the @code{long double} type equivalent to the @code{double}
29230type. This is the default for 32-bit Bionic C library.  A size
29231of 128 bits makes the @code{long double} type equivalent to the
29232@code{__float128} type. This is the default for 64-bit Bionic C library.
29233
29234@strong{Warning:} if you override the default value for your target ABI, this
29235changes the size of
29236structures and arrays containing @code{long double} variables,
29237as well as modifying the function calling convention for functions taking
29238@code{long double}.  Hence they are not binary-compatible
29239with code compiled without that switch.
29240
29241@item -malign-data=@var{type}
29242@opindex malign-data
29243Control how GCC aligns variables.  Supported values for @var{type} are
29244@samp{compat} uses increased alignment value compatible uses GCC 4.8
29245and earlier, @samp{abi} uses alignment value as specified by the
29246psABI, and @samp{cacheline} uses increased alignment value to match
29247the cache line size.  @samp{compat} is the default.
29248
29249@item -mlarge-data-threshold=@var{threshold}
29250@opindex mlarge-data-threshold
29251When @option{-mcmodel=medium} is specified, data objects larger than
29252@var{threshold} are placed in the large data section.  This value must be the
29253same across all objects linked into the binary, and defaults to 65535.
29254
29255@item -mrtd
29256@opindex mrtd
29257Use a different function-calling convention, in which functions that
29258take a fixed number of arguments return with the @code{ret @var{num}}
29259instruction, which pops their arguments while returning.  This saves one
29260instruction in the caller since there is no need to pop the arguments
29261there.
29262
29263You can specify that an individual function is called with this calling
29264sequence with the function attribute @code{stdcall}.  You can also
29265override the @option{-mrtd} option by using the function attribute
29266@code{cdecl}.  @xref{Function Attributes}.
29267
29268@strong{Warning:} this calling convention is incompatible with the one
29269normally used on Unix, so you cannot use it if you need to call
29270libraries compiled with the Unix compiler.
29271
29272Also, you must provide function prototypes for all functions that
29273take variable numbers of arguments (including @code{printf});
29274otherwise incorrect code is generated for calls to those
29275functions.
29276
29277In addition, seriously incorrect code results if you call a
29278function with too many arguments.  (Normally, extra arguments are
29279harmlessly ignored.)
29280
29281@item -mregparm=@var{num}
29282@opindex mregparm
29283Control how many registers are used to pass integer arguments.  By
29284default, no registers are used to pass arguments, and at most 3
29285registers can be used.  You can control this behavior for a specific
29286function by using the function attribute @code{regparm}.
29287@xref{Function Attributes}.
29288
29289@strong{Warning:} if you use this switch, and
29290@var{num} is nonzero, then you must build all modules with the same
29291value, including any libraries.  This includes the system libraries and
29292startup modules.
29293
29294@item -msseregparm
29295@opindex msseregparm
29296Use SSE register passing conventions for float and double arguments
29297and return values.  You can control this behavior for a specific
29298function by using the function attribute @code{sseregparm}.
29299@xref{Function Attributes}.
29300
29301@strong{Warning:} if you use this switch then you must build all
29302modules with the same value, including any libraries.  This includes
29303the system libraries and startup modules.
29304
29305@item -mvect8-ret-in-mem
29306@opindex mvect8-ret-in-mem
29307Return 8-byte vectors in memory instead of MMX registers.  This is the
29308default on VxWorks to match the ABI of the Sun Studio compilers until
29309version 12.  @emph{Only} use this option if you need to remain
29310compatible with existing code produced by those previous compiler
29311versions or older versions of GCC@.
29312
29313@item -mpc32
29314@itemx -mpc64
29315@itemx -mpc80
29316@opindex mpc32
29317@opindex mpc64
29318@opindex mpc80
29319
29320Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
29321is specified, the significands of results of floating-point operations are
29322rounded to 24 bits (single precision); @option{-mpc64} rounds the
29323significands of results of floating-point operations to 53 bits (double
29324precision) and @option{-mpc80} rounds the significands of results of
29325floating-point operations to 64 bits (extended double precision), which is
29326the default.  When this option is used, floating-point operations in higher
29327precisions are not available to the programmer without setting the FPU
29328control word explicitly.
29329
29330Setting the rounding of floating-point operations to less than the default
2933180 bits can speed some programs by 2% or more.  Note that some mathematical
29332libraries assume that extended-precision (80-bit) floating-point operations
29333are enabled by default; routines in such libraries could suffer significant
29334loss of accuracy, typically through so-called ``catastrophic cancellation'',
29335when this option is used to set the precision to less than extended precision.
29336
29337@item -mstackrealign
29338@opindex mstackrealign
29339Realign the stack at entry.  On the x86, the @option{-mstackrealign}
29340option generates an alternate prologue and epilogue that realigns the
29341run-time stack if necessary.  This supports mixing legacy codes that keep
293424-byte stack alignment with modern codes that keep 16-byte stack alignment for
29343SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
29344applicable to individual functions.
29345
29346@item -mpreferred-stack-boundary=@var{num}
29347@opindex mpreferred-stack-boundary
29348Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29349byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29350the default is 4 (16 bytes or 128 bits).
29351
29352@strong{Warning:} When generating code for the x86-64 architecture with
29353SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29354used to keep the stack boundary aligned to 8 byte boundary.  Since
29355x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29356intended to be used in controlled environment where stack space is
29357important limitation.  This option leads to wrong code when functions
29358compiled with 16 byte stack alignment (such as functions from a standard
29359library) are called with misaligned stack.  In this case, SSE
29360instructions may lead to misaligned memory access traps.  In addition,
29361variable arguments are handled incorrectly for 16 byte aligned
29362objects (including x87 long double and __int128), leading to wrong
29363results.  You must build all modules with
29364@option{-mpreferred-stack-boundary=3}, including any libraries.  This
29365includes the system libraries and startup modules.
29366
29367@item -mincoming-stack-boundary=@var{num}
29368@opindex mincoming-stack-boundary
29369Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29370boundary.  If @option{-mincoming-stack-boundary} is not specified,
29371the one specified by @option{-mpreferred-stack-boundary} is used.
29372
29373On Pentium and Pentium Pro, @code{double} and @code{long double} values
29374should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29375suffer significant run time performance penalties.  On Pentium III, the
29376Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29377properly if it is not 16-byte aligned.
29378
29379To ensure proper alignment of this values on the stack, the stack boundary
29380must be as aligned as that required by any value stored on the stack.
29381Further, every function must be generated such that it keeps the stack
29382aligned.  Thus calling a function compiled with a higher preferred
29383stack boundary from a function compiled with a lower preferred stack
29384boundary most likely misaligns the stack.  It is recommended that
29385libraries that use callbacks always use the default setting.
29386
29387This extra alignment does consume extra stack space, and generally
29388increases code size.  Code that is sensitive to stack space usage, such
29389as embedded systems and operating system kernels, may want to reduce the
29390preferred alignment to @option{-mpreferred-stack-boundary=2}.
29391
29392@need 200
29393@item -mmmx
29394@opindex mmmx
29395@need 200
29396@itemx -msse
29397@opindex msse
29398@need 200
29399@itemx -msse2
29400@opindex msse2
29401@need 200
29402@itemx -msse3
29403@opindex msse3
29404@need 200
29405@itemx -mssse3
29406@opindex mssse3
29407@need 200
29408@itemx -msse4
29409@opindex msse4
29410@need 200
29411@itemx -msse4a
29412@opindex msse4a
29413@need 200
29414@itemx -msse4.1
29415@opindex msse4.1
29416@need 200
29417@itemx -msse4.2
29418@opindex msse4.2
29419@need 200
29420@itemx -mavx
29421@opindex mavx
29422@need 200
29423@itemx -mavx2
29424@opindex mavx2
29425@need 200
29426@itemx -mavx512f
29427@opindex mavx512f
29428@need 200
29429@itemx -mavx512pf
29430@opindex mavx512pf
29431@need 200
29432@itemx -mavx512er
29433@opindex mavx512er
29434@need 200
29435@itemx -mavx512cd
29436@opindex mavx512cd
29437@need 200
29438@itemx -mavx512vl
29439@opindex mavx512vl
29440@need 200
29441@itemx -mavx512bw
29442@opindex mavx512bw
29443@need 200
29444@itemx -mavx512dq
29445@opindex mavx512dq
29446@need 200
29447@itemx -mavx512ifma
29448@opindex mavx512ifma
29449@need 200
29450@itemx -mavx512vbmi
29451@opindex mavx512vbmi
29452@need 200
29453@itemx -msha
29454@opindex msha
29455@need 200
29456@itemx -maes
29457@opindex maes
29458@need 200
29459@itemx -mpclmul
29460@opindex mpclmul
29461@need 200
29462@itemx -mclflushopt
29463@opindex mclflushopt
29464@need 200
29465@itemx -mclwb
29466@opindex mclwb
29467@need 200
29468@itemx -mfsgsbase
29469@opindex mfsgsbase
29470@need 200
29471@itemx -mptwrite
29472@opindex mptwrite
29473@need 200
29474@itemx -mrdrnd
29475@opindex mrdrnd
29476@need 200
29477@itemx -mf16c
29478@opindex mf16c
29479@need 200
29480@itemx -mfma
29481@opindex mfma
29482@need 200
29483@itemx -mpconfig
29484@opindex mpconfig
29485@need 200
29486@itemx -mwbnoinvd
29487@opindex mwbnoinvd
29488@need 200
29489@itemx -mfma4
29490@opindex mfma4
29491@need 200
29492@itemx -mprfchw
29493@opindex mprfchw
29494@need 200
29495@itemx -mrdpid
29496@opindex mrdpid
29497@need 200
29498@itemx -mprefetchwt1
29499@opindex mprefetchwt1
29500@need 200
29501@itemx -mrdseed
29502@opindex mrdseed
29503@need 200
29504@itemx -msgx
29505@opindex msgx
29506@need 200
29507@itemx -mxop
29508@opindex mxop
29509@need 200
29510@itemx -mlwp
29511@opindex mlwp
29512@need 200
29513@itemx -m3dnow
29514@opindex m3dnow
29515@need 200
29516@itemx -m3dnowa
29517@opindex m3dnowa
29518@need 200
29519@itemx -mpopcnt
29520@opindex mpopcnt
29521@need 200
29522@itemx -mabm
29523@opindex mabm
29524@need 200
29525@itemx -madx
29526@opindex madx
29527@need 200
29528@itemx -mbmi
29529@opindex mbmi
29530@need 200
29531@itemx -mbmi2
29532@opindex mbmi2
29533@need 200
29534@itemx -mlzcnt
29535@opindex mlzcnt
29536@need 200
29537@itemx -mfxsr
29538@opindex mfxsr
29539@need 200
29540@itemx -mxsave
29541@opindex mxsave
29542@need 200
29543@itemx -mxsaveopt
29544@opindex mxsaveopt
29545@need 200
29546@itemx -mxsavec
29547@opindex mxsavec
29548@need 200
29549@itemx -mxsaves
29550@opindex mxsaves
29551@need 200
29552@itemx -mrtm
29553@opindex mrtm
29554@need 200
29555@itemx -mhle
29556@opindex mhle
29557@need 200
29558@itemx -mtbm
29559@opindex mtbm
29560@need 200
29561@itemx -mmwaitx
29562@opindex mmwaitx
29563@need 200
29564@itemx -mclzero
29565@opindex mclzero
29566@need 200
29567@itemx -mpku
29568@opindex mpku
29569@need 200
29570@itemx -mavx512vbmi2
29571@opindex mavx512vbmi2
29572@need 200
29573@itemx -mavx512bf16
29574@opindex mavx512bf16
29575@need 200
29576@itemx -mgfni
29577@opindex mgfni
29578@need 200
29579@itemx -mvaes
29580@opindex mvaes
29581@need 200
29582@itemx -mwaitpkg
29583@opindex mwaitpkg
29584@need 200
29585@itemx -mvpclmulqdq
29586@opindex mvpclmulqdq
29587@need 200
29588@itemx -mavx512bitalg
29589@opindex mavx512bitalg
29590@need 200
29591@itemx -mmovdiri
29592@opindex mmovdiri
29593@need 200
29594@itemx -mmovdir64b
29595@opindex mmovdir64b
29596@need 200
29597@itemx -menqcmd
29598@opindex menqcmd
29599@need 200
29600@itemx -mavx512vpopcntdq
29601@opindex mavx512vpopcntdq
29602@need 200
29603@itemx -mavx512vp2intersect
29604@opindex mavx512vp2intersect
29605@need 200
29606@itemx -mavx5124fmaps
29607@opindex mavx5124fmaps
29608@need 200
29609@itemx -mavx512vnni
29610@opindex mavx512vnni
29611@need 200
29612@itemx -mavx5124vnniw
29613@opindex mavx5124vnniw
29614@need 200
29615@itemx -mcldemote
29616@opindex mcldemote
29617These switches enable the use of instructions in the MMX, SSE,
29618SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29619AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29620AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29621WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
296223DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29623XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29624GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29625ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
29626extended instruction sets.  Each has a corresponding @option{-mno-} option to
29627disable use of these instructions.
29628
29629These extensions are also available as built-in functions: see
29630@ref{x86 Built-in Functions}, for details of the functions enabled and
29631disabled by these switches.
29632
29633To generate SSE/SSE2 instructions automatically from floating-point
29634code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29635
29636GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29637generates new AVX instructions or AVX equivalence for all SSEx instructions
29638when needed.
29639
29640These options enable GCC to use these extended instructions in
29641generated code, even without @option{-mfpmath=sse}.  Applications that
29642perform run-time CPU detection must compile separate files for each
29643supported architecture, using the appropriate flags.  In particular,
29644the file containing the CPU detection code should be compiled without
29645these options.
29646
29647@item -mdump-tune-features
29648@opindex mdump-tune-features
29649This option instructs GCC to dump the names of the x86 performance
29650tuning features and default settings. The names can be used in
29651@option{-mtune-ctrl=@var{feature-list}}.
29652
29653@item -mtune-ctrl=@var{feature-list}
29654@opindex mtune-ctrl=@var{feature-list}
29655This option is used to do fine grain control of x86 code generation features.
29656@var{feature-list} is a comma separated list of @var{feature} names. See also
29657@option{-mdump-tune-features}. When specified, the @var{feature} is turned
29658on if it is not preceded with @samp{^}, otherwise, it is turned off.
29659@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29660developers. Using it may lead to code paths not covered by testing and can
29661potentially result in compiler ICEs or runtime errors.
29662
29663@item -mno-default
29664@opindex mno-default
29665This option instructs GCC to turn off all tunable features. See also
29666@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29667
29668@item -mcld
29669@opindex mcld
29670This option instructs GCC to emit a @code{cld} instruction in the prologue
29671of functions that use string instructions.  String instructions depend on
29672the DF flag to select between autoincrement or autodecrement mode.  While the
29673ABI specifies the DF flag to be cleared on function entry, some operating
29674systems violate this specification by not clearing the DF flag in their
29675exception dispatchers.  The exception handler can be invoked with the DF flag
29676set, which leads to wrong direction mode when string instructions are used.
29677This option can be enabled by default on 32-bit x86 targets by configuring
29678GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
29679instructions can be suppressed with the @option{-mno-cld} compiler option
29680in this case.
29681
29682@item -mvzeroupper
29683@opindex mvzeroupper
29684This option instructs GCC to emit a @code{vzeroupper} instruction
29685before a transfer of control flow out of the function to minimize
29686the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29687intrinsics.
29688
29689@item -mprefer-avx128
29690@opindex mprefer-avx128
29691This option instructs GCC to use 128-bit AVX instructions instead of
29692256-bit AVX instructions in the auto-vectorizer.
29693
29694@item -mprefer-vector-width=@var{opt}
29695@opindex mprefer-vector-width
29696This option instructs GCC to use @var{opt}-bit vector width in instructions
29697instead of default on the selected platform.
29698
29699@table @samp
29700@item none
29701No extra limitations applied to GCC other than defined by the selected platform.
29702
29703@item 128
29704Prefer 128-bit vector width for instructions.
29705
29706@item 256
29707Prefer 256-bit vector width for instructions.
29708
29709@item 512
29710Prefer 512-bit vector width for instructions.
29711@end table
29712
29713@item -mcx16
29714@opindex mcx16
29715This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29716code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29717objects.  This is useful for atomic updates of data structures exceeding one
29718machine word in size.  The compiler uses this instruction to implement
29719@ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
29720128-bit integers, a library call is always used.
29721
29722@item -msahf
29723@opindex msahf
29724This option enables generation of @code{SAHF} instructions in 64-bit code.
29725Early Intel Pentium 4 CPUs with Intel 64 support,
29726prior to the introduction of Pentium 4 G1 step in December 2005,
29727lacked the @code{LAHF} and @code{SAHF} instructions
29728which are supported by AMD64.
29729These are load and store instructions, respectively, for certain status flags.
29730In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29731@code{drem}, and @code{remainder} built-in functions;
29732see @ref{Other Builtins} for details.
29733
29734@item -mmovbe
29735@opindex mmovbe
29736This option enables use of the @code{movbe} instruction to implement
29737@code{__builtin_bswap32} and @code{__builtin_bswap64}.
29738
29739@item -mshstk
29740@opindex mshstk
29741The @option{-mshstk} option enables shadow stack built-in functions
29742from x86 Control-flow Enforcement Technology (CET).
29743
29744@item -mcrc32
29745@opindex mcrc32
29746This option enables built-in functions @code{__builtin_ia32_crc32qi},
29747@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29748@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29749
29750@item -mrecip
29751@opindex mrecip
29752This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29753(and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29754with an additional Newton-Raphson step
29755to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29756(and their vectorized
29757variants) for single-precision floating-point arguments.  These instructions
29758are generated only when @option{-funsafe-math-optimizations} is enabled
29759together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29760Note that while the throughput of the sequence is higher than the throughput
29761of the non-reciprocal instruction, the precision of the sequence can be
29762decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29763
29764Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29765(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29766combination), and doesn't need @option{-mrecip}.
29767
29768Also note that GCC emits the above sequence with additional Newton-Raphson step
29769for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
29770already with @option{-ffast-math} (or the above option combination), and
29771doesn't need @option{-mrecip}.
29772
29773@item -mrecip=@var{opt}
29774@opindex mrecip=opt
29775This option controls which reciprocal estimate instructions
29776may be used.  @var{opt} is a comma-separated list of options, which may
29777be preceded by a @samp{!} to invert the option:
29778
29779@table @samp
29780@item all
29781Enable all estimate instructions.
29782
29783@item default
29784Enable the default instructions, equivalent to @option{-mrecip}.
29785
29786@item none
29787Disable all estimate instructions, equivalent to @option{-mno-recip}.
29788
29789@item div
29790Enable the approximation for scalar division.
29791
29792@item vec-div
29793Enable the approximation for vectorized division.
29794
29795@item sqrt
29796Enable the approximation for scalar square root.
29797
29798@item vec-sqrt
29799Enable the approximation for vectorized square root.
29800@end table
29801
29802So, for example, @option{-mrecip=all,!sqrt} enables
29803all of the reciprocal approximations, except for square root.
29804
29805@item -mveclibabi=@var{type}
29806@opindex mveclibabi
29807Specifies the ABI type to use for vectorizing intrinsics using an
29808external library.  Supported values for @var{type} are @samp{svml}
29809for the Intel short
29810vector math library and @samp{acml} for the AMD math core library.
29811To use this option, both @option{-ftree-vectorize} and
29812@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
29813ABI-compatible library must be specified at link time.
29814
29815GCC currently emits calls to @code{vmldExp2},
29816@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
29817@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
29818@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
29819@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
29820@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
29821@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
29822@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
29823@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
29824@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
29825function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
29826@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
29827@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
29828@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
29829@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
29830when @option{-mveclibabi=acml} is used.
29831
29832@item -mabi=@var{name}
29833@opindex mabi
29834Generate code for the specified calling convention.  Permissible values
29835are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
29836@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
29837ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
29838You can control this behavior for specific functions by
29839using the function attributes @code{ms_abi} and @code{sysv_abi}.
29840@xref{Function Attributes}.
29841
29842@item -mforce-indirect-call
29843@opindex mforce-indirect-call
29844Force all calls to functions to be indirect. This is useful
29845when using Intel Processor Trace where it generates more precise timing
29846information for function calls.
29847
29848@item -mmanual-endbr
29849@opindex mmanual-endbr
29850Insert ENDBR instruction at function entry only via the @code{cf_check}
29851function attribute. This is useful when used with the option
29852@option{-fcf-protection=branch} to control ENDBR insertion at the
29853function entry.
29854
29855@item -mcall-ms2sysv-xlogues
29856@opindex mcall-ms2sysv-xlogues
29857@opindex mno-call-ms2sysv-xlogues
29858Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
29859System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
29860default, the code for saving and restoring these registers is emitted inline,
29861resulting in fairly lengthy prologues and epilogues.  Using
29862@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
29863use stubs in the static portion of libgcc to perform these saves and restores,
29864thus reducing function size at the cost of a few extra instructions.
29865
29866@item -mtls-dialect=@var{type}
29867@opindex mtls-dialect
29868Generate code to access thread-local storage using the @samp{gnu} or
29869@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
29870@samp{gnu2} is more efficient, but it may add compile- and run-time
29871requirements that cannot be satisfied on all systems.
29872
29873@item -mpush-args
29874@itemx -mno-push-args
29875@opindex mpush-args
29876@opindex mno-push-args
29877Use PUSH operations to store outgoing parameters.  This method is shorter
29878and usually equally fast as method using SUB/MOV operations and is enabled
29879by default.  In some cases disabling it may improve performance because of
29880improved scheduling and reduced dependencies.
29881
29882@item -maccumulate-outgoing-args
29883@opindex maccumulate-outgoing-args
29884If enabled, the maximum amount of space required for outgoing arguments is
29885computed in the function prologue.  This is faster on most modern CPUs
29886because of reduced dependencies, improved scheduling and reduced stack usage
29887when the preferred stack boundary is not equal to 2.  The drawback is a notable
29888increase in code size.  This switch implies @option{-mno-push-args}.
29889
29890@item -mthreads
29891@opindex mthreads
29892Support thread-safe exception handling on MinGW.  Programs that rely
29893on thread-safe exception handling must compile and link all code with the
29894@option{-mthreads} option.  When compiling, @option{-mthreads} defines
29895@option{-D_MT}; when linking, it links in a special thread helper library
29896@option{-lmingwthrd} which cleans up per-thread exception-handling data.
29897
29898@item -mms-bitfields
29899@itemx -mno-ms-bitfields
29900@opindex mms-bitfields
29901@opindex mno-ms-bitfields
29902
29903Enable/disable bit-field layout compatible with the native Microsoft
29904Windows compiler.
29905
29906If @code{packed} is used on a structure, or if bit-fields are used,
29907it may be that the Microsoft ABI lays out the structure differently
29908than the way GCC normally does.  Particularly when moving packed
29909data between functions compiled with GCC and the native Microsoft compiler
29910(either via function call or as data in a file), it may be necessary to access
29911either format.
29912
29913This option is enabled by default for Microsoft Windows
29914targets.  This behavior can also be controlled locally by use of variable
29915or type attributes.  For more information, see @ref{x86 Variable Attributes}
29916and @ref{x86 Type Attributes}.
29917
29918The Microsoft structure layout algorithm is fairly simple with the exception
29919of the bit-field packing.
29920The padding and alignment of members of structures and whether a bit-field
29921can straddle a storage-unit boundary are determine by these rules:
29922
29923@enumerate
29924@item Structure members are stored sequentially in the order in which they are
29925declared: the first member has the lowest memory address and the last member
29926the highest.
29927
29928@item Every data object has an alignment requirement.  The alignment requirement
29929for all data except structures, unions, and arrays is either the size of the
29930object or the current packing size (specified with either the
29931@code{aligned} attribute or the @code{pack} pragma),
29932whichever is less.  For structures, unions, and arrays,
29933the alignment requirement is the largest alignment requirement of its members.
29934Every object is allocated an offset so that:
29935
29936@smallexample
29937offset % alignment_requirement == 0
29938@end smallexample
29939
29940@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
29941unit if the integral types are the same size and if the next bit-field fits
29942into the current allocation unit without crossing the boundary imposed by the
29943common alignment requirements of the bit-fields.
29944@end enumerate
29945
29946MSVC interprets zero-length bit-fields in the following ways:
29947
29948@enumerate
29949@item If a zero-length bit-field is inserted between two bit-fields that
29950are normally coalesced, the bit-fields are not coalesced.
29951
29952For example:
29953
29954@smallexample
29955struct
29956 @{
29957   unsigned long bf_1 : 12;
29958   unsigned long : 0;
29959   unsigned long bf_2 : 12;
29960 @} t1;
29961@end smallexample
29962
29963@noindent
29964The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
29965zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
29966
29967@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
29968alignment of the zero-length bit-field is greater than the member that follows it,
29969@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
29970
29971For example:
29972
29973@smallexample
29974struct
29975 @{
29976   char foo : 4;
29977   short : 0;
29978   char bar;
29979 @} t2;
29980
29981struct
29982 @{
29983   char foo : 4;
29984   short : 0;
29985   double bar;
29986 @} t3;
29987@end smallexample
29988
29989@noindent
29990For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
29991Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
29992bit-field does not affect the alignment of @code{bar} or, as a result, the size
29993of the structure.
29994
29995Taking this into account, it is important to note the following:
29996
29997@enumerate
29998@item If a zero-length bit-field follows a normal bit-field, the type of the
29999zero-length bit-field may affect the alignment of the structure as whole. For
30000example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
30001normal bit-field, and is of type short.
30002
30003@item Even if a zero-length bit-field is not followed by a normal bit-field, it may
30004still affect the alignment of the structure:
30005
30006@smallexample
30007struct
30008 @{
30009   char foo : 6;
30010   long : 0;
30011 @} t4;
30012@end smallexample
30013
30014@noindent
30015Here, @code{t4} takes up 4 bytes.
30016@end enumerate
30017
30018@item Zero-length bit-fields following non-bit-field members are ignored:
30019
30020@smallexample
30021struct
30022 @{
30023   char foo;
30024   long : 0;
30025   char bar;
30026 @} t5;
30027@end smallexample
30028
30029@noindent
30030Here, @code{t5} takes up 2 bytes.
30031@end enumerate
30032
30033
30034@item -mno-align-stringops
30035@opindex mno-align-stringops
30036@opindex malign-stringops
30037Do not align the destination of inlined string operations.  This switch reduces
30038code size and improves performance in case the destination is already aligned,
30039but GCC doesn't know about it.
30040
30041@item -minline-all-stringops
30042@opindex minline-all-stringops
30043By default GCC inlines string operations only when the destination is
30044known to be aligned to least a 4-byte boundary.
30045This enables more inlining and increases code
30046size, but may improve performance of code that depends on fast
30047@code{memcpy} and @code{memset} for short lengths.
30048The option enables inline expansion of @code{strlen} for all
30049pointer alignments.
30050
30051@item -minline-stringops-dynamically
30052@opindex minline-stringops-dynamically
30053For string operations of unknown size, use run-time checks with
30054inline code for small blocks and a library call for large blocks.
30055
30056@item -mstringop-strategy=@var{alg}
30057@opindex mstringop-strategy=@var{alg}
30058Override the internal decision heuristic for the particular algorithm to use
30059for inlining string operations.  The allowed values for @var{alg} are:
30060
30061@table @samp
30062@item rep_byte
30063@itemx rep_4byte
30064@itemx rep_8byte
30065Expand using i386 @code{rep} prefix of the specified size.
30066
30067@item byte_loop
30068@itemx loop
30069@itemx unrolled_loop
30070Expand into an inline loop.
30071
30072@item libcall
30073Always use a library call.
30074@end table
30075
30076@item -mmemcpy-strategy=@var{strategy}
30077@opindex mmemcpy-strategy=@var{strategy}
30078Override the internal decision heuristic to decide if @code{__builtin_memcpy}
30079should be inlined and what inline algorithm to use when the expected size
30080of the copy operation is known. @var{strategy}
30081is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
30082@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
30083the max byte size with which inline algorithm @var{alg} is allowed.  For the last
30084triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
30085in the list must be specified in increasing order.  The minimal byte size for
30086@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
30087preceding range.
30088
30089@item -mmemset-strategy=@var{strategy}
30090@opindex mmemset-strategy=@var{strategy}
30091The option is similar to @option{-mmemcpy-strategy=} except that it is to control
30092@code{__builtin_memset} expansion.
30093
30094@item -momit-leaf-frame-pointer
30095@opindex momit-leaf-frame-pointer
30096Don't keep the frame pointer in a register for leaf functions.  This
30097avoids the instructions to save, set up, and restore frame pointers and
30098makes an extra register available in leaf functions.  The option
30099@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
30100which might make debugging harder.
30101
30102@item -mtls-direct-seg-refs
30103@itemx -mno-tls-direct-seg-refs
30104@opindex mtls-direct-seg-refs
30105Controls whether TLS variables may be accessed with offsets from the
30106TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
30107or whether the thread base pointer must be added.  Whether or not this
30108is valid depends on the operating system, and whether it maps the
30109segment to cover the entire TLS area.
30110
30111For systems that use the GNU C Library, the default is on.
30112
30113@item -msse2avx
30114@itemx -mno-sse2avx
30115@opindex msse2avx
30116Specify that the assembler should encode SSE instructions with VEX
30117prefix.  The option @option{-mavx} turns this on by default.
30118
30119@item -mfentry
30120@itemx -mno-fentry
30121@opindex mfentry
30122If profiling is active (@option{-pg}), put the profiling
30123counter call before the prologue.
30124Note: On x86 architectures the attribute @code{ms_hook_prologue}
30125isn't possible at the moment for @option{-mfentry} and @option{-pg}.
30126
30127@item -mrecord-mcount
30128@itemx -mno-record-mcount
30129@opindex mrecord-mcount
30130If profiling is active (@option{-pg}), generate a __mcount_loc section
30131that contains pointers to each profiling call. This is useful for
30132automatically patching and out calls.
30133
30134@item -mnop-mcount
30135@itemx -mno-nop-mcount
30136@opindex mnop-mcount
30137If profiling is active (@option{-pg}), generate the calls to
30138the profiling functions as NOPs. This is useful when they
30139should be patched in later dynamically. This is likely only
30140useful together with @option{-mrecord-mcount}.
30141
30142@item -minstrument-return=@var{type}
30143@opindex minstrument-return
30144Instrument function exit in -pg -mfentry instrumented functions with
30145call to specified function. This only instruments true returns ending
30146with ret, but not sibling calls ending with jump. Valid types
30147are @var{none} to not instrument, @var{call} to generate a call to __return__,
30148or @var{nop5} to generate a 5 byte nop.
30149
30150@item -mrecord-return
30151@itemx -mno-record-return
30152@opindex mrecord-return
30153Generate a __return_loc section pointing to all return instrumentation code.
30154
30155@item -mfentry-name=@var{name}
30156@opindex mfentry-name
30157Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
30158
30159@item -mfentry-section=@var{name}
30160@opindex mfentry-section
30161Set name of section to record -mrecord-mcount calls (default __mcount_loc).
30162
30163@item -mskip-rax-setup
30164@itemx -mno-skip-rax-setup
30165@opindex mskip-rax-setup
30166When generating code for the x86-64 architecture with SSE extensions
30167disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30168register when there are no variable arguments passed in vector registers.
30169
30170@strong{Warning:} Since RAX register is used to avoid unnecessarily
30171saving vector registers on stack when passing variable arguments, the
30172impacts of this option are callees may waste some stack space,
30173misbehave or jump to a random location.  GCC 4.4 or newer don't have
30174those issues, regardless the RAX register value.
30175
30176@item -m8bit-idiv
30177@itemx -mno-8bit-idiv
30178@opindex m8bit-idiv
30179On some processors, like Intel Atom, 8-bit unsigned integer divide is
30180much faster than 32-bit/64-bit integer divide.  This option generates a
30181run-time check.  If both dividend and divisor are within range of 0
30182to 255, 8-bit unsigned integer divide is used instead of
3018332-bit/64-bit integer divide.
30184
30185@item -mavx256-split-unaligned-load
30186@itemx -mavx256-split-unaligned-store
30187@opindex mavx256-split-unaligned-load
30188@opindex mavx256-split-unaligned-store
30189Split 32-byte AVX unaligned load and store.
30190
30191@item -mstack-protector-guard=@var{guard}
30192@itemx -mstack-protector-guard-reg=@var{reg}
30193@itemx -mstack-protector-guard-offset=@var{offset}
30194@opindex mstack-protector-guard
30195@opindex mstack-protector-guard-reg
30196@opindex mstack-protector-guard-offset
30197Generate stack protection code using canary at @var{guard}.  Supported
30198locations are @samp{global} for global canary or @samp{tls} for per-thread
30199canary in the TLS block (the default).  This option has effect only when
30200@option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30201
30202With the latter choice the options
30203@option{-mstack-protector-guard-reg=@var{reg}} and
30204@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30205which segment register (@code{%fs} or @code{%gs}) to use as base register
30206for reading the canary, and from what offset from that base register.
30207The default for those is as specified in the relevant ABI.
30208
30209@item -mgeneral-regs-only
30210@opindex mgeneral-regs-only
30211Generate code that uses only the general-purpose registers.  This
30212prevents the compiler from using floating-point, vector, mask and bound
30213registers.
30214
30215@item -mindirect-branch=@var{choice}
30216@opindex mindirect-branch
30217Convert indirect call and jump with @var{choice}.  The default is
30218@samp{keep}, which keeps indirect call and jump unmodified.
30219@samp{thunk} converts indirect call and jump to call and return thunk.
30220@samp{thunk-inline} converts indirect call and jump to inlined call
30221and return thunk.  @samp{thunk-extern} converts indirect call and jump
30222to external call and return thunk provided in a separate object file.
30223You can control this behavior for a specific function by using the
30224function attribute @code{indirect_branch}.  @xref{Function Attributes}.
30225
30226Note that @option{-mcmodel=large} is incompatible with
30227@option{-mindirect-branch=thunk} and
30228@option{-mindirect-branch=thunk-extern} since the thunk function may
30229not be reachable in the large code model.
30230
30231Note that @option{-mindirect-branch=thunk-extern} is compatible with
30232@option{-fcf-protection=branch} since the external thunk can be made
30233to enable control-flow check.
30234
30235@item -mfunction-return=@var{choice}
30236@opindex mfunction-return
30237Convert function return with @var{choice}.  The default is @samp{keep},
30238which keeps function return unmodified.  @samp{thunk} converts function
30239return to call and return thunk.  @samp{thunk-inline} converts function
30240return to inlined call and return thunk.  @samp{thunk-extern} converts
30241function return to external call and return thunk provided in a separate
30242object file.  You can control this behavior for a specific function by
30243using the function attribute @code{function_return}.
30244@xref{Function Attributes}.
30245
30246Note that @option{-mindirect-return=thunk-extern} is compatible with
30247@option{-fcf-protection=branch} since the external thunk can be made
30248to enable control-flow check.
30249
30250Note that @option{-mcmodel=large} is incompatible with
30251@option{-mfunction-return=thunk} and
30252@option{-mfunction-return=thunk-extern} since the thunk function may
30253not be reachable in the large code model.
30254
30255
30256@item -mindirect-branch-register
30257@opindex mindirect-branch-register
30258Force indirect call and jump via register.
30259
30260@end table
30261
30262These @samp{-m} switches are supported in addition to the above
30263on x86-64 processors in 64-bit environments.
30264
30265@table @gcctabopt
30266@item -m32
30267@itemx -m64
30268@itemx -mx32
30269@itemx -m16
30270@itemx -miamcu
30271@opindex m32
30272@opindex m64
30273@opindex mx32
30274@opindex m16
30275@opindex miamcu
30276Generate code for a 16-bit, 32-bit or 64-bit environment.
30277The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30278to 32 bits, and
30279generates code that runs on any i386 system.
30280
30281The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30282types to 64 bits, and generates code for the x86-64 architecture.
30283For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30284and @option{-mdynamic-no-pic} options.
30285
30286The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30287to 32 bits, and
30288generates code for the x86-64 architecture.
30289
30290The @option{-m16} option is the same as @option{-m32}, except for that
30291it outputs the @code{.code16gcc} assembly directive at the beginning of
30292the assembly output so that the binary can run in 16-bit mode.
30293
30294The @option{-miamcu} option generates code which conforms to Intel MCU
30295psABI.  It requires the @option{-m32} option to be turned on.
30296
30297@item -mno-red-zone
30298@opindex mno-red-zone
30299@opindex mred-zone
30300Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
30301by the x86-64 ABI; it is a 128-byte area beyond the location of the
30302stack pointer that is not modified by signal or interrupt handlers
30303and therefore can be used for temporary data without adjusting the stack
30304pointer.  The flag @option{-mno-red-zone} disables this red zone.
30305
30306@item -mcmodel=small
30307@opindex mcmodel=small
30308Generate code for the small code model: the program and its symbols must
30309be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
30310Programs can be statically or dynamically linked.  This is the default
30311code model.
30312
30313@item -mcmodel=kernel
30314@opindex mcmodel=kernel
30315Generate code for the kernel code model.  The kernel runs in the
30316negative 2 GB of the address space.
30317This model has to be used for Linux kernel code.
30318
30319@item -mcmodel=medium
30320@opindex mcmodel=medium
30321Generate code for the medium model: the program is linked in the lower 2
30322GB of the address space.  Small symbols are also placed there.  Symbols
30323with sizes larger than @option{-mlarge-data-threshold} are put into
30324large data or BSS sections and can be located above 2GB.  Programs can
30325be statically or dynamically linked.
30326
30327@item -mcmodel=large
30328@opindex mcmodel=large
30329Generate code for the large model.  This model makes no assumptions
30330about addresses and sizes of sections.
30331
30332@item -maddress-mode=long
30333@opindex maddress-mode=long
30334Generate code for long address mode.  This is only supported for 64-bit
30335and x32 environments.  It is the default address mode for 64-bit
30336environments.
30337
30338@item -maddress-mode=short
30339@opindex maddress-mode=short
30340Generate code for short address mode.  This is only supported for 32-bit
30341and x32 environments.  It is the default address mode for 32-bit and
30342x32 environments.
30343@end table
30344
30345@node x86 Windows Options
30346@subsection x86 Windows Options
30347@cindex x86 Windows Options
30348@cindex Windows Options for x86
30349
30350These additional options are available for Microsoft Windows targets:
30351
30352@table @gcctabopt
30353@item -mconsole
30354@opindex mconsole
30355This option
30356specifies that a console application is to be generated, by
30357instructing the linker to set the PE header subsystem type
30358required for console applications.
30359This option is available for Cygwin and MinGW targets and is
30360enabled by default on those targets.
30361
30362@item -mdll
30363@opindex mdll
30364This option is available for Cygwin and MinGW targets.  It
30365specifies that a DLL---a dynamic link library---is to be
30366generated, enabling the selection of the required runtime
30367startup object and entry point.
30368
30369@item -mnop-fun-dllimport
30370@opindex mnop-fun-dllimport
30371This option is available for Cygwin and MinGW targets.  It
30372specifies that the @code{dllimport} attribute should be ignored.
30373
30374@item -mthread
30375@opindex mthread
30376This option is available for MinGW targets. It specifies
30377that MinGW-specific thread support is to be used.
30378
30379@item -municode
30380@opindex municode
30381This option is available for MinGW-w64 targets.  It causes
30382the @code{UNICODE} preprocessor macro to be predefined, and
30383chooses Unicode-capable runtime startup code.
30384
30385@item -mwin32
30386@opindex mwin32
30387This option is available for Cygwin and MinGW targets.  It
30388specifies that the typical Microsoft Windows predefined macros are to
30389be set in the pre-processor, but does not influence the choice
30390of runtime library/startup code.
30391
30392@item -mwindows
30393@opindex mwindows
30394This option is available for Cygwin and MinGW targets.  It
30395specifies that a GUI application is to be generated by
30396instructing the linker to set the PE header subsystem type
30397appropriately.
30398
30399@item -fno-set-stack-executable
30400@opindex fno-set-stack-executable
30401@opindex fset-stack-executable
30402This option is available for MinGW targets. It specifies that
30403the executable flag for the stack used by nested functions isn't
30404set. This is necessary for binaries running in kernel mode of
30405Microsoft Windows, as there the User32 API, which is used to set executable
30406privileges, isn't available.
30407
30408@item -fwritable-relocated-rdata
30409@opindex fno-writable-relocated-rdata
30410@opindex fwritable-relocated-rdata
30411This option is available for MinGW and Cygwin targets.  It specifies
30412that relocated-data in read-only section is put into the @code{.data}
30413section.  This is a necessary for older runtimes not supporting
30414modification of @code{.rdata} sections for pseudo-relocation.
30415
30416@item -mpe-aligned-commons
30417@opindex mpe-aligned-commons
30418This option is available for Cygwin and MinGW targets.  It
30419specifies that the GNU extension to the PE file format that
30420permits the correct alignment of COMMON variables should be
30421used when generating code.  It is enabled by default if
30422GCC detects that the target assembler found during configuration
30423supports the feature.
30424@end table
30425
30426See also under @ref{x86 Options} for standard options.
30427
30428@node Xstormy16 Options
30429@subsection Xstormy16 Options
30430@cindex Xstormy16 Options
30431
30432These options are defined for Xstormy16:
30433
30434@table @gcctabopt
30435@item -msim
30436@opindex msim
30437Choose startup files and linker script suitable for the simulator.
30438@end table
30439
30440@node Xtensa Options
30441@subsection Xtensa Options
30442@cindex Xtensa Options
30443
30444These options are supported for Xtensa targets:
30445
30446@table @gcctabopt
30447@item -mconst16
30448@itemx -mno-const16
30449@opindex mconst16
30450@opindex mno-const16
30451Enable or disable use of @code{CONST16} instructions for loading
30452constant values.  The @code{CONST16} instruction is currently not a
30453standard option from Tensilica.  When enabled, @code{CONST16}
30454instructions are always used in place of the standard @code{L32R}
30455instructions.  The use of @code{CONST16} is enabled by default only if
30456the @code{L32R} instruction is not available.
30457
30458@item -mfused-madd
30459@itemx -mno-fused-madd
30460@opindex mfused-madd
30461@opindex mno-fused-madd
30462Enable or disable use of fused multiply/add and multiply/subtract
30463instructions in the floating-point option.  This has no effect if the
30464floating-point option is not also enabled.  Disabling fused multiply/add
30465and multiply/subtract instructions forces the compiler to use separate
30466instructions for the multiply and add/subtract operations.  This may be
30467desirable in some cases where strict IEEE 754-compliant results are
30468required: the fused multiply add/subtract instructions do not round the
30469intermediate result, thereby producing results with @emph{more} bits of
30470precision than specified by the IEEE standard.  Disabling fused multiply
30471add/subtract instructions also ensures that the program output is not
30472sensitive to the compiler's ability to combine multiply and add/subtract
30473operations.
30474
30475@item -mserialize-volatile
30476@itemx -mno-serialize-volatile
30477@opindex mserialize-volatile
30478@opindex mno-serialize-volatile
30479When this option is enabled, GCC inserts @code{MEMW} instructions before
30480@code{volatile} memory references to guarantee sequential consistency.
30481The default is @option{-mserialize-volatile}.  Use
30482@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30483
30484@item -mforce-no-pic
30485@opindex mforce-no-pic
30486For targets, like GNU/Linux, where all user-mode Xtensa code must be
30487position-independent code (PIC), this option disables PIC for compiling
30488kernel code.
30489
30490@item -mtext-section-literals
30491@itemx -mno-text-section-literals
30492@opindex mtext-section-literals
30493@opindex mno-text-section-literals
30494These options control the treatment of literal pools.  The default is
30495@option{-mno-text-section-literals}, which places literals in a separate
30496section in the output file.  This allows the literal pool to be placed
30497in a data RAM/ROM, and it also allows the linker to combine literal
30498pools from separate object files to remove redundant literals and
30499improve code size.  With @option{-mtext-section-literals}, the literals
30500are interspersed in the text section in order to keep them as close as
30501possible to their references.  This may be necessary for large assembly
30502files.  Literals for each function are placed right before that function.
30503
30504@item -mauto-litpools
30505@itemx -mno-auto-litpools
30506@opindex mauto-litpools
30507@opindex mno-auto-litpools
30508These options control the treatment of literal pools.  The default is
30509@option{-mno-auto-litpools}, which places literals in a separate
30510section in the output file unless @option{-mtext-section-literals} is
30511used.  With @option{-mauto-litpools} the literals are interspersed in
30512the text section by the assembler.  Compiler does not produce explicit
30513@code{.literal} directives and loads literals into registers with
30514@code{MOVI} instructions instead of @code{L32R} to let the assembler
30515do relaxation and place literals as necessary.  This option allows
30516assembler to create several literal pools per function and assemble
30517very big functions, which may not be possible with
30518@option{-mtext-section-literals}.
30519
30520@item -mtarget-align
30521@itemx -mno-target-align
30522@opindex mtarget-align
30523@opindex mno-target-align
30524When this option is enabled, GCC instructs the assembler to
30525automatically align instructions to reduce branch penalties at the
30526expense of some code density.  The assembler attempts to widen density
30527instructions to align branch targets and the instructions following call
30528instructions.  If there are not enough preceding safe density
30529instructions to align a target, no widening is performed.  The
30530default is @option{-mtarget-align}.  These options do not affect the
30531treatment of auto-aligned instructions like @code{LOOP}, which the
30532assembler always aligns, either by widening density instructions or
30533by inserting NOP instructions.
30534
30535@item -mlongcalls
30536@itemx -mno-longcalls
30537@opindex mlongcalls
30538@opindex mno-longcalls
30539When this option is enabled, GCC instructs the assembler to translate
30540direct calls to indirect calls unless it can determine that the target
30541of a direct call is in the range allowed by the call instruction.  This
30542translation typically occurs for calls to functions in other source
30543files.  Specifically, the assembler translates a direct @code{CALL}
30544instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30545The default is @option{-mno-longcalls}.  This option should be used in
30546programs where the call target can potentially be out of range.  This
30547option is implemented in the assembler, not the compiler, so the
30548assembly code generated by GCC still shows direct call
30549instructions---look at the disassembled object code to see the actual
30550instructions.  Note that the assembler uses an indirect call for
30551every cross-file call, not just those that really are out of range.
30552@end table
30553
30554@node zSeries Options
30555@subsection zSeries Options
30556@cindex zSeries options
30557
30558These are listed under @xref{S/390 and zSeries Options}.
30559
30560
30561@c man end
30562
30563@node Spec Files
30564@section Specifying Subprocesses and the Switches to Pass to Them
30565@cindex Spec Files
30566
30567@command{gcc} is a driver program.  It performs its job by invoking a
30568sequence of other programs to do the work of compiling, assembling and
30569linking.  GCC interprets its command-line parameters and uses these to
30570deduce which programs it should invoke, and which command-line options
30571it ought to place on their command lines.  This behavior is controlled
30572by @dfn{spec strings}.  In most cases there is one spec string for each
30573program that GCC can invoke, but a few programs have multiple spec
30574strings to control their behavior.  The spec strings built into GCC can
30575be overridden by using the @option{-specs=} command-line switch to specify
30576a spec file.
30577
30578@dfn{Spec files} are plain-text files that are used to construct spec
30579strings.  They consist of a sequence of directives separated by blank
30580lines.  The type of directive is determined by the first non-whitespace
30581character on the line, which can be one of the following:
30582
30583@table @code
30584@item %@var{command}
30585Issues a @var{command} to the spec file processor.  The commands that can
30586appear here are:
30587
30588@table @code
30589@item %include <@var{file}>
30590@cindex @code{%include}
30591Search for @var{file} and insert its text at the current point in the
30592specs file.
30593
30594@item %include_noerr <@var{file}>
30595@cindex @code{%include_noerr}
30596Just like @samp{%include}, but do not generate an error message if the include
30597file cannot be found.
30598
30599@item %rename @var{old_name} @var{new_name}
30600@cindex @code{%rename}
30601Rename the spec string @var{old_name} to @var{new_name}.
30602
30603@end table
30604
30605@item *[@var{spec_name}]:
30606This tells the compiler to create, override or delete the named spec
30607string.  All lines after this directive up to the next directive or
30608blank line are considered to be the text for the spec string.  If this
30609results in an empty string then the spec is deleted.  (Or, if the
30610spec did not exist, then nothing happens.)  Otherwise, if the spec
30611does not currently exist a new spec is created.  If the spec does
30612exist then its contents are overridden by the text of this
30613directive, unless the first character of that text is the @samp{+}
30614character, in which case the text is appended to the spec.
30615
30616@item [@var{suffix}]:
30617Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
30618and up to the next directive or blank line are considered to make up the
30619spec string for the indicated suffix.  When the compiler encounters an
30620input file with the named suffix, it processes the spec string in
30621order to work out how to compile that file.  For example:
30622
30623@smallexample
30624.ZZ:
30625z-compile -input %i
30626@end smallexample
30627
30628This says that any input file whose name ends in @samp{.ZZ} should be
30629passed to the program @samp{z-compile}, which should be invoked with the
30630command-line switch @option{-input} and with the result of performing the
30631@samp{%i} substitution.  (See below.)
30632
30633As an alternative to providing a spec string, the text following a
30634suffix directive can be one of the following:
30635
30636@table @code
30637@item @@@var{language}
30638This says that the suffix is an alias for a known @var{language}.  This is
30639similar to using the @option{-x} command-line switch to GCC to specify a
30640language explicitly.  For example:
30641
30642@smallexample
30643.ZZ:
30644@@c++
30645@end smallexample
30646
30647Says that .ZZ files are, in fact, C++ source files.
30648
30649@item #@var{name}
30650This causes an error messages saying:
30651
30652@smallexample
30653@var{name} compiler not installed on this system.
30654@end smallexample
30655@end table
30656
30657GCC already has an extensive list of suffixes built into it.
30658This directive adds an entry to the end of the list of suffixes, but
30659since the list is searched from the end backwards, it is effectively
30660possible to override earlier entries using this technique.
30661
30662@end table
30663
30664GCC has the following spec strings built into it.  Spec files can
30665override these strings or create their own.  Note that individual
30666targets can also add their own spec strings to this list.
30667
30668@smallexample
30669asm          Options to pass to the assembler
30670asm_final    Options to pass to the assembler post-processor
30671cpp          Options to pass to the C preprocessor
30672cc1          Options to pass to the C compiler
30673cc1plus      Options to pass to the C++ compiler
30674endfile      Object files to include at the end of the link
30675link         Options to pass to the linker
30676lib          Libraries to include on the command line to the linker
30677libgcc       Decides which GCC support library to pass to the linker
30678linker       Sets the name of the linker
30679predefines   Defines to be passed to the C preprocessor
30680signed_char  Defines to pass to CPP to say whether @code{char} is signed
30681             by default
30682startfile    Object files to include at the start of the link
30683@end smallexample
30684
30685Here is a small example of a spec file:
30686
30687@smallexample
30688%rename lib                 old_lib
30689
30690*lib:
30691--start-group -lgcc -lc -leval1 --end-group %(old_lib)
30692@end smallexample
30693
30694This example renames the spec called @samp{lib} to @samp{old_lib} and
30695then overrides the previous definition of @samp{lib} with a new one.
30696The new definition adds in some extra command-line options before
30697including the text of the old definition.
30698
30699@dfn{Spec strings} are a list of command-line options to be passed to their
30700corresponding program.  In addition, the spec strings can contain
30701@samp{%}-prefixed sequences to substitute variable text or to
30702conditionally insert text into the command line.  Using these constructs
30703it is possible to generate quite complex command lines.
30704
30705Here is a table of all defined @samp{%}-sequences for spec
30706strings.  Note that spaces are not generated automatically around the
30707results of expanding these sequences.  Therefore you can concatenate them
30708together or combine them with constant text in a single argument.
30709
30710@table @code
30711@item %%
30712Substitute one @samp{%} into the program name or argument.
30713
30714@item %i
30715Substitute the name of the input file being processed.
30716
30717@item %b
30718Substitute the basename of the input file being processed.
30719This is the substring up to (and not including) the last period
30720and not including the directory.
30721
30722@item %B
30723This is the same as @samp{%b}, but include the file suffix (text after
30724the last period).
30725
30726@item %d
30727Marks the argument containing or following the @samp{%d} as a
30728temporary file name, so that that file is deleted if GCC exits
30729successfully.  Unlike @samp{%g}, this contributes no text to the
30730argument.
30731
30732@item %g@var{suffix}
30733Substitute a file name that has suffix @var{suffix} and is chosen
30734once per compilation, and mark the argument in the same way as
30735@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
30736name is now chosen in a way that is hard to predict even when previously
30737chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30738might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
30739the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30740treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
30741was simply substituted with a file name chosen once per compilation,
30742without regard to any appended suffix (which was therefore treated
30743just like ordinary text), making such attacks more likely to succeed.
30744
30745@item %u@var{suffix}
30746Like @samp{%g}, but generates a new temporary file name
30747each time it appears instead of once per compilation.
30748
30749@item %U@var{suffix}
30750Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30751new one if there is no such last file name.  In the absence of any
30752@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30753the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30754involves the generation of two distinct file names, one
30755for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
30756simply substituted with a file name chosen for the previous @samp{%u},
30757without regard to any appended suffix.
30758
30759@item %j@var{suffix}
30760Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30761writable, and if @option{-save-temps} is not used;
30762otherwise, substitute the name
30763of a temporary file, just like @samp{%u}.  This temporary file is not
30764meant for communication between processes, but rather as a junk
30765disposal mechanism.
30766
30767@item %|@var{suffix}
30768@itemx %m@var{suffix}
30769Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
30770@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
30771all.  These are the two most common ways to instruct a program that it
30772should read from standard input or write to standard output.  If you
30773need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
30774construct: see for example @file{gcc/fortran/lang-specs.h}.
30775
30776@item %.@var{SUFFIX}
30777Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
30778when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
30779terminated by the next space or %.
30780
30781@item %w
30782Marks the argument containing or following the @samp{%w} as the
30783designated output file of this compilation.  This puts the argument
30784into the sequence of arguments that @samp{%o} substitutes.
30785
30786@item %o
30787Substitutes the names of all the output files, with spaces
30788automatically placed around them.  You should write spaces
30789around the @samp{%o} as well or the results are undefined.
30790@samp{%o} is for use in the specs for running the linker.
30791Input files whose names have no recognized suffix are not compiled
30792at all, but they are included among the output files, so they are
30793linked.
30794
30795@item %O
30796Substitutes the suffix for object files.  Note that this is
30797handled specially when it immediately follows @samp{%g, %u, or %U},
30798because of the need for those to form complete file names.  The
30799handling is such that @samp{%O} is treated exactly as if it had already
30800been substituted, except that @samp{%g, %u, and %U} do not currently
30801support additional @var{suffix} characters following @samp{%O} as they do
30802following, for example, @samp{.o}.
30803
30804@item %p
30805Substitutes the standard macro predefinitions for the
30806current target machine.  Use this when running @command{cpp}.
30807
30808@item %P
30809Like @samp{%p}, but puts @samp{__} before and after the name of each
30810predefined macro, except for macros that start with @samp{__} or with
30811@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
30812C@.
30813
30814@item %I
30815Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
30816@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
30817@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
30818and @option{-imultilib} as necessary.
30819
30820@item %s
30821Current argument is the name of a library or startup file of some sort.
30822Search for that file in a standard list of directories and substitute
30823the full name found.  The current working directory is included in the
30824list of directories scanned.
30825
30826@item %T
30827Current argument is the name of a linker script.  Search for that file
30828in the current list of directories to scan for libraries. If the file
30829is located insert a @option{--script} option into the command line
30830followed by the full path name found.  If the file is not found then
30831generate an error message.  Note: the current working directory is not
30832searched.
30833
30834@item %e@var{str}
30835Print @var{str} as an error message.  @var{str} is terminated by a newline.
30836Use this when inconsistent options are detected.
30837
30838@item %(@var{name})
30839Substitute the contents of spec string @var{name} at this point.
30840
30841@item %x@{@var{option}@}
30842Accumulate an option for @samp{%X}.
30843
30844@item %X
30845Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
30846spec string.
30847
30848@item %Y
30849Output the accumulated assembler options specified by @option{-Wa}.
30850
30851@item %Z
30852Output the accumulated preprocessor options specified by @option{-Wp}.
30853
30854@item %a
30855Process the @code{asm} spec.  This is used to compute the
30856switches to be passed to the assembler.
30857
30858@item %A
30859Process the @code{asm_final} spec.  This is a spec string for
30860passing switches to an assembler post-processor, if such a program is
30861needed.
30862
30863@item %l
30864Process the @code{link} spec.  This is the spec for computing the
30865command line passed to the linker.  Typically it makes use of the
30866@samp{%L %G %S %D and %E} sequences.
30867
30868@item %D
30869Dump out a @option{-L} option for each directory that GCC believes might
30870contain startup files.  If the target supports multilibs then the
30871current multilib directory is prepended to each of these paths.
30872
30873@item %L
30874Process the @code{lib} spec.  This is a spec string for deciding which
30875libraries are included on the command line to the linker.
30876
30877@item %G
30878Process the @code{libgcc} spec.  This is a spec string for deciding
30879which GCC support library is included on the command line to the linker.
30880
30881@item %S
30882Process the @code{startfile} spec.  This is a spec for deciding which
30883object files are the first ones passed to the linker.  Typically
30884this might be a file named @file{crt0.o}.
30885
30886@item %E
30887Process the @code{endfile} spec.  This is a spec string that specifies
30888the last object files that are passed to the linker.
30889
30890@item %C
30891Process the @code{cpp} spec.  This is used to construct the arguments
30892to be passed to the C preprocessor.
30893
30894@item %1
30895Process the @code{cc1} spec.  This is used to construct the options to be
30896passed to the actual C compiler (@command{cc1}).
30897
30898@item %2
30899Process the @code{cc1plus} spec.  This is used to construct the options to be
30900passed to the actual C++ compiler (@command{cc1plus}).
30901
30902@item %*
30903Substitute the variable part of a matched option.  See below.
30904Note that each comma in the substituted string is replaced by
30905a single space.
30906
30907@item %<S
30908Remove all occurrences of @code{-S} from the command line.  Note---this
30909command is position dependent.  @samp{%} commands in the spec string
30910before this one see @code{-S}, @samp{%} commands in the spec string
30911after this one do not.
30912
30913@item %:@var{function}(@var{args})
30914Call the named function @var{function}, passing it @var{args}.
30915@var{args} is first processed as a nested spec string, then split
30916into an argument vector in the usual fashion.  The function returns
30917a string which is processed as if it had appeared literally as part
30918of the current spec.
30919
30920The following built-in spec functions are provided:
30921
30922@table @code
30923@item @code{getenv}
30924The @code{getenv} spec function takes two arguments: an environment
30925variable name and a string.  If the environment variable is not
30926defined, a fatal error is issued.  Otherwise, the return value is the
30927value of the environment variable concatenated with the string.  For
30928example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
30929
30930@smallexample
30931%:getenv(TOPDIR /include)
30932@end smallexample
30933
30934expands to @file{/path/to/top/include}.
30935
30936@item @code{if-exists}
30937The @code{if-exists} spec function takes one argument, an absolute
30938pathname to a file.  If the file exists, @code{if-exists} returns the
30939pathname.  Here is a small example of its usage:
30940
30941@smallexample
30942*startfile:
30943crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
30944@end smallexample
30945
30946@item @code{if-exists-else}
30947The @code{if-exists-else} spec function is similar to the @code{if-exists}
30948spec function, except that it takes two arguments.  The first argument is
30949an absolute pathname to a file.  If the file exists, @code{if-exists-else}
30950returns the pathname.  If it does not exist, it returns the second argument.
30951This way, @code{if-exists-else} can be used to select one file or another,
30952based on the existence of the first.  Here is a small example of its usage:
30953
30954@smallexample
30955*startfile:
30956crt0%O%s %:if-exists(crti%O%s) \
30957%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
30958@end smallexample
30959
30960@item @code{replace-outfile}
30961The @code{replace-outfile} spec function takes two arguments.  It looks for the
30962first argument in the outfiles array and replaces it with the second argument.  Here
30963is a small example of its usage:
30964
30965@smallexample
30966%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
30967@end smallexample
30968
30969@item @code{remove-outfile}
30970The @code{remove-outfile} spec function takes one argument.  It looks for the
30971first argument in the outfiles array and removes it.  Here is a small example
30972its usage:
30973
30974@smallexample
30975%:remove-outfile(-lm)
30976@end smallexample
30977
30978@item @code{pass-through-libs}
30979The @code{pass-through-libs} spec function takes any number of arguments.  It
30980finds any @option{-l} options and any non-options ending in @file{.a} (which it
30981assumes are the names of linker input library archive files) and returns a
30982result containing all the found arguments each prepended by
30983@option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
30984intended to be passed to the LTO linker plugin.
30985
30986@smallexample
30987%:pass-through-libs(%G %L %G)
30988@end smallexample
30989
30990@item @code{print-asm-header}
30991The @code{print-asm-header} function takes no arguments and simply
30992prints a banner like:
30993
30994@smallexample
30995Assembler options
30996=================
30997
30998Use "-Wa,OPTION" to pass "OPTION" to the assembler.
30999@end smallexample
31000
31001It is used to separate compiler options from assembler options
31002in the @option{--target-help} output.
31003@end table
31004
31005@item %@{S@}
31006Substitutes the @code{-S} switch, if that switch is given to GCC@.
31007If that switch is not specified, this substitutes nothing.  Note that
31008the leading dash is omitted when specifying this option, and it is
31009automatically inserted if the substitution is performed.  Thus the spec
31010string @samp{%@{foo@}} matches the command-line option @option{-foo}
31011and outputs the command-line option @option{-foo}.
31012
31013@item %W@{S@}
31014Like %@{@code{S}@} but mark last argument supplied within as a file to be
31015deleted on failure.
31016
31017@item %@{S*@}
31018Substitutes all the switches specified to GCC whose names start
31019with @code{-S}, but which also take an argument.  This is used for
31020switches like @option{-o}, @option{-D}, @option{-I}, etc.
31021GCC considers @option{-o foo} as being
31022one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
31023text, including the space.  Thus two arguments are generated.
31024
31025@item %@{S*&T*@}
31026Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
31027(the order of @code{S} and @code{T} in the spec is not significant).
31028There can be any number of ampersand-separated variables; for each the
31029wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
31030
31031@item %@{S:X@}
31032Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
31033
31034@item %@{!S:X@}
31035Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
31036
31037@item %@{S*:X@}
31038Substitutes @code{X} if one or more switches whose names start with
31039@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
31040once, no matter how many such switches appeared.  However, if @code{%*}
31041appears somewhere in @code{X}, then @code{X} is substituted once
31042for each matching switch, with the @code{%*} replaced by the part of
31043that switch matching the @code{*}.
31044
31045If @code{%*} appears as the last part of a spec sequence then a space
31046is added after the end of the last substitution.  If there is more
31047text in the sequence, however, then a space is not generated.  This
31048allows the @code{%*} substitution to be used as part of a larger
31049string.  For example, a spec string like this:
31050
31051@smallexample
31052%@{mcu=*:--script=%*/memory.ld@}
31053@end smallexample
31054
31055@noindent
31056when matching an option like @option{-mcu=newchip} produces:
31057
31058@smallexample
31059--script=newchip/memory.ld
31060@end smallexample
31061
31062@item %@{.S:X@}
31063Substitutes @code{X}, if processing a file with suffix @code{S}.
31064
31065@item %@{!.S:X@}
31066Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
31067
31068@item %@{,S:X@}
31069Substitutes @code{X}, if processing a file for language @code{S}.
31070
31071@item %@{!,S:X@}
31072Substitutes @code{X}, if not processing a file for language @code{S}.
31073
31074@item %@{S|P:X@}
31075Substitutes @code{X} if either @code{-S} or @code{-P} is given to
31076GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
31077@code{*} sequences as well, although they have a stronger binding than
31078the @samp{|}.  If @code{%*} appears in @code{X}, all of the
31079alternatives must be starred, and only the first matching alternative
31080is substituted.
31081
31082For example, a spec string like this:
31083
31084@smallexample
31085%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
31086@end smallexample
31087
31088@noindent
31089outputs the following command-line options from the following input
31090command-line options:
31091
31092@smallexample
31093fred.c        -foo -baz
31094jim.d         -bar -boggle
31095-d fred.c     -foo -baz -boggle
31096-d jim.d      -bar -baz -boggle
31097@end smallexample
31098
31099@item %@{S:X; T:Y; :D@}
31100
31101If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
31102given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
31103be as many clauses as you need.  This may be combined with @code{.},
31104@code{,}, @code{!}, @code{|}, and @code{*} as needed.
31105
31106
31107@end table
31108
31109The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
31110or similar construct can use a backslash to ignore the special meaning
31111of the character following it, thus allowing literal matching of a
31112character that is otherwise specially treated.  For example,
31113@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
31114@option{-std=iso9899:1999} option is given.
31115
31116The conditional text @code{X} in a @samp{%@{S:X@}} or similar
31117construct may contain other nested @samp{%} constructs or spaces, or
31118even newlines.  They are processed as usual, as described above.
31119Trailing white space in @code{X} is ignored.  White space may also
31120appear anywhere on the left side of the colon in these constructs,
31121except between @code{.} or @code{*} and the corresponding word.
31122
31123The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
31124handled specifically in these constructs.  If another value of
31125@option{-O} or the negated form of a @option{-f}, @option{-m}, or
31126@option{-W} switch is found later in the command line, the earlier
31127switch value is ignored, except with @{@code{S}*@} where @code{S} is
31128just one letter, which passes all matching options.
31129
31130The character @samp{|} at the beginning of the predicate text is used to
31131indicate that a command should be piped to the following command, but
31132only if @option{-pipe} is specified.
31133
31134It is built into GCC which switches take arguments and which do not.
31135(You might think it would be useful to generalize this to allow each
31136compiler's spec to say which switches take arguments.  But this cannot
31137be done in a consistent fashion.  GCC cannot even decide which input
31138files have been specified without knowing which switches take arguments,
31139and it must know which input files to compile in order to tell which
31140compilers to run).
31141
31142GCC also knows implicitly that arguments starting in @option{-l} are to be
31143treated as compiler output files, and passed to the linker in their
31144proper position among the other output files.
31145
31146@node Environment Variables
31147@section Environment Variables Affecting GCC
31148@cindex environment variables
31149
31150@c man begin ENVIRONMENT
31151This section describes several environment variables that affect how GCC
31152operates.  Some of them work by specifying directories or prefixes to use
31153when searching for various kinds of files.  Some are used to specify other
31154aspects of the compilation environment.
31155
31156Note that you can also specify places to search using options such as
31157@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
31158take precedence over places specified using environment variables, which
31159in turn take precedence over those specified by the configuration of GCC@.
31160@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
31161GNU Compiler Collection (GCC) Internals}.
31162
31163@table @env
31164@item LANG
31165@itemx LC_CTYPE
31166@c @itemx LC_COLLATE
31167@itemx LC_MESSAGES
31168@c @itemx LC_MONETARY
31169@c @itemx LC_NUMERIC
31170@c @itemx LC_TIME
31171@itemx LC_ALL
31172@findex LANG
31173@findex LC_CTYPE
31174@c @findex LC_COLLATE
31175@findex LC_MESSAGES
31176@c @findex LC_MONETARY
31177@c @findex LC_NUMERIC
31178@c @findex LC_TIME
31179@findex LC_ALL
31180@cindex locale
31181These environment variables control the way that GCC uses
31182localization information which allows GCC to work with different
31183national conventions.  GCC inspects the locale categories
31184@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31185so.  These locale categories can be set to any value supported by your
31186installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
31187Kingdom encoded in UTF-8.
31188
31189The @env{LC_CTYPE} environment variable specifies character
31190classification.  GCC uses it to determine the character boundaries in
31191a string; this is needed for some multibyte encodings that contain quote
31192and escape characters that are otherwise interpreted as a string
31193end or escape.
31194
31195The @env{LC_MESSAGES} environment variable specifies the language to
31196use in diagnostic messages.
31197
31198If the @env{LC_ALL} environment variable is set, it overrides the value
31199of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31200and @env{LC_MESSAGES} default to the value of the @env{LANG}
31201environment variable.  If none of these variables are set, GCC
31202defaults to traditional C English behavior.
31203
31204@item TMPDIR
31205@findex TMPDIR
31206If @env{TMPDIR} is set, it specifies the directory to use for temporary
31207files.  GCC uses temporary files to hold the output of one stage of
31208compilation which is to be used as input to the next stage: for example,
31209the output of the preprocessor, which is the input to the compiler
31210proper.
31211
31212@item GCC_COMPARE_DEBUG
31213@findex GCC_COMPARE_DEBUG
31214Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31215@option{-fcompare-debug} to the compiler driver.  See the documentation
31216of this option for more details.
31217
31218@item GCC_EXEC_PREFIX
31219@findex GCC_EXEC_PREFIX
31220If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31221names of the subprograms executed by the compiler.  No slash is added
31222when this prefix is combined with the name of a subprogram, but you can
31223specify a prefix that ends with a slash if you wish.
31224
31225If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31226an appropriate prefix to use based on the pathname it is invoked with.
31227
31228If GCC cannot find the subprogram using the specified prefix, it
31229tries looking in the usual places for the subprogram.
31230
31231The default value of @env{GCC_EXEC_PREFIX} is
31232@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31233the installed compiler. In many cases @var{prefix} is the value
31234of @code{prefix} when you ran the @file{configure} script.
31235
31236Other prefixes specified with @option{-B} take precedence over this prefix.
31237
31238This prefix is also used for finding files such as @file{crt0.o} that are
31239used for linking.
31240
31241In addition, the prefix is used in an unusual way in finding the
31242directories to search for header files.  For each of the standard
31243directories whose name normally begins with @samp{/usr/local/lib/gcc}
31244(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31245replacing that beginning with the specified prefix to produce an
31246alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
31247@file{foo/bar} just before it searches the standard directory
31248@file{/usr/local/lib/bar}.
31249If a standard directory begins with the configured
31250@var{prefix} then the value of @var{prefix} is replaced by
31251@env{GCC_EXEC_PREFIX} when looking for header files.
31252
31253@item COMPILER_PATH
31254@findex COMPILER_PATH
31255The value of @env{COMPILER_PATH} is a colon-separated list of
31256directories, much like @env{PATH}.  GCC tries the directories thus
31257specified when searching for subprograms, if it cannot find the
31258subprograms using @env{GCC_EXEC_PREFIX}.
31259
31260@item LIBRARY_PATH
31261@findex LIBRARY_PATH
31262The value of @env{LIBRARY_PATH} is a colon-separated list of
31263directories, much like @env{PATH}.  When configured as a native compiler,
31264GCC tries the directories thus specified when searching for special
31265linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
31266using GCC also uses these directories when searching for ordinary
31267libraries for the @option{-l} option (but directories specified with
31268@option{-L} come first).
31269
31270@item LANG
31271@findex LANG
31272@cindex locale definition
31273This variable is used to pass locale information to the compiler.  One way in
31274which this information is used is to determine the character set to be used
31275when character literals, string literals and comments are parsed in C and C++.
31276When the compiler is configured to allow multibyte characters,
31277the following values for @env{LANG} are recognized:
31278
31279@table @samp
31280@item C-JIS
31281Recognize JIS characters.
31282@item C-SJIS
31283Recognize SJIS characters.
31284@item C-EUCJP
31285Recognize EUCJP characters.
31286@end table
31287
31288If @env{LANG} is not defined, or if it has some other value, then the
31289compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31290recognize and translate multibyte characters.
31291@end table
31292
31293@noindent
31294Some additional environment variables affect the behavior of the
31295preprocessor.
31296
31297@include cppenv.texi
31298
31299@c man end
31300
31301@node Precompiled Headers
31302@section Using Precompiled Headers
31303@cindex precompiled headers
31304@cindex speed of compilation
31305
31306Often large projects have many header files that are included in every
31307source file.  The time the compiler takes to process these header files
31308over and over again can account for nearly all of the time required to
31309build the project.  To make builds faster, GCC allows you to
31310@dfn{precompile} a header file.
31311
31312To create a precompiled header file, simply compile it as you would any
31313other file, if necessary using the @option{-x} option to make the driver
31314treat it as a C or C++ header file.  You may want to use a
31315tool like @command{make} to keep the precompiled header up-to-date when
31316the headers it contains change.
31317
31318A precompiled header file is searched for when @code{#include} is
31319seen in the compilation.  As it searches for the included file
31320(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31321compiler looks for a precompiled header in each directory just before it
31322looks for the include file in that directory.  The name searched for is
31323the name specified in the @code{#include} with @samp{.gch} appended.  If
31324the precompiled header file cannot be used, it is ignored.
31325
31326For instance, if you have @code{#include "all.h"}, and you have
31327@file{all.h.gch} in the same directory as @file{all.h}, then the
31328precompiled header file is used if possible, and the original
31329header is used otherwise.
31330
31331Alternatively, you might decide to put the precompiled header file in a
31332directory and use @option{-I} to ensure that directory is searched
31333before (or instead of) the directory containing the original header.
31334Then, if you want to check that the precompiled header file is always
31335used, you can put a file of the same name as the original header in this
31336directory containing an @code{#error} command.
31337
31338This also works with @option{-include}.  So yet another way to use
31339precompiled headers, good for projects not designed with precompiled
31340header files in mind, is to simply take most of the header files used by
31341a project, include them from another header file, precompile that header
31342file, and @option{-include} the precompiled header.  If the header files
31343have guards against multiple inclusion, they are skipped because
31344they've already been included (in the precompiled header).
31345
31346If you need to precompile the same header file for different
31347languages, targets, or compiler options, you can instead make a
31348@emph{directory} named like @file{all.h.gch}, and put each precompiled
31349header in the directory, perhaps using @option{-o}.  It doesn't matter
31350what you call the files in the directory; every precompiled header in
31351the directory is considered.  The first precompiled header
31352encountered in the directory that is valid for this compilation is
31353used; they're searched in no particular order.
31354
31355There are many other possibilities, limited only by your imagination,
31356good sense, and the constraints of your build system.
31357
31358A precompiled header file can be used only when these conditions apply:
31359
31360@itemize
31361@item
31362Only one precompiled header can be used in a particular compilation.
31363
31364@item
31365A precompiled header cannot be used once the first C token is seen.  You
31366can have preprocessor directives before a precompiled header; you cannot
31367include a precompiled header from inside another header.
31368
31369@item
31370The precompiled header file must be produced for the same language as
31371the current compilation.  You cannot use a C precompiled header for a C++
31372compilation.
31373
31374@item
31375The precompiled header file must have been produced by the same compiler
31376binary as the current compilation is using.
31377
31378@item
31379Any macros defined before the precompiled header is included must
31380either be defined in the same way as when the precompiled header was
31381generated, or must not affect the precompiled header, which usually
31382means that they don't appear in the precompiled header at all.
31383
31384The @option{-D} option is one way to define a macro before a
31385precompiled header is included; using a @code{#define} can also do it.
31386There are also some options that define macros implicitly, like
31387@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31388defined this way.
31389
31390@item If debugging information is output when using the precompiled
31391header, using @option{-g} or similar, the same kind of debugging information
31392must have been output when building the precompiled header.  However,
31393a precompiled header built using @option{-g} can be used in a compilation
31394when no debugging information is being output.
31395
31396@item The same @option{-m} options must generally be used when building
31397and using the precompiled header.  @xref{Submodel Options},
31398for any cases where this rule is relaxed.
31399
31400@item Each of the following options must be the same when building and using
31401the precompiled header:
31402
31403@gccoptlist{-fexceptions}
31404
31405@item
31406Some other command-line options starting with @option{-f},
31407@option{-p}, or @option{-O} must be defined in the same way as when
31408the precompiled header was generated.  At present, it's not clear
31409which options are safe to change and which are not; the safest choice
31410is to use exactly the same options when generating and using the
31411precompiled header.  The following are known to be safe:
31412
31413@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
31414-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
31415-fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
31416-pedantic-errors}
31417
31418@item Address space layout randomization (ASLR) can lead to not binary identical
31419PCH files.  If you rely on stable PCH file contents disable ASLR when generating
31420PCH files.
31421
31422@end itemize
31423
31424For all of these except the last, the compiler automatically
31425ignores the precompiled header if the conditions aren't met.  If you
31426find an option combination that doesn't work and doesn't cause the
31427precompiled header to be ignored, please consider filing a bug report,
31428see @ref{Bugs}.
31429
31430If you do use differing options when generating and using the
31431precompiled header, the actual behavior is a mixture of the
31432behavior for the options.  For instance, if you use @option{-g} to
31433generate the precompiled header but not when using it, you may or may
31434not get debugging information for routines in the precompiled header.
31435