xref: /netbsd/external/gpl3/gcc/dist/gcc/doc/invoke.texi (revision 1695e785)
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-iprefix @var{file}  -iwithprefix @var{dir} @gol
587-traditional  -traditional-cpp  -trigraphs @gol
588-U@var{macro}  -undef  @gol
589-Wp,@var{option}  -Xpreprocessor @var{option}}
590
591@item Assembler Options
592@xref{Assembler Options,,Passing Options to the Assembler}.
593@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
594
595@item Linker Options
596@xref{Link Options,,Options for Linking}.
597@gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
598-nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
599-e @var{entry}  --entry=@var{entry} @gol
600-pie  -pthread  -r  -rdynamic @gol
601-s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
602-static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
603-shared  -shared-libgcc  -symbolic @gol
604-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
605-u @var{symbol}  -z @var{keyword}}
606
607@item Directory Options
608@xref{Directory Options,,Options for Directory Search}.
609@gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
610-idirafter @var{dir} @gol
611-imacros @var{file}  -imultilib @var{dir} @gol
612-iplugindir=@var{dir}  @gol
613-iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
614-iremap@var{src}:@var{dst} -cxx-isystem=@var{dir} @gol
615-iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
616-L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
617-nostdinc  -nostdinc++  --sysroot=@var{dir}}
618
619@item Code Generation Options
620@xref{Code Gen Options,,Options for Code Generation Conventions}.
621@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
622-ffixed-@var{reg}  -fexceptions @gol
623-fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
624-fasynchronous-unwind-tables @gol
625-fno-gnu-unique @gol
626-finhibit-size-directive  -fcommon  -fno-ident @gol
627-fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
628-fno-jump-tables @gol
629-frecord-gcc-switches @gol
630-freg-struct-return  -fshort-enums  -fshort-wchar @gol
631-fverbose-asm  -fpack-struct[=@var{n}]  @gol
632-fleading-underscore  -ftls-model=@var{model} @gol
633-fstack-reuse=@var{reuse_level} @gol
634-ftrampolines  -ftrapv  -fwrapv @gol
635-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
636-fstrict-volatile-bitfields  -fsync-libcalls}
637
638@item Developer Options
639@xref{Developer Options,,GCC Developer Options}.
640@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
641-dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
642-fchecking  -fchecking=@var{n}
643-fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
644-fdisable-ipa-@var{pass_name} @gol
645-fdisable-rtl-@var{pass_name} @gol
646-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
647-fdisable-tree-@var{pass_name} @gol
648-fdisable-tree-@var{pass-name}=@var{range-list} @gol
649-fdump-debug  -fdump-earlydebug @gol
650-fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
651-fdump-final-insns@r{[}=@var{file}@r{]} @gol
652-fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
653-fdump-lang-all @gol
654-fdump-lang-@var{switch} @gol
655-fdump-lang-@var{switch}-@var{options} @gol
656-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
657-fdump-passes @gol
658-fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
659-fdump-statistics @gol
660-fdump-tree-all @gol
661-fdump-tree-@var{switch} @gol
662-fdump-tree-@var{switch}-@var{options} @gol
663-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
664-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
665-fenable-@var{kind}-@var{pass} @gol
666-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
667-fira-verbose=@var{n} @gol
668-flto-report  -flto-report-wpa  -fmem-report-wpa @gol
669-fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
670-fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
671-fprofile-report @gol
672-frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
673-fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
674-fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
675-fvar-tracking-assignments-toggle  -gtoggle @gol
676-print-file-name=@var{library}  -print-libgcc-file-name @gol
677-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
678-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
679-print-sysroot  -print-sysroot-headers-suffix @gol
680-save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
681
682@item Machine-Dependent Options
683@xref{Submodel Options,,Machine-Dependent Options}.
684@c This list is ordered alphanumerically by subsection name.
685@c Try and put the significant identifier (CPU or system) first,
686@c so users have a clue at guessing where the ones they want will be.
687
688@emph{AArch64 Options}
689@gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
690-mgeneral-regs-only @gol
691-mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
692-mstrict-align  -mno-strict-align @gol
693-momit-leaf-frame-pointer @gol
694-mtls-dialect=desc  -mtls-dialect=traditional @gol
695-mtls-size=@var{size} @gol
696-mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
697-mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
698-mpc-relative-literal-loads @gol
699-msign-return-address=@var{scope} @gol
700-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
701+@var{b-key}]|@var{bti} @gol
702-mharden-sls=@var{opts} @gol
703-march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
704-moverride=@var{string}  -mverbose-cost-dump @gol
705-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
706-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
707-moutline-atomics }
708
709@emph{Adapteva Epiphany Options}
710@gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
711-mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
712-msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
713-mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
714-mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
715-msplit-vecmove-early  -m1reg-@var{reg}}
716
717@emph{AMD GCN Options}
718@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
719
720@emph{ARC Options}
721@gccoptlist{-mbarrel-shifter  -mjli-always @gol
722-mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
723-mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
724-mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
725-mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
726-mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
727-mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
728-mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
729-mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
730-mvolatile-cache  -mtp-regno=@var{regno} @gol
731-malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
732-mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
733-mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
734-mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
735-mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
736-mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
737-munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
738-mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
739
740@emph{ARM Options}
741@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
742-mabi=@var{name} @gol
743-mapcs-stack-check  -mno-apcs-stack-check @gol
744-mapcs-reentrant  -mno-apcs-reentrant @gol
745-mgeneral-regs-only @gol
746-msched-prolog  -mno-sched-prolog @gol
747-mlittle-endian  -mbig-endian @gol
748-mbe8  -mbe32 @gol
749-mfloat-abi=@var{name} @gol
750-mfp16-format=@var{name}
751-mthumb-interwork  -mno-thumb-interwork @gol
752-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
753-mtune=@var{name}  -mprint-tune-info @gol
754-mstructure-size-boundary=@var{n} @gol
755-mabort-on-noreturn @gol
756-mlong-calls  -mno-long-calls @gol
757-msingle-pic-base  -mno-single-pic-base @gol
758-mpic-register=@var{reg} @gol
759-mnop-fun-dllimport @gol
760-mpoke-function-name @gol
761-mthumb  -marm  -mflip-thumb @gol
762-mtpcs-frame  -mtpcs-leaf-frame @gol
763-mcaller-super-interworking  -mcallee-super-interworking @gol
764-mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
765-mword-relocations @gol
766-mfix-cortex-m3-ldrd @gol
767-munaligned-access @gol
768-mneon-for-64bits @gol
769-mslow-flash-data @gol
770-masm-syntax-unified @gol
771-mrestrict-it @gol
772-mverbose-cost-dump @gol
773-mpure-code @gol
774-mcmse @gol
775-mfix-cmse-cve-2021-35465 @gol
776-mfdpic}
777
778@emph{AVR Options}
779@gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
780-mbranch-cost=@var{cost} @gol
781-mcall-prologues  -mgas-isr-prologues  -mint8 @gol
782-mdouble=@var{bits} -mlong-double=@var{bits} @gol
783-mn_flash=@var{size}  -mno-interrupts @gol
784-mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
785-mfract-convert-truncate @gol
786-mshort-calls  -nodevicelib  -nodevicespecs @gol
787-Waddr-space-convert  -Wmisspelled-isr}
788
789@emph{Blackfin Options}
790@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
791-msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
792-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
793-mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
794-mno-id-shared-library  -mshared-library-id=@var{n} @gol
795-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
796-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
797-mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
798-micplb}
799
800@emph{C6X Options}
801@gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
802-msim  -msdata=@var{sdata-type}}
803
804@emph{CRIS Options}
805@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
806-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
807-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
808-mstack-align  -mdata-align  -mconst-align @gol
809-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
810-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
811-mmul-bug-workaround  -mno-mul-bug-workaround}
812
813@emph{CR16 Options}
814@gccoptlist{-mmac @gol
815-mcr16cplus  -mcr16c @gol
816-msim  -mint32  -mbit-ops
817-mdata-model=@var{model}}
818
819@emph{C-SKY Options}
820@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
821-mbig-endian  -EB  -mlittle-endian  -EL @gol
822-mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
823-melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
824-mdsp  -medsp  -mvdsp @gol
825-mdiv  -msmart  -mhigh-registers  -manchor @gol
826-mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
827-mbranch-cost=@var{n}  -mcse-cc  -msched-prolog}
828
829@emph{Darwin Options}
830@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
831-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
832-client_name  -compatibility_version  -current_version @gol
833-dead_strip @gol
834-dependency-file  -dylib_file  -dylinker_install_name @gol
835-dynamic  -dynamiclib  -exported_symbols_list @gol
836-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
837-force_flat_namespace  -headerpad_max_install_names @gol
838-iframework @gol
839-image_base  -init  -install_name  -keep_private_externs @gol
840-multi_module  -multiply_defined  -multiply_defined_unused @gol
841-noall_load   -no_dead_strip_inits_and_terms @gol
842-nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
843-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
844-private_bundle  -read_only_relocs  -sectalign @gol
845-sectobjectsymbols  -whyload  -seg1addr @gol
846-sectcreate  -sectobjectsymbols  -sectorder @gol
847-segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
848-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
849-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
850-single_module  -static  -sub_library  -sub_umbrella @gol
851-twolevel_namespace  -umbrella  -undefined @gol
852-unexported_symbols_list  -weak_reference_mismatches @gol
853-whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
854-mkernel  -mone-byte-bool}
855
856@emph{DEC Alpha Options}
857@gccoptlist{-mno-fp-regs  -msoft-float @gol
858-mieee  -mieee-with-inexact  -mieee-conformant @gol
859-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
860-mtrap-precision=@var{mode}  -mbuild-constants @gol
861-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
862-mbwx  -mmax  -mfix  -mcix @gol
863-mfloat-vax  -mfloat-ieee @gol
864-mexplicit-relocs  -msmall-data  -mlarge-data @gol
865-msmall-text  -mlarge-text @gol
866-mmemory-latency=@var{time}}
867
868@emph{eBPF Options}
869@gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
870-mframe-limit=@var{bytes} -mxbpf}
871
872@emph{FR30 Options}
873@gccoptlist{-msmall-model  -mno-lsim}
874
875@emph{FT32 Options}
876@gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
877
878@emph{FRV Options}
879@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
880-mhard-float  -msoft-float @gol
881-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
882-mdouble  -mno-double @gol
883-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
884-mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
885-mlinked-fp  -mlong-calls  -malign-labels @gol
886-mlibrary-pic  -macc-4  -macc-8 @gol
887-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
888-moptimize-membar  -mno-optimize-membar @gol
889-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
890-mvliw-branch  -mno-vliw-branch @gol
891-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
892-mno-nested-cond-exec  -mtomcat-stats @gol
893-mTLS  -mtls @gol
894-mcpu=@var{cpu}}
895
896@emph{GNU/Linux Options}
897@gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
898-tno-android-cc  -tno-android-ld}
899
900@emph{H8/300 Options}
901@gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
902
903@emph{HPPA Options}
904@gccoptlist{-march=@var{architecture-type} @gol
905-mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
906-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
907-mfixed-range=@var{register-range} @gol
908-mjump-in-delay  -mlinker-opt  -mlong-calls @gol
909-mlong-load-store  -mno-disable-fpregs @gol
910-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
911-mno-jump-in-delay  -mno-long-load-store @gol
912-mno-portable-runtime  -mno-soft-float @gol
913-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
914-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
915-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
916-munix=@var{unix-std}  -nolibdld  -static  -threads}
917
918@emph{IA-64 Options}
919@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
920-mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
921-mconstant-gp  -mauto-pic  -mfused-madd @gol
922-minline-float-divide-min-latency @gol
923-minline-float-divide-max-throughput @gol
924-mno-inline-float-divide @gol
925-minline-int-divide-min-latency @gol
926-minline-int-divide-max-throughput  @gol
927-mno-inline-int-divide @gol
928-minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
929-mno-inline-sqrt @gol
930-mdwarf2-asm  -mearly-stop-bits @gol
931-mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
932-mtune=@var{cpu-type}  -milp32  -mlp64 @gol
933-msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
934-msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
935-msched-spec-ldc  -msched-spec-control-ldc @gol
936-msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
937-msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
938-msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
939-msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
940
941@emph{LM32 Options}
942@gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
943-msign-extend-enabled  -muser-enabled}
944
945@emph{M32R/D Options}
946@gccoptlist{-m32r2  -m32rx  -m32r @gol
947-mdebug @gol
948-malign-loops  -mno-align-loops @gol
949-missue-rate=@var{number} @gol
950-mbranch-cost=@var{number} @gol
951-mmodel=@var{code-size-model-type} @gol
952-msdata=@var{sdata-type} @gol
953-mno-flush-func  -mflush-func=@var{name} @gol
954-mno-flush-trap  -mflush-trap=@var{number} @gol
955-G @var{num}}
956
957@emph{M32C Options}
958@gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
959
960@emph{M680x0 Options}
961@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
962-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
963-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
964-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
965-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
966-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
967-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
968-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
969-mxgot  -mno-xgot  -mlong-jump-table-offsets}
970
971@emph{MCore Options}
972@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
973-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
974-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
975-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
976-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
977
978@emph{MeP Options}
979@gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
980-mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
981-mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
982-mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
983-mtiny=@var{n}}
984
985@emph{MicroBlaze Options}
986@gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
987-mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
988-mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
989-mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
990-mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
991-mpic-data-is-text-relative}
992
993@emph{MIPS Options}
994@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
995-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
996-mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
997-mips16  -mno-mips16  -mflip-mips16 @gol
998-minterlink-compressed  -mno-interlink-compressed @gol
999-minterlink-mips16  -mno-interlink-mips16 @gol
1000-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
1001-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1002-mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1003-mno-float  -msingle-float  -mdouble-float @gol
1004-modd-spreg  -mno-odd-spreg @gol
1005-mabs=@var{mode}  -mnan=@var{encoding} @gol
1006-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1007-mmcu  -mmno-mcu @gol
1008-meva  -mno-eva @gol
1009-mvirt  -mno-virt @gol
1010-mxpa  -mno-xpa @gol
1011-mcrc  -mno-crc @gol
1012-mginv  -mno-ginv @gol
1013-mmicromips  -mno-micromips @gol
1014-mmsa  -mno-msa @gol
1015-mloongson-mmi  -mno-loongson-mmi @gol
1016-mloongson-ext  -mno-loongson-ext @gol
1017-mloongson-ext2  -mno-loongson-ext2 @gol
1018-mfpu=@var{fpu-type} @gol
1019-msmartmips  -mno-smartmips @gol
1020-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1021-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1022-mlong64  -mlong32  -msym32  -mno-sym32 @gol
1023-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1024-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1025-membedded-data  -mno-embedded-data @gol
1026-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1027-mcode-readable=@var{setting} @gol
1028-msplit-addresses  -mno-split-addresses @gol
1029-mexplicit-relocs  -mno-explicit-relocs @gol
1030-mcheck-zero-division  -mno-check-zero-division @gol
1031-mdivide-traps  -mdivide-breaks @gol
1032-mload-store-pairs  -mno-load-store-pairs @gol
1033-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1034-mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1035-mfix-24k  -mno-fix-24k @gol
1036-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1037-mfix-r5900  -mno-fix-r5900 @gol
1038-mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1039-mfix-vr4120  -mno-fix-vr4120 @gol
1040-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1041-mflush-func=@var{func}  -mno-flush-func @gol
1042-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1043-mcompact-branches=@var{policy} @gol
1044-mfp-exceptions  -mno-fp-exceptions @gol
1045-mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1046-mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1047-mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1048-mframe-header-opt  -mno-frame-header-opt}
1049
1050@emph{MMIX Options}
1051@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1052-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1053-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1054-mno-base-addresses  -msingle-exit  -mno-single-exit}
1055
1056@emph{MN10300 Options}
1057@gccoptlist{-mmult-bug  -mno-mult-bug @gol
1058-mno-am33  -mam33  -mam33-2  -mam34 @gol
1059-mtune=@var{cpu-type} @gol
1060-mreturn-pointer-on-d0 @gol
1061-mno-crt0  -mrelax  -mliw  -msetlb}
1062
1063@emph{Moxie Options}
1064@gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1065
1066@emph{MSP430 Options}
1067@gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1068-mwarn-mcu @gol
1069-mcode-region=  -mdata-region= @gol
1070-msilicon-errata=  -msilicon-errata-warn= @gol
1071-mhwmult=  -minrt  -mtiny-printf}
1072
1073@emph{NDS32 Options}
1074@gccoptlist{-mbig-endian  -mlittle-endian @gol
1075-mreduced-regs  -mfull-regs @gol
1076-mcmov  -mno-cmov @gol
1077-mext-perf  -mno-ext-perf @gol
1078-mext-perf2  -mno-ext-perf2 @gol
1079-mext-string  -mno-ext-string @gol
1080-mv3push  -mno-v3push @gol
1081-m16bit  -mno-16bit @gol
1082-misr-vector-size=@var{num} @gol
1083-mcache-block-size=@var{num} @gol
1084-march=@var{arch} @gol
1085-mcmodel=@var{code-model} @gol
1086-mctor-dtor  -mrelax}
1087
1088@emph{Nios II Options}
1089@gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1090-mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1091-mel  -meb @gol
1092-mno-bypass-cache  -mbypass-cache @gol
1093-mno-cache-volatile  -mcache-volatile @gol
1094-mno-fast-sw-div  -mfast-sw-div @gol
1095-mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1096-mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1097-mcustom-fpu-cfg=@var{name} @gol
1098-mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1099-march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1100
1101@emph{Nvidia PTX Options}
1102@gccoptlist{-m32  -m64  -mmainkernel  -moptimize}
1103
1104@emph{OpenRISC Options}
1105@gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1106-msoft-mul  -msoft-div @gol
1107-msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1108-mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
1109
1110@emph{PDP-11 Options}
1111@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1112-mint32  -mno-int16  -mint16  -mno-int32 @gol
1113-msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1114
1115@emph{picoChip Options}
1116@gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1117-msymbol-as-address  -mno-inefficient-warnings}
1118
1119@emph{PowerPC Options}
1120See RS/6000 and PowerPC Options.
1121
1122@emph{PRU Options}
1123@gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1124-mabi=@var{variant} @gol}
1125
1126@emph{RISC-V Options}
1127@gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1128-mplt  -mno-plt @gol
1129-mabi=@var{ABI-string} @gol
1130-mfdiv  -mno-fdiv @gol
1131-mdiv  -mno-div @gol
1132-march=@var{ISA-string} @gol
1133-mtune=@var{processor-string} @gol
1134-mpreferred-stack-boundary=@var{num} @gol
1135-msmall-data-limit=@var{N-bytes} @gol
1136-msave-restore  -mno-save-restore @gol
1137-mstrict-align  -mno-strict-align @gol
1138-mcmodel=medlow  -mcmodel=medany @gol
1139-mexplicit-relocs  -mno-explicit-relocs @gol
1140-mrelax  -mno-relax @gol
1141-mriscv-attribute  -mmo-riscv-attribute @gol
1142-malign-data=@var{type}}
1143
1144@emph{RL78 Options}
1145@gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1146-mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1147-m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1148
1149@emph{RS/6000 and PowerPC Options}
1150@gccoptlist{-mcpu=@var{cpu-type} @gol
1151-mtune=@var{cpu-type} @gol
1152-mcmodel=@var{code-model} @gol
1153-mpowerpc64 @gol
1154-maltivec  -mno-altivec @gol
1155-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1156-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1157-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1158-mfprnd  -mno-fprnd @gol
1159-mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1160-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1161-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1162-malign-power  -malign-natural @gol
1163-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1164-mupdate  -mno-update @gol
1165-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1166-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1167-mstrict-align  -mno-strict-align  -mrelocatable @gol
1168-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1169-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1170-mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1171-mprioritize-restricted-insns=@var{priority} @gol
1172-msched-costly-dep=@var{dependence_type} @gol
1173-minsert-sched-nops=@var{scheme} @gol
1174-mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1175-mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1176-mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1177-mtraceback=@var{traceback_type} @gol
1178-maix-struct-return  -msvr4-struct-return @gol
1179-mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1180-mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1181-mblock-move-inline-limit=@var{num} @gol
1182-mblock-compare-inline-limit=@var{num} @gol
1183-mblock-compare-inline-loop-limit=@var{num} @gol
1184-mstring-compare-inline-limit=@var{num} @gol
1185-misel  -mno-isel @gol
1186-mvrsave  -mno-vrsave @gol
1187-mmulhw  -mno-mulhw @gol
1188-mdlmzb  -mno-dlmzb @gol
1189-mprototype  -mno-prototype @gol
1190-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1191-msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1192-mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1193-mno-recip-precision @gol
1194-mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1195-mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1196-msave-toc-indirect  -mno-save-toc-indirect @gol
1197-mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1198-mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1199-mquad-memory  -mno-quad-memory @gol
1200-mquad-memory-atomic  -mno-quad-memory-atomic @gol
1201-mcompat-align-parm  -mno-compat-align-parm @gol
1202-mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1203-mgnu-attribute  -mno-gnu-attribute @gol
1204-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1205-mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1206-mpcrel -mno-pcrel -mmma -mno-mmma}
1207
1208@emph{RX Options}
1209@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1210-mcpu=@gol
1211-mbig-endian-data  -mlittle-endian-data @gol
1212-msmall-data @gol
1213-msim  -mno-sim@gol
1214-mas100-syntax  -mno-as100-syntax@gol
1215-mrelax@gol
1216-mmax-constant-size=@gol
1217-mint-register=@gol
1218-mpid@gol
1219-mallow-string-insns  -mno-allow-string-insns@gol
1220-mjsr@gol
1221-mno-warn-multiple-fast-interrupts@gol
1222-msave-acc-in-interrupts}
1223
1224@emph{S/390 and zSeries Options}
1225@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1226-mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1227-mlong-double-64  -mlong-double-128 @gol
1228-mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1229-msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1230-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1231-mhtm  -mvx  -mzvector @gol
1232-mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip @gol
1233-mfused-madd  -mno-fused-madd @gol
1234-mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1235-mhotpatch=@var{halfwords},@var{halfwords}}
1236
1237@emph{Score Options}
1238@gccoptlist{-meb  -mel @gol
1239-mnhwloop @gol
1240-muls @gol
1241-mmac @gol
1242-mscore5  -mscore5u  -mscore7  -mscore7d}
1243
1244@emph{SH Options}
1245@gccoptlist{-m1  -m2  -m2e @gol
1246-m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1247-m3  -m3e @gol
1248-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1249-m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1250-mb  -ml  -mdalign  -mrelax @gol
1251-mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1252-mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1253-mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1254-mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1255-maccumulate-outgoing-args @gol
1256-matomic-model=@var{atomic-model} @gol
1257-mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1258-mcbranch-force-delay-slot @gol
1259-mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1260-mpretend-cmove  -mtas}
1261
1262@emph{Solaris 2 Options}
1263@gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1264-pthreads}
1265
1266@emph{SPARC Options}
1267@gccoptlist{-mcpu=@var{cpu-type} @gol
1268-mtune=@var{cpu-type} @gol
1269-mcmodel=@var{code-model} @gol
1270-mmemory-model=@var{mem-model} @gol
1271-m32  -m64  -mapp-regs  -mno-app-regs @gol
1272-mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1273-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1274-mhard-quad-float  -msoft-quad-float @gol
1275-mstack-bias  -mno-stack-bias @gol
1276-mstd-struct-return  -mno-std-struct-return @gol
1277-munaligned-doubles  -mno-unaligned-doubles @gol
1278-muser-mode  -mno-user-mode @gol
1279-mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1280-mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1281-mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1282-mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1283-mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1284-mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1285-mlra  -mno-lra}
1286
1287@emph{System V Options}
1288@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1289
1290@emph{TILE-Gx Options}
1291@gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1292-mcmodel=@var{code-model}}
1293
1294@emph{TILEPro Options}
1295@gccoptlist{-mcpu=@var{cpu}  -m32}
1296
1297@emph{V850 Options}
1298@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1299-mprolog-function  -mno-prolog-function  -mspace @gol
1300-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1301-mapp-regs  -mno-app-regs @gol
1302-mdisable-callt  -mno-disable-callt @gol
1303-mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1304-mv850e  -mv850  -mv850e3v5 @gol
1305-mloop @gol
1306-mrelax @gol
1307-mlong-jumps @gol
1308-msoft-float @gol
1309-mhard-float @gol
1310-mgcc-abi @gol
1311-mrh850-abi @gol
1312-mbig-switch}
1313
1314@emph{VAX Options}
1315@gccoptlist{-mg  -mgnu  -munix}
1316
1317@emph{Visium Options}
1318@gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1319-mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1320
1321@emph{VMS Options}
1322@gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1323-mpointer-size=@var{size}}
1324
1325@emph{VxWorks Options}
1326@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1327-Xbind-lazy  -Xbind-now}
1328
1329@emph{x86 Options}
1330@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1331-mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1332-mfpmath=@var{unit} @gol
1333-masm=@var{dialect}  -mno-fancy-math-387 @gol
1334-mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1335-mno-wide-multiply  -mrtd  -malign-double @gol
1336-mpreferred-stack-boundary=@var{num} @gol
1337-mincoming-stack-boundary=@var{num} @gol
1338-mcld  -mcx16  -msahf  -mmovbe  -mcrc32 @gol
1339-mrecip  -mrecip=@var{opt} @gol
1340-mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1341-mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1342-mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1343-mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1344-mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1345-mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1346-msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1347-madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1348-mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1349-mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1350-mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1351-mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1352-mrdseed  -msgx -mavx512vp2intersect@gol
1353-mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1354-minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1355-mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1356-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1357-m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1358-mregparm=@var{num}  -msseregparm @gol
1359-mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1360-mpc32  -mpc64  -mpc80  -mstackrealign @gol
1361-momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1362-mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1363-m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1364-msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1365-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1366-mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1367-malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1368-mstack-protector-guard-reg=@var{reg} @gol
1369-mstack-protector-guard-offset=@var{offset} @gol
1370-mstack-protector-guard-symbol=@var{symbol} @gol
1371-mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1372-mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1373-mindirect-branch-register}
1374
1375@emph{x86 Windows Options}
1376@gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1377-mnop-fun-dllimport  -mthread @gol
1378-municode  -mwin32  -mwindows  -fno-set-stack-executable}
1379
1380@emph{Xstormy16 Options}
1381@gccoptlist{-msim}
1382
1383@emph{Xtensa Options}
1384@gccoptlist{-mconst16  -mno-const16 @gol
1385-mfused-madd  -mno-fused-madd @gol
1386-mforce-no-pic @gol
1387-mserialize-volatile  -mno-serialize-volatile @gol
1388-mtext-section-literals  -mno-text-section-literals @gol
1389-mauto-litpools  -mno-auto-litpools @gol
1390-mtarget-align  -mno-target-align @gol
1391-mlongcalls  -mno-longcalls}
1392
1393@emph{zSeries Options}
1394See S/390 and zSeries Options.
1395@end table
1396
1397
1398@node Overall Options
1399@section Options Controlling the Kind of Output
1400
1401Compilation can involve up to four stages: preprocessing, compilation
1402proper, assembly and linking, always in that order.  GCC is capable of
1403preprocessing and compiling several files either into several
1404assembler input files, or into one assembler input file; then each
1405assembler input file produces an object file, and linking combines all
1406the object files (those newly compiled, and those specified as input)
1407into an executable file.
1408
1409@cindex file name suffix
1410For any given input file, the file name suffix determines what kind of
1411compilation is done:
1412
1413@table @gcctabopt
1414@item @var{file}.c
1415C source code that must be preprocessed.
1416
1417@item @var{file}.i
1418C source code that should not be preprocessed.
1419
1420@item @var{file}.ii
1421C++ source code that should not be preprocessed.
1422
1423@item @var{file}.m
1424Objective-C source code.  Note that you must link with the @file{libobjc}
1425library to make an Objective-C program work.
1426
1427@item @var{file}.mi
1428Objective-C source code that should not be preprocessed.
1429
1430@item @var{file}.mm
1431@itemx @var{file}.M
1432Objective-C++ source code.  Note that you must link with the @file{libobjc}
1433library to make an Objective-C++ program work.  Note that @samp{.M} refers
1434to a literal capital M@.
1435
1436@item @var{file}.mii
1437Objective-C++ source code that should not be preprocessed.
1438
1439@item @var{file}.h
1440C, C++, Objective-C or Objective-C++ header file to be turned into a
1441precompiled header (default), or C, C++ header file to be turned into an
1442Ada spec (via the @option{-fdump-ada-spec} switch).
1443
1444@item @var{file}.cc
1445@itemx @var{file}.cp
1446@itemx @var{file}.cxx
1447@itemx @var{file}.cpp
1448@itemx @var{file}.CPP
1449@itemx @var{file}.c++
1450@itemx @var{file}.C
1451C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1452the last two letters must both be literally @samp{x}.  Likewise,
1453@samp{.C} refers to a literal capital C@.
1454
1455@item @var{file}.mm
1456@itemx @var{file}.M
1457Objective-C++ source code that must be preprocessed.
1458
1459@item @var{file}.mii
1460Objective-C++ source code that should not be preprocessed.
1461
1462@item @var{file}.hh
1463@itemx @var{file}.H
1464@itemx @var{file}.hp
1465@itemx @var{file}.hxx
1466@itemx @var{file}.hpp
1467@itemx @var{file}.HPP
1468@itemx @var{file}.h++
1469@itemx @var{file}.tcc
1470C++ header file to be turned into a precompiled header or Ada spec.
1471
1472@item @var{file}.f
1473@itemx @var{file}.for
1474@itemx @var{file}.ftn
1475Fixed form Fortran source code that should not be preprocessed.
1476
1477@item @var{file}.F
1478@itemx @var{file}.FOR
1479@itemx @var{file}.fpp
1480@itemx @var{file}.FPP
1481@itemx @var{file}.FTN
1482Fixed form Fortran source code that must be preprocessed (with the traditional
1483preprocessor).
1484
1485@item @var{file}.f90
1486@itemx @var{file}.f95
1487@itemx @var{file}.f03
1488@itemx @var{file}.f08
1489Free form Fortran source code that should not be preprocessed.
1490
1491@item @var{file}.F90
1492@itemx @var{file}.F95
1493@itemx @var{file}.F03
1494@itemx @var{file}.F08
1495Free form Fortran source code that must be preprocessed (with the
1496traditional preprocessor).
1497
1498@item @var{file}.go
1499Go source code.
1500
1501@item @var{file}.brig
1502BRIG files (binary representation of HSAIL).
1503
1504@item @var{file}.d
1505D source code.
1506
1507@item @var{file}.di
1508D interface file.
1509
1510@item @var{file}.dd
1511D documentation code (Ddoc).
1512
1513@item @var{file}.ads
1514Ada source code file that contains a library unit declaration (a
1515declaration of a package, subprogram, or generic, or a generic
1516instantiation), or a library unit renaming declaration (a package,
1517generic, or subprogram renaming declaration).  Such files are also
1518called @dfn{specs}.
1519
1520@item @var{file}.adb
1521Ada source code file containing a library unit body (a subprogram or
1522package body).  Such files are also called @dfn{bodies}.
1523
1524@c GCC also knows about some suffixes for languages not yet included:
1525@c Ratfor:
1526@c @var{file}.r
1527
1528@item @var{file}.s
1529Assembler code.
1530
1531@item @var{file}.S
1532@itemx @var{file}.sx
1533Assembler code that must be preprocessed.
1534
1535@item @var{other}
1536An object file to be fed straight into linking.
1537Any file name with no recognized suffix is treated this way.
1538@end table
1539
1540@opindex x
1541You can specify the input language explicitly with the @option{-x} option:
1542
1543@table @gcctabopt
1544@item -x @var{language}
1545Specify explicitly the @var{language} for the following input files
1546(rather than letting the compiler choose a default based on the file
1547name suffix).  This option applies to all following input files until
1548the next @option{-x} option.  Possible values for @var{language} are:
1549@smallexample
1550c  c-header  cpp-output
1551c++  c++-header  c++-cpp-output
1552objective-c  objective-c-header  objective-c-cpp-output
1553objective-c++ objective-c++-header objective-c++-cpp-output
1554assembler  assembler-with-cpp
1555ada
1556d
1557f77  f77-cpp-input f95  f95-cpp-input
1558go
1559brig
1560@end smallexample
1561
1562@item -x none
1563Turn off any specification of a language, so that subsequent files are
1564handled according to their file name suffixes (as they are if @option{-x}
1565has not been used at all).
1566@end table
1567
1568If you only want some of the stages of compilation, you can use
1569@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1570one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1571@command{gcc} is to stop.  Note that some combinations (for example,
1572@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1573
1574@table @gcctabopt
1575@item -c
1576@opindex c
1577Compile or assemble the source files, but do not link.  The linking
1578stage simply is not done.  The ultimate output is in the form of an
1579object file for each source file.
1580
1581By default, the object file name for a source file is made by replacing
1582the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1583
1584Unrecognized input files, not requiring compilation or assembly, are
1585ignored.
1586
1587@item -S
1588@opindex S
1589Stop after the stage of compilation proper; do not assemble.  The output
1590is in the form of an assembler code file for each non-assembler input
1591file specified.
1592
1593By default, the assembler file name for a source file is made by
1594replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1595
1596Input files that don't require compilation are ignored.
1597
1598@item -E
1599@opindex E
1600Stop after the preprocessing stage; do not run the compiler proper.  The
1601output is in the form of preprocessed source code, which is sent to the
1602standard output.
1603
1604Input files that don't require preprocessing are ignored.
1605
1606@cindex output file option
1607@item -o @var{file}
1608@opindex o
1609Place output in file @var{file}.  This applies to whatever
1610sort of output is being produced, whether it be an executable file,
1611an object file, an assembler file or preprocessed C code.
1612
1613If @option{-o} is not specified, the default is to put an executable
1614file in @file{a.out}, the object file for
1615@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1616assembler file in @file{@var{source}.s}, a precompiled header file in
1617@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1618standard output.
1619
1620@item -v
1621@opindex v
1622Print (on standard error output) the commands executed to run the stages
1623of compilation.  Also print the version number of the compiler driver
1624program and of the preprocessor and the compiler proper.
1625
1626@item -###
1627@opindex ###
1628Like @option{-v} except the commands are not executed and arguments
1629are quoted unless they contain only alphanumeric characters or @code{./-_}.
1630This is useful for shell scripts to capture the driver-generated command lines.
1631
1632@item --help
1633@opindex help
1634Print (on the standard output) a description of the command-line options
1635understood by @command{gcc}.  If the @option{-v} option is also specified
1636then @option{--help} is also passed on to the various processes
1637invoked by @command{gcc}, so that they can display the command-line options
1638they accept.  If the @option{-Wextra} option has also been specified
1639(prior to the @option{--help} option), then command-line options that
1640have no documentation associated with them are also displayed.
1641
1642@item --target-help
1643@opindex target-help
1644Print (on the standard output) a description of target-specific command-line
1645options for each tool.  For some targets extra target-specific
1646information may also be printed.
1647
1648@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1649Print (on the standard output) a description of the command-line
1650options understood by the compiler that fit into all specified classes
1651and qualifiers.  These are the supported classes:
1652
1653@table @asis
1654@item @samp{optimizers}
1655Display all of the optimization options supported by the
1656compiler.
1657
1658@item @samp{warnings}
1659Display all of the options controlling warning messages
1660produced by the compiler.
1661
1662@item @samp{target}
1663Display target-specific options.  Unlike the
1664@option{--target-help} option however, target-specific options of the
1665linker and assembler are not displayed.  This is because those
1666tools do not currently support the extended @option{--help=} syntax.
1667
1668@item @samp{params}
1669Display the values recognized by the @option{--param}
1670option.
1671
1672@item @var{language}
1673Display the options supported for @var{language}, where
1674@var{language} is the name of one of the languages supported in this
1675version of GCC@.  If an option is supported by all languages, one needs
1676to select @samp{common} class.
1677
1678@item @samp{common}
1679Display the options that are common to all languages.
1680@end table
1681
1682These are the supported qualifiers:
1683
1684@table @asis
1685@item @samp{undocumented}
1686Display only those options that are undocumented.
1687
1688@item @samp{joined}
1689Display options taking an argument that appears after an equal
1690sign in the same continuous piece of text, such as:
1691@samp{--help=target}.
1692
1693@item @samp{separate}
1694Display options taking an argument that appears as a separate word
1695following the original option, such as: @samp{-o output-file}.
1696@end table
1697
1698Thus for example to display all the undocumented target-specific
1699switches supported by the compiler, use:
1700
1701@smallexample
1702--help=target,undocumented
1703@end smallexample
1704
1705The sense of a qualifier can be inverted by prefixing it with the
1706@samp{^} character, so for example to display all binary warning
1707options (i.e., ones that are either on or off and that do not take an
1708argument) that have a description, use:
1709
1710@smallexample
1711--help=warnings,^joined,^undocumented
1712@end smallexample
1713
1714The argument to @option{--help=} should not consist solely of inverted
1715qualifiers.
1716
1717Combining several classes is possible, although this usually
1718restricts the output so much that there is nothing to display.  One
1719case where it does work, however, is when one of the classes is
1720@var{target}.  For example, to display all the target-specific
1721optimization options, use:
1722
1723@smallexample
1724--help=target,optimizers
1725@end smallexample
1726
1727The @option{--help=} option can be repeated on the command line.  Each
1728successive use displays its requested class of options, skipping
1729those that have already been displayed.  If @option{--help} is also
1730specified anywhere on the command line then this takes precedence
1731over any @option{--help=} option.
1732
1733If the @option{-Q} option appears on the command line before the
1734@option{--help=} option, then the descriptive text displayed by
1735@option{--help=} is changed.  Instead of describing the displayed
1736options, an indication is given as to whether the option is enabled,
1737disabled or set to a specific value (assuming that the compiler
1738knows this at the point where the @option{--help=} option is used).
1739
1740Here is a truncated example from the ARM port of @command{gcc}:
1741
1742@smallexample
1743  % gcc -Q -mabi=2 --help=target -c
1744  The following options are target specific:
1745  -mabi=                                2
1746  -mabort-on-noreturn                   [disabled]
1747  -mapcs                                [disabled]
1748@end smallexample
1749
1750The output is sensitive to the effects of previous command-line
1751options, so for example it is possible to find out which optimizations
1752are enabled at @option{-O2} by using:
1753
1754@smallexample
1755-Q -O2 --help=optimizers
1756@end smallexample
1757
1758Alternatively you can discover which binary optimizations are enabled
1759by @option{-O3} by using:
1760
1761@smallexample
1762gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1763gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1764diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1765@end smallexample
1766
1767@item --version
1768@opindex version
1769Display the version number and copyrights of the invoked GCC@.
1770
1771@item -pass-exit-codes
1772@opindex pass-exit-codes
1773Normally the @command{gcc} program exits with the code of 1 if any
1774phase of the compiler returns a non-success return code.  If you specify
1775@option{-pass-exit-codes}, the @command{gcc} program instead returns with
1776the numerically highest error produced by any phase returning an error
1777indication.  The C, C++, and Fortran front ends return 4 if an internal
1778compiler error is encountered.
1779
1780@item -pipe
1781@opindex pipe
1782Use pipes rather than temporary files for communication between the
1783various stages of compilation.  This fails to work on some systems where
1784the assembler is unable to read from a pipe; but the GNU assembler has
1785no trouble.
1786
1787@item -specs=@var{file}
1788@opindex specs
1789Process @var{file} after the compiler reads in the standard @file{specs}
1790file, in order to override the defaults which the @command{gcc} driver
1791program uses when determining what switches to pass to @command{cc1},
1792@command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
1793@option{-specs=@var{file}} can be specified on the command line, and they
1794are processed in order, from left to right.  @xref{Spec Files}, for
1795information about the format of the @var{file}.
1796
1797@item -wrapper
1798@opindex wrapper
1799Invoke all subcommands under a wrapper program.  The name of the
1800wrapper program and its parameters are passed as a comma separated
1801list.
1802
1803@smallexample
1804gcc -c t.c -wrapper gdb,--args
1805@end smallexample
1806
1807@noindent
1808This invokes all subprograms of @command{gcc} under
1809@samp{gdb --args}, thus the invocation of @command{cc1} is
1810@samp{gdb --args cc1 @dots{}}.
1811
1812@item -ffile-prefix-map=@var{old}=@var{new}
1813@opindex ffile-prefix-map
1814When compiling files residing in directory @file{@var{old}}, record
1815any references to them in the result of the compilation as if the
1816files resided in directory @file{@var{new}} instead.  Specifying this
1817option is equivalent to specifying all the individual
1818@option{-f*-prefix-map} options.  This can be used to make reproducible
1819builds that are location independent.  See also
1820@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1821
1822@item -fplugin=@var{name}.so
1823@opindex fplugin
1824Load the plugin code in file @var{name}.so, assumed to be a
1825shared object to be dlopen'd by the compiler.  The base name of
1826the shared object file is used to identify the plugin for the
1827purposes of argument parsing (See
1828@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1829Each plugin should define the callback functions specified in the
1830Plugins API.
1831
1832@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1833@opindex fplugin-arg
1834Define an argument called @var{key} with a value of @var{value}
1835for the plugin called @var{name}.
1836
1837@item -fdump-ada-spec@r{[}-slim@r{]}
1838@opindex fdump-ada-spec
1839For C and C++ source and include files, generate corresponding Ada specs.
1840@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1841GNAT User's Guide}, which provides detailed documentation on this feature.
1842
1843@item -fada-spec-parent=@var{unit}
1844@opindex fada-spec-parent
1845In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1846Ada specs as child units of parent @var{unit}.
1847
1848@item -fdump-go-spec=@var{file}
1849@opindex fdump-go-spec
1850For input files in any language, generate corresponding Go
1851declarations in @var{file}.  This generates Go @code{const},
1852@code{type}, @code{var}, and @code{func} declarations which may be a
1853useful way to start writing a Go interface to code written in some
1854other language.
1855
1856@include @value{srcdir}/../libiberty/at-file.texi
1857@end table
1858
1859@node Invoking G++
1860@section Compiling C++ Programs
1861
1862@cindex suffixes for C++ source
1863@cindex C++ source file suffixes
1864C++ source files conventionally use one of the suffixes @samp{.C},
1865@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1866@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1867@samp{.H}, or (for shared template code) @samp{.tcc}; and
1868preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1869files with these names and compiles them as C++ programs even if you
1870call the compiler the same way as for compiling C programs (usually
1871with the name @command{gcc}).
1872
1873@findex g++
1874@findex c++
1875However, the use of @command{gcc} does not add the C++ library.
1876@command{g++} is a program that calls GCC and automatically specifies linking
1877against the C++ library.  It treats @samp{.c},
1878@samp{.h} and @samp{.i} files as C++ source files instead of C source
1879files unless @option{-x} is used.  This program is also useful when
1880precompiling a C header file with a @samp{.h} extension for use in C++
1881compilations.  On many systems, @command{g++} is also installed with
1882the name @command{c++}.
1883
1884@cindex invoking @command{g++}
1885When you compile C++ programs, you may specify many of the same
1886command-line options that you use for compiling programs in any
1887language; or command-line options meaningful for C and related
1888languages; or options that are meaningful only for C++ programs.
1889@xref{C Dialect Options,,Options Controlling C Dialect}, for
1890explanations of options for languages related to C@.
1891@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1892explanations of options that are meaningful only for C++ programs.
1893
1894@node C Dialect Options
1895@section Options Controlling C Dialect
1896@cindex dialect options
1897@cindex language dialect options
1898@cindex options, dialect
1899
1900The following options control the dialect of C (or languages derived
1901from C, such as C++, Objective-C and Objective-C++) that the compiler
1902accepts:
1903
1904@table @gcctabopt
1905@cindex ANSI support
1906@cindex ISO support
1907@item -ansi
1908@opindex ansi
1909In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1910equivalent to @option{-std=c++98}.
1911
1912This turns off certain features of GCC that are incompatible with ISO
1913C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1914such as the @code{asm} and @code{typeof} keywords, and
1915predefined macros such as @code{unix} and @code{vax} that identify the
1916type of system you are using.  It also enables the undesirable and
1917rarely used ISO trigraph feature.  For the C compiler,
1918it disables recognition of C++ style @samp{//} comments as well as
1919the @code{inline} keyword.
1920
1921The alternate keywords @code{__asm__}, @code{__extension__},
1922@code{__inline__} and @code{__typeof__} continue to work despite
1923@option{-ansi}.  You would not want to use them in an ISO C program, of
1924course, but it is useful to put them in header files that might be included
1925in compilations done with @option{-ansi}.  Alternate predefined macros
1926such as @code{__unix__} and @code{__vax__} are also available, with or
1927without @option{-ansi}.
1928
1929The @option{-ansi} option does not cause non-ISO programs to be
1930rejected gratuitously.  For that, @option{-Wpedantic} is required in
1931addition to @option{-ansi}.  @xref{Warning Options}.
1932
1933The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1934option is used.  Some header files may notice this macro and refrain
1935from declaring certain functions or defining certain macros that the
1936ISO standard doesn't call for; this is to avoid interfering with any
1937programs that might use these names for other things.
1938
1939Functions that are normally built in but do not have semantics
1940defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1941functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1942built-in functions provided by GCC}, for details of the functions
1943affected.
1944
1945@item -std=
1946@opindex std
1947Determine the language standard. @xref{Standards,,Language Standards
1948Supported by GCC}, for details of these standard versions.  This option
1949is currently only supported when compiling C or C++.
1950
1951The compiler can accept several base standards, such as @samp{c90} or
1952@samp{c++98}, and GNU dialects of those standards, such as
1953@samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
1954compiler accepts all programs following that standard plus those
1955using GNU extensions that do not contradict it.  For example,
1956@option{-std=c90} turns off certain features of GCC that are
1957incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1958keywords, but not other GNU extensions that do not have a meaning in
1959ISO C90, such as omitting the middle term of a @code{?:}
1960expression. On the other hand, when a GNU dialect of a standard is
1961specified, all features supported by the compiler are enabled, even when
1962those features change the meaning of the base standard.  As a result, some
1963strict-conforming programs may be rejected.  The particular standard
1964is used by @option{-Wpedantic} to identify which features are GNU
1965extensions given that version of the standard. For example
1966@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1967comments, while @option{-std=gnu99 -Wpedantic} does not.
1968
1969A value for this option must be provided; possible values are
1970
1971@table @samp
1972@item c90
1973@itemx c89
1974@itemx iso9899:1990
1975Support all ISO C90 programs (certain GNU extensions that conflict
1976with ISO C90 are disabled). Same as @option{-ansi} for C code.
1977
1978@item iso9899:199409
1979ISO C90 as modified in amendment 1.
1980
1981@item c99
1982@itemx c9x
1983@itemx iso9899:1999
1984@itemx iso9899:199x
1985ISO C99.  This standard is substantially completely supported, modulo
1986bugs and floating-point issues
1987(mainly but not entirely relating to optional C99 features from
1988Annexes F and G).  See
1989@w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1990names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1991
1992@item c11
1993@itemx c1x
1994@itemx iso9899:2011
1995ISO C11, the 2011 revision of the ISO C standard.  This standard is
1996substantially completely supported, modulo bugs, floating-point issues
1997(mainly but not entirely relating to optional C11 features from
1998Annexes F and G) and the optional Annexes K (Bounds-checking
1999interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2000
2001@item c17
2002@itemx c18
2003@itemx iso9899:2017
2004@itemx iso9899:2018
2005ISO C17, the 2017 revision of the ISO C standard
2006(published in 2018).  This standard is
2007same as C11 except for corrections of defects (all of which are also
2008applied with @option{-std=c11}) and a new value of
2009@code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2010
2011@item c2x
2012The next version of the ISO C standard, still under development.  The
2013support for this version is experimental and incomplete.
2014
2015@item gnu90
2016@itemx gnu89
2017GNU dialect of ISO C90 (including some C99 features).
2018
2019@item gnu99
2020@itemx gnu9x
2021GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2022
2023@item gnu11
2024@itemx gnu1x
2025GNU dialect of ISO C11.
2026The name @samp{gnu1x} is deprecated.
2027
2028@item gnu17
2029@itemx gnu18
2030GNU dialect of ISO C17.  This is the default for C code.
2031
2032@item gnu2x
2033The next version of the ISO C standard, still under development, plus
2034GNU extensions.  The support for this version is experimental and
2035incomplete.
2036
2037@item c++98
2038@itemx c++03
2039The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2040additional defect reports. Same as @option{-ansi} for C++ code.
2041
2042@item gnu++98
2043@itemx gnu++03
2044GNU dialect of @option{-std=c++98}.
2045
2046@item c++11
2047@itemx c++0x
2048The 2011 ISO C++ standard plus amendments.
2049The name @samp{c++0x} is deprecated.
2050
2051@item gnu++11
2052@itemx gnu++0x
2053GNU dialect of @option{-std=c++11}.
2054The name @samp{gnu++0x} is deprecated.
2055
2056@item c++14
2057@itemx c++1y
2058The 2014 ISO C++ standard plus amendments.
2059The name @samp{c++1y} is deprecated.
2060
2061@item gnu++14
2062@itemx gnu++1y
2063GNU dialect of @option{-std=c++14}.
2064This is the default for C++ code.
2065The name @samp{gnu++1y} is deprecated.
2066
2067@item c++17
2068@itemx c++1z
2069The 2017 ISO C++ standard plus amendments.
2070The name @samp{c++1z} is deprecated.
2071
2072@item gnu++17
2073@itemx gnu++1z
2074GNU dialect of @option{-std=c++17}.
2075The name @samp{gnu++1z} is deprecated.
2076
2077@item c++20
2078@itemx c++2a
2079The next revision of the ISO C++ standard, planned for
20802020.  Support is highly experimental, and will almost certainly
2081change in incompatible ways in future releases.
2082
2083@item gnu++20
2084@itemx gnu++2a
2085GNU dialect of @option{-std=c++20}.  Support is highly experimental,
2086and will almost certainly change in incompatible ways in future
2087releases.
2088@end table
2089
2090@item -fgnu89-inline
2091@opindex fgnu89-inline
2092The option @option{-fgnu89-inline} tells GCC to use the traditional
2093GNU semantics for @code{inline} functions when in C99 mode.
2094@xref{Inline,,An Inline Function is As Fast As a Macro}.
2095Using this option is roughly equivalent to adding the
2096@code{gnu_inline} function attribute to all inline functions
2097(@pxref{Function Attributes}).
2098
2099The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2100C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2101specifies the default behavior).
2102This option is not supported in @option{-std=c90} or
2103@option{-std=gnu90} mode.
2104
2105The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2106@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2107in effect for @code{inline} functions.  @xref{Common Predefined
2108Macros,,,cpp,The C Preprocessor}.
2109
2110@item -fpermitted-flt-eval-methods=@var{style}
2111@opindex fpermitted-flt-eval-methods
2112@opindex fpermitted-flt-eval-methods=c11
2113@opindex fpermitted-flt-eval-methods=ts-18661-3
2114ISO/IEC TS 18661-3 defines new permissible values for
2115@code{FLT_EVAL_METHOD} that indicate that operations and constants with
2116a semantic type that is an interchange or extended format should be
2117evaluated to the precision and range of that type.  These new values are
2118a superset of those permitted under C99/C11, which does not specify the
2119meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2120conforming to C11 may not have been written expecting the possibility of
2121the new values.
2122
2123@option{-fpermitted-flt-eval-methods} specifies whether the compiler
2124should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2125or the extended set of values specified in ISO/IEC TS 18661-3.
2126
2127@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2128
2129The default when in a standards compliant mode (@option{-std=c11} or similar)
2130is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2131dialect (@option{-std=gnu11} or similar) is
2132@option{-fpermitted-flt-eval-methods=ts-18661-3}.
2133
2134@item -aux-info @var{filename}
2135@opindex aux-info
2136Output to the given filename prototyped declarations for all functions
2137declared and/or defined in a translation unit, including those in header
2138files.  This option is silently ignored in any language other than C@.
2139
2140Besides declarations, the file indicates, in comments, the origin of
2141each declaration (source file and line), whether the declaration was
2142implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2143@samp{O} for old, respectively, in the first character after the line
2144number and the colon), and whether it came from a declaration or a
2145definition (@samp{C} or @samp{F}, respectively, in the following
2146character).  In the case of function definitions, a K&R-style list of
2147arguments followed by their declarations is also provided, inside
2148comments, after the declaration.
2149
2150@item -fallow-parameterless-variadic-functions
2151@opindex fallow-parameterless-variadic-functions
2152Accept variadic functions without named parameters.
2153
2154Although it is possible to define such a function, this is not very
2155useful as it is not possible to read the arguments.  This is only
2156supported for C as this construct is allowed by C++.
2157
2158@item -fno-asm
2159@opindex fno-asm
2160@opindex fasm
2161Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2162keyword, so that code can use these words as identifiers.  You can use
2163the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2164instead.  @option{-ansi} implies @option{-fno-asm}.
2165
2166In C++, this switch only affects the @code{typeof} keyword, since
2167@code{asm} and @code{inline} are standard keywords.  You may want to
2168use the @option{-fno-gnu-keywords} flag instead, which has the same
2169effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2170switch only affects the @code{asm} and @code{typeof} keywords, since
2171@code{inline} is a standard keyword in ISO C99.
2172
2173@item -fno-builtin
2174@itemx -fno-builtin-@var{function}
2175@opindex fno-builtin
2176@opindex fbuiltin
2177@cindex built-in functions
2178Don't recognize built-in functions that do not begin with
2179@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2180functions provided by GCC}, for details of the functions affected,
2181including those which are not built-in functions when @option{-ansi} or
2182@option{-std} options for strict ISO C conformance are used because they
2183do not have an ISO standard meaning.
2184
2185GCC normally generates special code to handle certain built-in functions
2186more efficiently; for instance, calls to @code{alloca} may become single
2187instructions which adjust the stack directly, and calls to @code{memcpy}
2188may become inline copy loops.  The resulting code is often both smaller
2189and faster, but since the function calls no longer appear as such, you
2190cannot set a breakpoint on those calls, nor can you change the behavior
2191of the functions by linking with a different library.  In addition,
2192when a function is recognized as a built-in function, GCC may use
2193information about that function to warn about problems with calls to
2194that function, or to generate more efficient code, even if the
2195resulting code still contains calls to that function.  For example,
2196warnings are given with @option{-Wformat} for bad calls to
2197@code{printf} when @code{printf} is built in and @code{strlen} is
2198known not to modify global memory.
2199
2200With the @option{-fno-builtin-@var{function}} option
2201only the built-in function @var{function} is
2202disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2203function is named that is not built-in in this version of GCC, this
2204option is ignored.  There is no corresponding
2205@option{-fbuiltin-@var{function}} option; if you wish to enable
2206built-in functions selectively when using @option{-fno-builtin} or
2207@option{-ffreestanding}, you may define macros such as:
2208
2209@smallexample
2210#define abs(n)          __builtin_abs ((n))
2211#define strcpy(d, s)    __builtin_strcpy ((d), (s))
2212@end smallexample
2213
2214@item -fgimple
2215@opindex fgimple
2216
2217Enable parsing of function definitions marked with @code{__GIMPLE}.
2218This is an experimental feature that allows unit testing of GIMPLE
2219passes.
2220
2221@item -fhosted
2222@opindex fhosted
2223@cindex hosted environment
2224
2225Assert that compilation targets a hosted environment.  This implies
2226@option{-fbuiltin}.  A hosted environment is one in which the
2227entire standard library is available, and in which @code{main} has a return
2228type of @code{int}.  Examples are nearly everything except a kernel.
2229This is equivalent to @option{-fno-freestanding}.
2230
2231@item -ffreestanding
2232@opindex ffreestanding
2233@cindex hosted environment
2234
2235Assert that compilation targets a freestanding environment.  This
2236implies @option{-fno-builtin}.  A freestanding environment
2237is one in which the standard library may not exist, and program startup may
2238not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2239This is equivalent to @option{-fno-hosted}.
2240
2241@xref{Standards,,Language Standards Supported by GCC}, for details of
2242freestanding and hosted environments.
2243
2244@item -fopenacc
2245@opindex fopenacc
2246@cindex OpenACC accelerator programming
2247Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2248@code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2249compiler generates accelerated code according to the OpenACC Application
2250Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2251implies @option{-pthread}, and thus is only supported on targets that
2252have support for @option{-pthread}.
2253
2254@item -fopenacc-dim=@var{geom}
2255@opindex fopenacc-dim
2256@cindex OpenACC accelerator programming
2257Specify default compute dimensions for parallel offload regions that do
2258not explicitly specify.  The @var{geom} value is a triple of
2259':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2260can be omitted, to use a target-specific default value.
2261
2262@item -fopenmp
2263@opindex fopenmp
2264@cindex OpenMP parallel
2265Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2266@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2267compiler generates parallel code according to the OpenMP Application
2268Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2269implies @option{-pthread}, and thus is only supported on targets that
2270have support for @option{-pthread}. @option{-fopenmp} implies
2271@option{-fopenmp-simd}.
2272
2273@item -fopenmp-simd
2274@opindex fopenmp-simd
2275@cindex OpenMP SIMD
2276@cindex SIMD
2277Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2278in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2279are ignored.
2280
2281@item -fgnu-tm
2282@opindex fgnu-tm
2283When the option @option{-fgnu-tm} is specified, the compiler
2284generates code for the Linux variant of Intel's current Transactional
2285Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2286an experimental feature whose interface may change in future versions
2287of GCC, as the official specification changes.  Please note that not
2288all architectures are supported for this feature.
2289
2290For more information on GCC's support for transactional memory,
2291@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2292Transactional Memory Library}.
2293
2294Note that the transactional memory feature is not supported with
2295non-call exceptions (@option{-fnon-call-exceptions}).
2296
2297@item -fms-extensions
2298@opindex fms-extensions
2299Accept some non-standard constructs used in Microsoft header files.
2300
2301In C++ code, this allows member names in structures to be similar
2302to previous types declarations.
2303
2304@smallexample
2305typedef int UOW;
2306struct ABC @{
2307  UOW UOW;
2308@};
2309@end smallexample
2310
2311Some cases of unnamed fields in structures and unions are only
2312accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2313fields within structs/unions}, for details.
2314
2315Note that this option is off for all targets except for x86
2316targets using ms-abi.
2317
2318@item -fplan9-extensions
2319@opindex fplan9-extensions
2320Accept some non-standard constructs used in Plan 9 code.
2321
2322This enables @option{-fms-extensions}, permits passing pointers to
2323structures with anonymous fields to functions that expect pointers to
2324elements of the type of the field, and permits referring to anonymous
2325fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2326struct/union fields within structs/unions}, for details.  This is only
2327supported for C, not C++.
2328
2329@item -fcond-mismatch
2330@opindex fcond-mismatch
2331Allow conditional expressions with mismatched types in the second and
2332third arguments.  The value of such an expression is void.  This option
2333is not supported for C++.
2334
2335@item -flax-vector-conversions
2336@opindex flax-vector-conversions
2337Allow implicit conversions between vectors with differing numbers of
2338elements and/or incompatible element types.  This option should not be
2339used for new code.
2340
2341@item -funsigned-char
2342@opindex funsigned-char
2343Let the type @code{char} be unsigned, like @code{unsigned char}.
2344
2345Each kind of machine has a default for what @code{char} should
2346be.  It is either like @code{unsigned char} by default or like
2347@code{signed char} by default.
2348
2349Ideally, a portable program should always use @code{signed char} or
2350@code{unsigned char} when it depends on the signedness of an object.
2351But many programs have been written to use plain @code{char} and
2352expect it to be signed, or expect it to be unsigned, depending on the
2353machines they were written for.  This option, and its inverse, let you
2354make such a program work with the opposite default.
2355
2356The type @code{char} is always a distinct type from each of
2357@code{signed char} or @code{unsigned char}, even though its behavior
2358is always just like one of those two.
2359
2360@item -fsigned-char
2361@opindex fsigned-char
2362Let the type @code{char} be signed, like @code{signed char}.
2363
2364Note that this is equivalent to @option{-fno-unsigned-char}, which is
2365the negative form of @option{-funsigned-char}.  Likewise, the option
2366@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2367
2368@item -fsigned-bitfields
2369@itemx -funsigned-bitfields
2370@itemx -fno-signed-bitfields
2371@itemx -fno-unsigned-bitfields
2372@opindex fsigned-bitfields
2373@opindex funsigned-bitfields
2374@opindex fno-signed-bitfields
2375@opindex fno-unsigned-bitfields
2376These options control whether a bit-field is signed or unsigned, when the
2377declaration does not use either @code{signed} or @code{unsigned}.  By
2378default, such a bit-field is signed, because this is consistent: the
2379basic integer types such as @code{int} are signed types.
2380
2381@item -fsso-struct=@var{endianness}
2382@opindex fsso-struct
2383Set the default scalar storage order of structures and unions to the
2384specified endianness.  The accepted values are @samp{big-endian},
2385@samp{little-endian} and @samp{native} for the native endianness of
2386the target (the default).  This option is not supported for C++.
2387
2388@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2389code that is not binary compatible with code generated without it if the
2390specified endianness is not the native endianness of the target.
2391@end table
2392
2393@node C++ Dialect Options
2394@section Options Controlling C++ Dialect
2395
2396@cindex compiler options, C++
2397@cindex C++ options, command-line
2398@cindex options, C++
2399This section describes the command-line options that are only meaningful
2400for C++ programs.  You can also use most of the GNU compiler options
2401regardless of what language your program is in.  For example, you
2402might compile a file @file{firstClass.C} like this:
2403
2404@smallexample
2405g++ -g -fstrict-enums -O -c firstClass.C
2406@end smallexample
2407
2408@noindent
2409In this example, only @option{-fstrict-enums} is an option meant
2410only for C++ programs; you can use the other options with any
2411language supported by GCC@.
2412
2413Some options for compiling C programs, such as @option{-std}, are also
2414relevant for C++ programs.
2415@xref{C Dialect Options,,Options Controlling C Dialect}.
2416
2417Here is a list of options that are @emph{only} for compiling C++ programs:
2418
2419@table @gcctabopt
2420
2421@item -fabi-version=@var{n}
2422@opindex fabi-version
2423Use version @var{n} of the C++ ABI@.  The default is version 0.
2424
2425Version 0 refers to the version conforming most closely to
2426the C++ ABI specification.  Therefore, the ABI obtained using version 0
2427will change in different versions of G++ as ABI bugs are fixed.
2428
2429Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2430
2431Version 2 is the version of the C++ ABI that first appeared in G++
24323.4, and was the default through G++ 4.9.
2433
2434Version 3 corrects an error in mangling a constant address as a
2435template argument.
2436
2437Version 4, which first appeared in G++ 4.5, implements a standard
2438mangling for vector types.
2439
2440Version 5, which first appeared in G++ 4.6, corrects the mangling of
2441attribute const/volatile on function pointer types, decltype of a
2442plain decl, and use of a function parameter in the declaration of
2443another parameter.
2444
2445Version 6, which first appeared in G++ 4.7, corrects the promotion
2446behavior of C++11 scoped enums and the mangling of template argument
2447packs, const/static_cast, prefix ++ and --, and a class scope function
2448used as a template argument.
2449
2450Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2451builtin type and corrects the mangling of lambdas in default argument
2452scope.
2453
2454Version 8, which first appeared in G++ 4.9, corrects the substitution
2455behavior of function types with function-cv-qualifiers.
2456
2457Version 9, which first appeared in G++ 5.2, corrects the alignment of
2458@code{nullptr_t}.
2459
2460Version 10, which first appeared in G++ 6.1, adds mangling of
2461attributes that affect type identity, such as ia32 calling convention
2462attributes (e.g.@: @samp{stdcall}).
2463
2464Version 11, which first appeared in G++ 7, corrects the mangling of
2465sizeof... expressions and operator names.  For multiple entities with
2466the same name within a function, that are declared in different scopes,
2467the mangling now changes starting with the twelfth occurrence.  It also
2468implies @option{-fnew-inheriting-ctors}.
2469
2470Version 12, which first appeared in G++ 8, corrects the calling
2471conventions for empty classes on the x86_64 target and for classes
2472with only deleted copy/move constructors.  It accidentally changes the
2473calling convention for classes with a deleted copy constructor and a
2474trivial move constructor.
2475
2476Version 13, which first appeared in G++ 8.2, fixes the accidental
2477change in version 12.
2478
2479Version 14, which first appeared in G++ 10, corrects the mangling of
2480the nullptr expression.
2481
2482See also @option{-Wabi}.
2483
2484@item -fabi-compat-version=@var{n}
2485@opindex fabi-compat-version
2486On targets that support strong aliases, G++
2487works around mangling changes by creating an alias with the correct
2488mangled name when defining a symbol with an incorrect mangled name.
2489This switch specifies which ABI version to use for the alias.
2490
2491With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2492compatibility).  If another ABI version is explicitly selected, this
2493defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2494use @option{-fabi-compat-version=2}.
2495
2496If this option is not provided but @option{-Wabi=@var{n}} is, that
2497version is used for compatibility aliases.  If this option is provided
2498along with @option{-Wabi} (without the version), the version from this
2499option is used for the warning.
2500
2501@item -fno-access-control
2502@opindex fno-access-control
2503@opindex faccess-control
2504Turn off all access checking.  This switch is mainly useful for working
2505around bugs in the access control code.
2506
2507@item -faligned-new
2508@opindex faligned-new
2509Enable support for C++17 @code{new} of types that require more
2510alignment than @code{void* ::operator new(std::size_t)} provides.  A
2511numeric argument such as @code{-faligned-new=32} can be used to
2512specify how much alignment (in bytes) is provided by that function,
2513but few users will need to override the default of
2514@code{alignof(std::max_align_t)}.
2515
2516This flag is enabled by default for @option{-std=c++17}.
2517
2518@item -fchar8_t
2519@itemx -fno-char8_t
2520@opindex fchar8_t
2521@opindex fno-char8_t
2522Enable support for @code{char8_t} as adopted for C++2a.  This includes
2523the addition of a new @code{char8_t} fundamental type, changes to the
2524types of UTF-8 string and character literals, new signatures for
2525user-defined literals, associated standard library updates, and new
2526@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2527
2528This option enables functions to be overloaded for ordinary and UTF-8
2529strings:
2530
2531@smallexample
2532int f(const char *);    // #1
2533int f(const char8_t *); // #2
2534int v1 = f("text");     // Calls #1
2535int v2 = f(u8"text");   // Calls #2
2536@end smallexample
2537
2538@noindent
2539and introduces new signatures for user-defined literals:
2540
2541@smallexample
2542int operator""_udl1(char8_t);
2543int v3 = u8'x'_udl1;
2544int operator""_udl2(const char8_t*, std::size_t);
2545int v4 = u8"text"_udl2;
2546template<typename T, T...> int operator""_udl3();
2547int v5 = u8"text"_udl3;
2548@end smallexample
2549
2550@noindent
2551The change to the types of UTF-8 string and character literals introduces
2552incompatibilities with ISO C++11 and later standards.  For example, the
2553following code is well-formed under ISO C++11, but is ill-formed when
2554@option{-fchar8_t} is specified.
2555
2556@smallexample
2557char ca[] = u8"xx";     // error: char-array initialized from wide
2558                        //        string
2559const char *cp = u8"xx";// error: invalid conversion from
2560                        //        `const char8_t*' to `const char*'
2561int f(const char*);
2562auto v = f(u8"xx");     // error: invalid conversion from
2563                        //        `const char8_t*' to `const char*'
2564std::string s@{u8"xx"@};  // error: no matching function for call to
2565                        //        `std::basic_string<char>::basic_string()'
2566using namespace std::literals;
2567s = u8"xx"s;            // error: conversion from
2568                        //        `basic_string<char8_t>' to non-scalar
2569                        //        type `basic_string<char>' requested
2570@end smallexample
2571
2572@item -fcheck-new
2573@opindex fcheck-new
2574Check that the pointer returned by @code{operator new} is non-null
2575before attempting to modify the storage allocated.  This check is
2576normally unnecessary because the C++ standard specifies that
2577@code{operator new} only returns @code{0} if it is declared
2578@code{throw()}, in which case the compiler always checks the
2579return value even without this option.  In all other cases, when
2580@code{operator new} has a non-empty exception specification, memory
2581exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2582@samp{new (nothrow)}.
2583
2584@item -fconcepts
2585@itemx -fconcepts-ts
2586@opindex fconcepts
2587@opindex fconcepts-ts
2588Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2589C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2590
2591With @option{-std=c++2a} and above, Concepts are part of the language
2592standard, so @option{-fconcepts} defaults to on.  But the standard
2593specification of Concepts differs significantly from the TS, so some
2594constructs that were allowed in the TS but didn't make it into the
2595standard can still be enabled by @option{-fconcepts-ts}.
2596
2597@item -fconstexpr-depth=@var{n}
2598@opindex fconstexpr-depth
2599Set the maximum nested evaluation depth for C++11 constexpr functions
2600to @var{n}.  A limit is needed to detect endless recursion during
2601constant expression evaluation.  The minimum specified by the standard
2602is 512.
2603
2604@item -fconstexpr-cache-depth=@var{n}
2605@opindex fconstexpr-cache-depth
2606Set the maximum level of nested evaluation depth for C++11 constexpr
2607functions that will be cached to @var{n}.  This is a heuristic that
2608trades off compilation speed (when the cache avoids repeated
2609calculations) against memory consumption (when the cache grows very
2610large from highly recursive evaluations).  The default is 8.  Very few
2611users are likely to want to adjust it, but if your code does heavy
2612constexpr calculations you might want to experiment to find which
2613value works best for you.
2614
2615@item -fconstexpr-loop-limit=@var{n}
2616@opindex fconstexpr-loop-limit
2617Set the maximum number of iterations for a loop in C++14 constexpr functions
2618to @var{n}.  A limit is needed to detect infinite loops during
2619constant expression evaluation.  The default is 262144 (1<<18).
2620
2621@item -fconstexpr-ops-limit=@var{n}
2622@opindex fconstexpr-ops-limit
2623Set the maximum number of operations during a single constexpr evaluation.
2624Even when number of iterations of a single loop is limited with the above limit,
2625if there are several nested loops and each of them has many iterations but still
2626smaller than the above limit, or if in a body of some loop or even outside
2627of a loop too many expressions need to be evaluated, the resulting constexpr
2628evaluation might take too long.
2629The default is 33554432 (1<<25).
2630
2631@item -fcoroutines
2632@opindex fcoroutines
2633Enable support for the C++ coroutines extension (experimental).
2634
2635@item -fno-elide-constructors
2636@opindex fno-elide-constructors
2637@opindex felide-constructors
2638The C++ standard allows an implementation to omit creating a temporary
2639that is only used to initialize another object of the same type.
2640Specifying this option disables that optimization, and forces G++ to
2641call the copy constructor in all cases.  This option also causes G++
2642to call trivial member functions which otherwise would be expanded inline.
2643
2644In C++17, the compiler is required to omit these temporaries, but this
2645option still affects trivial member functions.
2646
2647@item -fno-enforce-eh-specs
2648@opindex fno-enforce-eh-specs
2649@opindex fenforce-eh-specs
2650Don't generate code to check for violation of exception specifications
2651at run time.  This option violates the C++ standard, but may be useful
2652for reducing code size in production builds, much like defining
2653@code{NDEBUG}.  This does not give user code permission to throw
2654exceptions in violation of the exception specifications; the compiler
2655still optimizes based on the specifications, so throwing an
2656unexpected exception results in undefined behavior at run time.
2657
2658@item -fextern-tls-init
2659@itemx -fno-extern-tls-init
2660@opindex fextern-tls-init
2661@opindex fno-extern-tls-init
2662The C++11 and OpenMP standards allow @code{thread_local} and
2663@code{threadprivate} variables to have dynamic (runtime)
2664initialization.  To support this, any use of such a variable goes
2665through a wrapper function that performs any necessary initialization.
2666When the use and definition of the variable are in the same
2667translation unit, this overhead can be optimized away, but when the
2668use is in a different translation unit there is significant overhead
2669even if the variable doesn't actually need dynamic initialization.  If
2670the programmer can be sure that no use of the variable in a
2671non-defining TU needs to trigger dynamic initialization (either
2672because the variable is statically initialized, or a use of the
2673variable in the defining TU will be executed before any uses in
2674another TU), they can avoid this overhead with the
2675@option{-fno-extern-tls-init} option.
2676
2677On targets that support symbol aliases, the default is
2678@option{-fextern-tls-init}.  On targets that do not support symbol
2679aliases, the default is @option{-fno-extern-tls-init}.
2680
2681@item -fno-gnu-keywords
2682@opindex fno-gnu-keywords
2683@opindex fgnu-keywords
2684Do not recognize @code{typeof} as a keyword, so that code can use this
2685word as an identifier.  You can use the keyword @code{__typeof__} instead.
2686This option is implied by the strict ISO C++ dialects: @option{-ansi},
2687@option{-std=c++98}, @option{-std=c++11}, etc.
2688
2689@item -fno-implicit-templates
2690@opindex fno-implicit-templates
2691@opindex fimplicit-templates
2692Never emit code for non-inline templates that are instantiated
2693implicitly (i.e.@: by use); only emit code for explicit instantiations.
2694If you use this option, you must take care to structure your code to
2695include all the necessary explicit instantiations to avoid getting
2696undefined symbols at link time.
2697@xref{Template Instantiation}, for more information.
2698
2699@item -fno-implicit-inline-templates
2700@opindex fno-implicit-inline-templates
2701@opindex fimplicit-inline-templates
2702Don't emit code for implicit instantiations of inline templates, either.
2703The default is to handle inlines differently so that compiles with and
2704without optimization need the same set of explicit instantiations.
2705
2706@item -fno-implement-inlines
2707@opindex fno-implement-inlines
2708@opindex fimplement-inlines
2709To save space, do not emit out-of-line copies of inline functions
2710controlled by @code{#pragma implementation}.  This causes linker
2711errors if these functions are not inlined everywhere they are called.
2712
2713@item -fms-extensions
2714@opindex fms-extensions
2715Disable Wpedantic warnings about constructs used in MFC, such as implicit
2716int and getting a pointer to member function via non-standard syntax.
2717
2718@item -fnew-inheriting-ctors
2719@opindex fnew-inheriting-ctors
2720Enable the P0136 adjustment to the semantics of C++11 constructor
2721inheritance.  This is part of C++17 but also considered to be a Defect
2722Report against C++11 and C++14.  This flag is enabled by default
2723unless @option{-fabi-version=10} or lower is specified.
2724
2725@item -fnew-ttp-matching
2726@opindex fnew-ttp-matching
2727Enable the P0522 resolution to Core issue 150, template template
2728parameters and default arguments: this allows a template with default
2729template arguments as an argument for a template template parameter
2730with fewer template parameters.  This flag is enabled by default for
2731@option{-std=c++17}.
2732
2733@item -fno-nonansi-builtins
2734@opindex fno-nonansi-builtins
2735@opindex fnonansi-builtins
2736Disable built-in declarations of functions that are not mandated by
2737ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
2738@code{index}, @code{bzero}, @code{conjf}, and other related functions.
2739
2740@item -fnothrow-opt
2741@opindex fnothrow-opt
2742Treat a @code{throw()} exception specification as if it were a
2743@code{noexcept} specification to reduce or eliminate the text size
2744overhead relative to a function with no exception specification.  If
2745the function has local variables of types with non-trivial
2746destructors, the exception specification actually makes the
2747function smaller because the EH cleanups for those variables can be
2748optimized away.  The semantic effect is that an exception thrown out of
2749a function with such an exception specification results in a call
2750to @code{terminate} rather than @code{unexpected}.
2751
2752@item -fno-operator-names
2753@opindex fno-operator-names
2754@opindex foperator-names
2755Do not treat the operator name keywords @code{and}, @code{bitand},
2756@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2757synonyms as keywords.
2758
2759@item -fno-optional-diags
2760@opindex fno-optional-diags
2761@opindex foptional-diags
2762Disable diagnostics that the standard says a compiler does not need to
2763issue.  Currently, the only such diagnostic issued by G++ is the one for
2764a name having multiple meanings within a class.
2765
2766@item -fpermissive
2767@opindex fpermissive
2768Downgrade some diagnostics about nonconformant code from errors to
2769warnings.  Thus, using @option{-fpermissive} allows some
2770nonconforming code to compile.
2771
2772@item -fno-pretty-templates
2773@opindex fno-pretty-templates
2774@opindex fpretty-templates
2775When an error message refers to a specialization of a function
2776template, the compiler normally prints the signature of the
2777template followed by the template arguments and any typedefs or
2778typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2779rather than @code{void f(int)}) so that it's clear which template is
2780involved.  When an error message refers to a specialization of a class
2781template, the compiler omits any template arguments that match
2782the default template arguments for that template.  If either of these
2783behaviors make it harder to understand the error message rather than
2784easier, you can use @option{-fno-pretty-templates} to disable them.
2785
2786@item -fno-rtti
2787@opindex fno-rtti
2788@opindex frtti
2789Disable generation of information about every class with virtual
2790functions for use by the C++ run-time type identification features
2791(@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
2792of the language, you can save some space by using this flag.  Note that
2793exception handling uses the same information, but G++ generates it as
2794needed. The @code{dynamic_cast} operator can still be used for casts that
2795do not require run-time type information, i.e.@: casts to @code{void *} or to
2796unambiguous base classes.
2797
2798Mixing code compiled with @option{-frtti} with that compiled with
2799@option{-fno-rtti} may not work.  For example, programs may
2800fail to link if a class compiled with @option{-fno-rtti} is used as a base
2801for a class compiled with @option{-frtti}.
2802
2803@item -fsized-deallocation
2804@opindex fsized-deallocation
2805Enable the built-in global declarations
2806@smallexample
2807void operator delete (void *, std::size_t) noexcept;
2808void operator delete[] (void *, std::size_t) noexcept;
2809@end smallexample
2810as introduced in C++14.  This is useful for user-defined replacement
2811deallocation functions that, for example, use the size of the object
2812to make deallocation faster.  Enabled by default under
2813@option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
2814warns about places that might want to add a definition.
2815
2816@item -fstrict-enums
2817@opindex fstrict-enums
2818Allow the compiler to optimize using the assumption that a value of
2819enumerated type can only be one of the values of the enumeration (as
2820defined in the C++ standard; basically, a value that can be
2821represented in the minimum number of bits needed to represent all the
2822enumerators).  This assumption may not be valid if the program uses a
2823cast to convert an arbitrary integer value to the enumerated type.
2824
2825@item -fstrong-eval-order
2826@opindex fstrong-eval-order
2827Evaluate member access, array subscripting, and shift expressions in
2828left-to-right order, and evaluate assignment in right-to-left order,
2829as adopted for C++17.  Enabled by default with @option{-std=c++17}.
2830@option{-fstrong-eval-order=some} enables just the ordering of member
2831access and shift expressions, and is the default without
2832@option{-std=c++17}.
2833
2834@item -ftemplate-backtrace-limit=@var{n}
2835@opindex ftemplate-backtrace-limit
2836Set the maximum number of template instantiation notes for a single
2837warning or error to @var{n}.  The default value is 10.
2838
2839@item -ftemplate-depth=@var{n}
2840@opindex ftemplate-depth
2841Set the maximum instantiation depth for template classes to @var{n}.
2842A limit on the template instantiation depth is needed to detect
2843endless recursions during template class instantiation.  ANSI/ISO C++
2844conforming programs must not rely on a maximum depth greater than 17
2845(changed to 1024 in C++11).  The default value is 900, as the compiler
2846can run out of stack space before hitting 1024 in some situations.
2847
2848@item -fno-threadsafe-statics
2849@opindex fno-threadsafe-statics
2850@opindex fthreadsafe-statics
2851Do not emit the extra code to use the routines specified in the C++
2852ABI for thread-safe initialization of local statics.  You can use this
2853option to reduce code size slightly in code that doesn't need to be
2854thread-safe.
2855
2856@item -fuse-cxa-atexit
2857@opindex fuse-cxa-atexit
2858Register destructors for objects with static storage duration with the
2859@code{__cxa_atexit} function rather than the @code{atexit} function.
2860This option is required for fully standards-compliant handling of static
2861destructors, but only works if your C library supports
2862@code{__cxa_atexit}.
2863
2864@item -fno-use-cxa-get-exception-ptr
2865@opindex fno-use-cxa-get-exception-ptr
2866@opindex fuse-cxa-get-exception-ptr
2867Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2868causes @code{std::uncaught_exception} to be incorrect, but is necessary
2869if the runtime routine is not available.
2870
2871@item -fvisibility-inlines-hidden
2872@opindex fvisibility-inlines-hidden
2873This switch declares that the user does not attempt to compare
2874pointers to inline functions or methods where the addresses of the two functions
2875are taken in different shared objects.
2876
2877The effect of this is that GCC may, effectively, mark inline methods with
2878@code{__attribute__ ((visibility ("hidden")))} so that they do not
2879appear in the export table of a DSO and do not require a PLT indirection
2880when used within the DSO@.  Enabling this option can have a dramatic effect
2881on load and link times of a DSO as it massively reduces the size of the
2882dynamic export table when the library makes heavy use of templates.
2883
2884The behavior of this switch is not quite the same as marking the
2885methods as hidden directly, because it does not affect static variables
2886local to the function or cause the compiler to deduce that
2887the function is defined in only one shared object.
2888
2889You may mark a method as having a visibility explicitly to negate the
2890effect of the switch for that method.  For example, if you do want to
2891compare pointers to a particular inline method, you might mark it as
2892having default visibility.  Marking the enclosing class with explicit
2893visibility has no effect.
2894
2895Explicitly instantiated inline methods are unaffected by this option
2896as their linkage might otherwise cross a shared library boundary.
2897@xref{Template Instantiation}.
2898
2899@item -fvisibility-ms-compat
2900@opindex fvisibility-ms-compat
2901This flag attempts to use visibility settings to make GCC's C++
2902linkage model compatible with that of Microsoft Visual Studio.
2903
2904The flag makes these changes to GCC's linkage model:
2905
2906@enumerate
2907@item
2908It sets the default visibility to @code{hidden}, like
2909@option{-fvisibility=hidden}.
2910
2911@item
2912Types, but not their members, are not hidden by default.
2913
2914@item
2915The One Definition Rule is relaxed for types without explicit
2916visibility specifications that are defined in more than one
2917shared object: those declarations are permitted if they are
2918permitted when this option is not used.
2919@end enumerate
2920
2921In new code it is better to use @option{-fvisibility=hidden} and
2922export those classes that are intended to be externally visible.
2923Unfortunately it is possible for code to rely, perhaps accidentally,
2924on the Visual Studio behavior.
2925
2926Among the consequences of these changes are that static data members
2927of the same type with the same name but defined in different shared
2928objects are different, so changing one does not change the other;
2929and that pointers to function members defined in different shared
2930objects may not compare equal.  When this flag is given, it is a
2931violation of the ODR to define types with the same name differently.
2932
2933@item -fno-weak
2934@opindex fno-weak
2935@opindex fweak
2936Do not use weak symbol support, even if it is provided by the linker.
2937By default, G++ uses weak symbols if they are available.  This
2938option exists only for testing, and should not be used by end-users;
2939it results in inferior code and has no benefits.  This option may
2940be removed in a future release of G++.
2941
2942@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2943@opindex fext-numeric-literals
2944@opindex fno-ext-numeric-literals
2945Accept imaginary, fixed-point, or machine-defined
2946literal number suffixes as GNU extensions.
2947When this option is turned off these suffixes are treated
2948as C++11 user-defined literal numeric suffixes.
2949This is on by default for all pre-C++11 dialects and all GNU dialects:
2950@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2951@option{-std=gnu++14}.
2952This option is off by default
2953for ISO C++11 onwards (@option{-std=c++11}, ...).
2954
2955@item -nostdinc++
2956@opindex nostdinc++
2957Do not search for header files in the standard directories specific to
2958C++, but do still search the other standard directories.  (This option
2959is used when building the C++ library.)
2960@end table
2961
2962In addition, these warning options have meanings only for C++ programs:
2963
2964@table @gcctabopt
2965@item -Wabi-tag @r{(C++ and Objective-C++ only)}
2966@opindex Wabi-tag
2967@opindex Wabi-tag
2968Warn when a type with an ABI tag is used in a context that does not
2969have that ABI tag.  See @ref{C++ Attributes} for more information
2970about ABI tags.
2971
2972@item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
2973@opindex Wcomma-subscript
2974@opindex Wno-comma-subscript
2975Warn about uses of a comma expression within a subscripting expression.
2976This usage was deprecated in C++2a.  However, a comma expression wrapped
2977in @code{( )} is not deprecated.  Example:
2978
2979@smallexample
2980@group
2981void f(int *a, int b, int c) @{
2982    a[b,c];     // deprecated
2983    a[(b,c)];   // OK
2984@}
2985@end group
2986@end smallexample
2987
2988Enabled by default with @option{-std=c++2a}.
2989
2990@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2991@opindex Wctor-dtor-privacy
2992@opindex Wno-ctor-dtor-privacy
2993Warn when a class seems unusable because all the constructors or
2994destructors in that class are private, and it has neither friends nor
2995public static member functions.  Also warn if there are no non-private
2996methods, and there's at least one private member function that isn't
2997a constructor or destructor.
2998
2999@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3000@opindex Wdelete-non-virtual-dtor
3001@opindex Wno-delete-non-virtual-dtor
3002Warn when @code{delete} is used to destroy an instance of a class that
3003has virtual functions and non-virtual destructor. It is unsafe to delete
3004an instance of a derived class through a pointer to a base class if the
3005base class does not have a virtual destructor.  This warning is enabled
3006by @option{-Wall}.
3007
3008@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3009@opindex Wdeprecated-copy
3010@opindex Wno-deprecated-copy
3011Warn that the implicit declaration of a copy constructor or copy
3012assignment operator is deprecated if the class has a user-provided
3013copy constructor or copy assignment operator, in C++11 and up.  This
3014warning is enabled by @option{-Wextra}.  With
3015@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3016user-provided destructor.
3017
3018@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3019@opindex Winit-list-lifetime
3020@opindex Wno-init-list-lifetime
3021Do not warn about uses of @code{std::initializer_list} that are likely
3022to result in dangling pointers.  Since the underlying array for an
3023@code{initializer_list} is handled like a normal C++ temporary object,
3024it is easy to inadvertently keep a pointer to the array past the end
3025of the array's lifetime.  For example:
3026
3027@itemize @bullet
3028@item
3029If a function returns a temporary @code{initializer_list}, or a local
3030@code{initializer_list} variable, the array's lifetime ends at the end
3031of the return statement, so the value returned has a dangling pointer.
3032
3033@item
3034If a new-expression creates an @code{initializer_list}, the array only
3035lives until the end of the enclosing full-expression, so the
3036@code{initializer_list} in the heap has a dangling pointer.
3037
3038@item
3039When an @code{initializer_list} variable is assigned from a
3040brace-enclosed initializer list, the temporary array created for the
3041right side of the assignment only lives until the end of the
3042full-expression, so at the next statement the @code{initializer_list}
3043variable has a dangling pointer.
3044
3045@smallexample
3046// li's initial underlying array lives as long as li
3047std::initializer_list<int> li = @{ 1,2,3 @};
3048// assignment changes li to point to a temporary array
3049li = @{ 4, 5 @};
3050// now the temporary is gone and li has a dangling pointer
3051int i = li.begin()[0] // undefined behavior
3052@end smallexample
3053
3054@item
3055When a list constructor stores the @code{begin} pointer from the
3056@code{initializer_list} argument, this doesn't extend the lifetime of
3057the array, so if a class variable is constructed from a temporary
3058@code{initializer_list}, the pointer is left dangling by the end of
3059the variable declaration statement.
3060
3061@end itemize
3062
3063@item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3064@opindex Wliteral-suffix
3065@opindex Wno-literal-suffix
3066Do not warn when a string or character literal is followed by a
3067ud-suffix which does not begin with an underscore.  As a conforming
3068extension, GCC treats such suffixes as separate preprocessing tokens
3069in order to maintain backwards compatibility with code that uses
3070formatting macros from @code{<inttypes.h>}.  For example:
3071
3072@smallexample
3073#define __STDC_FORMAT_MACROS
3074#include <inttypes.h>
3075#include <stdio.h>
3076
3077int main() @{
3078  int64_t i64 = 123;
3079  printf("My int64: %" PRId64"\n", i64);
3080@}
3081@end smallexample
3082
3083In this case, @code{PRId64} is treated as a separate preprocessing token.
3084
3085This option also controls warnings when a user-defined literal
3086operator is declared with a literal suffix identifier that doesn't
3087begin with an underscore. Literal suffix identifiers that don't begin
3088with an underscore are reserved for future standardization.
3089
3090These warnings are enabled by default.
3091
3092@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3093@opindex Wnarrowing
3094@opindex Wno-narrowing
3095For C++11 and later standards, narrowing conversions are diagnosed by default,
3096as required by the standard.  A narrowing conversion from a constant produces
3097an error, and a narrowing conversion from a non-constant produces a warning,
3098but @option{-Wno-narrowing} suppresses the diagnostic.
3099Note that this does not affect the meaning of well-formed code;
3100narrowing conversions are still considered ill-formed in SFINAE contexts.
3101
3102With @option{-Wnarrowing} in C++98, warn when a narrowing
3103conversion prohibited by C++11 occurs within
3104@samp{@{ @}}, e.g.
3105
3106@smallexample
3107int i = @{ 2.2 @}; // error: narrowing from double to int
3108@end smallexample
3109
3110This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3111
3112@item -Wnoexcept @r{(C++ and Objective-C++ only)}
3113@opindex Wnoexcept
3114@opindex Wno-noexcept
3115Warn when a noexcept-expression evaluates to false because of a call
3116to a function that does not have a non-throwing exception
3117specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3118the compiler to never throw an exception.
3119
3120@item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3121@opindex Wnoexcept-type
3122@opindex Wno-noexcept-type
3123Warn if the C++17 feature making @code{noexcept} part of a function
3124type changes the mangled name of a symbol relative to C++14.  Enabled
3125by @option{-Wabi} and @option{-Wc++17-compat}.
3126
3127As an example:
3128
3129@smallexample
3130template <class T> void f(T t) @{ t(); @};
3131void g() noexcept;
3132void h() @{ f(g); @}
3133@end smallexample
3134
3135@noindent
3136In C++14, @code{f} calls @code{f<void(*)()>}, but in
3137C++17 it calls @code{f<void(*)()noexcept>}.
3138
3139@item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3140@opindex Wclass-memaccess
3141@opindex Wno-class-memaccess
3142Warn when the destination of a call to a raw memory function such as
3143@code{memset} or @code{memcpy} is an object of class type, and when writing
3144into such an object might bypass the class non-trivial or deleted constructor
3145or copy assignment, violate const-correctness or encapsulation, or corrupt
3146virtual table pointers.  Modifying the representation of such objects may
3147violate invariants maintained by member functions of the class.  For example,
3148the call to @code{memset} below is undefined because it modifies a non-trivial
3149class object and is, therefore, diagnosed.  The safe way to either initialize
3150or clear the storage of objects of such types is by using the appropriate
3151constructor or assignment operator, if one is available.
3152@smallexample
3153std::string str = "abc";
3154memset (&str, 0, sizeof str);
3155@end smallexample
3156The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3157Explicitly casting the pointer to the class object to @code{void *} or
3158to a type that can be safely accessed by the raw memory function suppresses
3159the warning.
3160
3161@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3162@opindex Wnon-virtual-dtor
3163@opindex Wno-non-virtual-dtor
3164Warn when a class has virtual functions and an accessible non-virtual
3165destructor itself or in an accessible polymorphic base class, in which
3166case it is possible but unsafe to delete an instance of a derived
3167class through a pointer to the class itself or base class.  This
3168warning is automatically enabled if @option{-Weffc++} is specified.
3169
3170@item -Wregister @r{(C++ and Objective-C++ only)}
3171@opindex Wregister
3172@opindex Wno-register
3173Warn on uses of the @code{register} storage class specifier, except
3174when it is part of the GNU @ref{Explicit Register Variables} extension.
3175The use of the @code{register} keyword as storage class specifier has
3176been deprecated in C++11 and removed in C++17.
3177Enabled by default with @option{-std=c++17}.
3178
3179@item -Wreorder @r{(C++ and Objective-C++ only)}
3180@opindex Wreorder
3181@opindex Wno-reorder
3182@cindex reordering, warning
3183@cindex warning for reordering of member initializers
3184Warn when the order of member initializers given in the code does not
3185match the order in which they must be executed.  For instance:
3186
3187@smallexample
3188struct A @{
3189  int i;
3190  int j;
3191  A(): j (0), i (1) @{ @}
3192@};
3193@end smallexample
3194
3195@noindent
3196The compiler rearranges the member initializers for @code{i}
3197and @code{j} to match the declaration order of the members, emitting
3198a warning to that effect.  This warning is enabled by @option{-Wall}.
3199
3200@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3201@opindex Wpessimizing-move
3202@opindex Wno-pessimizing-move
3203This warning warns when a call to @code{std::move} prevents copy
3204elision.  A typical scenario when copy elision can occur is when returning in
3205a function with a class return type, when the expression being returned is the
3206name of a non-volatile automatic object, and is not a function parameter, and
3207has the same type as the function return type.
3208
3209@smallexample
3210struct T @{
3211@dots{}
3212@};
3213T fn()
3214@{
3215  T t;
3216  @dots{}
3217  return std::move (t);
3218@}
3219@end smallexample
3220
3221But in this example, the @code{std::move} call prevents copy elision.
3222
3223This warning is enabled by @option{-Wall}.
3224
3225@item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3226@opindex Wredundant-move
3227@opindex Wno-redundant-move
3228This warning warns about redundant calls to @code{std::move}; that is, when
3229a move operation would have been performed even without the @code{std::move}
3230call.  This happens because the compiler is forced to treat the object as if
3231it were an rvalue in certain situations such as returning a local variable,
3232where copy elision isn't applicable.  Consider:
3233
3234@smallexample
3235struct T @{
3236@dots{}
3237@};
3238T fn(T t)
3239@{
3240  @dots{}
3241  return std::move (t);
3242@}
3243@end smallexample
3244
3245Here, the @code{std::move} call is redundant.  Because G++ implements Core
3246Issue 1579, another example is:
3247
3248@smallexample
3249struct T @{ // convertible to U
3250@dots{}
3251@};
3252struct U @{
3253@dots{}
3254@};
3255U fn()
3256@{
3257  T t;
3258  @dots{}
3259  return std::move (t);
3260@}
3261@end smallexample
3262In this example, copy elision isn't applicable because the type of the
3263expression being returned and the function return type differ, yet G++
3264treats the return value as if it were designated by an rvalue.
3265
3266This warning is enabled by @option{-Wextra}.
3267
3268@item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3269@opindex Wredundant-tags
3270@opindex Wno-redundant-tags
3271Warn about redundant class-key and enum-key in references to class types
3272and enumerated types in contexts where the key can be eliminated without
3273causing an ambiguity.  For example:
3274
3275@smallexample
3276struct foo;
3277struct foo *p;   // warn that keyword struct can be eliminated
3278@end smallexample
3279
3280@noindent
3281On the other hand, in this example there is no warning:
3282
3283@smallexample
3284struct foo;
3285void foo ();   // "hides" struct foo
3286void bar (struct foo&);  // no warning, keyword struct is necessary
3287@end smallexample
3288
3289@item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3290@opindex Wsubobject-linkage
3291@opindex Wno-subobject-linkage
3292Do not warn
3293if a class type has a base or a field whose type uses the anonymous
3294namespace or depends on a type with no linkage.  If a type A depends on
3295a type B with no or internal linkage, defining it in multiple
3296translation units would be an ODR violation because the meaning of B
3297is different in each translation unit.  If A only appears in a single
3298translation unit, the best way to silence the warning is to give it
3299internal linkage by putting it in an anonymous namespace as well.  The
3300compiler doesn't give this warning for types defined in the main .C
3301file, as those are unlikely to have multiple definitions.
3302@option{-Wsubobject-linkage} is enabled by default.
3303
3304@item -Weffc++ @r{(C++ and Objective-C++ only)}
3305@opindex Weffc++
3306@opindex Wno-effc++
3307Warn about violations of the following style guidelines from Scott Meyers'
3308@cite{Effective C++} series of books:
3309
3310@itemize @bullet
3311@item
3312Define a copy constructor and an assignment operator for classes
3313with dynamically-allocated memory.
3314
3315@item
3316Prefer initialization to assignment in constructors.
3317
3318@item
3319Have @code{operator=} return a reference to @code{*this}.
3320
3321@item
3322Don't try to return a reference when you must return an object.
3323
3324@item
3325Distinguish between prefix and postfix forms of increment and
3326decrement operators.
3327
3328@item
3329Never overload @code{&&}, @code{||}, or @code{,}.
3330
3331@end itemize
3332
3333This option also enables @option{-Wnon-virtual-dtor}, which is also
3334one of the effective C++ recommendations.  However, the check is
3335extended to warn about the lack of virtual destructor in accessible
3336non-polymorphic bases classes too.
3337
3338When selecting this option, be aware that the standard library
3339headers do not obey all of these guidelines; use @samp{grep -v}
3340to filter out those warnings.
3341
3342@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3343@opindex Wstrict-null-sentinel
3344@opindex Wno-strict-null-sentinel
3345Warn about the use of an uncasted @code{NULL} as sentinel.  When
3346compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3347to @code{__null}.  Although it is a null pointer constant rather than a
3348null pointer, it is guaranteed to be of the same size as a pointer.
3349But this use is not portable across different compilers.
3350
3351@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3352@opindex Wno-non-template-friend
3353@opindex Wnon-template-friend
3354Disable warnings when non-template friend functions are declared
3355within a template.  In very old versions of GCC that predate implementation
3356of the ISO standard, declarations such as
3357@samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3358could be interpreted as a particular specialization of a template
3359function; the warning exists to diagnose compatibility problems,
3360and is enabled by default.
3361
3362@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3363@opindex Wold-style-cast
3364@opindex Wno-old-style-cast
3365Warn if an old-style (C-style) cast to a non-void type is used within
3366a C++ program.  The new-style casts (@code{dynamic_cast},
3367@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3368less vulnerable to unintended effects and much easier to search for.
3369
3370@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3371@opindex Woverloaded-virtual
3372@opindex Wno-overloaded-virtual
3373@cindex overloaded virtual function, warning
3374@cindex warning for overloaded virtual function
3375Warn when a function declaration hides virtual functions from a
3376base class.  For example, in:
3377
3378@smallexample
3379struct A @{
3380  virtual void f();
3381@};
3382
3383struct B: public A @{
3384  void f(int);
3385@};
3386@end smallexample
3387
3388the @code{A} class version of @code{f} is hidden in @code{B}, and code
3389like:
3390
3391@smallexample
3392B* b;
3393b->f();
3394@end smallexample
3395
3396@noindent
3397fails to compile.
3398
3399@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3400@opindex Wno-pmf-conversions
3401@opindex Wpmf-conversions
3402Disable the diagnostic for converting a bound pointer to member function
3403to a plain pointer.
3404
3405@item -Wsign-promo @r{(C++ and Objective-C++ only)}
3406@opindex Wsign-promo
3407@opindex Wno-sign-promo
3408Warn when overload resolution chooses a promotion from unsigned or
3409enumerated type to a signed type, over a conversion to an unsigned type of
3410the same size.  Previous versions of G++ tried to preserve
3411unsignedness, but the standard mandates the current behavior.
3412
3413@item -Wtemplates @r{(C++ and Objective-C++ only)}
3414@opindex Wtemplates
3415@opindex Wno-templates
3416Warn when a primary template declaration is encountered.  Some coding
3417rules disallow templates, and this may be used to enforce that rule.
3418The warning is inactive inside a system header file, such as the STL, so
3419one can still use the STL.  One may also instantiate or specialize
3420templates.
3421
3422@item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3423@opindex Wmismatched-tags
3424@opindex Wno-mismatched-tags
3425Warn for declarations of structs, classes, and class templates and their
3426specializations with a class-key that does not match either the definition
3427or the first declaration if no definition is provided.
3428
3429For example, the declaration of @code{struct Object} in the argument list
3430of @code{draw} triggers the warning.  To avoid it, either remove the redundant
3431class-key @code{struct} or replace it with @code{class} to match its definition.
3432@smallexample
3433class Object @{
3434public:
3435  virtual ~Object () = 0;
3436@};
3437void draw (struct Object*);
3438@end smallexample
3439
3440It is not wrong to declare a class with the class-key @code{struct} as
3441the example above shows.  The @option{-Wmismatched-tags} option is intended
3442to help achieve a consistent style of class declarations.  In code that is
3443intended to be portable to Windows-based compilers the warning helps prevent
3444unresolved references due to the difference in the mangling of symbols
3445declared with different class-keys.  The option can be used either on its
3446own or in conjunction with @option{-Wredundant-tags}.
3447
3448@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3449@opindex Wmultiple-inheritance
3450@opindex Wno-multiple-inheritance
3451Warn when a class is defined with multiple direct base classes.  Some
3452coding rules disallow multiple inheritance, and this may be used to
3453enforce that rule.  The warning is inactive inside a system header file,
3454such as the STL, so one can still use the STL.  One may also define
3455classes that indirectly use multiple inheritance.
3456
3457@item -Wvirtual-inheritance
3458@opindex Wvirtual-inheritance
3459@opindex Wno-virtual-inheritance
3460Warn when a class is defined with a virtual direct base class.  Some
3461coding rules disallow multiple inheritance, and this may be used to
3462enforce that rule.  The warning is inactive inside a system header file,
3463such as the STL, so one can still use the STL.  One may also define
3464classes that indirectly use virtual inheritance.
3465
3466@item -Wno-virtual-move-assign
3467@opindex Wvirtual-move-assign
3468@opindex Wno-virtual-move-assign
3469Suppress warnings about inheriting from a virtual base with a
3470non-trivial C++11 move assignment operator.  This is dangerous because
3471if the virtual base is reachable along more than one path, it is
3472moved multiple times, which can mean both objects end up in the
3473moved-from state.  If the move assignment operator is written to avoid
3474moving from a moved-from object, this warning can be disabled.
3475
3476@item -Wnamespaces
3477@opindex Wnamespaces
3478@opindex Wno-namespaces
3479Warn when a namespace definition is opened.  Some coding rules disallow
3480namespaces, and this may be used to enforce that rule.  The warning is
3481inactive inside a system header file, such as the STL, so one can still
3482use the STL.  One may also use using directives and qualified names.
3483
3484@item -Wno-terminate @r{(C++ and Objective-C++ only)}
3485@opindex Wterminate
3486@opindex Wno-terminate
3487Disable the warning about a throw-expression that will immediately
3488result in a call to @code{terminate}.
3489
3490@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3491@opindex Wno-class-conversion
3492@opindex Wclass-conversion
3493Do not warn when a conversion function converts an
3494object to the same type, to a base class of that type, or to void; such
3495a conversion function will never be called.
3496
3497@item -Wvolatile @r{(C++ and Objective-C++ only)}
3498@opindex Wvolatile
3499@opindex Wno-volatile
3500Warn about deprecated uses of the @code{volatile} qualifier.  This includes
3501postfix and prefix @code{++} and @code{--} expressions of
3502@code{volatile}-qualified types, using simple assignments where the left
3503operand is a @code{volatile}-qualified non-class type for their value,
3504compound assignments where the left operand is a @code{volatile}-qualified
3505non-class type, @code{volatile}-qualified function return type,
3506@code{volatile}-qualified parameter type, and structured bindings of a
3507@code{volatile}-qualified type.  This usage was deprecated in C++20.
3508
3509Enabled by default with @option{-std=c++2a}.
3510
3511@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3512@opindex Wzero-as-null-pointer-constant
3513@opindex Wno-zero-as-null-pointer-constant
3514Warn when a literal @samp{0} is used as null pointer constant.  This can
3515be useful to facilitate the conversion to @code{nullptr} in C++11.
3516
3517@item -Waligned-new
3518@opindex Waligned-new
3519@opindex Wno-aligned-new
3520Warn about a new-expression of a type that requires greater alignment
3521than the @code{alignof(std::max_align_t)} but uses an allocation
3522function without an explicit alignment parameter. This option is
3523enabled by @option{-Wall}.
3524
3525Normally this only warns about global allocation functions, but
3526@option{-Waligned-new=all} also warns about class member allocation
3527functions.
3528
3529@item -Wno-placement-new
3530@itemx -Wplacement-new=@var{n}
3531@opindex Wplacement-new
3532@opindex Wno-placement-new
3533Warn about placement new expressions with undefined behavior, such as
3534constructing an object in a buffer that is smaller than the type of
3535the object.  For example, the placement new expression below is diagnosed
3536because it attempts to construct an array of 64 integers in a buffer only
353764 bytes large.
3538@smallexample
3539char buf [64];
3540new (buf) int[64];
3541@end smallexample
3542This warning is enabled by default.
3543
3544@table @gcctabopt
3545@item -Wplacement-new=1
3546This is the default warning level of @option{-Wplacement-new}.  At this
3547level the warning is not issued for some strictly undefined constructs that
3548GCC allows as extensions for compatibility with legacy code.  For example,
3549the following @code{new} expression is not diagnosed at this level even
3550though it has undefined behavior according to the C++ standard because
3551it writes past the end of the one-element array.
3552@smallexample
3553struct S @{ int n, a[1]; @};
3554S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3555new (s->a)int [32]();
3556@end smallexample
3557
3558@item -Wplacement-new=2
3559At this level, in addition to diagnosing all the same constructs as at level
35601, a diagnostic is also issued for placement new expressions that construct
3561an object in the last member of structure whose type is an array of a single
3562element and whose size is less than the size of the object being constructed.
3563While the previous example would be diagnosed, the following construct makes
3564use of the flexible member array extension to avoid the warning at level 2.
3565@smallexample
3566struct S @{ int n, a[]; @};
3567S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3568new (s->a)int [32]();
3569@end smallexample
3570
3571@end table
3572
3573@item -Wcatch-value
3574@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3575@opindex Wcatch-value
3576@opindex Wno-catch-value
3577Warn about catch handlers that do not catch via reference.
3578With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3579warn about polymorphic class types that are caught by value.
3580With @option{-Wcatch-value=2} warn about all class types that are caught
3581by value. With @option{-Wcatch-value=3} warn about all types that are
3582not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3583
3584@item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3585@opindex Wconditionally-supported
3586@opindex Wno-conditionally-supported
3587Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3588
3589@item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3590@opindex Wdelete-incomplete
3591@opindex Wno-delete-incomplete
3592Do not warn when deleting a pointer to incomplete type, which may cause
3593undefined behavior at runtime.  This warning is enabled by default.
3594
3595@item -Wextra-semi @r{(C++, Objective-C++ only)}
3596@opindex Wextra-semi
3597@opindex Wno-extra-semi
3598Warn about redundant semicolons after in-class function definitions.
3599
3600@item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3601@opindex Winaccessible-base
3602@opindex Wno-inaccessible-base
3603This option controls warnings
3604when a base class is inaccessible in a class derived from it due to
3605ambiguity.  The warning is enabled by default.
3606Note that the warning for ambiguous virtual
3607bases is enabled by the @option{-Wextra} option.
3608@smallexample
3609@group
3610struct A @{ int a; @};
3611
3612struct B : A @{ @};
3613
3614struct C : B, A @{ @};
3615@end group
3616@end smallexample
3617
3618@item -Wno-inherited-variadic-ctor
3619@opindex Winherited-variadic-ctor
3620@opindex Wno-inherited-variadic-ctor
3621Suppress warnings about use of C++11 inheriting constructors when the
3622base class inherited from has a C variadic constructor; the warning is
3623on by default because the ellipsis is not inherited.
3624
3625@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3626@opindex Wno-invalid-offsetof
3627@opindex Winvalid-offsetof
3628Suppress warnings from applying the @code{offsetof} macro to a non-POD
3629type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
3630to a non-standard-layout type is undefined.  In existing C++ implementations,
3631however, @code{offsetof} typically gives meaningful results.
3632This flag is for users who are aware that they are
3633writing nonportable code and who have deliberately chosen to ignore the
3634warning about it.
3635
3636The restrictions on @code{offsetof} may be relaxed in a future version
3637of the C++ standard.
3638
3639@item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3640@opindex Wsized-deallocation
3641@opindex Wno-sized-deallocation
3642Warn about a definition of an unsized deallocation function
3643@smallexample
3644void operator delete (void *) noexcept;
3645void operator delete[] (void *) noexcept;
3646@end smallexample
3647without a definition of the corresponding sized deallocation function
3648@smallexample
3649void operator delete (void *, std::size_t) noexcept;
3650void operator delete[] (void *, std::size_t) noexcept;
3651@end smallexample
3652or vice versa.  Enabled by @option{-Wextra} along with
3653@option{-fsized-deallocation}.
3654
3655@item -Wsuggest-final-types
3656@opindex Wno-suggest-final-types
3657@opindex Wsuggest-final-types
3658Warn about types with virtual methods where code quality would be improved
3659if the type were declared with the C++11 @code{final} specifier,
3660or, if possible,
3661declared in an anonymous namespace. This allows GCC to more aggressively
3662devirtualize the polymorphic calls. This warning is more effective with
3663link-time optimization,
3664where the information about the class hierarchy graph is
3665more complete.
3666
3667@item -Wsuggest-final-methods
3668@opindex Wno-suggest-final-methods
3669@opindex Wsuggest-final-methods
3670Warn about virtual methods where code quality would be improved if the method
3671were declared with the C++11 @code{final} specifier,
3672or, if possible, its type were
3673declared in an anonymous namespace or with the @code{final} specifier.
3674This warning is
3675more effective with link-time optimization, where the information about the
3676class hierarchy graph is more complete. It is recommended to first consider
3677suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3678annotations.
3679
3680@item -Wsuggest-override
3681@opindex Wsuggest-override
3682@opindex Wno-suggest-override
3683Warn about overriding virtual functions that are not marked with the
3684@code{override} keyword.
3685
3686@item -Wuseless-cast @r{(C++ and Objective-C++ only)}
3687@opindex Wuseless-cast
3688@opindex Wno-useless-cast
3689Warn when an expression is casted to its own type.
3690
3691@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3692@opindex Wconversion-null
3693@opindex Wno-conversion-null
3694Do not warn for conversions between @code{NULL} and non-pointer
3695types. @option{-Wconversion-null} is enabled by default.
3696
3697@end table
3698
3699@node Objective-C and Objective-C++ Dialect Options
3700@section Options Controlling Objective-C and Objective-C++ Dialects
3701
3702@cindex compiler options, Objective-C and Objective-C++
3703@cindex Objective-C and Objective-C++ options, command-line
3704@cindex options, Objective-C and Objective-C++
3705(NOTE: This manual does not describe the Objective-C and Objective-C++
3706languages themselves.  @xref{Standards,,Language Standards
3707Supported by GCC}, for references.)
3708
3709This section describes the command-line options that are only meaningful
3710for Objective-C and Objective-C++ programs.  You can also use most of
3711the language-independent GNU compiler options.
3712For example, you might compile a file @file{some_class.m} like this:
3713
3714@smallexample
3715gcc -g -fgnu-runtime -O -c some_class.m
3716@end smallexample
3717
3718@noindent
3719In this example, @option{-fgnu-runtime} is an option meant only for
3720Objective-C and Objective-C++ programs; you can use the other options with
3721any language supported by GCC@.
3722
3723Note that since Objective-C is an extension of the C language, Objective-C
3724compilations may also use options specific to the C front-end (e.g.,
3725@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
3726C++-specific options (e.g., @option{-Wabi}).
3727
3728Here is a list of options that are @emph{only} for compiling Objective-C
3729and Objective-C++ programs:
3730
3731@table @gcctabopt
3732@item -fconstant-string-class=@var{class-name}
3733@opindex fconstant-string-class
3734Use @var{class-name} as the name of the class to instantiate for each
3735literal string specified with the syntax @code{@@"@dots{}"}.  The default
3736class name is @code{NXConstantString} if the GNU runtime is being used, and
3737@code{NSConstantString} if the NeXT runtime is being used (see below).  The
3738@option{-fconstant-cfstrings} option, if also present, overrides the
3739@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3740to be laid out as constant CoreFoundation strings.
3741
3742@item -fgnu-runtime
3743@opindex fgnu-runtime
3744Generate object code compatible with the standard GNU Objective-C
3745runtime.  This is the default for most types of systems.
3746
3747@item -fnext-runtime
3748@opindex fnext-runtime
3749Generate output compatible with the NeXT runtime.  This is the default
3750for NeXT-based systems, including Darwin and Mac OS X@.  The macro
3751@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3752used.
3753
3754@item -fno-nil-receivers
3755@opindex fno-nil-receivers
3756@opindex fnil-receivers
3757Assume that all Objective-C message dispatches (@code{[receiver
3758message:arg]}) in this translation unit ensure that the receiver is
3759not @code{nil}.  This allows for more efficient entry points in the
3760runtime to be used.  This option is only available in conjunction with
3761the NeXT runtime and ABI version 0 or 1.
3762
3763@item -fobjc-abi-version=@var{n}
3764@opindex fobjc-abi-version
3765Use version @var{n} of the Objective-C ABI for the selected runtime.
3766This option is currently supported only for the NeXT runtime.  In that
3767case, Version 0 is the traditional (32-bit) ABI without support for
3768properties and other Objective-C 2.0 additions.  Version 1 is the
3769traditional (32-bit) ABI with support for properties and other
3770Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
3771nothing is specified, the default is Version 0 on 32-bit target
3772machines, and Version 2 on 64-bit target machines.
3773
3774@item -fobjc-call-cxx-cdtors
3775@opindex fobjc-call-cxx-cdtors
3776For each Objective-C class, check if any of its instance variables is a
3777C++ object with a non-trivial default constructor.  If so, synthesize a
3778special @code{- (id) .cxx_construct} instance method which runs
3779non-trivial default constructors on any such instance variables, in order,
3780and then return @code{self}.  Similarly, check if any instance variable
3781is a C++ object with a non-trivial destructor, and if so, synthesize a
3782special @code{- (void) .cxx_destruct} method which runs
3783all such default destructors, in reverse order.
3784
3785The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3786methods thusly generated only operate on instance variables
3787declared in the current Objective-C class, and not those inherited
3788from superclasses.  It is the responsibility of the Objective-C
3789runtime to invoke all such methods in an object's inheritance
3790hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
3791by the runtime immediately after a new object instance is allocated;
3792the @code{- (void) .cxx_destruct} methods are invoked immediately
3793before the runtime deallocates an object instance.
3794
3795As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3796support for invoking the @code{- (id) .cxx_construct} and
3797@code{- (void) .cxx_destruct} methods.
3798
3799@item -fobjc-direct-dispatch
3800@opindex fobjc-direct-dispatch
3801Allow fast jumps to the message dispatcher.  On Darwin this is
3802accomplished via the comm page.
3803
3804@item -fobjc-exceptions
3805@opindex fobjc-exceptions
3806Enable syntactic support for structured exception handling in
3807Objective-C, similar to what is offered by C++.  This option
3808is required to use the Objective-C keywords @code{@@try},
3809@code{@@throw}, @code{@@catch}, @code{@@finally} and
3810@code{@@synchronized}.  This option is available with both the GNU
3811runtime and the NeXT runtime (but not available in conjunction with
3812the NeXT runtime on Mac OS X 10.2 and earlier).
3813
3814@item -fobjc-gc
3815@opindex fobjc-gc
3816Enable garbage collection (GC) in Objective-C and Objective-C++
3817programs.  This option is only available with the NeXT runtime; the
3818GNU runtime has a different garbage collection implementation that
3819does not require special compiler flags.
3820
3821@item -fobjc-nilcheck
3822@opindex fobjc-nilcheck
3823For the NeXT runtime with version 2 of the ABI, check for a nil
3824receiver in method invocations before doing the actual method call.
3825This is the default and can be disabled using
3826@option{-fno-objc-nilcheck}.  Class methods and super calls are never
3827checked for nil in this way no matter what this flag is set to.
3828Currently this flag does nothing when the GNU runtime, or an older
3829version of the NeXT runtime ABI, is used.
3830
3831@item -fobjc-std=objc1
3832@opindex fobjc-std
3833Conform to the language syntax of Objective-C 1.0, the language
3834recognized by GCC 4.0.  This only affects the Objective-C additions to
3835the C/C++ language; it does not affect conformance to C/C++ standards,
3836which is controlled by the separate C/C++ dialect option flags.  When
3837this option is used with the Objective-C or Objective-C++ compiler,
3838any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3839This is useful if you need to make sure that your Objective-C code can
3840be compiled with older versions of GCC@.
3841
3842@item -freplace-objc-classes
3843@opindex freplace-objc-classes
3844Emit a special marker instructing @command{ld(1)} not to statically link in
3845the resulting object file, and allow @command{dyld(1)} to load it in at
3846run time instead.  This is used in conjunction with the Fix-and-Continue
3847debugging mode, where the object file in question may be recompiled and
3848dynamically reloaded in the course of program execution, without the need
3849to restart the program itself.  Currently, Fix-and-Continue functionality
3850is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3851and later.
3852
3853@item -fzero-link
3854@opindex fzero-link
3855When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3856to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3857compile time) with static class references that get initialized at load time,
3858which improves run-time performance.  Specifying the @option{-fzero-link} flag
3859suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3860to be retained.  This is useful in Zero-Link debugging mode, since it allows
3861for individual class implementations to be modified during program execution.
3862The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3863regardless of command-line options.
3864
3865@item -fno-local-ivars
3866@opindex fno-local-ivars
3867@opindex flocal-ivars
3868By default instance variables in Objective-C can be accessed as if
3869they were local variables from within the methods of the class they're
3870declared in.  This can lead to shadowing between instance variables
3871and other variables declared either locally inside a class method or
3872globally with the same name.  Specifying the @option{-fno-local-ivars}
3873flag disables this behavior thus avoiding variable shadowing issues.
3874
3875@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3876@opindex fivar-visibility
3877Set the default instance variable visibility to the specified option
3878so that instance variables declared outside the scope of any access
3879modifier directives default to the specified visibility.
3880
3881@item -gen-decls
3882@opindex gen-decls
3883Dump interface declarations for all classes seen in the source file to a
3884file named @file{@var{sourcename}.decl}.
3885
3886@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3887@opindex Wassign-intercept
3888@opindex Wno-assign-intercept
3889Warn whenever an Objective-C assignment is being intercepted by the
3890garbage collector.
3891
3892@item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
3893@opindex Wproperty-assign-default
3894@opindex Wno-property-assign-default
3895Do not warn if a property for an Objective-C object has no assign
3896semantics specified.
3897
3898@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3899@opindex Wno-protocol
3900@opindex Wprotocol
3901If a class is declared to implement a protocol, a warning is issued for
3902every method in the protocol that is not implemented by the class.  The
3903default behavior is to issue a warning for every method not explicitly
3904implemented in the class, even if a method implementation is inherited
3905from the superclass.  If you use the @option{-Wno-protocol} option, then
3906methods inherited from the superclass are considered to be implemented,
3907and no warning is issued for them.
3908
3909@item -Wselector @r{(Objective-C and Objective-C++ only)}
3910@opindex Wselector
3911@opindex Wno-selector
3912Warn if multiple methods of different types for the same selector are
3913found during compilation.  The check is performed on the list of methods
3914in the final stage of compilation.  Additionally, a check is performed
3915for each selector appearing in a @code{@@selector(@dots{})}
3916expression, and a corresponding method for that selector has been found
3917during compilation.  Because these checks scan the method table only at
3918the end of compilation, these warnings are not produced if the final
3919stage of compilation is not reached, for example because an error is
3920found during compilation, or because the @option{-fsyntax-only} option is
3921being used.
3922
3923@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3924@opindex Wstrict-selector-match
3925@opindex Wno-strict-selector-match
3926Warn if multiple methods with differing argument and/or return types are
3927found for a given selector when attempting to send a message using this
3928selector to a receiver of type @code{id} or @code{Class}.  When this flag
3929is off (which is the default behavior), the compiler omits such warnings
3930if any differences found are confined to types that share the same size
3931and alignment.
3932
3933@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3934@opindex Wundeclared-selector
3935@opindex Wno-undeclared-selector
3936Warn if a @code{@@selector(@dots{})} expression referring to an
3937undeclared selector is found.  A selector is considered undeclared if no
3938method with that name has been declared before the
3939@code{@@selector(@dots{})} expression, either explicitly in an
3940@code{@@interface} or @code{@@protocol} declaration, or implicitly in
3941an @code{@@implementation} section.  This option always performs its
3942checks as soon as a @code{@@selector(@dots{})} expression is found,
3943while @option{-Wselector} only performs its checks in the final stage of
3944compilation.  This also enforces the coding style convention
3945that methods and selectors must be declared before being used.
3946
3947@item -print-objc-runtime-info
3948@opindex print-objc-runtime-info
3949Generate C header describing the largest structure that is passed by
3950value, if any.
3951
3952@end table
3953
3954@node Diagnostic Message Formatting Options
3955@section Options to Control Diagnostic Messages Formatting
3956@cindex options to control diagnostics formatting
3957@cindex diagnostic messages
3958@cindex message formatting
3959
3960Traditionally, diagnostic messages have been formatted irrespective of
3961the output device's aspect (e.g.@: its width, @dots{}).  You can use the
3962options described below
3963to control the formatting algorithm for diagnostic messages,
3964e.g.@: how many characters per line, how often source location
3965information should be reported.  Note that some language front ends may not
3966honor these options.
3967
3968@table @gcctabopt
3969@item -fmessage-length=@var{n}
3970@opindex fmessage-length
3971Try to format error messages so that they fit on lines of about
3972@var{n} characters.  If @var{n} is zero, then no line-wrapping is
3973done; each error message appears on a single line.  This is the
3974default for all front ends.
3975
3976Note - this option also affects the display of the @samp{#error} and
3977@samp{#warning} pre-processor directives, and the @samp{deprecated}
3978function/type/variable attribute.  It does not however affect the
3979@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3980
3981@item -fdiagnostics-show-location=once
3982@opindex fdiagnostics-show-location
3983Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
3984reporter to emit source location information @emph{once}; that is, in
3985case the message is too long to fit on a single physical line and has to
3986be wrapped, the source location won't be emitted (as prefix) again,
3987over and over, in subsequent continuation lines.  This is the default
3988behavior.
3989
3990@item -fdiagnostics-show-location=every-line
3991Only meaningful in line-wrapping mode.  Instructs the diagnostic
3992messages reporter to emit the same source location information (as
3993prefix) for physical lines that result from the process of breaking
3994a message which is too long to fit on a single line.
3995
3996@item -fdiagnostics-color[=@var{WHEN}]
3997@itemx -fno-diagnostics-color
3998@opindex fdiagnostics-color
3999@cindex highlight, color
4000@vindex GCC_COLORS @r{environment variable}
4001Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
4002or @samp{auto}.  The default depends on how the compiler has been configured,
4003it can be any of the above @var{WHEN} options or also @samp{never}
4004if @env{GCC_COLORS} environment variable isn't present in the environment,
4005and @samp{auto} otherwise.
4006@samp{auto} makes GCC use color only when the standard error is a terminal,
4007and when not executing in an emacs shell.
4008The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4009aliases for @option{-fdiagnostics-color=always} and
4010@option{-fdiagnostics-color=never}, respectively.
4011
4012The colors are defined by the environment variable @env{GCC_COLORS}.
4013Its value is a colon-separated list of capabilities and Select Graphic
4014Rendition (SGR) substrings. SGR commands are interpreted by the
4015terminal or terminal emulator.  (See the section in the documentation
4016of your text terminal for permitted values and their meanings as
4017character attributes.)  These substring values are integers in decimal
4018representation and can be concatenated with semicolons.
4019Common values to concatenate include
4020@samp{1} for bold,
4021@samp{4} for underline,
4022@samp{5} for blink,
4023@samp{7} for inverse,
4024@samp{39} for default foreground color,
4025@samp{30} to @samp{37} for foreground colors,
4026@samp{90} to @samp{97} for 16-color mode foreground colors,
4027@samp{38;5;0} to @samp{38;5;255}
4028for 88-color and 256-color modes foreground colors,
4029@samp{49} for default background color,
4030@samp{40} to @samp{47} for background colors,
4031@samp{100} to @samp{107} for 16-color mode background colors,
4032and @samp{48;5;0} to @samp{48;5;255}
4033for 88-color and 256-color modes background colors.
4034
4035The default @env{GCC_COLORS} is
4036@smallexample
4037error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4038quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4039diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4040type-diff=01;32
4041@end smallexample
4042@noindent
4043where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4044@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4045@samp{01} is bold, and @samp{31} is red.
4046Setting @env{GCC_COLORS} to the empty string disables colors.
4047Supported capabilities are as follows.
4048
4049@table @code
4050@item error=
4051@vindex error GCC_COLORS @r{capability}
4052SGR substring for error: markers.
4053
4054@item warning=
4055@vindex warning GCC_COLORS @r{capability}
4056SGR substring for warning: markers.
4057
4058@item note=
4059@vindex note GCC_COLORS @r{capability}
4060SGR substring for note: markers.
4061
4062@item path=
4063@vindex path GCC_COLORS @r{capability}
4064SGR substring for colorizing paths of control-flow events as printed
4065via @option{-fdiagnostics-path-format=}, such as the identifiers of
4066individual events and lines indicating interprocedural calls and returns.
4067
4068@item range1=
4069@vindex range1 GCC_COLORS @r{capability}
4070SGR substring for first additional range.
4071
4072@item range2=
4073@vindex range2 GCC_COLORS @r{capability}
4074SGR substring for second additional range.
4075
4076@item locus=
4077@vindex locus GCC_COLORS @r{capability}
4078SGR substring for location information, @samp{file:line} or
4079@samp{file:line:column} etc.
4080
4081@item quote=
4082@vindex quote GCC_COLORS @r{capability}
4083SGR substring for information printed within quotes.
4084
4085@item fixit-insert=
4086@vindex fixit-insert GCC_COLORS @r{capability}
4087SGR substring for fix-it hints suggesting text to
4088be inserted or replaced.
4089
4090@item fixit-delete=
4091@vindex fixit-delete GCC_COLORS @r{capability}
4092SGR substring for fix-it hints suggesting text to
4093be deleted.
4094
4095@item diff-filename=
4096@vindex diff-filename GCC_COLORS @r{capability}
4097SGR substring for filename headers within generated patches.
4098
4099@item diff-hunk=
4100@vindex diff-hunk GCC_COLORS @r{capability}
4101SGR substring for the starts of hunks within generated patches.
4102
4103@item diff-delete=
4104@vindex diff-delete GCC_COLORS @r{capability}
4105SGR substring for deleted lines within generated patches.
4106
4107@item diff-insert=
4108@vindex diff-insert GCC_COLORS @r{capability}
4109SGR substring for inserted lines within generated patches.
4110
4111@item type-diff=
4112@vindex type-diff GCC_COLORS @r{capability}
4113SGR substring for highlighting mismatching types within template
4114arguments in the C++ frontend.
4115@end table
4116
4117@item -fdiagnostics-urls[=@var{WHEN}]
4118@opindex fdiagnostics-urls
4119@cindex urls
4120@vindex GCC_URLS @r{environment variable}
4121@vindex TERM_URLS @r{environment variable}
4122Use escape sequences to embed URLs in diagnostics.  For example, when
4123@option{-fdiagnostics-show-option} emits text showing the command-line
4124option controlling a diagnostic, embed a URL for documentation of that
4125option.
4126
4127@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4128@samp{auto} makes GCC use URL escape sequences only when the standard error
4129is a terminal, and when not executing in an emacs shell or any graphical
4130terminal which is known to be incompatible with this feature, see below.
4131
4132The default depends on how the compiler has been configured.
4133It can be any of the above @var{WHEN} options.
4134
4135GCC can also be configured (via the
4136@option{--with-diagnostics-urls=auto-if-env} configure-time option)
4137so that the default is affected by environment variables.
4138Under such a configuration, GCC defaults to using @samp{auto}
4139if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4140present and non-empty in the environment of the compiler, or @samp{never}
4141if neither are.
4142
4143However, even with @option{-fdiagnostics-urls=always} the behavior is
4144dependent on those environment variables:
4145If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4146diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
4147If set to @samp{bel}, the default, URLs use BEL escape sequences.
4148Any other non-empty value enables the feature.
4149If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4150Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4151BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4152
4153At this time GCC tries to detect also a few terminals that are known to
4154not implement the URL feature, and have bugs or at least had bugs in
4155some versions that are still in use, where the URL escapes are likely
4156to misbehave, i.e. print garbage on the screen.
4157That list is currently xfce4-terminal, certain known to be buggy
4158gnome-terminal versions, the linux console, and mingw.
4159This check can be skipped with the @option{-fdiagnostics-urls=always}.
4160
4161@item -fno-diagnostics-show-option
4162@opindex fno-diagnostics-show-option
4163@opindex fdiagnostics-show-option
4164By default, each diagnostic emitted includes text indicating the
4165command-line option that directly controls the diagnostic (if such an
4166option is known to the diagnostic machinery).  Specifying the
4167@option{-fno-diagnostics-show-option} flag suppresses that behavior.
4168
4169@item -fno-diagnostics-show-caret
4170@opindex fno-diagnostics-show-caret
4171@opindex fdiagnostics-show-caret
4172By default, each diagnostic emitted includes the original source line
4173and a caret @samp{^} indicating the column.  This option suppresses this
4174information.  The source line is truncated to @var{n} characters, if
4175the @option{-fmessage-length=n} option is given.  When the output is done
4176to the terminal, the width is limited to the width given by the
4177@env{COLUMNS} environment variable or, if not set, to the terminal width.
4178
4179@item -fno-diagnostics-show-labels
4180@opindex fno-diagnostics-show-labels
4181@opindex fdiagnostics-show-labels
4182By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4183diagnostics can label ranges of source code with pertinent information, such
4184as the types of expressions:
4185
4186@smallexample
4187    printf ("foo %s bar", long_i + long_j);
4188                 ~^       ~~~~~~~~~~~~~~~
4189                  |              |
4190                  char *         long int
4191@end smallexample
4192
4193This option suppresses the printing of these labels (in the example above,
4194the vertical bars and the ``char *'' and ``long int'' text).
4195
4196@item -fno-diagnostics-show-cwe
4197@opindex fno-diagnostics-show-cwe
4198@opindex fdiagnostics-show-cwe
4199Diagnostic messages can optionally have an associated
4200@url{https://cwe.mitre.org/index.html, CWE} identifier.
4201GCC itself only provides such metadata for some of the @option{-fanalyzer}
4202diagnostics.  GCC plugins may also provide diagnostics with such metadata.
4203By default, if this information is present, it will be printed with
4204the diagnostic.  This option suppresses the printing of this metadata.
4205
4206@item -fno-diagnostics-show-line-numbers
4207@opindex fno-diagnostics-show-line-numbers
4208@opindex fdiagnostics-show-line-numbers
4209By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4210a left margin is printed, showing line numbers.  This option suppresses this
4211left margin.
4212
4213@item -fdiagnostics-minimum-margin-width=@var{width}
4214@opindex fdiagnostics-minimum-margin-width
4215This option controls the minimum width of the left margin printed by
4216@option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
4217
4218@item -fdiagnostics-parseable-fixits
4219@opindex fdiagnostics-parseable-fixits
4220Emit fix-it hints in a machine-parseable format, suitable for consumption
4221by IDEs.  For each fix-it, a line will be printed after the relevant
4222diagnostic, starting with the string ``fix-it:''.  For example:
4223
4224@smallexample
4225fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4226@end smallexample
4227
4228The location is expressed as a half-open range, expressed as a count of
4229bytes, starting at byte 1 for the initial column.  In the above example,
4230bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4231given string:
4232
4233@smallexample
423400000000011111111112222222222
423512345678901234567890123456789
4236  gtk_widget_showall (dlg);
4237  ^^^^^^^^^^^^^^^^^^
4238  gtk_widget_show_all
4239@end smallexample
4240
4241The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4242newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4243(e.g. vertical tab as ``\013'').
4244
4245An empty replacement string indicates that the given range is to be removed.
4246An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4247be inserted at the given position.
4248
4249@item -fdiagnostics-generate-patch
4250@opindex fdiagnostics-generate-patch
4251Print fix-it hints to stderr in unified diff format, after any diagnostics
4252are printed.  For example:
4253
4254@smallexample
4255--- test.c
4256+++ test.c
4257@@ -42,5 +42,5 @@
4258
4259 void show_cb(GtkDialog *dlg)
4260 @{
4261-  gtk_widget_showall(dlg);
4262+  gtk_widget_show_all(dlg);
4263 @}
4264
4265@end smallexample
4266
4267The diff may or may not be colorized, following the same rules
4268as for diagnostics (see @option{-fdiagnostics-color}).
4269
4270@item -fdiagnostics-show-template-tree
4271@opindex fdiagnostics-show-template-tree
4272
4273In the C++ frontend, when printing diagnostics showing mismatching
4274template types, such as:
4275
4276@smallexample
4277  could not convert 'std::map<int, std::vector<double> >()'
4278    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4279@end smallexample
4280
4281the @option{-fdiagnostics-show-template-tree} flag enables printing a
4282tree-like structure showing the common and differing parts of the types,
4283such as:
4284
4285@smallexample
4286  map<
4287    [...],
4288    vector<
4289      [double != float]>>
4290@end smallexample
4291
4292The parts that differ are highlighted with color (``double'' and
4293``float'' in this case).
4294
4295@item -fno-elide-type
4296@opindex fno-elide-type
4297@opindex felide-type
4298By default when the C++ frontend prints diagnostics showing mismatching
4299template types, common parts of the types are printed as ``[...]'' to
4300simplify the error message.  For example:
4301
4302@smallexample
4303  could not convert 'std::map<int, std::vector<double> >()'
4304    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4305@end smallexample
4306
4307Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4308This flag also affects the output of the
4309@option{-fdiagnostics-show-template-tree} flag.
4310
4311@item -fdiagnostics-path-format=@var{KIND}
4312@opindex fdiagnostics-path-format
4313Specify how to print paths of control-flow events for diagnostics that
4314have such a path associated with them.
4315
4316@var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4317the default.
4318
4319@samp{none} means to not print diagnostic paths.
4320
4321@samp{separate-events} means to print a separate ``note'' diagnostic for
4322each event within the diagnostic.  For example:
4323
4324@smallexample
4325test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4326test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4327test.c:27:3: note: (2) when 'i < count'
4328test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4329@end smallexample
4330
4331@samp{inline-events} means to print the events ``inline'' within the source
4332code.  This view attempts to consolidate the events into runs of
4333sufficiently-close events, printing them as labelled ranges within the source.
4334
4335For example, the same events as above might be printed as:
4336
4337@smallexample
4338  'test': events 1-3
4339    |
4340    |   25 |   list = PyList_New(0);
4341    |      |          ^~~~~~~~~~~~~
4342    |      |          |
4343    |      |          (1) when 'PyList_New' fails, returning NULL
4344    |   26 |
4345    |   27 |   for (i = 0; i < count; i++) @{
4346    |      |   ~~~
4347    |      |   |
4348    |      |   (2) when 'i < count'
4349    |   28 |     item = PyLong_FromLong(random());
4350    |   29 |     PyList_Append(list, item);
4351    |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
4352    |      |     |
4353    |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4354    |
4355@end smallexample
4356
4357Interprocedural control flow is shown by grouping the events by stack frame,
4358and using indentation to show how stack frames are nested, pushed, and popped.
4359
4360For example:
4361
4362@smallexample
4363  'test': events 1-2
4364    |
4365    |  133 | @{
4366    |      | ^
4367    |      | |
4368    |      | (1) entering 'test'
4369    |  134 |   boxed_int *obj = make_boxed_int (i);
4370    |      |                    ~~~~~~~~~~~~~~~~~~
4371    |      |                    |
4372    |      |                    (2) calling 'make_boxed_int'
4373    |
4374    +--> 'make_boxed_int': events 3-4
4375           |
4376           |  120 | @{
4377           |      | ^
4378           |      | |
4379           |      | (3) entering 'make_boxed_int'
4380           |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4381           |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4382           |      |                                    |
4383           |      |                                    (4) calling 'wrapped_malloc'
4384           |
4385           +--> 'wrapped_malloc': events 5-6
4386                  |
4387                  |    7 | @{
4388                  |      | ^
4389                  |      | |
4390                  |      | (5) entering 'wrapped_malloc'
4391                  |    8 |   return malloc (size);
4392                  |      |          ~~~~~~~~~~~~~
4393                  |      |          |
4394                  |      |          (6) calling 'malloc'
4395                  |
4396    <-------------+
4397    |
4398 'test': event 7
4399    |
4400    |  138 |   free_boxed_int (obj);
4401    |      |   ^~~~~~~~~~~~~~~~~~~~
4402    |      |   |
4403    |      |   (7) calling 'free_boxed_int'
4404    |
4405(etc)
4406@end smallexample
4407
4408@item -fdiagnostics-show-path-depths
4409@opindex fdiagnostics-show-path-depths
4410This option provides additional information when printing control-flow paths
4411associated with a diagnostic.
4412
4413If this is option is provided then the stack depth will be printed for
4414each run of events within @option{-fdiagnostics-path-format=separate-events}.
4415
4416This is intended for use by GCC developers and plugin developers when
4417debugging diagnostics that report interprocedural control flow.
4418
4419@item -fno-show-column
4420@opindex fno-show-column
4421@opindex fshow-column
4422Do not print column numbers in diagnostics.  This may be necessary if
4423diagnostics are being scanned by a program that does not understand the
4424column numbers, such as @command{dejagnu}.
4425
4426@item -fdiagnostics-format=@var{FORMAT}
4427@opindex fdiagnostics-format
4428Select a different format for printing diagnostics.
4429@var{FORMAT} is @samp{text} or @samp{json}.
4430The default is @samp{text}.
4431
4432The @samp{json} format consists of a top-level JSON array containing JSON
4433objects representing the diagnostics.
4434
4435The JSON is emitted as one line, without formatting; the examples below
4436have been formatted for clarity.
4437
4438Diagnostics can have child diagnostics.  For example, this error and note:
4439
4440@smallexample
4441misleading-indentation.c:15:3: warning: this 'if' clause does not
4442  guard... [-Wmisleading-indentation]
4443   15 |   if (flag)
4444      |   ^~
4445misleading-indentation.c:17:5: note: ...this statement, but the latter
4446  is misleadingly indented as if it were guarded by the 'if'
4447   17 |     y = 2;
4448      |     ^
4449@end smallexample
4450
4451@noindent
4452might be printed in JSON form (after formatting) like this:
4453
4454@smallexample
4455[
4456    @{
4457        "kind": "warning",
4458        "locations": [
4459            @{
4460                "caret": @{
4461                    "column": 3,
4462                    "file": "misleading-indentation.c",
4463                    "line": 15
4464                @},
4465                "finish": @{
4466                    "column": 4,
4467                    "file": "misleading-indentation.c",
4468                    "line": 15
4469                @}
4470            @}
4471        ],
4472        "message": "this \u2018if\u2019 clause does not guard...",
4473        "option": "-Wmisleading-indentation",
4474        "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4475        "children": [
4476            @{
4477                "kind": "note",
4478                "locations": [
4479                    @{
4480                        "caret": @{
4481                            "column": 5,
4482                            "file": "misleading-indentation.c",
4483                            "line": 17
4484                        @}
4485                    @}
4486                ],
4487                "message": "...this statement, but the latter is @dots{}"
4488            @}
4489        ]
4490    @},
4491    @dots{}
4492]
4493@end smallexample
4494
4495@noindent
4496where the @code{note} is a child of the @code{warning}.
4497
4498A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
4499an @code{option} key describing the command-line option controlling the
4500warning.
4501
4502A diagnostic can contain zero or more locations.  Each location has up
4503to three positions within it: a @code{caret} position and optional
4504@code{start} and @code{finish} positions.  A location can also have
4505an optional @code{label} string.  For example, this error:
4506
4507@smallexample
4508bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4509   'struct s'@} and 'T' @{aka 'struct t'@})
4510   64 |   return callee_4a () + callee_4b ();
4511      |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4512      |          |              |
4513      |          |              T @{aka struct t@}
4514      |          S @{aka struct s@}
4515@end smallexample
4516
4517@noindent
4518has three locations.  Its primary location is at the ``+'' token at column
451923.  It has two secondary locations, describing the left and right-hand sides
4520of the expression, which have labels.  It might be printed in JSON form as:
4521
4522@smallexample
4523    @{
4524        "children": [],
4525        "kind": "error",
4526        "locations": [
4527            @{
4528                "caret": @{
4529                    "column": 23, "file": "bad-binary-ops.c", "line": 64
4530                @}
4531            @},
4532            @{
4533                "caret": @{
4534                    "column": 10, "file": "bad-binary-ops.c", "line": 64
4535                @},
4536                "finish": @{
4537                    "column": 21, "file": "bad-binary-ops.c", "line": 64
4538                @},
4539                "label": "S @{aka struct s@}"
4540            @},
4541            @{
4542                "caret": @{
4543                    "column": 25, "file": "bad-binary-ops.c", "line": 64
4544                @},
4545                "finish": @{
4546                    "column": 36, "file": "bad-binary-ops.c", "line": 64
4547                @},
4548                "label": "T @{aka struct t@}"
4549            @}
4550        ],
4551        "message": "invalid operands to binary + @dots{}"
4552    @}
4553@end smallexample
4554
4555If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4556consisting of half-open intervals, similar to the output of
4557@option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
4558with a replacement fix-it hint:
4559
4560@smallexample
4561demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4562  mean 'color'?
4563    8 |   return ptr->colour;
4564      |               ^~~~~~
4565      |               color
4566@end smallexample
4567
4568@noindent
4569might be printed in JSON form as:
4570
4571@smallexample
4572    @{
4573        "children": [],
4574        "fixits": [
4575            @{
4576                "next": @{
4577                    "column": 21,
4578                    "file": "demo.c",
4579                    "line": 8
4580                @},
4581                "start": @{
4582                    "column": 15,
4583                    "file": "demo.c",
4584                    "line": 8
4585                @},
4586                "string": "color"
4587            @}
4588        ],
4589        "kind": "error",
4590        "locations": [
4591            @{
4592                "caret": @{
4593                    "column": 15,
4594                    "file": "demo.c",
4595                    "line": 8
4596                @},
4597                "finish": @{
4598                    "column": 20,
4599                    "file": "demo.c",
4600                    "line": 8
4601                @}
4602            @}
4603        ],
4604        "message": "\u2018struct s\u2019 has no member named @dots{}"
4605    @}
4606@end smallexample
4607
4608@noindent
4609where the fix-it hint suggests replacing the text from @code{start} up
4610to but not including @code{next} with @code{string}'s value.  Deletions
4611are expressed via an empty value for @code{string}, insertions by
4612having @code{start} equal @code{next}.
4613
4614If the diagnostic has a path of control-flow events associated with it,
4615it has a @code{path} array of objects representing the events.  Each
4616event object has a @code{description} string, a @code{location} object,
4617along with a @code{function} string and a @code{depth} number for
4618representing interprocedural paths.  The @code{function} represents the
4619current function at that event, and the @code{depth} represents the
4620stack depth relative to some baseline: the higher, the more frames are
4621within the stack.
4622
4623For example, the intraprocedural example shown for
4624@option{-fdiagnostics-path-format=} might have this JSON for its path:
4625
4626@smallexample
4627    "path": [
4628        @{
4629            "depth": 0,
4630            "description": "when 'PyList_New' fails, returning NULL",
4631            "function": "test",
4632            "location": @{
4633                "column": 10,
4634                "file": "test.c",
4635                "line": 25
4636            @}
4637        @},
4638        @{
4639            "depth": 0,
4640            "description": "when 'i < count'",
4641            "function": "test",
4642            "location": @{
4643                "column": 3,
4644                "file": "test.c",
4645                "line": 27
4646            @}
4647        @},
4648        @{
4649            "depth": 0,
4650            "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4651            "function": "test",
4652            "location": @{
4653                "column": 5,
4654                "file": "test.c",
4655                "line": 29
4656            @}
4657        @}
4658    ]
4659@end smallexample
4660
4661@end table
4662
4663@node Warning Options
4664@section Options to Request or Suppress Warnings
4665@cindex options to control warnings
4666@cindex warning messages
4667@cindex messages, warning
4668@cindex suppressing warnings
4669
4670Warnings are diagnostic messages that report constructions that
4671are not inherently erroneous but that are risky or suggest there
4672may have been an error.
4673
4674The following language-independent options do not enable specific
4675warnings but control the kinds of diagnostics produced by GCC@.
4676
4677@table @gcctabopt
4678@cindex syntax checking
4679@item -fsyntax-only
4680@opindex fsyntax-only
4681Check the code for syntax errors, but don't do anything beyond that.
4682
4683@item -fmax-errors=@var{n}
4684@opindex fmax-errors
4685Limits the maximum number of error messages to @var{n}, at which point
4686GCC bails out rather than attempting to continue processing the source
4687code.  If @var{n} is 0 (the default), there is no limit on the number
4688of error messages produced.  If @option{-Wfatal-errors} is also
4689specified, then @option{-Wfatal-errors} takes precedence over this
4690option.
4691
4692@item -w
4693@opindex w
4694Inhibit all warning messages.
4695
4696@item -Werror
4697@opindex Werror
4698@opindex Wno-error
4699Make all warnings into errors.
4700
4701@item -Werror=
4702@opindex Werror=
4703@opindex Wno-error=
4704Make the specified warning into an error.  The specifier for a warning
4705is appended; for example @option{-Werror=switch} turns the warnings
4706controlled by @option{-Wswitch} into errors.  This switch takes a
4707negative form, to be used to negate @option{-Werror} for specific
4708warnings; for example @option{-Wno-error=switch} makes
4709@option{-Wswitch} warnings not be errors, even when @option{-Werror}
4710is in effect.
4711
4712The warning message for each controllable warning includes the
4713option that controls the warning.  That option can then be used with
4714@option{-Werror=} and @option{-Wno-error=} as described above.
4715(Printing of the option in the warning message can be disabled using the
4716@option{-fno-diagnostics-show-option} flag.)
4717
4718Note that specifying @option{-Werror=}@var{foo} automatically implies
4719@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
4720imply anything.
4721
4722@item -Wfatal-errors
4723@opindex Wfatal-errors
4724@opindex Wno-fatal-errors
4725This option causes the compiler to abort compilation on the first error
4726occurred rather than trying to keep going and printing further error
4727messages.
4728
4729@end table
4730
4731You can request many specific warnings with options beginning with
4732@samp{-W}, for example @option{-Wimplicit} to request warnings on
4733implicit declarations.  Each of these specific warning options also
4734has a negative form beginning @samp{-Wno-} to turn off warnings; for
4735example, @option{-Wno-implicit}.  This manual lists only one of the
4736two forms, whichever is not the default.  For further
4737language-specific options also refer to @ref{C++ Dialect Options} and
4738@ref{Objective-C and Objective-C++ Dialect Options}.
4739Additional warnings can be produced by enabling the static analyzer;
4740@xref{Static Analyzer Options}.
4741
4742Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4743options, such as @option{-Wunused}, which may turn on further options,
4744such as @option{-Wunused-value}. The combined effect of positive and
4745negative forms is that more specific options have priority over less
4746specific ones, independently of their position in the command-line. For
4747options of the same specificity, the last one takes effect. Options
4748enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4749as if they appeared at the end of the command-line.
4750
4751When an unrecognized warning option is requested (e.g.,
4752@option{-Wunknown-warning}), GCC emits a diagnostic stating
4753that the option is not recognized.  However, if the @option{-Wno-} form
4754is used, the behavior is slightly different: no diagnostic is
4755produced for @option{-Wno-unknown-warning} unless other diagnostics
4756are being produced.  This allows the use of new @option{-Wno-} options
4757with old compilers, but if something goes wrong, the compiler
4758warns that an unrecognized option is present.
4759
4760The effectiveness of some warnings depends on optimizations also being
4761enabled. For example @option{-Wsuggest-final-types} is more effective
4762with link-time optimization and @option{-Wmaybe-uninitialized} does not
4763warn at all unless optimization is enabled.
4764
4765@table @gcctabopt
4766@item -Wpedantic
4767@itemx -pedantic
4768@opindex pedantic
4769@opindex Wpedantic
4770@opindex Wno-pedantic
4771Issue all the warnings demanded by strict ISO C and ISO C++;
4772reject all programs that use forbidden extensions, and some other
4773programs that do not follow ISO C and ISO C++.  For ISO C, follows the
4774version of the ISO C standard specified by any @option{-std} option used.
4775
4776Valid ISO C and ISO C++ programs should compile properly with or without
4777this option (though a rare few require @option{-ansi} or a
4778@option{-std} option specifying the required version of ISO C)@.  However,
4779without this option, certain GNU extensions and traditional C and C++
4780features are supported as well.  With this option, they are rejected.
4781
4782@option{-Wpedantic} does not cause warning messages for use of the
4783alternate keywords whose names begin and end with @samp{__}.  This alternate
4784format can also be used to disable warnings for non-ISO @samp{__intN} types,
4785i.e. @samp{__intN__}.
4786Pedantic warnings are also disabled in the expression that follows
4787@code{__extension__}.  However, only system header files should use
4788these escape routes; application programs should avoid them.
4789@xref{Alternate Keywords}.
4790
4791Some users try to use @option{-Wpedantic} to check programs for strict ISO
4792C conformance.  They soon find that it does not do quite what they want:
4793it finds some non-ISO practices, but not all---only those for which
4794ISO C @emph{requires} a diagnostic, and some others for which
4795diagnostics have been added.
4796
4797A feature to report any failure to conform to ISO C might be useful in
4798some instances, but would require considerable additional work and would
4799be quite different from @option{-Wpedantic}.  We don't have plans to
4800support such a feature in the near future.
4801
4802Where the standard specified with @option{-std} represents a GNU
4803extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4804corresponding @dfn{base standard}, the version of ISO C on which the GNU
4805extended dialect is based.  Warnings from @option{-Wpedantic} are given
4806where they are required by the base standard.  (It does not make sense
4807for such warnings to be given only for features not in the specified GNU
4808C dialect, since by definition the GNU dialects of C include all
4809features the compiler supports with the given option, and there would be
4810nothing to warn about.)
4811
4812@item -pedantic-errors
4813@opindex pedantic-errors
4814Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4815requires a diagnostic, in some cases where there is undefined behavior
4816at compile-time and in some other cases that do not prevent compilation
4817of programs that are valid according to the standard. This is not
4818equivalent to @option{-Werror=pedantic}, since there are errors enabled
4819by this option and not enabled by the latter and vice versa.
4820
4821@item -Wall
4822@opindex Wall
4823@opindex Wno-all
4824This enables all the warnings about constructions that some users
4825consider questionable, and that are easy to avoid (or modify to
4826prevent the warning), even in conjunction with macros.  This also
4827enables some language-specific warnings described in @ref{C++ Dialect
4828Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4829
4830@option{-Wall} turns on the following warning flags:
4831
4832@gccoptlist{-Waddress   @gol
4833-Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
4834-Wbool-compare  @gol
4835-Wbool-operation  @gol
4836-Wc++11-compat  -Wc++14-compat  @gol
4837-Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
4838-Wchar-subscripts  @gol
4839-Wcomment  @gol
4840-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4841-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4842-Wenum-conversion @r{in C/ObjC;} @gol
4843-Wformat   @gol
4844-Wformat-overflow  @gol
4845-Wformat-truncation  @gol
4846-Wint-in-bool-context  @gol
4847-Wimplicit @r{(C and Objective-C only)} @gol
4848-Wimplicit-int @r{(C and Objective-C only)} @gol
4849-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4850-Winit-self @r{(only for C++)} @gol
4851-Wlogical-not-parentheses @gol
4852-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
4853-Wmaybe-uninitialized @gol
4854-Wmemset-elt-size @gol
4855-Wmemset-transposed-args @gol
4856-Wmisleading-indentation @r{(only for C/C++)} @gol
4857-Wmissing-attributes @gol
4858-Wmissing-braces @r{(only for C/ObjC)} @gol
4859-Wmultistatement-macros  @gol
4860-Wnarrowing @r{(only for C++)}  @gol
4861-Wnonnull  @gol
4862-Wnonnull-compare  @gol
4863-Wopenmp-simd @gol
4864-Wparentheses  @gol
4865-Wpessimizing-move @r{(only for C++)}  @gol
4866-Wpointer-sign  @gol
4867-Wreorder   @gol
4868-Wrestrict   @gol
4869-Wreturn-type  @gol
4870-Wsequence-point  @gol
4871-Wsign-compare @r{(only in C++)}  @gol
4872-Wsizeof-pointer-div @gol
4873-Wsizeof-pointer-memaccess @gol
4874-Wstrict-aliasing  @gol
4875-Wstrict-overflow=1  @gol
4876-Wswitch  @gol
4877-Wtautological-compare  @gol
4878-Wtrigraphs  @gol
4879-Wuninitialized  @gol
4880-Wunknown-pragmas  @gol
4881-Wunused-function  @gol
4882-Wunused-label     @gol
4883-Wunused-value     @gol
4884-Wunused-variable  @gol
4885-Wvolatile-register-var  @gol
4886-Wzero-length-bounds}
4887
4888Note that some warning flags are not implied by @option{-Wall}.  Some of
4889them warn about constructions that users generally do not consider
4890questionable, but which occasionally you might wish to check for;
4891others warn about constructions that are necessary or hard to avoid in
4892some cases, and there is no simple way to modify the code to suppress
4893the warning. Some of them are enabled by @option{-Wextra} but many of
4894them must be enabled individually.
4895
4896@item -Wextra
4897@opindex W
4898@opindex Wextra
4899@opindex Wno-extra
4900This enables some extra warning flags that are not enabled by
4901@option{-Wall}. (This option used to be called @option{-W}.  The older
4902name is still supported, but the newer name is more descriptive.)
4903
4904@gccoptlist{-Wclobbered  @gol
4905-Wcast-function-type  @gol
4906-Wdeprecated-copy @r{(C++ only)} @gol
4907-Wempty-body  @gol
4908-Wignored-qualifiers @gol
4909-Wimplicit-fallthrough=3 @gol
4910-Wmissing-field-initializers  @gol
4911-Wmissing-parameter-type @r{(C only)}  @gol
4912-Wold-style-declaration @r{(C only)}  @gol
4913-Woverride-init  @gol
4914-Wsign-compare @r{(C only)} @gol
4915-Wstring-compare @gol
4916-Wredundant-move @r{(only for C++)}  @gol
4917-Wtype-limits  @gol
4918-Wuninitialized  @gol
4919-Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}  @gol
4920-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4921-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4922
4923
4924The option @option{-Wextra} also prints warning messages for the
4925following cases:
4926
4927@itemize @bullet
4928
4929@item
4930A pointer is compared against integer zero with @code{<}, @code{<=},
4931@code{>}, or @code{>=}.
4932
4933@item
4934(C++ only) An enumerator and a non-enumerator both appear in a
4935conditional expression.
4936
4937@item
4938(C++ only) Ambiguous virtual bases.
4939
4940@item
4941(C++ only) Subscripting an array that has been declared @code{register}.
4942
4943@item
4944(C++ only) Taking the address of a variable that has been declared
4945@code{register}.
4946
4947@item
4948(C++ only) A base class is not initialized in the copy constructor
4949of a derived class.
4950
4951@end itemize
4952
4953@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
4954@opindex Wabi
4955@opindex Wno-abi
4956
4957Warn about code affected by ABI changes.  This includes code that may
4958not be compatible with the vendor-neutral C++ ABI as well as the psABI
4959for the particular target.
4960
4961Since G++ now defaults to updating the ABI with each major release,
4962normally @option{-Wabi} warns only about C++ ABI compatibility
4963problems if there is a check added later in a release series for an
4964ABI issue discovered since the initial release.  @option{-Wabi} warns
4965about more things if an older ABI version is selected (with
4966@option{-fabi-version=@var{n}}).
4967
4968@option{-Wabi} can also be used with an explicit version number to
4969warn about C++ ABI compatibility with a particular @option{-fabi-version}
4970level, e.g.@: @option{-Wabi=2} to warn about changes relative to
4971@option{-fabi-version=2}.
4972
4973If an explicit version number is provided and
4974@option{-fabi-compat-version} is not specified, the version number
4975from this option is used for compatibility aliases.  If no explicit
4976version number is provided with this option, but
4977@option{-fabi-compat-version} is specified, that version number is
4978used for C++ ABI warnings.
4979
4980Although an effort has been made to warn about
4981all such cases, there are probably some cases that are not warned about,
4982even though G++ is generating incompatible code.  There may also be
4983cases where warnings are emitted even though the code that is generated
4984is compatible.
4985
4986You should rewrite your code to avoid these warnings if you are
4987concerned about the fact that code generated by G++ may not be binary
4988compatible with code generated by other compilers.
4989
4990Known incompatibilities in @option{-fabi-version=2} (which was the
4991default from GCC 3.4 to 4.9) include:
4992
4993@itemize @bullet
4994
4995@item
4996A template with a non-type template parameter of reference type was
4997mangled incorrectly:
4998@smallexample
4999extern int N;
5000template <int &> struct S @{@};
5001void n (S<N>) @{2@}
5002@end smallexample
5003
5004This was fixed in @option{-fabi-version=3}.
5005
5006@item
5007SIMD vector types declared using @code{__attribute ((vector_size))} were
5008mangled in a non-standard way that does not allow for overloading of
5009functions taking vectors of different sizes.
5010
5011The mangling was changed in @option{-fabi-version=4}.
5012
5013@item
5014@code{__attribute ((const))} and @code{noreturn} were mangled as type
5015qualifiers, and @code{decltype} of a plain declaration was folded away.
5016
5017These mangling issues were fixed in @option{-fabi-version=5}.
5018
5019@item
5020Scoped enumerators passed as arguments to a variadic function are
5021promoted like unscoped enumerators, causing @code{va_arg} to complain.
5022On most targets this does not actually affect the parameter passing
5023ABI, as there is no way to pass an argument smaller than @code{int}.
5024
5025Also, the ABI changed the mangling of template argument packs,
5026@code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5027a class scope function used as a template argument.
5028
5029These issues were corrected in @option{-fabi-version=6}.
5030
5031@item
5032Lambdas in default argument scope were mangled incorrectly, and the
5033ABI changed the mangling of @code{nullptr_t}.
5034
5035These issues were corrected in @option{-fabi-version=7}.
5036
5037@item
5038When mangling a function type with function-cv-qualifiers, the
5039un-qualified function type was incorrectly treated as a substitution
5040candidate.
5041
5042This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5043
5044@item
5045@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5046unaligned accesses.  Note that this did not affect the ABI of a
5047function with a @code{nullptr_t} parameter, as parameters have a
5048minimum alignment.
5049
5050This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5051
5052@item
5053Target-specific attributes that affect the identity of a type, such as
5054ia32 calling conventions on a function type (stdcall, regparm, etc.),
5055did not affect the mangled name, leading to name collisions when
5056function pointers were used as template arguments.
5057
5058This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5059
5060@end itemize
5061
5062This option also enables warnings about psABI-related changes.
5063The known psABI changes at this point include:
5064
5065@itemize @bullet
5066
5067@item
5068For SysV/x86-64, unions with @code{long double} members are
5069passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
5070the case.  For example:
5071
5072@smallexample
5073union U @{
5074  long double ld;
5075  int i;
5076@};
5077@end smallexample
5078
5079@noindent
5080@code{union U} is now always passed in memory.
5081
5082@end itemize
5083
5084@item -Wchar-subscripts
5085@opindex Wchar-subscripts
5086@opindex Wno-char-subscripts
5087Warn if an array subscript has type @code{char}.  This is a common cause
5088of error, as programmers often forget that this type is signed on some
5089machines.
5090This warning is enabled by @option{-Wall}.
5091
5092@item -Wno-coverage-mismatch
5093@opindex Wno-coverage-mismatch
5094@opindex Wcoverage-mismatch
5095Warn if feedback profiles do not match when using the
5096@option{-fprofile-use} option.
5097If a source file is changed between compiling with @option{-fprofile-generate}
5098and with @option{-fprofile-use}, the files with the profile feedback can fail
5099to match the source file and GCC cannot use the profile feedback
5100information.  By default, this warning is enabled and is treated as an
5101error.  @option{-Wno-coverage-mismatch} can be used to disable the
5102warning or @option{-Wno-error=coverage-mismatch} can be used to
5103disable the error.  Disabling the error for this warning can result in
5104poorly optimized code and is useful only in the
5105case of very minor changes such as bug fixes to an existing code-base.
5106Completely disabling the warning is not recommended.
5107
5108@item -Wno-cpp
5109@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5110@opindex Wno-cpp
5111@opindex Wcpp
5112Suppress warning messages emitted by @code{#warning} directives.
5113
5114@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5115@opindex Wdouble-promotion
5116@opindex Wno-double-promotion
5117Give a warning when a value of type @code{float} is implicitly
5118promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
5119floating-point unit implement @code{float} in hardware, but emulate
5120@code{double} in software.  On such a machine, doing computations
5121using @code{double} values is much more expensive because of the
5122overhead required for software emulation.
5123
5124It is easy to accidentally do computations with @code{double} because
5125floating-point literals are implicitly of type @code{double}.  For
5126example, in:
5127@smallexample
5128@group
5129float area(float radius)
5130@{
5131   return 3.14159 * radius * radius;
5132@}
5133@end group
5134@end smallexample
5135the compiler performs the entire computation with @code{double}
5136because the floating-point literal is a @code{double}.
5137
5138@item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5139@opindex Wduplicate-decl-specifier
5140@opindex Wno-duplicate-decl-specifier
5141Warn if a declaration has duplicate @code{const}, @code{volatile},
5142@code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
5143@option{-Wall}.
5144
5145@item -Wformat
5146@itemx -Wformat=@var{n}
5147@opindex Wformat
5148@opindex Wno-format
5149@opindex ffreestanding
5150@opindex fno-builtin
5151@opindex Wformat=
5152Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5153the arguments supplied have types appropriate to the format string
5154specified, and that the conversions specified in the format string make
5155sense.  This includes standard functions, and others specified by format
5156attributes (@pxref{Function Attributes}), in the @code{printf},
5157@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5158not in the C standard) families (or other target-specific families).
5159Which functions are checked without format attributes having been
5160specified depends on the standard version selected, and such checks of
5161functions without the attribute specified are disabled by
5162@option{-ffreestanding} or @option{-fno-builtin}.
5163
5164The formats are checked against the format features supported by GNU
5165libc version 2.2.  These include all ISO C90 and C99 features, as well
5166as features from the Single Unix Specification and some BSD and GNU
5167extensions.  Other library implementations may not support all these
5168features; GCC does not support warning about features that go beyond a
5169particular library's limitations.  However, if @option{-Wpedantic} is used
5170with @option{-Wformat}, warnings are given about format features not
5171in the selected standard version (but not for @code{strfmon} formats,
5172since those are not in any version of the C standard).  @xref{C Dialect
5173Options,,Options Controlling C Dialect}.
5174
5175@table @gcctabopt
5176@item -Wformat=1
5177@itemx -Wformat
5178@opindex Wformat
5179@opindex Wformat=1
5180Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5181@option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
5182@option{-Wformat} also checks for null format arguments for several
5183functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
5184aspects of this level of format checking can be disabled by the
5185options: @option{-Wno-format-contains-nul},
5186@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5187@option{-Wformat} is enabled by @option{-Wall}.
5188
5189@item -Wformat=2
5190@opindex Wformat=2
5191Enable @option{-Wformat} plus additional format checks.  Currently
5192equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5193-Wformat-y2k}.
5194@end table
5195
5196@item -Wno-format-contains-nul
5197@opindex Wno-format-contains-nul
5198@opindex Wformat-contains-nul
5199If @option{-Wformat} is specified, do not warn about format strings that
5200contain NUL bytes.
5201
5202@item -Wno-format-extra-args
5203@opindex Wno-format-extra-args
5204@opindex Wformat-extra-args
5205If @option{-Wformat} is specified, do not warn about excess arguments to a
5206@code{printf} or @code{scanf} format function.  The C standard specifies
5207that such arguments are ignored.
5208
5209Where the unused arguments lie between used arguments that are
5210specified with @samp{$} operand number specifications, normally
5211warnings are still given, since the implementation could not know what
5212type to pass to @code{va_arg} to skip the unused arguments.  However,
5213in the case of @code{scanf} formats, this option suppresses the
5214warning if the unused arguments are all pointers, since the Single
5215Unix Specification says that such unused arguments are allowed.
5216
5217@item -Wformat-overflow
5218@itemx -Wformat-overflow=@var{level}
5219@opindex Wformat-overflow
5220@opindex Wno-format-overflow
5221Warn about calls to formatted input/output functions such as @code{sprintf}
5222and @code{vsprintf} that might overflow the destination buffer.  When the
5223exact number of bytes written by a format directive cannot be determined
5224at compile-time it is estimated based on heuristics that depend on the
5225@var{level} argument and on optimization.  While enabling optimization
5226will in most cases improve the accuracy of the warning, it may also
5227result in false positives.
5228
5229@table @gcctabopt
5230@item -Wformat-overflow
5231@itemx -Wformat-overflow=1
5232@opindex Wformat-overflow
5233@opindex Wno-format-overflow
5234Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5235employs a conservative approach that warns only about calls that most
5236likely overflow the buffer.  At this level, numeric arguments to format
5237directives with unknown values are assumed to have the value of one, and
5238strings of unknown length to be empty.  Numeric arguments that are known
5239to be bounded to a subrange of their type, or string arguments whose output
5240is bounded either by their directive's precision or by a finite set of
5241string literals, are assumed to take on the value within the range that
5242results in the most bytes on output.  For example, the call to @code{sprintf}
5243below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5244the terminating NUL character (@code{'\0'}) appended by the function
5245to the destination buffer will be written past its end.  Increasing
5246the size of the buffer by a single byte is sufficient to avoid the
5247warning, though it may not be sufficient to avoid the overflow.
5248
5249@smallexample
5250void f (int a, int b)
5251@{
5252  char buf [13];
5253  sprintf (buf, "a = %i, b = %i\n", a, b);
5254@}
5255@end smallexample
5256
5257@item -Wformat-overflow=2
5258Level @var{2} warns also about calls that might overflow the destination
5259buffer given an argument of sufficient length or magnitude.  At level
5260@var{2}, unknown numeric arguments are assumed to have the minimum
5261representable value for signed types with a precision greater than 1, and
5262the maximum representable value otherwise.  Unknown string arguments whose
5263length cannot be assumed to be bounded either by the directive's precision,
5264or by a finite set of string literals they may evaluate to, or the character
5265array they may point to, are assumed to be 1 character long.
5266
5267At level @var{2}, the call in the example above is again diagnosed, but
5268this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5269@code{%i} directive will write some of its digits beyond the end of
5270the destination buffer.  To make the call safe regardless of the values
5271of the two variables, the size of the destination buffer must be increased
5272to at least 34 bytes.  GCC includes the minimum size of the buffer in
5273an informational note following the warning.
5274
5275An alternative to increasing the size of the destination buffer is to
5276constrain the range of formatted values.  The maximum length of string
5277arguments can be bounded by specifying the precision in the format
5278directive.  When numeric arguments of format directives can be assumed
5279to be bounded by less than the precision of their type, choosing
5280an appropriate length modifier to the format specifier will reduce
5281the required buffer size.  For example, if @var{a} and @var{b} in the
5282example above can be assumed to be within the precision of
5283the @code{short int} type then using either the @code{%hi} format
5284directive or casting the argument to @code{short} reduces the maximum
5285required size of the buffer to 24 bytes.
5286
5287@smallexample
5288void f (int a, int b)
5289@{
5290  char buf [23];
5291  sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5292@}
5293@end smallexample
5294@end table
5295
5296@item -Wno-format-zero-length
5297@opindex Wno-format-zero-length
5298@opindex Wformat-zero-length
5299If @option{-Wformat} is specified, do not warn about zero-length formats.
5300The C standard specifies that zero-length formats are allowed.
5301
5302@item -Wformat-nonliteral
5303@opindex Wformat-nonliteral
5304@opindex Wno-format-nonliteral
5305If @option{-Wformat} is specified, also warn if the format string is not a
5306string literal and so cannot be checked, unless the format function
5307takes its format arguments as a @code{va_list}.
5308
5309@item -Wformat-security
5310@opindex Wformat-security
5311@opindex Wno-format-security
5312If @option{-Wformat} is specified, also warn about uses of format
5313functions that represent possible security problems.  At present, this
5314warns about calls to @code{printf} and @code{scanf} functions where the
5315format string is not a string literal and there are no format arguments,
5316as in @code{printf (foo);}.  This may be a security hole if the format
5317string came from untrusted input and contains @samp{%n}.  (This is
5318currently a subset of what @option{-Wformat-nonliteral} warns about, but
5319in future warnings may be added to @option{-Wformat-security} that are not
5320included in @option{-Wformat-nonliteral}.)
5321
5322@item -Wformat-signedness
5323@opindex Wformat-signedness
5324@opindex Wno-format-signedness
5325If @option{-Wformat} is specified, also warn if the format string
5326requires an unsigned argument and the argument is signed and vice versa.
5327
5328@item -Wformat-truncation
5329@itemx -Wformat-truncation=@var{level}
5330@opindex Wformat-truncation
5331@opindex Wno-format-truncation
5332Warn about calls to formatted input/output functions such as @code{snprintf}
5333and @code{vsnprintf} that might result in output truncation.  When the exact
5334number of bytes written by a format directive cannot be determined at
5335compile-time it is estimated based on heuristics that depend on
5336the @var{level} argument and on optimization.  While enabling optimization
5337will in most cases improve the accuracy of the warning, it may also result
5338in false positives.  Except as noted otherwise, the option uses the same
5339logic @option{-Wformat-overflow}.
5340
5341@table @gcctabopt
5342@item -Wformat-truncation
5343@itemx -Wformat-truncation=1
5344@opindex Wformat-truncation
5345@opindex Wno-format-truncation
5346Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5347employs a conservative approach that warns only about calls to bounded
5348functions whose return value is unused and that will most likely result
5349in output truncation.
5350
5351@item -Wformat-truncation=2
5352Level @var{2} warns also about calls to bounded functions whose return
5353value is used and that might result in truncation given an argument of
5354sufficient length or magnitude.
5355@end table
5356
5357@item -Wformat-y2k
5358@opindex Wformat-y2k
5359@opindex Wno-format-y2k
5360If @option{-Wformat} is specified, also warn about @code{strftime}
5361formats that may yield only a two-digit year.
5362
5363@item -Wnonnull
5364@opindex Wnonnull
5365@opindex Wno-nonnull
5366Warn about passing a null pointer for arguments marked as
5367requiring a non-null value by the @code{nonnull} function attribute.
5368
5369@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
5370can be disabled with the @option{-Wno-nonnull} option.
5371
5372@item -Wnonnull-compare
5373@opindex Wnonnull-compare
5374@opindex Wno-nonnull-compare
5375Warn when comparing an argument marked with the @code{nonnull}
5376function attribute against null inside the function.
5377
5378@option{-Wnonnull-compare} is included in @option{-Wall}.  It
5379can be disabled with the @option{-Wno-nonnull-compare} option.
5380
5381@item -Wnull-dereference
5382@opindex Wnull-dereference
5383@opindex Wno-null-dereference
5384Warn if the compiler detects paths that trigger erroneous or
5385undefined behavior due to dereferencing a null pointer.  This option
5386is only active when @option{-fdelete-null-pointer-checks} is active,
5387which is enabled by optimizations in most targets.  The precision of
5388the warnings depends on the optimization options used.
5389
5390@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5391@opindex Winit-self
5392@opindex Wno-init-self
5393Warn about uninitialized variables that are initialized with themselves.
5394Note this option can only be used with the @option{-Wuninitialized} option.
5395
5396For example, GCC warns about @code{i} being uninitialized in the
5397following snippet only when @option{-Winit-self} has been specified:
5398@smallexample
5399@group
5400int f()
5401@{
5402  int i = i;
5403  return i;
5404@}
5405@end group
5406@end smallexample
5407
5408This warning is enabled by @option{-Wall} in C++.
5409
5410@item -Wno-implicit-int @r{(C and Objective-C only)}
5411@opindex Wimplicit-int
5412@opindex Wno-implicit-int
5413This option controls warnings when a declaration does not specify a type.
5414This warning is enabled by default in C99 and later dialects of C,
5415and also by @option{-Wall}.
5416
5417@item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5418@opindex Wimplicit-function-declaration
5419@opindex Wno-implicit-function-declaration
5420This option controls warnings when a function is used before being declared.
5421This warning is enabled by default in C99 and later dialects of C,
5422and also by @option{-Wall}.
5423The warning is made into an error by @option{-pedantic-errors}.
5424
5425@item -Wimplicit @r{(C and Objective-C only)}
5426@opindex Wimplicit
5427@opindex Wno-implicit
5428Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5429This warning is enabled by @option{-Wall}.
5430
5431@item -Wimplicit-fallthrough
5432@opindex Wimplicit-fallthrough
5433@opindex Wno-implicit-fallthrough
5434@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5435and @option{-Wno-implicit-fallthrough} is the same as
5436@option{-Wimplicit-fallthrough=0}.
5437
5438@item -Wimplicit-fallthrough=@var{n}
5439@opindex Wimplicit-fallthrough=
5440Warn when a switch case falls through.  For example:
5441
5442@smallexample
5443@group
5444switch (cond)
5445  @{
5446  case 1:
5447    a = 1;
5448    break;
5449  case 2:
5450    a = 2;
5451  case 3:
5452    a = 3;
5453    break;
5454  @}
5455@end group
5456@end smallexample
5457
5458This warning does not warn when the last statement of a case cannot
5459fall through, e.g. when there is a return statement or a call to function
5460declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
5461also takes into account control flow statements, such as ifs, and only
5462warns when appropriate.  E.g.@:
5463
5464@smallexample
5465@group
5466switch (cond)
5467  @{
5468  case 1:
5469    if (i > 3) @{
5470      bar (5);
5471      break;
5472    @} else if (i < 1) @{
5473      bar (0);
5474    @} else
5475      return;
5476  default:
5477    @dots{}
5478  @}
5479@end group
5480@end smallexample
5481
5482Since there are occasions where a switch case fall through is desirable,
5483GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5484to be used along with a null statement to suppress this warning that
5485would normally occur:
5486
5487@smallexample
5488@group
5489switch (cond)
5490  @{
5491  case 1:
5492    bar (0);
5493    __attribute__ ((fallthrough));
5494  default:
5495    @dots{}
5496  @}
5497@end group
5498@end smallexample
5499
5500C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5501warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
5502or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5503Instead of these attributes, it is also possible to add a fallthrough comment
5504to silence the warning.  The whole body of the C or C++ style comment should
5505match the given regular expressions listed below.  The option argument @var{n}
5506specifies what kind of comments are accepted:
5507
5508@itemize @bullet
5509
5510@item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5511
5512@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5513expression, any comment is used as fallthrough comment.
5514
5515@item @option{-Wimplicit-fallthrough=2} case insensitively matches
5516@code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5517
5518@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5519following regular expressions:
5520
5521@itemize @bullet
5522
5523@item @code{-fallthrough}
5524
5525@item @code{@@fallthrough@@}
5526
5527@item @code{lint -fallthrough[ \t]*}
5528
5529@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5530
5531@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5532
5533@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5534
5535@end itemize
5536
5537@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5538following regular expressions:
5539
5540@itemize @bullet
5541
5542@item @code{-fallthrough}
5543
5544@item @code{@@fallthrough@@}
5545
5546@item @code{lint -fallthrough[ \t]*}
5547
5548@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5549
5550@end itemize
5551
5552@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5553fallthrough comments, only attributes disable the warning.
5554
5555@end itemize
5556
5557The comment needs to be followed after optional whitespace and other comments
5558by @code{case} or @code{default} keywords or by a user label that precedes some
5559@code{case} or @code{default} label.
5560
5561@smallexample
5562@group
5563switch (cond)
5564  @{
5565  case 1:
5566    bar (0);
5567    /* FALLTHRU */
5568  default:
5569    @dots{}
5570  @}
5571@end group
5572@end smallexample
5573
5574The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5575
5576@item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5577@opindex Wif-not-aligned
5578@opindex Wno-if-not-aligned
5579Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5580should be issued.  These warnings are enabled by default.
5581
5582@item -Wignored-qualifiers @r{(C and C++ only)}
5583@opindex Wignored-qualifiers
5584@opindex Wno-ignored-qualifiers
5585Warn if the return type of a function has a type qualifier
5586such as @code{const}.  For ISO C such a type qualifier has no effect,
5587since the value returned by a function is not an lvalue.
5588For C++, the warning is only emitted for scalar types or @code{void}.
5589ISO C prohibits qualified @code{void} return types on function
5590definitions, so such return types always receive a warning
5591even without this option.
5592
5593This warning is also enabled by @option{-Wextra}.
5594
5595@item -Wno-ignored-attributes @r{(C and C++ only)}
5596@opindex Wignored-attributes
5597@opindex Wno-ignored-attributes
5598This option controls warnings when an attribute is ignored.
5599This is different from the
5600@option{-Wattributes} option in that it warns whenever the compiler decides
5601to drop an attribute, not that the attribute is either unknown, used in a
5602wrong place, etc.  This warning is enabled by default.
5603
5604@item -Wmain
5605@opindex Wmain
5606@opindex Wno-main
5607Warn if the type of @code{main} is suspicious.  @code{main} should be
5608a function with external linkage, returning int, taking either zero
5609arguments, two, or three arguments of appropriate types.  This warning
5610is enabled by default in C++ and is enabled by either @option{-Wall}
5611or @option{-Wpedantic}.
5612
5613@item -Wmisleading-indentation @r{(C and C++ only)}
5614@opindex Wmisleading-indentation
5615@opindex Wno-misleading-indentation
5616Warn when the indentation of the code does not reflect the block structure.
5617Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5618@code{for} clauses with a guarded statement that does not use braces,
5619followed by an unguarded statement with the same indentation.
5620
5621In the following example, the call to ``bar'' is misleadingly indented as
5622if it were guarded by the ``if'' conditional.
5623
5624@smallexample
5625  if (some_condition ())
5626    foo ();
5627    bar ();  /* Gotcha: this is not guarded by the "if".  */
5628@end smallexample
5629
5630In the case of mixed tabs and spaces, the warning uses the
5631@option{-ftabstop=} option to determine if the statements line up
5632(defaulting to 8).
5633
5634The warning is not issued for code involving multiline preprocessor logic
5635such as the following example.
5636
5637@smallexample
5638  if (flagA)
5639    foo (0);
5640#if SOME_CONDITION_THAT_DOES_NOT_HOLD
5641  if (flagB)
5642#endif
5643    foo (1);
5644@end smallexample
5645
5646The warning is not issued after a @code{#line} directive, since this
5647typically indicates autogenerated code, and no assumptions can be made
5648about the layout of the file that the directive references.
5649
5650This warning is enabled by @option{-Wall} in C and C++.
5651
5652@item -Wmissing-attributes
5653@opindex Wmissing-attributes
5654@opindex Wno-missing-attributes
5655Warn when a declaration of a function is missing one or more attributes
5656that a related function is declared with and whose absence may adversely
5657affect the correctness or efficiency of generated code.  For example,
5658the warning is issued for declarations of aliases that use attributes
5659to specify less restrictive requirements than those of their targets.
5660This typically represents a potential optimization opportunity.
5661By contrast, the @option{-Wattribute-alias=2} option controls warnings
5662issued when the alias is more restrictive than the target, which could
5663lead to incorrect code generation.
5664Attributes considered include @code{alloc_align}, @code{alloc_size},
5665@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5666@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5667@code{returns_nonnull}, and @code{returns_twice}.
5668
5669In C++, the warning is issued when an explicit specialization of a primary
5670template declared with attribute @code{alloc_align}, @code{alloc_size},
5671@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5672or @code{nonnull} is declared without it.  Attributes @code{deprecated},
5673@code{error}, and @code{warning} suppress the warning.
5674(@pxref{Function Attributes}).
5675
5676You can use the @code{copy} attribute to apply the same
5677set of attributes to a declaration as that on another declaration without
5678explicitly enumerating the attributes. This attribute can be applied
5679to declarations of functions (@pxref{Common Function Attributes}),
5680variables (@pxref{Common Variable Attributes}), or types
5681(@pxref{Common Type Attributes}).
5682
5683@option{-Wmissing-attributes} is enabled by @option{-Wall}.
5684
5685For example, since the declaration of the primary function template
5686below makes use of both attribute @code{malloc} and @code{alloc_size}
5687the declaration of the explicit specialization of the template is
5688diagnosed because it is missing one of the attributes.
5689
5690@smallexample
5691template <class T>
5692T* __attribute__ ((malloc, alloc_size (1)))
5693allocate (size_t);
5694
5695template <>
5696void* __attribute__ ((malloc))   // missing alloc_size
5697allocate<void> (size_t);
5698@end smallexample
5699
5700@item -Wmissing-braces
5701@opindex Wmissing-braces
5702@opindex Wno-missing-braces
5703Warn if an aggregate or union initializer is not fully bracketed.  In
5704the following example, the initializer for @code{a} is not fully
5705bracketed, but that for @code{b} is fully bracketed.
5706
5707@smallexample
5708int a[2][2] = @{ 0, 1, 2, 3 @};
5709int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5710@end smallexample
5711
5712This warning is enabled by @option{-Wall}.
5713
5714@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5715@opindex Wmissing-include-dirs
5716@opindex Wno-missing-include-dirs
5717Warn if a user-supplied include directory does not exist.
5718
5719@item -Wno-missing-profile
5720@opindex Wmissing-profile
5721@opindex Wno-missing-profile
5722This option controls warnings if feedback profiles are missing when using the
5723@option{-fprofile-use} option.
5724This option diagnoses those cases where a new function or a new file is added
5725between compiling with @option{-fprofile-generate} and with
5726@option{-fprofile-use}, without regenerating the profiles.
5727In these cases, the profile feedback data files do not contain any
5728profile feedback information for
5729the newly added function or file respectively.  Also, in the case when profile
5730count data (.gcda) files are removed, GCC cannot use any profile feedback
5731information.  In all these cases, warnings are issued to inform you that a
5732profile generation step is due.
5733Ignoring the warning can result in poorly optimized code.
5734@option{-Wno-missing-profile} can be used to
5735disable the warning, but this is not recommended and should be done only
5736when non-existent profile data is justified.
5737
5738@item -Wmultistatement-macros
5739@opindex Wmultistatement-macros
5740@opindex Wno-multistatement-macros
5741Warn about unsafe multiple statement macros that appear to be guarded
5742by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5743@code{while}, in which only the first statement is actually guarded after
5744the macro is expanded.
5745
5746For example:
5747
5748@smallexample
5749#define DOIT x++; y++
5750if (c)
5751  DOIT;
5752@end smallexample
5753
5754will increment @code{y} unconditionally, not just when @code{c} holds.
5755The can usually be fixed by wrapping the macro in a do-while loop:
5756@smallexample
5757#define DOIT do @{ x++; y++; @} while (0)
5758if (c)
5759  DOIT;
5760@end smallexample
5761
5762This warning is enabled by @option{-Wall} in C and C++.
5763
5764@item -Wparentheses
5765@opindex Wparentheses
5766@opindex Wno-parentheses
5767Warn if parentheses are omitted in certain contexts, such
5768as when there is an assignment in a context where a truth value
5769is expected, or when operators are nested whose precedence people
5770often get confused about.
5771
5772Also warn if a comparison like @code{x<=y<=z} appears; this is
5773equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5774interpretation from that of ordinary mathematical notation.
5775
5776Also warn for dangerous uses of the GNU extension to
5777@code{?:} with omitted middle operand. When the condition
5778in the @code{?}: operator is a boolean expression, the omitted value is
5779always 1.  Often programmers expect it to be a value computed
5780inside the conditional expression instead.
5781
5782For C++ this also warns for some cases of unnecessary parentheses in
5783declarations, which can indicate an attempt at a function call instead
5784of a declaration:
5785@smallexample
5786@{
5787  // Declares a local variable called mymutex.
5788  std::unique_lock<std::mutex> (mymutex);
5789  // User meant std::unique_lock<std::mutex> lock (mymutex);
5790@}
5791@end smallexample
5792
5793This warning is enabled by @option{-Wall}.
5794
5795@item -Wsequence-point
5796@opindex Wsequence-point
5797@opindex Wno-sequence-point
5798Warn about code that may have undefined semantics because of violations
5799of sequence point rules in the C and C++ standards.
5800
5801The C and C++ standards define the order in which expressions in a C/C++
5802program are evaluated in terms of @dfn{sequence points}, which represent
5803a partial ordering between the execution of parts of the program: those
5804executed before the sequence point, and those executed after it.  These
5805occur after the evaluation of a full expression (one which is not part
5806of a larger expression), after the evaluation of the first operand of a
5807@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5808function is called (but after the evaluation of its arguments and the
5809expression denoting the called function), and in certain other places.
5810Other than as expressed by the sequence point rules, the order of
5811evaluation of subexpressions of an expression is not specified.  All
5812these rules describe only a partial order rather than a total order,
5813since, for example, if two functions are called within one expression
5814with no sequence point between them, the order in which the functions
5815are called is not specified.  However, the standards committee have
5816ruled that function calls do not overlap.
5817
5818It is not specified when between sequence points modifications to the
5819values of objects take effect.  Programs whose behavior depends on this
5820have undefined behavior; the C and C++ standards specify that ``Between
5821the previous and next sequence point an object shall have its stored
5822value modified at most once by the evaluation of an expression.
5823Furthermore, the prior value shall be read only to determine the value
5824to be stored.''.  If a program breaks these rules, the results on any
5825particular implementation are entirely unpredictable.
5826
5827Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5828= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
5829diagnosed by this option, and it may give an occasional false positive
5830result, but in general it has been found fairly effective at detecting
5831this sort of problem in programs.
5832
5833The C++17 standard will define the order of evaluation of operands in
5834more cases: in particular it requires that the right-hand side of an
5835assignment be evaluated before the left-hand side, so the above
5836examples are no longer undefined.  But this option will still warn
5837about them, to help people avoid writing code that is undefined in C
5838and earlier revisions of C++.
5839
5840The standard is worded confusingly, therefore there is some debate
5841over the precise meaning of the sequence point rules in subtle cases.
5842Links to discussions of the problem, including proposed formal
5843definitions, may be found on the GCC readings page, at
5844@uref{http://gcc.gnu.org/@/readings.html}.
5845
5846This warning is enabled by @option{-Wall} for C and C++.
5847
5848@item -Wno-return-local-addr
5849@opindex Wno-return-local-addr
5850@opindex Wreturn-local-addr
5851Do not warn about returning a pointer (or in C++, a reference) to a
5852variable that goes out of scope after the function returns.
5853
5854@item -Wreturn-type
5855@opindex Wreturn-type
5856@opindex Wno-return-type
5857Warn whenever a function is defined with a return type that defaults
5858to @code{int}.  Also warn about any @code{return} statement with no
5859return value in a function whose return type is not @code{void}
5860(falling off the end of the function body is considered returning
5861without a value).
5862
5863For C only, warn about a @code{return} statement with an expression in a
5864function whose return type is @code{void}, unless the expression type is
5865also @code{void}.  As a GNU extension, the latter case is accepted
5866without a warning unless @option{-Wpedantic} is used.  Attempting
5867to use the return value of a non-@code{void} function other than @code{main}
5868that flows off the end by reaching the closing curly brace that terminates
5869the function is undefined.
5870
5871Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5872than @code{main} results in undefined behavior even when the value of
5873the function is not used.
5874
5875This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5876
5877@item -Wno-shift-count-negative
5878@opindex Wshift-count-negative
5879@opindex Wno-shift-count-negative
5880Controls warnings if a shift count is negative.
5881This warning is enabled by default.
5882
5883@item -Wno-shift-count-overflow
5884@opindex Wshift-count-overflow
5885@opindex Wno-shift-count-overflow
5886Controls warnings if a shift count is greater than or equal to the bit width
5887of the type.  This warning is enabled by default.
5888
5889@item -Wshift-negative-value
5890@opindex Wshift-negative-value
5891@opindex Wno-shift-negative-value
5892Warn if left shifting a negative value.  This warning is enabled by
5893@option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
5894
5895@item -Wno-shift-overflow
5896@itemx -Wshift-overflow=@var{n}
5897@opindex Wshift-overflow
5898@opindex Wno-shift-overflow
5899These options control warnings about left shift overflows.
5900
5901@table @gcctabopt
5902@item -Wshift-overflow=1
5903This is the warning level of @option{-Wshift-overflow} and is enabled
5904by default in C99 and C++11 modes (and newer).  This warning level does
5905not warn about left-shifting 1 into the sign bit.  (However, in C, such
5906an overflow is still rejected in contexts where an integer constant expression
5907is required.)  No warning is emitted in C++2A mode (and newer), as signed left
5908shifts always wrap.
5909
5910@item -Wshift-overflow=2
5911This warning level also warns about left-shifting 1 into the sign bit,
5912unless C++14 mode (or newer) is active.
5913@end table
5914
5915@item -Wswitch
5916@opindex Wswitch
5917@opindex Wno-switch
5918Warn whenever a @code{switch} statement has an index of enumerated type
5919and lacks a @code{case} for one or more of the named codes of that
5920enumeration.  (The presence of a @code{default} label prevents this
5921warning.)  @code{case} labels outside the enumeration range also
5922provoke warnings when this option is used (even if there is a
5923@code{default} label).
5924This warning is enabled by @option{-Wall}.
5925
5926@item -Wswitch-default
5927@opindex Wswitch-default
5928@opindex Wno-switch-default
5929Warn whenever a @code{switch} statement does not have a @code{default}
5930case.
5931
5932@item -Wswitch-enum
5933@opindex Wswitch-enum
5934@opindex Wno-switch-enum
5935Warn whenever a @code{switch} statement has an index of enumerated type
5936and lacks a @code{case} for one or more of the named codes of that
5937enumeration.  @code{case} labels outside the enumeration range also
5938provoke warnings when this option is used.  The only difference
5939between @option{-Wswitch} and this option is that this option gives a
5940warning about an omitted enumeration code even if there is a
5941@code{default} label.
5942
5943@item -Wno-switch-bool
5944@opindex Wswitch-bool
5945@opindex Wno-switch-bool
5946Do not warn when a @code{switch} statement has an index of boolean type
5947and the case values are outside the range of a boolean type.
5948It is possible to suppress this warning by casting the controlling
5949expression to a type other than @code{bool}.  For example:
5950@smallexample
5951@group
5952switch ((int) (a == 4))
5953  @{
5954  @dots{}
5955  @}
5956@end group
5957@end smallexample
5958This warning is enabled by default for C and C++ programs.
5959
5960@item -Wno-switch-outside-range
5961@opindex Wswitch-outside-range
5962@opindex Wno-switch-outside-range
5963This option controls warnings when a @code{switch} case has a value
5964that is outside of its
5965respective type range.  This warning is enabled by default for
5966C and C++ programs.
5967
5968@item -Wno-switch-unreachable
5969@opindex Wswitch-unreachable
5970@opindex Wno-switch-unreachable
5971Do not warn when a @code{switch} statement contains statements between the
5972controlling expression and the first case label, which will never be
5973executed.  For example:
5974@smallexample
5975@group
5976switch (cond)
5977  @{
5978   i = 15;
5979  @dots{}
5980   case 5:
5981  @dots{}
5982  @}
5983@end group
5984@end smallexample
5985@option{-Wswitch-unreachable} does not warn if the statement between the
5986controlling expression and the first case label is just a declaration:
5987@smallexample
5988@group
5989switch (cond)
5990  @{
5991   int i;
5992  @dots{}
5993   case 5:
5994   i = 5;
5995  @dots{}
5996  @}
5997@end group
5998@end smallexample
5999This warning is enabled by default for C and C++ programs.
6000
6001@item -Wsync-nand @r{(C and C++ only)}
6002@opindex Wsync-nand
6003@opindex Wno-sync-nand
6004Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6005built-in functions are used.  These functions changed semantics in GCC 4.4.
6006
6007@item -Wunused-but-set-parameter
6008@opindex Wunused-but-set-parameter
6009@opindex Wno-unused-but-set-parameter
6010Warn whenever a function parameter is assigned to, but otherwise unused
6011(aside from its declaration).
6012
6013To suppress this warning use the @code{unused} attribute
6014(@pxref{Variable Attributes}).
6015
6016This warning is also enabled by @option{-Wunused} together with
6017@option{-Wextra}.
6018
6019@item -Wunused-but-set-variable
6020@opindex Wunused-but-set-variable
6021@opindex Wno-unused-but-set-variable
6022Warn whenever a local variable is assigned to, but otherwise unused
6023(aside from its declaration).
6024This warning is enabled by @option{-Wall}.
6025
6026To suppress this warning use the @code{unused} attribute
6027(@pxref{Variable Attributes}).
6028
6029This warning is also enabled by @option{-Wunused}, which is enabled
6030by @option{-Wall}.
6031
6032@item -Wunused-function
6033@opindex Wunused-function
6034@opindex Wno-unused-function
6035Warn whenever a static function is declared but not defined or a
6036non-inline static function is unused.
6037This warning is enabled by @option{-Wall}.
6038
6039@item -Wunused-label
6040@opindex Wunused-label
6041@opindex Wno-unused-label
6042Warn whenever a label is declared but not used.
6043This warning is enabled by @option{-Wall}.
6044
6045To suppress this warning use the @code{unused} attribute
6046(@pxref{Variable Attributes}).
6047
6048@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6049@opindex Wunused-local-typedefs
6050@opindex Wno-unused-local-typedefs
6051Warn when a typedef locally defined in a function is not used.
6052This warning is enabled by @option{-Wall}.
6053
6054@item -Wunused-parameter
6055@opindex Wunused-parameter
6056@opindex Wno-unused-parameter
6057Warn whenever a function parameter is unused aside from its declaration.
6058
6059To suppress this warning use the @code{unused} attribute
6060(@pxref{Variable Attributes}).
6061
6062@item -Wno-unused-result
6063@opindex Wunused-result
6064@opindex Wno-unused-result
6065Do not warn if a caller of a function marked with attribute
6066@code{warn_unused_result} (@pxref{Function Attributes}) does not use
6067its return value. The default is @option{-Wunused-result}.
6068
6069@item -Wunused-variable
6070@opindex Wunused-variable
6071@opindex Wno-unused-variable
6072Warn whenever a local or static variable is unused aside from its
6073declaration. This option implies @option{-Wunused-const-variable=1} for C,
6074but not for C++. This warning is enabled by @option{-Wall}.
6075
6076To suppress this warning use the @code{unused} attribute
6077(@pxref{Variable Attributes}).
6078
6079@item -Wunused-const-variable
6080@itemx -Wunused-const-variable=@var{n}
6081@opindex Wunused-const-variable
6082@opindex Wno-unused-const-variable
6083Warn whenever a constant static variable is unused aside from its declaration.
6084@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6085for C, but not for C++. In C this declares variable storage, but in C++ this
6086is not an error since const variables take the place of @code{#define}s.
6087
6088To suppress this warning use the @code{unused} attribute
6089(@pxref{Variable Attributes}).
6090
6091@table @gcctabopt
6092@item -Wunused-const-variable=1
6093This is the warning level that is enabled by @option{-Wunused-variable} for
6094C.  It warns only about unused static const variables defined in the main
6095compilation unit, but not about static const variables declared in any
6096header included.
6097
6098@item -Wunused-const-variable=2
6099This warning level also warns for unused constant static variables in
6100headers (excluding system headers).  This is the warning level of
6101@option{-Wunused-const-variable} and must be explicitly requested since
6102in C++ this isn't an error and in C it might be harder to clean up all
6103headers included.
6104@end table
6105
6106@item -Wunused-value
6107@opindex Wunused-value
6108@opindex Wno-unused-value
6109Warn whenever a statement computes a result that is explicitly not
6110used. To suppress this warning cast the unused expression to
6111@code{void}. This includes an expression-statement or the left-hand
6112side of a comma expression that contains no side effects. For example,
6113an expression such as @code{x[i,j]} causes a warning, while
6114@code{x[(void)i,j]} does not.
6115
6116This warning is enabled by @option{-Wall}.
6117
6118@item -Wunused
6119@opindex Wunused
6120@opindex Wno-unused
6121All the above @option{-Wunused} options combined.
6122
6123In order to get a warning about an unused function parameter, you must
6124either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6125@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6126
6127@item -Wuninitialized
6128@opindex Wuninitialized
6129@opindex Wno-uninitialized
6130Warn if an automatic variable is used without first being initialized.
6131In C++, warn if a non-static reference or non-static @code{const}
6132member appears in a class without constructors.
6133
6134If you want to warn about code that uses the uninitialized value of the
6135variable in its own initializer, use the @option{-Winit-self} option.
6136
6137These warnings occur for individual uninitialized elements of
6138structure, union or array variables as well as for variables that are
6139uninitialized as a whole.  They do not occur for variables or elements
6140declared @code{volatile}.  Because these warnings depend on
6141optimization, the exact variables or elements for which there are
6142warnings depend on the precise optimization options and version of GCC
6143used.
6144
6145Note that there may be no warning about a variable that is used only
6146to compute a value that itself is never used, because such
6147computations may be deleted by data flow analysis before the warnings
6148are printed.
6149
6150@item -Wno-invalid-memory-model
6151@opindex Winvalid-memory-model
6152@opindex Wno-invalid-memory-model
6153This option controls warnings
6154for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6155and the C11 atomic generic functions with a memory consistency argument
6156that is either invalid for the operation or outside the range of values
6157of the @code{memory_order} enumeration.  For example, since the
6158@code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6159defined for the relaxed, release, and sequentially consistent memory
6160orders the following code is diagnosed:
6161
6162@smallexample
6163void store (int *i)
6164@{
6165  __atomic_store_n (i, 0, memory_order_consume);
6166@}
6167@end smallexample
6168
6169@option{-Winvalid-memory-model} is enabled by default.
6170
6171@item -Wmaybe-uninitialized
6172@opindex Wmaybe-uninitialized
6173@opindex Wno-maybe-uninitialized
6174For an automatic (i.e.@: local) variable, if there exists a path from the
6175function entry to a use of the variable that is initialized, but there exist
6176some other paths for which the variable is not initialized, the compiler
6177emits a warning if it cannot prove the uninitialized paths are not
6178executed at run time.
6179
6180These warnings are only possible in optimizing compilation, because otherwise
6181GCC does not keep track of the state of variables.
6182
6183These warnings are made optional because GCC may not be able to determine when
6184the code is correct in spite of appearing to have an error.  Here is one
6185example of how this can happen:
6186
6187@smallexample
6188@group
6189@{
6190  int x;
6191  switch (y)
6192    @{
6193    case 1: x = 1;
6194      break;
6195    case 2: x = 4;
6196      break;
6197    case 3: x = 5;
6198    @}
6199  foo (x);
6200@}
6201@end group
6202@end smallexample
6203
6204@noindent
6205If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6206always initialized, but GCC doesn't know this. To suppress the
6207warning, you need to provide a default case with assert(0) or
6208similar code.
6209
6210@cindex @code{longjmp} warnings
6211This option also warns when a non-volatile automatic variable might be
6212changed by a call to @code{longjmp}.
6213The compiler sees only the calls to @code{setjmp}.  It cannot know
6214where @code{longjmp} will be called; in fact, a signal handler could
6215call it at any point in the code.  As a result, you may get a warning
6216even when there is in fact no problem because @code{longjmp} cannot
6217in fact be called at the place that would cause a problem.
6218
6219Some spurious warnings can be avoided if you declare all the functions
6220you use that never return as @code{noreturn}.  @xref{Function
6221Attributes}.
6222
6223This warning is enabled by @option{-Wall} or @option{-Wextra}.
6224
6225@item -Wunknown-pragmas
6226@opindex Wunknown-pragmas
6227@opindex Wno-unknown-pragmas
6228@cindex warning for unknown pragmas
6229@cindex unknown pragmas, warning
6230@cindex pragmas, warning of unknown
6231Warn when a @code{#pragma} directive is encountered that is not understood by
6232GCC@.  If this command-line option is used, warnings are even issued
6233for unknown pragmas in system header files.  This is not the case if
6234the warnings are only enabled by the @option{-Wall} command-line option.
6235
6236@item -Wno-pragmas
6237@opindex Wno-pragmas
6238@opindex Wpragmas
6239Do not warn about misuses of pragmas, such as incorrect parameters,
6240invalid syntax, or conflicts between pragmas.  See also
6241@option{-Wunknown-pragmas}.
6242
6243@item -Wno-prio-ctor-dtor
6244@opindex Wno-prio-ctor-dtor
6245@opindex Wprio-ctor-dtor
6246Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6247The use of constructor and destructor attributes allow you to assign a
6248priority to the constructor/destructor to control its order of execution
6249before @code{main} is called or after it returns.  The priority values must be
6250greater than 100 as the compiler reserves priority values between 0--100 for
6251the implementation.
6252
6253@item -Wstrict-aliasing
6254@opindex Wstrict-aliasing
6255@opindex Wno-strict-aliasing
6256This option is only active when @option{-fstrict-aliasing} is active.
6257It warns about code that might break the strict aliasing rules that the
6258compiler is using for optimization.  The warning does not catch all
6259cases, but does attempt to catch the more common pitfalls.  It is
6260included in @option{-Wall}.
6261It is equivalent to @option{-Wstrict-aliasing=3}
6262
6263@item -Wstrict-aliasing=n
6264@opindex Wstrict-aliasing=n
6265This option is only active when @option{-fstrict-aliasing} is active.
6266It warns about code that might break the strict aliasing rules that the
6267compiler is using for optimization.
6268Higher levels correspond to higher accuracy (fewer false positives).
6269Higher levels also correspond to more effort, similar to the way @option{-O}
6270works.
6271@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6272
6273Level 1: Most aggressive, quick, least accurate.
6274Possibly useful when higher levels
6275do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6276false negatives.  However, it has many false positives.
6277Warns for all pointer conversions between possibly incompatible types,
6278even if never dereferenced.  Runs in the front end only.
6279
6280Level 2: Aggressive, quick, not too precise.
6281May still have many false positives (not as many as level 1 though),
6282and few false negatives (but possibly more than level 1).
6283Unlike level 1, it only warns when an address is taken.  Warns about
6284incomplete types.  Runs in the front end only.
6285
6286Level 3 (default for @option{-Wstrict-aliasing}):
6287Should have very few false positives and few false
6288negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
6289Takes care of the common pun+dereference pattern in the front end:
6290@code{*(int*)&some_float}.
6291If optimization is enabled, it also runs in the back end, where it deals
6292with multiple statement cases using flow-sensitive points-to information.
6293Only warns when the converted pointer is dereferenced.
6294Does not warn about incomplete types.
6295
6296@item -Wstrict-overflow
6297@itemx -Wstrict-overflow=@var{n}
6298@opindex Wstrict-overflow
6299@opindex Wno-strict-overflow
6300This option is only active when signed overflow is undefined.
6301It warns about cases where the compiler optimizes based on the
6302assumption that signed overflow does not occur.  Note that it does not
6303warn about all cases where the code might overflow: it only warns
6304about cases where the compiler implements some optimization.  Thus
6305this warning depends on the optimization level.
6306
6307An optimization that assumes that signed overflow does not occur is
6308perfectly safe if the values of the variables involved are such that
6309overflow never does, in fact, occur.  Therefore this warning can
6310easily give a false positive: a warning about code that is not
6311actually a problem.  To help focus on important issues, several
6312warning levels are defined.  No warnings are issued for the use of
6313undefined signed overflow when estimating how many iterations a loop
6314requires, in particular when determining whether a loop will be
6315executed at all.
6316
6317@table @gcctabopt
6318@item -Wstrict-overflow=1
6319Warn about cases that are both questionable and easy to avoid.  For
6320example the compiler simplifies
6321@code{x + 1 > x} to @code{1}.  This level of
6322@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6323are not, and must be explicitly requested.
6324
6325@item -Wstrict-overflow=2
6326Also warn about other cases where a comparison is simplified to a
6327constant.  For example: @code{abs (x) >= 0}.  This can only be
6328simplified when signed integer overflow is undefined, because
6329@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6330zero.  @option{-Wstrict-overflow} (with no level) is the same as
6331@option{-Wstrict-overflow=2}.
6332
6333@item -Wstrict-overflow=3
6334Also warn about other cases where a comparison is simplified.  For
6335example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6336
6337@item -Wstrict-overflow=4
6338Also warn about other simplifications not covered by the above cases.
6339For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6340
6341@item -Wstrict-overflow=5
6342Also warn about cases where the compiler reduces the magnitude of a
6343constant involved in a comparison.  For example: @code{x + 2 > y} is
6344simplified to @code{x + 1 >= y}.  This is reported only at the
6345highest warning level because this simplification applies to many
6346comparisons, so this warning level gives a very large number of
6347false positives.
6348@end table
6349
6350@item -Wstring-compare
6351@opindex Wstring-compare
6352@opindex Wno-string-compare
6353Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6354determined to be either zero or non-zero in tests for such equality
6355owing to the length of one argument being greater than the size of
6356the array the other argument is stored in (or the bound in the case
6357of @code{strncmp}).  Such calls could be mistakes.  For example,
6358the call to @code{strcmp} below is diagnosed because its result is
6359necessarily non-zero irrespective of the contents of the array @code{a}.
6360
6361@smallexample
6362extern char a[4];
6363void f (char *d)
6364@{
6365  strcpy (d, "string");
6366  @dots{}
6367  if (0 == strcmp (a, d))   // cannot be true
6368    puts ("a and d are the same");
6369@}
6370@end smallexample
6371
6372@option{-Wstring-compare} is enabled by @option{-Wextra}.
6373
6374@item -Wstringop-overflow
6375@itemx -Wstringop-overflow=@var{type}
6376@opindex Wstringop-overflow
6377@opindex Wno-stringop-overflow
6378Warn for calls to string manipulation functions such as @code{memcpy} and
6379@code{strcpy} that are determined to overflow the destination buffer.  The
6380optional argument is one greater than the type of Object Size Checking to
6381perform to determine the size of the destination.  @xref{Object Size Checking}.
6382The argument is meaningful only for functions that operate on character arrays
6383but not for raw memory functions like @code{memcpy} which always make use
6384of Object Size type-0.  The option also warns for calls that specify a size
6385in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6386The option produces the best results with optimization enabled but can detect
6387a small subset of simple buffer overflows even without optimization in
6388calls to the GCC built-in functions like @code{__builtin_memcpy} that
6389correspond to the standard functions.  In any case, the option warns about
6390just a subset of buffer overflows detected by the corresponding overflow
6391checking built-ins.  For example, the option issues a warning for
6392the @code{strcpy} call below because it copies at least 5 characters
6393(the string @code{"blue"} including the terminating NUL) into the buffer
6394of size 4.
6395
6396@smallexample
6397enum Color @{ blue, purple, yellow @};
6398const char* f (enum Color clr)
6399@{
6400  static char buf [4];
6401  const char *str;
6402  switch (clr)
6403    @{
6404      case blue: str = "blue"; break;
6405      case purple: str = "purple"; break;
6406      case yellow: str = "yellow"; break;
6407    @}
6408
6409  return strcpy (buf, str);   // warning here
6410@}
6411@end smallexample
6412
6413Option @option{-Wstringop-overflow=2} is enabled by default.
6414
6415@table @gcctabopt
6416@item -Wstringop-overflow
6417@itemx -Wstringop-overflow=1
6418@opindex Wstringop-overflow
6419@opindex Wno-stringop-overflow
6420The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6421to determine the sizes of destination objects.  This is the default setting
6422of the option.  At this setting the option does not warn for writes past
6423the end of subobjects of larger objects accessed by pointers unless the
6424size of the largest surrounding object is known.  When the destination may
6425be one of several objects it is assumed to be the largest one of them.  On
6426Linux systems, when optimization is enabled at this setting the option warns
6427for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6428a non-zero value.
6429
6430@item -Wstringop-overflow=2
6431The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6432to determine the sizes of destination objects.  At this setting the option
6433warna about overflows when writing to members of the largest complete
6434objects whose exact size is known.  However, it does not warn for excessive
6435writes to the same members of unknown objects referenced by pointers since
6436they may point to arrays containing unknown numbers of elements.
6437
6438@item -Wstringop-overflow=3
6439The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6440to determine the sizes of destination objects.  At this setting the option
6441warns about overflowing the smallest object or data member.  This is the
6442most restrictive setting of the option that may result in warnings for safe
6443code.
6444
6445@item -Wstringop-overflow=4
6446The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6447to determine the sizes of destination objects.  At this setting the option
6448warns about overflowing any data members, and when the destination is
6449one of several objects it uses the size of the largest of them to decide
6450whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
6451setting of the option may result in warnings for benign code.
6452@end table
6453
6454@item -Wno-stringop-truncation
6455@opindex Wstringop-truncation
6456@opindex Wno-stringop-truncation
6457Do not warn for calls to bounded string manipulation functions
6458such as @code{strncat},
6459@code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6460or leave the destination unchanged.
6461
6462In the following example, the call to @code{strncat} specifies a bound that
6463is less than the length of the source string.  As a result, the copy of
6464the source will be truncated and so the call is diagnosed.  To avoid the
6465warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6466
6467@smallexample
6468void append (char *buf, size_t bufsize)
6469@{
6470  strncat (buf, ".txt", 3);
6471@}
6472@end smallexample
6473
6474As another example, the following call to @code{strncpy} results in copying
6475to @code{d} just the characters preceding the terminating NUL, without
6476appending the NUL to the end.  Assuming the result of @code{strncpy} is
6477necessarily a NUL-terminated string is a common mistake, and so the call
6478is diagnosed.  To avoid the warning when the result is not expected to be
6479NUL-terminated, call @code{memcpy} instead.
6480
6481@smallexample
6482void copy (char *d, const char *s)
6483@{
6484  strncpy (d, s, strlen (s));
6485@}
6486@end smallexample
6487
6488In the following example, the call to @code{strncpy} specifies the size
6489of the destination buffer as the bound.  If the length of the source
6490string is equal to or greater than this size the result of the copy will
6491not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
6492the warning, specify @code{sizeof buf - 1} as the bound and set the last
6493element of the buffer to @code{NUL}.
6494
6495@smallexample
6496void copy (const char *s)
6497@{
6498  char buf[80];
6499  strncpy (buf, s, sizeof buf);
6500  @dots{}
6501@}
6502@end smallexample
6503
6504In situations where a character array is intended to store a sequence
6505of bytes with no terminating @code{NUL} such an array may be annotated
6506with attribute @code{nonstring} to avoid this warning.  Such arrays,
6507however, are not suitable arguments to functions that expect
6508@code{NUL}-terminated strings.  To help detect accidental misuses of
6509such arrays GCC issues warnings unless it can prove that the use is
6510safe.  @xref{Common Variable Attributes}.
6511
6512@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6513@opindex Wsuggest-attribute=
6514@opindex Wno-suggest-attribute=
6515Warn for cases where adding an attribute may be beneficial. The
6516attributes currently supported are listed below.
6517
6518@table @gcctabopt
6519@item -Wsuggest-attribute=pure
6520@itemx -Wsuggest-attribute=const
6521@itemx -Wsuggest-attribute=noreturn
6522@itemx -Wmissing-noreturn
6523@itemx -Wsuggest-attribute=malloc
6524@opindex Wsuggest-attribute=pure
6525@opindex Wno-suggest-attribute=pure
6526@opindex Wsuggest-attribute=const
6527@opindex Wno-suggest-attribute=const
6528@opindex Wsuggest-attribute=noreturn
6529@opindex Wno-suggest-attribute=noreturn
6530@opindex Wmissing-noreturn
6531@opindex Wno-missing-noreturn
6532@opindex Wsuggest-attribute=malloc
6533@opindex Wno-suggest-attribute=malloc
6534
6535Warn about functions that might be candidates for attributes
6536@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6537only warns for functions visible in other compilation units or (in the case of
6538@code{pure} and @code{const}) if it cannot prove that the function returns
6539normally. A function returns normally if it doesn't contain an infinite loop or
6540return abnormally by throwing, calling @code{abort} or trapping.  This analysis
6541requires option @option{-fipa-pure-const}, which is enabled by default at
6542@option{-O} and higher.  Higher optimization levels improve the accuracy
6543of the analysis.
6544
6545@item -Wsuggest-attribute=format
6546@itemx -Wmissing-format-attribute
6547@opindex Wsuggest-attribute=format
6548@opindex Wmissing-format-attribute
6549@opindex Wno-suggest-attribute=format
6550@opindex Wno-missing-format-attribute
6551@opindex Wformat
6552@opindex Wno-format
6553
6554Warn about function pointers that might be candidates for @code{format}
6555attributes.  Note these are only possible candidates, not absolute ones.
6556GCC guesses that function pointers with @code{format} attributes that
6557are used in assignment, initialization, parameter passing or return
6558statements should have a corresponding @code{format} attribute in the
6559resulting type.  I.e.@: the left-hand side of the assignment or
6560initialization, the type of the parameter variable, or the return type
6561of the containing function respectively should also have a @code{format}
6562attribute to avoid the warning.
6563
6564GCC also warns about function definitions that might be
6565candidates for @code{format} attributes.  Again, these are only
6566possible candidates.  GCC guesses that @code{format} attributes
6567might be appropriate for any function that calls a function like
6568@code{vprintf} or @code{vscanf}, but this might not always be the
6569case, and some functions for which @code{format} attributes are
6570appropriate may not be detected.
6571
6572@item -Wsuggest-attribute=cold
6573@opindex Wsuggest-attribute=cold
6574@opindex Wno-suggest-attribute=cold
6575
6576Warn about functions that might be candidates for @code{cold} attribute.  This
6577is based on static detection and generally only warns about functions which
6578always leads to a call to another @code{cold} function such as wrappers of
6579C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6580@end table
6581
6582@item -Walloc-zero
6583@opindex Wno-alloc-zero
6584@opindex Walloc-zero
6585Warn about calls to allocation functions decorated with attribute
6586@code{alloc_size} that specify zero bytes, including those to the built-in
6587forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6588@code{malloc}, and @code{realloc}.  Because the behavior of these functions
6589when called with a zero size differs among implementations (and in the case
6590of @code{realloc} has been deprecated) relying on it may result in subtle
6591portability bugs and should be avoided.
6592
6593@item -Walloc-size-larger-than=@var{byte-size}
6594@opindex Walloc-size-larger-than=
6595@opindex Wno-alloc-size-larger-than
6596Warn about calls to functions decorated with attribute @code{alloc_size}
6597that attempt to allocate objects larger than the specified number of bytes,
6598or where the result of the size computation in an integer type with infinite
6599precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6600@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6601Warnings controlled by the option can be disabled either by specifying
6602@var{byte-size} of @samp{SIZE_MAX} or more or by
6603@option{-Wno-alloc-size-larger-than}.
6604@xref{Function Attributes}.
6605
6606@item -Wno-alloc-size-larger-than
6607@opindex Wno-alloc-size-larger-than
6608Disable @option{-Walloc-size-larger-than=} warnings.  The option is
6609equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6610larger.
6611
6612@item -Walloca
6613@opindex Wno-alloca
6614@opindex Walloca
6615This option warns on all uses of @code{alloca} in the source.
6616
6617@item -Walloca-larger-than=@var{byte-size}
6618@opindex Walloca-larger-than=
6619@opindex Wno-alloca-larger-than
6620This option warns on calls to @code{alloca} with an integer argument whose
6621value is either zero, or that is not bounded by a controlling predicate
6622that limits its value to at most @var{byte-size}.  It also warns for calls
6623to @code{alloca} where the bound value is unknown.  Arguments of non-integer
6624types are considered unbounded even if they appear to be constrained to
6625the expected range.
6626
6627For example, a bounded case of @code{alloca} could be:
6628
6629@smallexample
6630void func (size_t n)
6631@{
6632  void *p;
6633  if (n <= 1000)
6634    p = alloca (n);
6635  else
6636    p = malloc (n);
6637  f (p);
6638@}
6639@end smallexample
6640
6641In the above example, passing @code{-Walloca-larger-than=1000} would not
6642issue a warning because the call to @code{alloca} is known to be at most
66431000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
6644the compiler would emit a warning.
6645
6646Unbounded uses, on the other hand, are uses of @code{alloca} with no
6647controlling predicate constraining its integer argument.  For example:
6648
6649@smallexample
6650void func ()
6651@{
6652  void *p = alloca (n);
6653  f (p);
6654@}
6655@end smallexample
6656
6657If @code{-Walloca-larger-than=500} were passed, the above would trigger
6658a warning, but this time because of the lack of bounds checking.
6659
6660Note, that even seemingly correct code involving signed integers could
6661cause a warning:
6662
6663@smallexample
6664void func (signed int n)
6665@{
6666  if (n < 500)
6667    @{
6668      p = alloca (n);
6669      f (p);
6670    @}
6671@}
6672@end smallexample
6673
6674In the above example, @var{n} could be negative, causing a larger than
6675expected argument to be implicitly cast into the @code{alloca} call.
6676
6677This option also warns when @code{alloca} is used in a loop.
6678
6679@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6680but is usually only effective  when @option{-ftree-vrp} is active (default
6681for @option{-O2} and above).
6682
6683See also @option{-Wvla-larger-than=}@samp{byte-size}.
6684
6685@item -Wno-alloca-larger-than
6686@opindex Wno-alloca-larger-than
6687Disable @option{-Walloca-larger-than=} warnings.  The option is
6688equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6689
6690@item -Warith-conversion
6691@opindex Warith-conversion
6692@opindex Wno-arith-conversion
6693Do warn about implicit conversions from arithmetic operations even
6694when conversion of the operands to the same type cannot change their
6695values.  This affects warnings from @option{-Wconversion},
6696@option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
6697
6698@smallexample
6699@group
6700void f (char c, int i)
6701@{
6702  c = c + i; // warns with @option{-Wconversion}
6703  c = c + 1; // only warns with @option{-Warith-conversion}
6704@}
6705@end group
6706@end smallexample
6707
6708@item -Warray-bounds
6709@itemx -Warray-bounds=@var{n}
6710@opindex Wno-array-bounds
6711@opindex Warray-bounds
6712This option is only active when @option{-ftree-vrp} is active
6713(default for @option{-O2} and above). It warns about subscripts to arrays
6714that are always out of bounds. This warning is enabled by @option{-Wall}.
6715
6716@table @gcctabopt
6717@item -Warray-bounds=1
6718This is the warning level of @option{-Warray-bounds} and is enabled
6719by @option{-Wall}; higher levels are not, and must be explicitly requested.
6720
6721@item -Warray-bounds=2
6722This warning level also warns about out of bounds access for
6723arrays at the end of a struct and for arrays accessed through
6724pointers. This warning level may give a larger number of
6725false positives and is deactivated by default.
6726@end table
6727
6728@item -Wattribute-alias=@var{n}
6729@itemx -Wno-attribute-alias
6730@opindex Wattribute-alias
6731@opindex Wno-attribute-alias
6732Warn about declarations using the @code{alias} and similar attributes whose
6733target is incompatible with the type of the alias.
6734@xref{Function Attributes,,Declaring Attributes of Functions}.
6735
6736@table @gcctabopt
6737@item -Wattribute-alias=1
6738The default warning level of the @option{-Wattribute-alias} option diagnoses
6739incompatibilities between the type of the alias declaration and that of its
6740target.  Such incompatibilities are typically indicative of bugs.
6741
6742@item -Wattribute-alias=2
6743
6744At this level @option{-Wattribute-alias} also diagnoses cases where
6745the attributes of the alias declaration are more restrictive than the
6746attributes applied to its target.  These mismatches can potentially
6747result in incorrect code generation.  In other cases they may be
6748benign and could be resolved simply by adding the missing attribute to
6749the target.  For comparison, see the @option{-Wmissing-attributes}
6750option, which controls diagnostics when the alias declaration is less
6751restrictive than the target, rather than more restrictive.
6752
6753Attributes considered include @code{alloc_align}, @code{alloc_size},
6754@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6755@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6756@code{returns_nonnull}, and @code{returns_twice}.
6757@end table
6758
6759@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6760This is the default.  You can disable these warnings with either
6761@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6762
6763@item -Wbool-compare
6764@opindex Wno-bool-compare
6765@opindex Wbool-compare
6766Warn about boolean expression compared with an integer value different from
6767@code{true}/@code{false}.  For instance, the following comparison is
6768always false:
6769@smallexample
6770int n = 5;
6771@dots{}
6772if ((n > 1) == 2) @{ @dots{} @}
6773@end smallexample
6774This warning is enabled by @option{-Wall}.
6775
6776@item -Wbool-operation
6777@opindex Wno-bool-operation
6778@opindex Wbool-operation
6779Warn about suspicious operations on expressions of a boolean type.  For
6780instance, bitwise negation of a boolean is very likely a bug in the program.
6781For C, this warning also warns about incrementing or decrementing a boolean,
6782which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
6783Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6784
6785This warning is enabled by @option{-Wall}.
6786
6787@item -Wduplicated-branches
6788@opindex Wno-duplicated-branches
6789@opindex Wduplicated-branches
6790Warn when an if-else has identical branches.  This warning detects cases like
6791@smallexample
6792if (p != NULL)
6793  return 0;
6794else
6795  return 0;
6796@end smallexample
6797It doesn't warn when both branches contain just a null statement.  This warning
6798also warn for conditional operators:
6799@smallexample
6800  int i = x ? *p : *p;
6801@end smallexample
6802
6803@item -Wduplicated-cond
6804@opindex Wno-duplicated-cond
6805@opindex Wduplicated-cond
6806Warn about duplicated conditions in an if-else-if chain.  For instance,
6807warn for the following code:
6808@smallexample
6809if (p->q != NULL) @{ @dots{} @}
6810else if (p->q != NULL) @{ @dots{} @}
6811@end smallexample
6812
6813@item -Wframe-address
6814@opindex Wno-frame-address
6815@opindex Wframe-address
6816Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6817is called with an argument greater than 0.  Such calls may return indeterminate
6818values or crash the program.  The warning is included in @option{-Wall}.
6819
6820@item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6821@opindex Wno-discarded-qualifiers
6822@opindex Wdiscarded-qualifiers
6823Do not warn if type qualifiers on pointers are being discarded.
6824Typically, the compiler warns if a @code{const char *} variable is
6825passed to a function that takes a @code{char *} parameter.  This option
6826can be used to suppress such a warning.
6827
6828@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6829@opindex Wno-discarded-array-qualifiers
6830@opindex Wdiscarded-array-qualifiers
6831Do not warn if type qualifiers on arrays which are pointer targets
6832are being discarded.  Typically, the compiler warns if a
6833@code{const int (*)[]} variable is passed to a function that
6834takes a @code{int (*)[]} parameter.  This option can be used to
6835suppress such a warning.
6836
6837@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6838@opindex Wno-incompatible-pointer-types
6839@opindex Wincompatible-pointer-types
6840Do not warn when there is a conversion between pointers that have incompatible
6841types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
6842which warns for pointer argument passing or assignment with different
6843signedness.
6844
6845@item -Wno-int-conversion @r{(C and Objective-C only)}
6846@opindex Wno-int-conversion
6847@opindex Wint-conversion
6848Do not warn about incompatible integer to pointer and pointer to integer
6849conversions.  This warning is about implicit conversions; for explicit
6850conversions the warnings @option{-Wno-int-to-pointer-cast} and
6851@option{-Wno-pointer-to-int-cast} may be used.
6852
6853@item -Wzero-length-bounds
6854@opindex Wzero-length-bounds
6855@opindex Wzero-length-bounds
6856Warn about accesses to elements of zero-length array members that might
6857overlap other members of the same object.  Declaring interior zero-length
6858arrays is discouraged because accesses to them are undefined.  See
6859@xref{Zero Length}.
6860
6861For example, the first two stores in function @code{bad} are diagnosed
6862because the array elements overlap the subsequent members @code{b} and
6863@code{c}.  The third store is diagnosed by @option{-Warray-bounds}
6864because it is beyond the bounds of the enclosing object.
6865
6866@smallexample
6867struct X @{ int a[0]; int b, c; @};
6868struct X x;
6869
6870void bad (void)
6871@{
6872  x.a[0] = 0;   // -Wzero-length-bounds
6873  x.a[1] = 1;   // -Wzero-length-bounds
6874  x.a[2] = 2;   // -Warray-bounds
6875@}
6876@end smallexample
6877
6878Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6879
6880@item -Wno-div-by-zero
6881@opindex Wno-div-by-zero
6882@opindex Wdiv-by-zero
6883Do not warn about compile-time integer division by zero.  Floating-point
6884division by zero is not warned about, as it can be a legitimate way of
6885obtaining infinities and NaNs.
6886
6887@item -Wsystem-headers
6888@opindex Wsystem-headers
6889@opindex Wno-system-headers
6890@cindex warnings from system headers
6891@cindex system headers, warnings from
6892Print warning messages for constructs found in system header files.
6893Warnings from system headers are normally suppressed, on the assumption
6894that they usually do not indicate real problems and would only make the
6895compiler output harder to read.  Using this command-line option tells
6896GCC to emit warnings from system headers as if they occurred in user
6897code.  However, note that using @option{-Wall} in conjunction with this
6898option does @emph{not} warn about unknown pragmas in system
6899headers---for that, @option{-Wunknown-pragmas} must also be used.
6900
6901@item -Wtautological-compare
6902@opindex Wtautological-compare
6903@opindex Wno-tautological-compare
6904Warn if a self-comparison always evaluates to true or false.  This
6905warning detects various mistakes such as:
6906@smallexample
6907int i = 1;
6908@dots{}
6909if (i > i) @{ @dots{} @}
6910@end smallexample
6911
6912This warning also warns about bitwise comparisons that always evaluate
6913to true or false, for instance:
6914@smallexample
6915if ((a & 16) == 10) @{ @dots{} @}
6916@end smallexample
6917will always be false.
6918
6919This warning is enabled by @option{-Wall}.
6920
6921@item -Wtrampolines
6922@opindex Wtrampolines
6923@opindex Wno-trampolines
6924Warn about trampolines generated for pointers to nested functions.
6925A trampoline is a small piece of data or code that is created at run
6926time on the stack when the address of a nested function is taken, and is
6927used to call the nested function indirectly.  For some targets, it is
6928made up of data only and thus requires no special treatment.  But, for
6929most targets, it is made up of code and thus requires the stack to be
6930made executable in order for the program to work properly.
6931
6932@item -Wfloat-equal
6933@opindex Wfloat-equal
6934@opindex Wno-float-equal
6935Warn if floating-point values are used in equality comparisons.
6936
6937The idea behind this is that sometimes it is convenient (for the
6938programmer) to consider floating-point values as approximations to
6939infinitely precise real numbers.  If you are doing this, then you need
6940to compute (by analyzing the code, or in some other way) the maximum or
6941likely maximum error that the computation introduces, and allow for it
6942when performing comparisons (and when producing output, but that's a
6943different problem).  In particular, instead of testing for equality, you
6944should check to see whether the two values have ranges that overlap; and
6945this is done with the relational operators, so equality comparisons are
6946probably mistaken.
6947
6948@item -Wtraditional @r{(C and Objective-C only)}
6949@opindex Wtraditional
6950@opindex Wno-traditional
6951Warn about certain constructs that behave differently in traditional and
6952ISO C@.  Also warn about ISO C constructs that have no traditional C
6953equivalent, and/or problematic constructs that should be avoided.
6954
6955@itemize @bullet
6956@item
6957Macro parameters that appear within string literals in the macro body.
6958In traditional C macro replacement takes place within string literals,
6959but in ISO C it does not.
6960
6961@item
6962In traditional C, some preprocessor directives did not exist.
6963Traditional preprocessors only considered a line to be a directive
6964if the @samp{#} appeared in column 1 on the line.  Therefore
6965@option{-Wtraditional} warns about directives that traditional C
6966understands but ignores because the @samp{#} does not appear as the
6967first character on the line.  It also suggests you hide directives like
6968@code{#pragma} not understood by traditional C by indenting them.  Some
6969traditional implementations do not recognize @code{#elif}, so this option
6970suggests avoiding it altogether.
6971
6972@item
6973A function-like macro that appears without arguments.
6974
6975@item
6976The unary plus operator.
6977
6978@item
6979The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6980constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
6981constants.)  Note, these suffixes appear in macros defined in the system
6982headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6983Use of these macros in user code might normally lead to spurious
6984warnings, however GCC's integrated preprocessor has enough context to
6985avoid warning in these cases.
6986
6987@item
6988A function declared external in one block and then used after the end of
6989the block.
6990
6991@item
6992A @code{switch} statement has an operand of type @code{long}.
6993
6994@item
6995A non-@code{static} function declaration follows a @code{static} one.
6996This construct is not accepted by some traditional C compilers.
6997
6998@item
6999The ISO type of an integer constant has a different width or
7000signedness from its traditional type.  This warning is only issued if
7001the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
7002typically represent bit patterns, are not warned about.
7003
7004@item
7005Usage of ISO string concatenation is detected.
7006
7007@item
7008Initialization of automatic aggregates.
7009
7010@item
7011Identifier conflicts with labels.  Traditional C lacks a separate
7012namespace for labels.
7013
7014@item
7015Initialization of unions.  If the initializer is zero, the warning is
7016omitted.  This is done under the assumption that the zero initializer in
7017user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7018initializer warnings and relies on default initialization to zero in the
7019traditional C case.
7020
7021@item
7022Conversions by prototypes between fixed/floating-point values and vice
7023versa.  The absence of these prototypes when compiling with traditional
7024C causes serious problems.  This is a subset of the possible
7025conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7026
7027@item
7028Use of ISO C style function definitions.  This warning intentionally is
7029@emph{not} issued for prototype declarations or variadic functions
7030because these ISO C features appear in your code when using
7031libiberty's traditional C compatibility macros, @code{PARAMS} and
7032@code{VPARAMS}.  This warning is also bypassed for nested functions
7033because that feature is already a GCC extension and thus not relevant to
7034traditional C compatibility.
7035@end itemize
7036
7037@item -Wtraditional-conversion @r{(C and Objective-C only)}
7038@opindex Wtraditional-conversion
7039@opindex Wno-traditional-conversion
7040Warn if a prototype causes a type conversion that is different from what
7041would happen to the same argument in the absence of a prototype.  This
7042includes conversions of fixed point to floating and vice versa, and
7043conversions changing the width or signedness of a fixed-point argument
7044except when the same as the default promotion.
7045
7046@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7047@opindex Wdeclaration-after-statement
7048@opindex Wno-declaration-after-statement
7049Warn when a declaration is found after a statement in a block.  This
7050construct, known from C++, was introduced with ISO C99 and is by default
7051allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Declarations}.
7052
7053@item -Wshadow
7054@opindex Wshadow
7055@opindex Wno-shadow
7056Warn whenever a local variable or type declaration shadows another
7057variable, parameter, type, class member (in C++), or instance variable
7058(in Objective-C) or whenever a built-in function is shadowed.  Note
7059that in C++, the compiler warns if a local variable shadows an
7060explicit typedef, but not if it shadows a struct/class/enum.
7061If this warning is enabled, it includes also all instances of
7062local shadowing.  This means that @option{-Wno-shadow=local}
7063and @option{-Wno-shadow=compatible-local} are ignored when
7064@option{-Wshadow} is used.
7065Same as @option{-Wshadow=global}.
7066
7067@item -Wno-shadow-ivar @r{(Objective-C only)}
7068@opindex Wno-shadow-ivar
7069@opindex Wshadow-ivar
7070Do not warn whenever a local variable shadows an instance variable in an
7071Objective-C method.
7072
7073@item -Wshadow=global
7074@opindex Wshadow=global
7075Warn for any shadowing.
7076Same as @option{-Wshadow}.
7077
7078@item -Wshadow=local
7079@opindex Wshadow=local
7080Warn when a local variable shadows another local variable or parameter.
7081
7082@item -Wshadow=compatible-local
7083@opindex Wshadow=compatible-local
7084Warn when a local variable shadows another local variable or parameter
7085whose type is compatible with that of the shadowing variable.  In C++,
7086type compatibility here means the type of the shadowing variable can be
7087converted to that of the shadowed variable.  The creation of this flag
7088(in addition to @option{-Wshadow=local}) is based on the idea that when
7089a local variable shadows another one of incompatible type, it is most
7090likely intentional, not a bug or typo, as shown in the following example:
7091
7092@smallexample
7093@group
7094for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7095@{
7096  for (int i = 0; i < N; ++i)
7097  @{
7098    ...
7099  @}
7100  ...
7101@}
7102@end group
7103@end smallexample
7104
7105Since the two variable @code{i} in the example above have incompatible types,
7106enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7107Because their types are incompatible, if a programmer accidentally uses one
7108in place of the other, type checking is expected to catch that and emit an
7109error or warning.  Use of this flag instead of @option{-Wshadow=local} can
7110possibly reduce the number of warnings triggered by intentional shadowing.
7111Note that this also means that shadowing @code{const char *i} by
7112@code{char *i} does not emit a warning.
7113
7114This warning is also enabled by @option{-Wshadow=local}.
7115
7116@item -Wlarger-than=@var{byte-size}
7117@opindex Wlarger-than=
7118@opindex Wlarger-than-@var{byte-size}
7119Warn whenever an object is defined whose size exceeds @var{byte-size}.
7120@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7121Warnings controlled by the option can be disabled either by specifying
7122@var{byte-size} of @samp{SIZE_MAX} or more or by
7123@option{-Wno-larger-than}.
7124
7125@item -Wno-larger-than
7126@opindex Wno-larger-than
7127Disable @option{-Wlarger-than=} warnings.  The option is equivalent
7128to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7129
7130@item -Wframe-larger-than=@var{byte-size}
7131@opindex Wframe-larger-than=
7132@opindex Wno-frame-larger-than
7133Warn if the size of a function frame exceeds @var{byte-size}.
7134The computation done to determine the stack frame size is approximate
7135and not conservative.
7136The actual requirements may be somewhat greater than @var{byte-size}
7137even if you do not get a warning.  In addition, any space allocated
7138via @code{alloca}, variable-length arrays, or related constructs
7139is not included by the compiler when determining
7140whether or not to issue a warning.
7141@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7142Warnings controlled by the option can be disabled either by specifying
7143@var{byte-size} of @samp{SIZE_MAX} or more or by
7144@option{-Wno-frame-larger-than}.
7145
7146@item -Wno-frame-larger-than
7147@opindex Wno-frame-larger-than
7148Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
7149to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7150
7151@item -Wno-free-nonheap-object
7152@opindex Wno-free-nonheap-object
7153@opindex Wfree-nonheap-object
7154Do not warn when attempting to free an object that was not allocated
7155on the heap.
7156
7157@item -Wstack-usage=@var{byte-size}
7158@opindex Wstack-usage
7159@opindex Wno-stack-usage
7160Warn if the stack usage of a function might exceed @var{byte-size}.
7161The computation done to determine the stack usage is conservative.
7162Any space allocated via @code{alloca}, variable-length arrays, or related
7163constructs is included by the compiler when determining whether or not to
7164issue a warning.
7165
7166The message is in keeping with the output of @option{-fstack-usage}.
7167
7168@itemize
7169@item
7170If the stack usage is fully static but exceeds the specified amount, it's:
7171
7172@smallexample
7173  warning: stack usage is 1120 bytes
7174@end smallexample
7175@item
7176If the stack usage is (partly) dynamic but bounded, it's:
7177
7178@smallexample
7179  warning: stack usage might be 1648 bytes
7180@end smallexample
7181@item
7182If the stack usage is (partly) dynamic and not bounded, it's:
7183
7184@smallexample
7185  warning: stack usage might be unbounded
7186@end smallexample
7187@end itemize
7188
7189@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7190Warnings controlled by the option can be disabled either by specifying
7191@var{byte-size} of @samp{SIZE_MAX} or more or by
7192@option{-Wno-stack-usage}.
7193
7194@item -Wno-stack-usage
7195@opindex Wno-stack-usage
7196Disable @option{-Wstack-usage=} warnings.  The option is equivalent
7197to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7198
7199@item -Wunsafe-loop-optimizations
7200@opindex Wunsafe-loop-optimizations
7201@opindex Wno-unsafe-loop-optimizations
7202Warn if the loop cannot be optimized because the compiler cannot
7203assume anything on the bounds of the loop indices.  With
7204@option{-funsafe-loop-optimizations} warn if the compiler makes
7205such assumptions.
7206
7207@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7208@opindex Wno-pedantic-ms-format
7209@opindex Wpedantic-ms-format
7210When used in combination with @option{-Wformat}
7211and @option{-pedantic} without GNU extensions, this option
7212disables the warnings about non-ISO @code{printf} / @code{scanf} format
7213width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7214which depend on the MS runtime.
7215
7216@item -Wpointer-arith
7217@opindex Wpointer-arith
7218@opindex Wno-pointer-arith
7219Warn about anything that depends on the ``size of'' a function type or
7220of @code{void}.  GNU C assigns these types a size of 1, for
7221convenience in calculations with @code{void *} pointers and pointers
7222to functions.  In C++, warn also when an arithmetic operation involves
7223@code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
7224
7225@item -Wno-pointer-compare
7226@opindex Wpointer-compare
7227@opindex Wno-pointer-compare
7228Do not warn if a pointer is compared with a zero character constant.
7229This usually
7230means that the pointer was meant to be dereferenced.  For example:
7231
7232@smallexample
7233const char *p = foo ();
7234if (p == '\0')
7235  return 42;
7236@end smallexample
7237
7238Note that the code above is invalid in C++11.
7239
7240This warning is enabled by default.
7241
7242@item -Wtype-limits
7243@opindex Wtype-limits
7244@opindex Wno-type-limits
7245Warn if a comparison is always true or always false due to the limited
7246range of the data type, but do not warn for constant expressions.  For
7247example, warn if an unsigned variable is compared against zero with
7248@code{<} or @code{>=}.  This warning is also enabled by
7249@option{-Wextra}.
7250
7251@item -Wabsolute-value @r{(C and Objective-C only)}
7252@opindex Wabsolute-value
7253@opindex Wno-absolute-value
7254Warn for calls to standard functions that compute the absolute value
7255of an argument when a more appropriate standard function is available.
7256For example, calling @code{abs(3.14)} triggers the warning because the
7257appropriate function to call to compute the absolute value of a double
7258argument is @code{fabs}.  The option also triggers warnings when the
7259argument in a call to such a function has an unsigned type.  This
7260warning can be suppressed with an explicit type cast and it is also
7261enabled by @option{-Wextra}.
7262
7263@include cppwarnopts.texi
7264
7265@item -Wbad-function-cast @r{(C and Objective-C only)}
7266@opindex Wbad-function-cast
7267@opindex Wno-bad-function-cast
7268Warn when a function call is cast to a non-matching type.
7269For example, warn if a call to a function returning an integer type
7270is cast to a pointer type.
7271
7272@item -Wc90-c99-compat @r{(C and Objective-C only)}
7273@opindex Wc90-c99-compat
7274@opindex Wno-c90-c99-compat
7275Warn about features not present in ISO C90, but present in ISO C99.
7276For instance, warn about use of variable length arrays, @code{long long}
7277type, @code{bool} type, compound literals, designated initializers, and so
7278on.  This option is independent of the standards mode.  Warnings are disabled
7279in the expression that follows @code{__extension__}.
7280
7281@item -Wc99-c11-compat @r{(C and Objective-C only)}
7282@opindex Wc99-c11-compat
7283@opindex Wno-c99-c11-compat
7284Warn about features not present in ISO C99, but present in ISO C11.
7285For instance, warn about use of anonymous structures and unions,
7286@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7287@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7288and so on.  This option is independent of the standards mode.  Warnings are
7289disabled in the expression that follows @code{__extension__}.
7290
7291@item -Wc11-c2x-compat @r{(C and Objective-C only)}
7292@opindex Wc11-c2x-compat
7293@opindex Wno-c11-c2x-compat
7294Warn about features not present in ISO C11, but present in ISO C2X.
7295For instance, warn about omitting the string in @code{_Static_assert},
7296use of @samp{[[]]} syntax for attributes, use of decimal
7297floating-point types, and so on.  This option is independent of the
7298standards mode.  Warnings are disabled in the expression that follows
7299@code{__extension__}.
7300
7301@item -Wc++-compat @r{(C and Objective-C only)}
7302@opindex Wc++-compat
7303@opindex Wno-c++-compat
7304Warn about ISO C constructs that are outside of the common subset of
7305ISO C and ISO C++, e.g.@: request for implicit conversion from
7306@code{void *} to a pointer to non-@code{void} type.
7307
7308@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7309@opindex Wc++11-compat
7310@opindex Wno-c++11-compat
7311Warn about C++ constructs whose meaning differs between ISO C++ 1998
7312and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7313in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
7314enabled by @option{-Wall}.
7315
7316@item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7317@opindex Wc++14-compat
7318@opindex Wno-c++14-compat
7319Warn about C++ constructs whose meaning differs between ISO C++ 2011
7320and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
7321
7322@item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7323@opindex Wc++17-compat
7324@opindex Wno-c++17-compat
7325Warn about C++ constructs whose meaning differs between ISO C++ 2014
7326and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
7327
7328@item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7329@opindex Wc++20-compat
7330@opindex Wno-c++20-compat
7331Warn about C++ constructs whose meaning differs between ISO C++ 2017
7332and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
7333
7334@item -Wcast-qual
7335@opindex Wcast-qual
7336@opindex Wno-cast-qual
7337Warn whenever a pointer is cast so as to remove a type qualifier from
7338the target type.  For example, warn if a @code{const char *} is cast
7339to an ordinary @code{char *}.
7340
7341Also warn when making a cast that introduces a type qualifier in an
7342unsafe way.  For example, casting @code{char **} to @code{const char **}
7343is unsafe, as in this example:
7344
7345@smallexample
7346  /* p is char ** value.  */
7347  const char **q = (const char **) p;
7348  /* Assignment of readonly string to const char * is OK.  */
7349  *q = "string";
7350  /* Now char** pointer points to read-only memory.  */
7351  **p = 'b';
7352@end smallexample
7353
7354@item -Wcast-align
7355@opindex Wcast-align
7356@opindex Wno-cast-align
7357Warn whenever a pointer is cast such that the required alignment of the
7358target is increased.  For example, warn if a @code{char *} is cast to
7359an @code{int *} on machines where integers can only be accessed at
7360two- or four-byte boundaries.
7361
7362@item -Wcast-align=strict
7363@opindex Wcast-align=strict
7364Warn whenever a pointer is cast such that the required alignment of the
7365target is increased.  For example, warn if a @code{char *} is cast to
7366an @code{int *} regardless of the target machine.
7367
7368@item -Wcast-function-type
7369@opindex Wcast-function-type
7370@opindex Wno-cast-function-type
7371Warn when a function pointer is cast to an incompatible function pointer.
7372In a cast involving function types with a variable argument list only
7373the types of initial arguments that are provided are considered.
7374Any parameter of pointer-type matches any other pointer-type.  Any benign
7375differences in integral types are ignored, like @code{int} vs.@: @code{long}
7376on ILP32 targets.  Likewise type qualifiers are ignored.  The function
7377type @code{void (*) (void)} is special and matches everything, which can
7378be used to suppress this warning.
7379In a cast involving pointer to member types this warning warns whenever
7380the type cast is changing the pointer to member type.
7381This warning is enabled by @option{-Wextra}.
7382
7383@item -Wwrite-strings
7384@opindex Wwrite-strings
7385@opindex Wno-write-strings
7386When compiling C, give string constants the type @code{const
7387char[@var{length}]} so that copying the address of one into a
7388non-@code{const} @code{char *} pointer produces a warning.  These
7389warnings help you find at compile time code that can try to write
7390into a string constant, but only if you have been very careful about
7391using @code{const} in declarations and prototypes.  Otherwise, it is
7392just a nuisance. This is why we did not make @option{-Wall} request
7393these warnings.
7394
7395When compiling C++, warn about the deprecated conversion from string
7396literals to @code{char *}.  This warning is enabled by default for C++
7397programs.
7398
7399@item -Wclobbered
7400@opindex Wclobbered
7401@opindex Wno-clobbered
7402Warn for variables that might be changed by @code{longjmp} or
7403@code{vfork}.  This warning is also enabled by @option{-Wextra}.
7404
7405@item -Wconversion
7406@opindex Wconversion
7407@opindex Wno-conversion
7408Warn for implicit conversions that may alter a value. This includes
7409conversions between real and integer, like @code{abs (x)} when
7410@code{x} is @code{double}; conversions between signed and unsigned,
7411like @code{unsigned ui = -1}; and conversions to smaller types, like
7412@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7413((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7414changed by the conversion like in @code{abs (2.0)}.  Warnings about
7415conversions between signed and unsigned integers can be disabled by
7416using @option{-Wno-sign-conversion}.
7417
7418For C++, also warn for confusing overload resolution for user-defined
7419conversions; and conversions that never use a type conversion
7420operator: conversions to @code{void}, the same type, a base class or a
7421reference to them. Warnings about conversions between signed and
7422unsigned integers are disabled by default in C++ unless
7423@option{-Wsign-conversion} is explicitly enabled.
7424
7425Warnings about conversion from arithmetic on a small type back to that
7426type are only given with @option{-Warith-conversion}.
7427
7428@item -Wdangling-else
7429@opindex Wdangling-else
7430@opindex Wno-dangling-else
7431Warn about constructions where there may be confusion to which
7432@code{if} statement an @code{else} branch belongs.  Here is an example of
7433such a case:
7434
7435@smallexample
7436@group
7437@{
7438  if (a)
7439    if (b)
7440      foo ();
7441  else
7442    bar ();
7443@}
7444@end group
7445@end smallexample
7446
7447In C/C++, every @code{else} branch belongs to the innermost possible
7448@code{if} statement, which in this example is @code{if (b)}.  This is
7449often not what the programmer expected, as illustrated in the above
7450example by indentation the programmer chose.  When there is the
7451potential for this confusion, GCC issues a warning when this flag
7452is specified.  To eliminate the warning, add explicit braces around
7453the innermost @code{if} statement so there is no way the @code{else}
7454can belong to the enclosing @code{if}.  The resulting code
7455looks like this:
7456
7457@smallexample
7458@group
7459@{
7460  if (a)
7461    @{
7462      if (b)
7463        foo ();
7464      else
7465        bar ();
7466    @}
7467@}
7468@end group
7469@end smallexample
7470
7471This warning is enabled by @option{-Wparentheses}.
7472
7473@item -Wdate-time
7474@opindex Wdate-time
7475@opindex Wno-date-time
7476Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7477are encountered as they might prevent bit-wise-identical reproducible
7478compilations.
7479
7480@item -Wempty-body
7481@opindex Wempty-body
7482@opindex Wno-empty-body
7483Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7484while} statement.  This warning is also enabled by @option{-Wextra}.
7485
7486@item -Wno-endif-labels
7487@opindex Wendif-labels
7488@opindex Wno-endif-labels
7489Do not warn about stray tokens after @code{#else} and @code{#endif}.
7490
7491@item -Wenum-compare
7492@opindex Wenum-compare
7493@opindex Wno-enum-compare
7494Warn about a comparison between values of different enumerated types.
7495In C++ enumerated type mismatches in conditional expressions are also
7496diagnosed and the warning is enabled by default.  In C this warning is
7497enabled by @option{-Wall}.
7498
7499@item -Wenum-conversion @r{(C, Objective-C only)}
7500@opindex Wenum-conversion
7501@opindex Wno-enum-conversion
7502Warn when a value of enumerated type is implicitly converted to a
7503different enumerated type.  This warning is enabled by @option{-Wextra}.
7504
7505@item -Wjump-misses-init @r{(C, Objective-C only)}
7506@opindex Wjump-misses-init
7507@opindex Wno-jump-misses-init
7508Warn if a @code{goto} statement or a @code{switch} statement jumps
7509forward across the initialization of a variable, or jumps backward to a
7510label after the variable has been initialized.  This only warns about
7511variables that are initialized when they are declared.  This warning is
7512only supported for C and Objective-C; in C++ this sort of branch is an
7513error in any case.
7514
7515@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
7516can be disabled with the @option{-Wno-jump-misses-init} option.
7517
7518@item -Wsign-compare
7519@opindex Wsign-compare
7520@opindex Wno-sign-compare
7521@cindex warning for comparison of signed and unsigned values
7522@cindex comparison of signed and unsigned values, warning
7523@cindex signed and unsigned values, comparison warning
7524Warn when a comparison between signed and unsigned values could produce
7525an incorrect result when the signed value is converted to unsigned.
7526In C++, this warning is also enabled by @option{-Wall}.  In C, it is
7527also enabled by @option{-Wextra}.
7528
7529@item -Wsign-conversion
7530@opindex Wsign-conversion
7531@opindex Wno-sign-conversion
7532Warn for implicit conversions that may change the sign of an integer
7533value, like assigning a signed integer expression to an unsigned
7534integer variable. An explicit cast silences the warning. In C, this
7535option is enabled also by @option{-Wconversion}.
7536
7537@item -Wfloat-conversion
7538@opindex Wfloat-conversion
7539@opindex Wno-float-conversion
7540Warn for implicit conversions that reduce the precision of a real value.
7541This includes conversions from real to integer, and from higher precision
7542real to lower precision real values.  This option is also enabled by
7543@option{-Wconversion}.
7544
7545@item -Wno-scalar-storage-order
7546@opindex Wno-scalar-storage-order
7547@opindex Wscalar-storage-order
7548Do not warn on suspicious constructs involving reverse scalar storage order.
7549
7550@item -Wsizeof-pointer-div
7551@opindex Wsizeof-pointer-div
7552@opindex Wno-sizeof-pointer-div
7553Warn for suspicious divisions of two sizeof expressions that divide
7554the pointer size by the element size, which is the usual way to compute
7555the array size but won't work out correctly with pointers.  This warning
7556warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7557not an array, but a pointer.  This warning is enabled by @option{-Wall}.
7558
7559@item -Wsizeof-pointer-memaccess
7560@opindex Wsizeof-pointer-memaccess
7561@opindex Wno-sizeof-pointer-memaccess
7562Warn for suspicious length parameters to certain string and memory built-in
7563functions if the argument uses @code{sizeof}.  This warning triggers for
7564example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7565an array, but a pointer, and suggests a possible fix, or about
7566@code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
7567also warns about calls to bounded string copy functions like @code{strncat}
7568or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7569the source array.  For example, in the following function the call to
7570@code{strncat} specifies the size of the source string as the bound.  That
7571is almost certainly a mistake and so the call is diagnosed.
7572@smallexample
7573void make_file (const char *name)
7574@{
7575  char path[PATH_MAX];
7576  strncpy (path, name, sizeof path - 1);
7577  strncat (path, ".text", sizeof ".text");
7578  @dots{}
7579@}
7580@end smallexample
7581
7582The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7583
7584@item -Wno-sizeof-array-argument
7585@opindex Wsizeof-array-argument
7586@opindex Wno-sizeof-array-argument
7587Do not warn when the @code{sizeof} operator is applied to a parameter that is
7588declared as an array in a function definition.  This warning is enabled by
7589default for C and C++ programs.
7590
7591@item -Wmemset-elt-size
7592@opindex Wmemset-elt-size
7593@opindex Wno-memset-elt-size
7594Warn for suspicious calls to the @code{memset} built-in function, if the
7595first argument references an array, and the third argument is a number
7596equal to the number of elements, but not equal to the size of the array
7597in memory.  This indicates that the user has omitted a multiplication by
7598the element size.  This warning is enabled by @option{-Wall}.
7599
7600@item -Wmemset-transposed-args
7601@opindex Wmemset-transposed-args
7602@opindex Wno-memset-transposed-args
7603Warn for suspicious calls to the @code{memset} built-in function where
7604the second argument is not zero and the third argument is zero.  For
7605example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7606@code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
7607is only emitted if the third argument is a literal zero.  Otherwise, if
7608it is an expression that is folded to zero, or a cast of zero to some
7609type, it is far less likely that the arguments have been mistakenly
7610transposed and no warning is emitted.  This warning is enabled
7611by @option{-Wall}.
7612
7613@item -Waddress
7614@opindex Waddress
7615@opindex Wno-address
7616Warn about suspicious uses of memory addresses. These include using
7617the address of a function in a conditional expression, such as
7618@code{void func(void); if (func)}, and comparisons against the memory
7619address of a string literal, such as @code{if (x == "abc")}.  Such
7620uses typically indicate a programmer error: the address of a function
7621always evaluates to true, so their use in a conditional usually
7622indicate that the programmer forgot the parentheses in a function
7623call; and comparisons against string literals result in unspecified
7624behavior and are not portable in C, so they usually indicate that the
7625programmer intended to use @code{strcmp}.  This warning is enabled by
7626@option{-Wall}.
7627
7628@item -Wno-address-of-packed-member
7629@opindex Waddress-of-packed-member
7630@opindex Wno-address-of-packed-member
7631Do not warn when the address of packed member of struct or union is taken,
7632which usually results in an unaligned pointer value.  This is
7633enabled by default.
7634
7635@item -Wlogical-op
7636@opindex Wlogical-op
7637@opindex Wno-logical-op
7638Warn about suspicious uses of logical operators in expressions.
7639This includes using logical operators in contexts where a
7640bit-wise operator is likely to be expected.  Also warns when
7641the operands of a logical operator are the same:
7642@smallexample
7643extern int a;
7644if (a < 0 && a < 0) @{ @dots{} @}
7645@end smallexample
7646
7647@item -Wlogical-not-parentheses
7648@opindex Wlogical-not-parentheses
7649@opindex Wno-logical-not-parentheses
7650Warn about logical not used on the left hand side operand of a comparison.
7651This option does not warn if the right operand is considered to be a boolean
7652expression.  Its purpose is to detect suspicious code like the following:
7653@smallexample
7654int a;
7655@dots{}
7656if (!a > 1) @{ @dots{} @}
7657@end smallexample
7658
7659It is possible to suppress the warning by wrapping the LHS into
7660parentheses:
7661@smallexample
7662if ((!a) > 1) @{ @dots{} @}
7663@end smallexample
7664
7665This warning is enabled by @option{-Wall}.
7666
7667@item -Waggregate-return
7668@opindex Waggregate-return
7669@opindex Wno-aggregate-return
7670Warn if any functions that return structures or unions are defined or
7671called.  (In languages where you can return an array, this also elicits
7672a warning.)
7673
7674@item -Wno-aggressive-loop-optimizations
7675@opindex Wno-aggressive-loop-optimizations
7676@opindex Waggressive-loop-optimizations
7677Warn if in a loop with constant number of iterations the compiler detects
7678undefined behavior in some statement during one or more of the iterations.
7679
7680@item -Wno-attributes
7681@opindex Wno-attributes
7682@opindex Wattributes
7683Do not warn if an unexpected @code{__attribute__} is used, such as
7684unrecognized attributes, function attributes applied to variables,
7685etc.  This does not stop errors for incorrect use of supported
7686attributes.
7687
7688@item -Wno-builtin-declaration-mismatch
7689@opindex Wno-builtin-declaration-mismatch
7690@opindex Wbuiltin-declaration-mismatch
7691Warn if a built-in function is declared with an incompatible signature
7692or as a non-function, or when a built-in function declared with a type
7693that does not include a prototype is called with arguments whose promoted
7694types do not match those expected by the function.  When @option{-Wextra}
7695is specified, also warn when a built-in function that takes arguments is
7696declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
7697warning is enabled by default.  To avoid the warning include the appropriate
7698header to bring the prototypes of built-in functions into scope.
7699
7700For example, the call to @code{memset} below is diagnosed by the warning
7701because the function expects a value of type @code{size_t} as its argument
7702but the type of @code{32} is @code{int}.  With @option{-Wextra},
7703the declaration of the function is diagnosed as well.
7704@smallexample
7705extern void* memset ();
7706void f (void *d)
7707@{
7708  memset (d, '\0', 32);
7709@}
7710@end smallexample
7711
7712@item -Wno-builtin-macro-redefined
7713@opindex Wno-builtin-macro-redefined
7714@opindex Wbuiltin-macro-redefined
7715Do not warn if certain built-in macros are redefined.  This suppresses
7716warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7717@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7718
7719@item -Wstrict-prototypes @r{(C and Objective-C only)}
7720@opindex Wstrict-prototypes
7721@opindex Wno-strict-prototypes
7722Warn if a function is declared or defined without specifying the
7723argument types.  (An old-style function definition is permitted without
7724a warning if preceded by a declaration that specifies the argument
7725types.)
7726
7727@item -Wold-style-declaration @r{(C and Objective-C only)}
7728@opindex Wold-style-declaration
7729@opindex Wno-old-style-declaration
7730Warn for obsolescent usages, according to the C Standard, in a
7731declaration. For example, warn if storage-class specifiers like
7732@code{static} are not the first things in a declaration.  This warning
7733is also enabled by @option{-Wextra}.
7734
7735@item -Wold-style-definition @r{(C and Objective-C only)}
7736@opindex Wold-style-definition
7737@opindex Wno-old-style-definition
7738Warn if an old-style function definition is used.  A warning is given
7739even if there is a previous prototype.  A definition using @samp{()}
7740is not considered an old-style definition in C2X mode, because it is
7741equivalent to @samp{(void)} in that case, but is considered an
7742old-style definition for older standards.
7743
7744@item -Wmissing-parameter-type @r{(C and Objective-C only)}
7745@opindex Wmissing-parameter-type
7746@opindex Wno-missing-parameter-type
7747A function parameter is declared without a type specifier in K&R-style
7748functions:
7749
7750@smallexample
7751void foo(bar) @{ @}
7752@end smallexample
7753
7754This warning is also enabled by @option{-Wextra}.
7755
7756@item -Wmissing-prototypes @r{(C and Objective-C only)}
7757@opindex Wmissing-prototypes
7758@opindex Wno-missing-prototypes
7759Warn if a global function is defined without a previous prototype
7760declaration.  This warning is issued even if the definition itself
7761provides a prototype.  Use this option to detect global functions
7762that do not have a matching prototype declaration in a header file.
7763This option is not valid for C++ because all function declarations
7764provide prototypes and a non-matching declaration declares an
7765overload rather than conflict with an earlier declaration.
7766Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7767
7768@item -Wmissing-declarations
7769@opindex Wmissing-declarations
7770@opindex Wno-missing-declarations
7771Warn if a global function is defined without a previous declaration.
7772Do so even if the definition itself provides a prototype.
7773Use this option to detect global functions that are not declared in
7774header files.  In C, no warnings are issued for functions with previous
7775non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7776missing prototypes.  In C++, no warnings are issued for function templates,
7777or for inline functions, or for functions in anonymous namespaces.
7778
7779@item -Wmissing-field-initializers
7780@opindex Wmissing-field-initializers
7781@opindex Wno-missing-field-initializers
7782@opindex W
7783@opindex Wextra
7784@opindex Wno-extra
7785Warn if a structure's initializer has some fields missing.  For
7786example, the following code causes such a warning, because
7787@code{x.h} is implicitly zero:
7788
7789@smallexample
7790struct s @{ int f, g, h; @};
7791struct s x = @{ 3, 4 @};
7792@end smallexample
7793
7794This option does not warn about designated initializers, so the following
7795modification does not trigger a warning:
7796
7797@smallexample
7798struct s @{ int f, g, h; @};
7799struct s x = @{ .f = 3, .g = 4 @};
7800@end smallexample
7801
7802In C this option does not warn about the universal zero initializer
7803@samp{@{ 0 @}}:
7804
7805@smallexample
7806struct s @{ int f, g, h; @};
7807struct s x = @{ 0 @};
7808@end smallexample
7809
7810Likewise, in C++ this option does not warn about the empty @{ @}
7811initializer, for example:
7812
7813@smallexample
7814struct s @{ int f, g, h; @};
7815s x = @{ @};
7816@end smallexample
7817
7818This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
7819warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7820
7821@item -Wno-multichar
7822@opindex Wno-multichar
7823@opindex Wmultichar
7824Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7825Usually they indicate a typo in the user's code, as they have
7826implementation-defined values, and should not be used in portable code.
7827
7828@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7829@opindex Wnormalized=
7830@opindex Wnormalized
7831@opindex Wno-normalized
7832@cindex NFC
7833@cindex NFKC
7834@cindex character set, input normalization
7835In ISO C and ISO C++, two identifiers are different if they are
7836different sequences of characters.  However, sometimes when characters
7837outside the basic ASCII character set are used, you can have two
7838different character sequences that look the same.  To avoid confusion,
7839the ISO 10646 standard sets out some @dfn{normalization rules} which
7840when applied ensure that two sequences that look the same are turned into
7841the same sequence.  GCC can warn you if you are using identifiers that
7842have not been normalized; this option controls that warning.
7843
7844There are four levels of warning supported by GCC@.  The default is
7845@option{-Wnormalized=nfc}, which warns about any identifier that is
7846not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
7847recommended form for most uses.  It is equivalent to
7848@option{-Wnormalized}.
7849
7850Unfortunately, there are some characters allowed in identifiers by
7851ISO C and ISO C++ that, when turned into NFC, are not allowed in
7852identifiers.  That is, there's no way to use these symbols in portable
7853ISO C or C++ and have all your identifiers in NFC@.
7854@option{-Wnormalized=id} suppresses the warning for these characters.
7855It is hoped that future versions of the standards involved will correct
7856this, which is why this option is not the default.
7857
7858You can switch the warning off for all characters by writing
7859@option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
7860only do this if you are using some other normalization scheme (like
7861``D''), because otherwise you can easily create bugs that are
7862literally impossible to see.
7863
7864Some characters in ISO 10646 have distinct meanings but look identical
7865in some fonts or display methodologies, especially once formatting has
7866been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7867LETTER N'', displays just like a regular @code{n} that has been
7868placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
7869normalization scheme to convert all these into a standard form as
7870well, and GCC warns if your code is not in NFKC if you use
7871@option{-Wnormalized=nfkc}.  This warning is comparable to warning
7872about every identifier that contains the letter O because it might be
7873confused with the digit 0, and so is not the default, but may be
7874useful as a local coding convention if the programming environment
7875cannot be fixed to display these characters distinctly.
7876
7877@item -Wno-attribute-warning
7878@opindex Wno-attribute-warning
7879@opindex Wattribute-warning
7880Do not warn about usage of functions (@pxref{Function Attributes})
7881declared with @code{warning} attribute.  By default, this warning is
7882enabled.  @option{-Wno-attribute-warning} can be used to disable the
7883warning or @option{-Wno-error=attribute-warning} can be used to
7884disable the error when compiled with @option{-Werror} flag.
7885
7886@item -Wno-deprecated
7887@opindex Wno-deprecated
7888@opindex Wdeprecated
7889Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
7890
7891@item -Wno-deprecated-declarations
7892@opindex Wno-deprecated-declarations
7893@opindex Wdeprecated-declarations
7894Do not warn about uses of functions (@pxref{Function Attributes}),
7895variables (@pxref{Variable Attributes}), and types (@pxref{Type
7896Attributes}) marked as deprecated by using the @code{deprecated}
7897attribute.
7898
7899@item -Wno-overflow
7900@opindex Wno-overflow
7901@opindex Woverflow
7902Do not warn about compile-time overflow in constant expressions.
7903
7904@item -Wno-odr
7905@opindex Wno-odr
7906@opindex Wodr
7907Warn about One Definition Rule violations during link-time optimization.
7908Enabled by default.
7909
7910@item -Wopenmp-simd
7911@opindex Wopenmp-simd
7912@opindex Wno-openmp-simd
7913Warn if the vectorizer cost model overrides the OpenMP
7914simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
7915option can be used to relax the cost model.
7916
7917@item -Woverride-init @r{(C and Objective-C only)}
7918@opindex Woverride-init
7919@opindex Wno-override-init
7920@opindex W
7921@opindex Wextra
7922@opindex Wno-extra
7923Warn if an initialized field without side effects is overridden when
7924using designated initializers (@pxref{Designated Inits, , Designated
7925Initializers}).
7926
7927This warning is included in @option{-Wextra}.  To get other
7928@option{-Wextra} warnings without this one, use @option{-Wextra
7929-Wno-override-init}.
7930
7931@item -Wno-override-init-side-effects @r{(C and Objective-C only)}
7932@opindex Woverride-init-side-effects
7933@opindex Wno-override-init-side-effects
7934Do not warn if an initialized field with side effects is overridden when
7935using designated initializers (@pxref{Designated Inits, , Designated
7936Initializers}).  This warning is enabled by default.
7937
7938@item -Wpacked
7939@opindex Wpacked
7940@opindex Wno-packed
7941Warn if a structure is given the packed attribute, but the packed
7942attribute has no effect on the layout or size of the structure.
7943Such structures may be mis-aligned for little benefit.  For
7944instance, in this code, the variable @code{f.x} in @code{struct bar}
7945is misaligned even though @code{struct bar} does not itself
7946have the packed attribute:
7947
7948@smallexample
7949@group
7950struct foo @{
7951  int x;
7952  char a, b, c, d;
7953@} __attribute__((packed));
7954struct bar @{
7955  char z;
7956  struct foo f;
7957@};
7958@end group
7959@end smallexample
7960
7961@item -Wnopacked-bitfield-compat
7962@opindex Wpacked-bitfield-compat
7963@opindex Wno-packed-bitfield-compat
7964The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7965on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
7966the change can lead to differences in the structure layout.  GCC
7967informs you when the offset of such a field has changed in GCC 4.4.
7968For example there is no longer a 4-bit padding between field @code{a}
7969and @code{b} in this structure:
7970
7971@smallexample
7972struct foo
7973@{
7974  char a:4;
7975  char b:8;
7976@} __attribute__ ((packed));
7977@end smallexample
7978
7979This warning is enabled by default.  Use
7980@option{-Wno-packed-bitfield-compat} to disable this warning.
7981
7982@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7983@opindex Wpacked-not-aligned
7984@opindex Wno-packed-not-aligned
7985Warn if a structure field with explicitly specified alignment in a
7986packed struct or union is misaligned.  For example, a warning will
7987be issued on @code{struct S}, like, @code{warning: alignment 1 of
7988'struct S' is less than 8}, in this code:
7989
7990@smallexample
7991@group
7992struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7993struct __attribute__ ((packed)) S @{
7994  struct S8 s8;
7995@};
7996@end group
7997@end smallexample
7998
7999This warning is enabled by @option{-Wall}.
8000
8001@item -Wpadded
8002@opindex Wpadded
8003@opindex Wno-padded
8004Warn if padding is included in a structure, either to align an element
8005of the structure or to align the whole structure.  Sometimes when this
8006happens it is possible to rearrange the fields of the structure to
8007reduce the padding and so make the structure smaller.
8008
8009@item -Wredundant-decls
8010@opindex Wredundant-decls
8011@opindex Wno-redundant-decls
8012Warn if anything is declared more than once in the same scope, even in
8013cases where multiple declaration is valid and changes nothing.
8014
8015@item -Wrestrict
8016@opindex Wrestrict
8017@opindex Wno-restrict
8018Warn when an object referenced by a @code{restrict}-qualified parameter
8019(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8020argument, or when copies between such objects overlap.  For example,
8021the call to the @code{strcpy} function below attempts to truncate the string
8022by replacing its initial characters with the last four.  However, because
8023the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8024the call is diagnosed.
8025
8026@smallexample
8027void foo (void)
8028@{
8029  char a[] = "abcd1234";
8030  strcpy (a, a + 4);
8031  @dots{}
8032@}
8033@end smallexample
8034The @option{-Wrestrict} option detects some instances of simple overlap
8035even without optimization but works best at @option{-O2} and above.  It
8036is included in @option{-Wall}.
8037
8038@item -Wnested-externs @r{(C and Objective-C only)}
8039@opindex Wnested-externs
8040@opindex Wno-nested-externs
8041Warn if an @code{extern} declaration is encountered within a function.
8042
8043@item -Winline
8044@opindex Winline
8045@opindex Wno-inline
8046Warn if a function that is declared as inline cannot be inlined.
8047Even with this option, the compiler does not warn about failures to
8048inline functions declared in system headers.
8049
8050The compiler uses a variety of heuristics to determine whether or not
8051to inline a function.  For example, the compiler takes into account
8052the size of the function being inlined and the amount of inlining
8053that has already been done in the current function.  Therefore,
8054seemingly insignificant changes in the source program can cause the
8055warnings produced by @option{-Winline} to appear or disappear.
8056
8057@item -Wint-in-bool-context
8058@opindex Wint-in-bool-context
8059@opindex Wno-int-in-bool-context
8060Warn for suspicious use of integer values where boolean values are expected,
8061such as conditional expressions (?:) using non-boolean integer constants in
8062boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
8063integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
8064for all kinds of multiplications regardless of the data type.
8065This warning is enabled by @option{-Wall}.
8066
8067@item -Wno-int-to-pointer-cast
8068@opindex Wno-int-to-pointer-cast
8069@opindex Wint-to-pointer-cast
8070Suppress warnings from casts to pointer type of an integer of a
8071different size. In C++, casting to a pointer type of smaller size is
8072an error. @option{Wint-to-pointer-cast} is enabled by default.
8073
8074
8075@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8076@opindex Wno-pointer-to-int-cast
8077@opindex Wpointer-to-int-cast
8078Suppress warnings from casts from a pointer to an integer type of a
8079different size.
8080
8081@item -Winvalid-pch
8082@opindex Winvalid-pch
8083@opindex Wno-invalid-pch
8084Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8085the search path but cannot be used.
8086
8087@item -Wlong-long
8088@opindex Wlong-long
8089@opindex Wno-long-long
8090Warn if @code{long long} type is used.  This is enabled by either
8091@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8092modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
8093
8094@item -Wvariadic-macros
8095@opindex Wvariadic-macros
8096@opindex Wno-variadic-macros
8097Warn if variadic macros are used in ISO C90 mode, or if the GNU
8098alternate syntax is used in ISO C99 mode.  This is enabled by either
8099@option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
8100messages, use @option{-Wno-variadic-macros}.
8101
8102@item -Wno-varargs
8103@opindex Wvarargs
8104@opindex Wno-varargs
8105Do not warn upon questionable usage of the macros used to handle variable
8106arguments like @code{va_start}.  These warnings are enabled by default.
8107
8108@item -Wvector-operation-performance
8109@opindex Wvector-operation-performance
8110@opindex Wno-vector-operation-performance
8111Warn if vector operation is not implemented via SIMD capabilities of the
8112architecture.  Mainly useful for the performance tuning.
8113Vector operation can be implemented @code{piecewise}, which means that the
8114scalar operation is performed on every vector element;
8115@code{in parallel}, which means that the vector operation is implemented
8116using scalars of wider type, which normally is more performance efficient;
8117and @code{as a single scalar}, which means that vector fits into a
8118scalar type.
8119
8120@item -Wvla
8121@opindex Wvla
8122@opindex Wno-vla
8123Warn if a variable-length array is used in the code.
8124@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8125the variable-length array.
8126
8127@item -Wvla-larger-than=@var{byte-size}
8128@opindex Wvla-larger-than=
8129@opindex Wno-vla-larger-than
8130If this option is used, the compiler warns for declarations of
8131variable-length arrays whose size is either unbounded, or bounded
8132by an argument that allows the array size to exceed @var{byte-size}
8133bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8134works, but with variable-length arrays.
8135
8136Note that GCC may optimize small variable-length arrays of a known
8137value into plain arrays, so this warning may not get triggered for
8138such arrays.
8139
8140@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8141is typically only effective when @option{-ftree-vrp} is active (default
8142for @option{-O2} and above).
8143
8144See also @option{-Walloca-larger-than=@var{byte-size}}.
8145
8146@item -Wno-vla-larger-than
8147@opindex Wno-vla-larger-than
8148Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
8149to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8150
8151@item -Wvolatile-register-var
8152@opindex Wvolatile-register-var
8153@opindex Wno-volatile-register-var
8154Warn if a register variable is declared volatile.  The volatile
8155modifier does not inhibit all optimizations that may eliminate reads
8156and/or writes to register variables.  This warning is enabled by
8157@option{-Wall}.
8158
8159@item -Wdisabled-optimization
8160@opindex Wdisabled-optimization
8161@opindex Wno-disabled-optimization
8162Warn if a requested optimization pass is disabled.  This warning does
8163not generally indicate that there is anything wrong with your code; it
8164merely indicates that GCC's optimizers are unable to handle the code
8165effectively.  Often, the problem is that your code is too big or too
8166complex; GCC refuses to optimize programs when the optimization
8167itself is likely to take inordinate amounts of time.
8168
8169@item -Wpointer-sign @r{(C and Objective-C only)}
8170@opindex Wpointer-sign
8171@opindex Wno-pointer-sign
8172Warn for pointer argument passing or assignment with different signedness.
8173This option is only supported for C and Objective-C@.  It is implied by
8174@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8175@option{-Wno-pointer-sign}.
8176
8177@item -Wstack-protector
8178@opindex Wstack-protector
8179@opindex Wno-stack-protector
8180This option is only active when @option{-fstack-protector} is active.  It
8181warns about functions that are not protected against stack smashing.
8182
8183@item -Woverlength-strings
8184@opindex Woverlength-strings
8185@opindex Wno-overlength-strings
8186Warn about string constants that are longer than the ``minimum
8187maximum'' length specified in the C standard.  Modern compilers
8188generally allow string constants that are much longer than the
8189standard's minimum limit, but very portable programs should avoid
8190using longer strings.
8191
8192The limit applies @emph{after} string constant concatenation, and does
8193not count the trailing NUL@.  In C90, the limit was 509 characters; in
8194C99, it was raised to 4095.  C++98 does not specify a normative
8195minimum maximum, so we do not diagnose overlength strings in C++@.
8196
8197This option is implied by @option{-Wpedantic}, and can be disabled with
8198@option{-Wno-overlength-strings}.
8199
8200@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8201@opindex Wunsuffixed-float-constants
8202@opindex Wno-unsuffixed-float-constants
8203
8204Issue a warning for any floating constant that does not have
8205a suffix.  When used together with @option{-Wsystem-headers} it
8206warns about such constants in system header files.  This can be useful
8207when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8208from the decimal floating-point extension to C99.
8209
8210@item -Wno-lto-type-mismatch
8211@opindex Wlto-type-mismatch
8212@opindex Wno-lto-type-mismatch
8213
8214During the link-time optimization, do not warn about type mismatches in
8215global declarations from different compilation units.
8216Requires @option{-flto} to be enabled.  Enabled by default.
8217
8218@item -Wno-designated-init @r{(C and Objective-C only)}
8219@opindex Wdesignated-init
8220@opindex Wno-designated-init
8221Suppress warnings when a positional initializer is used to initialize
8222a structure that has been marked with the @code{designated_init}
8223attribute.
8224
8225@item -Wno-hsa
8226@opindex Whsa
8227@opindex Wno-hsa
8228Do not warn when HSAIL cannot be emitted for the compiled function or
8229OpenMP construct.  These warnings are enabled by default.
8230
8231@end table
8232
8233@node Static Analyzer Options
8234@section Options That Control Static Analysis
8235
8236@table @gcctabopt
8237@item -fanalyzer
8238@opindex analyzer
8239@opindex fanalyzer
8240@opindex fno-analyzer
8241This option enables an static analysis of program flow which looks
8242for ``interesting'' interprocedural paths through the
8243code, and issues warnings for problems found on them.
8244
8245This analysis is much more expensive than other GCC warnings.
8246
8247Enabling this option effectively enables the following warnings:
8248
8249@gccoptlist{ @gol
8250-Wanalyzer-double-fclose @gol
8251-Wanalyzer-double-free @gol
8252-Wanalyzer-exposure-through-output-file @gol
8253-Wanalyzer-file-leak @gol
8254-Wanalyzer-free-of-non-heap @gol
8255-Wanalyzer-malloc-leak @gol
8256-Wanalyzer-possible-null-argument @gol
8257-Wanalyzer-possible-null-dereference @gol
8258-Wanalyzer-null-argument @gol
8259-Wanalyzer-null-dereference @gol
8260-Wanalyzer-stale-setjmp-buffer @gol
8261-Wanalyzer-tainted-array-index @gol
8262-Wanalyzer-unsafe-call-within-signal-handler @gol
8263-Wanalyzer-use-after-free @gol
8264-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8265}
8266
8267This option is only available if GCC was configured with analyzer
8268support enabled.
8269
8270@item -Wanalyzer-too-complex
8271@opindex Wanalyzer-too-complex
8272@opindex Wno-analyzer-too-complex
8273If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8274to attempt to explore the control flow and data flow in the program,
8275but these can be defeated by sufficiently complicated code.
8276
8277By default, the analysis silently stops if the code is too
8278complicated for the analyzer to fully explore and it reaches an internal
8279limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
8280
8281@item -Wno-analyzer-double-fclose
8282@opindex Wanalyzer-double-fclose
8283@opindex Wno-analyzer-double-fclose
8284This warning requires @option{-fanalyzer}, which enables it; use
8285@option{-Wno-analyzer-double-fclose} to disable it.
8286
8287This diagnostic warns for paths through the code in which a @code{FILE *}
8288can have @code{fclose} called on it more than once.
8289
8290@item -Wno-analyzer-double-free
8291@opindex Wanalyzer-double-free
8292@opindex Wno-analyzer-double-free
8293This warning requires @option{-fanalyzer}, which enables it; use
8294@option{-Wno-analyzer-double-free} to disable it.
8295
8296This diagnostic warns for paths through the code in which a pointer
8297can have @code{free} called on it more than once.
8298
8299@item -Wno-analyzer-exposure-through-output-file
8300@opindex Wanalyzer-exposure-through-output-file
8301@opindex Wno-analyzer-exposure-through-output-file
8302This warning requires @option{-fanalyzer}, which enables it; use
8303@option{-Wno-analyzer-exposure-through-output-file}
8304to disable it.
8305
8306This diagnostic warns for paths through the code in which a
8307security-sensitive value is written to an output file
8308(such as writing a password to a log file).
8309
8310@item -Wno-analyzer-file-leak
8311@opindex Wanalyzer-file-leak
8312@opindex Wno-analyzer-file-leak
8313This warning requires @option{-fanalyzer}, which enables it; use
8314@option{-Wno-analyzer-file-leak}
8315to disable it.
8316
8317This diagnostic warns for paths through the code in which a
8318@code{<stdio.h>} @code{FILE *} stream object is leaked.
8319
8320@item -Wno-analyzer-free-of-non-heap
8321@opindex Wanalyzer-free-of-non-heap
8322@opindex Wno-analyzer-free-of-non-heap
8323This warning requires @option{-fanalyzer}, which enables it; use
8324@option{-Wno-analyzer-free-of-non-heap}
8325to disable it.
8326
8327This diagnostic warns for paths through the code in which @code{free}
8328is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8329
8330@item -Wno-analyzer-malloc-leak
8331@opindex Wanalyzer-malloc-leak
8332@opindex Wno-analyzer-malloc-leak
8333This warning requires @option{-fanalyzer}, which enables it; use
8334@option{-Wno-analyzer-malloc-leak}
8335to disable it.
8336
8337This diagnostic warns for paths through the code in which a
8338pointer allocated via @code{malloc} is leaked.
8339
8340@item -Wno-analyzer-possible-null-argument
8341@opindex Wanalyzer-possible-null-argument
8342@opindex Wno-analyzer-possible-null-argument
8343This warning requires @option{-fanalyzer}, which enables it; use
8344@option{-Wno-analyzer-possible-null-argument} to disable it.
8345
8346This diagnostic warns for paths through the code in which a
8347possibly-NULL value is passed to a function argument marked
8348with @code{__attribute__((nonnull))} as requiring a non-NULL
8349value.
8350
8351@item -Wno-analyzer-possible-null-dereference
8352@opindex Wanalyzer-possible-null-dereference
8353@opindex Wno-analyzer-possible-null-dereference
8354This warning requires @option{-fanalyzer}, which enables it; use
8355@option{-Wno-analyzer-possible-null-dereference} to disable it.
8356
8357This diagnostic warns for paths through the code in which a
8358possibly-NULL value is dereferenced.
8359
8360@item -Wno-analyzer-null-argument
8361@opindex Wanalyzer-null-argument
8362@opindex Wno-analyzer-null-argument
8363This warning requires @option{-fanalyzer}, which enables it; use
8364@option{-Wno-analyzer-null-argument} to disable it.
8365
8366This diagnostic warns for paths through the code in which a
8367value known to be NULL is passed to a function argument marked
8368with @code{__attribute__((nonnull))} as requiring a non-NULL
8369value.
8370
8371@item -Wno-analyzer-null-dereference
8372@opindex Wanalyzer-null-dereference
8373@opindex Wno-analyzer-null-dereference
8374This warning requires @option{-fanalyzer}, which enables it; use
8375@option{-Wno-analyzer-null-dereference} to disable it.
8376
8377This diagnostic warns for paths through the code in which a
8378value known to be NULL is dereferenced.
8379
8380@item -Wno-analyzer-stale-setjmp-buffer
8381@opindex Wanalyzer-stale-setjmp-buffer
8382@opindex Wno-analyzer-stale-setjmp-buffer
8383This warning requires @option{-fanalyzer}, which enables it; use
8384@option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8385
8386This diagnostic warns for paths through the code in which
8387@code{longjmp} is called to rewind to a @code{jmp_buf} relating
8388to a @code{setjmp} call in a function that has returned.
8389
8390When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8391location, it records the stack frame.  The stack frame becomes invalid
8392when the function containing the @code{setjmp} call returns.  Attempting
8393to rewind to it via @code{longjmp} would reference a stack frame that
8394no longer exists, and likely lead to a crash (or worse).
8395
8396@item -Wno-analyzer-tainted-array-index
8397@opindex Wanalyzer-tainted-array-index
8398@opindex Wno-analyzer-tainted-array-index
8399This warning requires both @option{-fanalyzer} and
8400@option{-fanalyzer-checker=taint} to enable it;
8401use @option{-Wno-analyzer-tainted-array-index} to disable it.
8402
8403This diagnostic warns for paths through the code in which a value
8404that could be under an attacker's control is used as the index
8405of an array access without being sanitized.
8406
8407@item -Wno-analyzer-unsafe-call-within-signal-handler
8408@opindex Wanalyzer-unsafe-call-within-signal-handler
8409@opindex Wno-analyzer-unsafe-call-within-signal-handler
8410This warning requires @option{-fanalyzer}, which enables it; use
8411@option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8412
8413This diagnostic warns for paths through the code in which a
8414function known to be async-signal-unsafe (such as @code{fprintf}) is
8415called from a signal handler.
8416
8417@item -Wno-analyzer-use-after-free
8418@opindex Wanalyzer-use-after-free
8419@opindex Wno-analyzer-use-after-free
8420This warning requires @option{-fanalyzer}, which enables it; use
8421@option{-Wno-analyzer-use-after-free} to disable it.
8422
8423This diagnostic warns for paths through the code in which a
8424pointer is used after @code{free} is called on it.
8425
8426@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8427@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8428@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8429This warning requires @option{-fanalyzer}, which enables it; use
8430@option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8431to disable it.
8432
8433This diagnostic warns for paths through the code in which a pointer
8434is dereferenced that points to a variable in a stale stack frame.
8435
8436@end table
8437
8438Pertinent parameters for controlling the exploration are:
8439@option{--param analyzer-bb-explosion-factor=@var{value}},
8440@option{--param analyzer-max-enodes-per-program-point=@var{value}},
8441@option{--param analyzer-max-recursion-depth=@var{value}}, and
8442@option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8443
8444The following options control the analyzer.
8445
8446@table @gcctabopt
8447
8448@item -fanalyzer-call-summaries
8449@opindex fanalyzer-call-summaries
8450@opindex fno-analyzer-call-summaries
8451Simplify interprocedural analysis by computing the effect of certain calls,
8452rather than exploring all paths through the function from callsite to each
8453possible return.
8454
8455If enabled, call summaries are only used for functions with more than one
8456call site, and that are sufficiently complicated (as per
8457@option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8458
8459@item -fanalyzer-checker=@var{name}
8460@opindex fanalyzer-checker
8461Restrict the analyzer to run just the named checker, and enable it.
8462
8463Some checkers are disabled by default (even with @option{-fanalyzer}),
8464such as the @code{taint} checker that implements
8465@option{-Wanalyzer-tainted-array-index}, and this option is required
8466to enable them.
8467
8468@item -fanalyzer-fine-grained
8469@opindex fanalyzer-fine-grained
8470@opindex fno-analyzer-fine-grained
8471This option is intended for analyzer developers.
8472
8473Internally the analyzer builds an ``exploded graph'' that combines
8474control flow graphs with data flow information.
8475
8476By default, an edge in this graph can contain the effects of a run
8477of multiple statements within a basic block.  With
8478@option{-fanalyzer-fine-grained}, each statement gets its own edge.
8479
8480@item -fanalyzer-show-duplicate-count
8481@opindex fanalyzer-show-duplicate-count
8482@opindex fno-analyzer-show-duplicate-count
8483This option is intended for analyzer developers: if multiple diagnostics
8484have been detected as being duplicates of each other, it emits a note when
8485reporting the best diagnostic, giving the number of additional diagnostics
8486that were suppressed by the deduplication logic.
8487
8488@item -fno-analyzer-state-merge
8489@opindex fanalyzer-state-merge
8490@opindex fno-analyzer-state-merge
8491This option is intended for analyzer developers.
8492
8493By default the analyzer attempts to simplify analysis by merging
8494sufficiently similar states at each program point as it builds its
8495``exploded graph''.  With @option{-fno-analyzer-state-merge} this
8496merging can be suppressed, for debugging state-handling issues.
8497
8498@item -fno-analyzer-state-purge
8499@opindex fanalyzer-state-purge
8500@opindex fno-analyzer-state-purge
8501This option is intended for analyzer developers.
8502
8503By default the analyzer attempts to simplify analysis by purging
8504aspects of state at a program point that appear to no longer be relevant
8505e.g. the values of locals that aren't accessed later in the function
8506and which aren't relevant to leak analysis.
8507
8508With @option{-fno-analyzer-state-purge} this purging of state can
8509be suppressed, for debugging state-handling issues.
8510
8511@item -fanalyzer-transitivity
8512@opindex fanalyzer-transitivity
8513@opindex fno-analyzer-transitivity
8514This option enables transitivity of constraints within the analyzer.
8515
8516@item -fanalyzer-verbose-edges
8517This option is intended for analyzer developers.  It enables more
8518verbose, lower-level detail in the descriptions of control flow
8519within diagnostic paths.
8520
8521@item -fanalyzer-verbose-state-changes
8522This option is intended for analyzer developers.  It enables more
8523verbose, lower-level detail in the descriptions of events relating
8524to state machines within diagnostic paths.
8525
8526@item -fanalyzer-verbosity=@var{level}
8527This option controls the complexity of the control flow paths that are
8528emitted for analyzer diagnostics.
8529
8530The @var{level} can be one of:
8531
8532@table @samp
8533@item 0
8534At this level, interprocedural call and return events are displayed,
8535along with the most pertinent state-change events relating to
8536a diagnostic.  For example, for a double-@code{free} diagnostic,
8537both calls to @code{free} will be shown.
8538
8539@item 1
8540As per the previous level, but also show events for the entry
8541to each function.
8542
8543@item 2
8544As per the previous level, but also show events relating to
8545control flow that are significant to triggering the issue
8546(e.g. ``true path taken'' at a conditional).
8547
8548This level is the default.
8549
8550@item 3
8551As per the previous level, but show all control flow events, not
8552just significant ones.
8553
8554@item 4
8555This level is intended for analyzer developers; it adds various
8556other events intended for debugging the analyzer.
8557
8558@end table
8559
8560@item -fdump-analyzer
8561@opindex fdump-analyzer
8562Dump internal details about what the analyzer is doing to
8563@file{@var{file}.analyzer.txt}.
8564This option is overridden by @option{-fdump-analyzer-stderr}.
8565
8566@item -fdump-analyzer-stderr
8567@opindex fdump-analyzer-stderr
8568Dump internal details about what the analyzer is doing to stderr.
8569This option overrides @option{-fdump-analyzer}.
8570
8571@item -fdump-analyzer-callgraph
8572@opindex fdump-analyzer-callgraph
8573Dump a representation of the call graph suitable for viewing with
8574GraphViz to @file{@var{file}.callgraph.dot}.
8575
8576@item -fdump-analyzer-exploded-graph
8577@opindex fdump-analyzer-exploded-graph
8578Dump a representation of the ``exploded graph'' suitable for viewing with
8579GraphViz to @file{@var{file}.eg.dot}.
8580Nodes are color-coded based on state-machine states to emphasize
8581state changes.
8582
8583@item -fdump-analyzer-exploded-nodes
8584@opindex dump-analyzer-exploded-nodes
8585Emit diagnostics showing where nodes in the ``exploded graph'' are
8586in relation to the program source.
8587
8588@item -fdump-analyzer-exploded-nodes-2
8589@opindex dump-analyzer-exploded-nodes-2
8590Dump a textual representation of the ``exploded graph'' to
8591@file{@var{file}.eg.txt}.
8592
8593@item -fdump-analyzer-exploded-nodes-3
8594@opindex dump-analyzer-exploded-nodes-3
8595Dump a textual representation of the ``exploded graph'' to
8596one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8597This is typically a large number of dump files.
8598
8599@item -fdump-analyzer-state-purge
8600@opindex fdump-analyzer-state-purge
8601As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8602``supergraph'' suitable for viewing with GraphViz, but annotate the
8603graph with information on what state will be purged at each node.
8604The graph is written to @file{@var{file}.state-purge.dot}.
8605
8606@item -fdump-analyzer-supergraph
8607@opindex fdump-analyzer-supergraph
8608Dump representations of the ``supergraph'' suitable for viewing with
8609GraphViz to @file{@var{file}.supergraph.dot} and to
8610@file{@var{file}.supergraph-eg.dot}.  These show all of the
8611control flow graphs in the program, with interprocedural edges for
8612calls and returns.  The second dump contains annotations showing nodes
8613in the ``exploded graph'' and diagnostics associated with them.
8614
8615@end table
8616
8617@node Debugging Options
8618@section Options for Debugging Your Program
8619@cindex options, debugging
8620@cindex debugging information options
8621
8622To tell GCC to emit extra information for use by a debugger, in almost
8623all cases you need only to add @option{-g} to your other options.
8624
8625GCC allows you to use @option{-g} with
8626@option{-O}.  The shortcuts taken by optimized code may occasionally
8627be surprising: some variables you declared may not exist
8628at all; flow of control may briefly move where you did not expect it;
8629some statements may not be executed because they compute constant
8630results or their values are already at hand; some statements may
8631execute in different places because they have been moved out of loops.
8632Nevertheless it is possible to debug optimized output.  This makes
8633it reasonable to use the optimizer for programs that might have bugs.
8634
8635If you are not using some other optimization option, consider
8636using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
8637With no @option{-O} option at all, some compiler passes that collect
8638information useful for debugging do not run at all, so that
8639@option{-Og} may result in a better debugging experience.
8640
8641@table @gcctabopt
8642@item -g
8643@opindex g
8644Produce debugging information in the operating system's native format
8645(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
8646information.
8647
8648On most systems that use stabs format, @option{-g} enables use of extra
8649debugging information that only GDB can use; this extra information
8650makes debugging work better in GDB but probably makes other debuggers
8651crash or
8652refuse to read the program.  If you want to control for certain whether
8653to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8654@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8655
8656@item -ggdb
8657@opindex ggdb
8658Produce debugging information for use by GDB@.  This means to use the
8659most expressive format available (DWARF, stabs, or the native format
8660if neither of those are supported), including GDB extensions if at all
8661possible.
8662
8663@item -gdwarf
8664@itemx -gdwarf-@var{version}
8665@opindex gdwarf
8666Produce debugging information in DWARF format (if that is supported).
8667The value of @var{version} may be either 2, 3, 4 or 5; the default version
8668for most targets is 4.  DWARF Version 5 is only experimental.
8669
8670Note that with DWARF Version 2, some ports require and always
8671use some non-conflicting DWARF 3 extensions in the unwind tables.
8672
8673Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8674for maximum benefit.
8675
8676GCC no longer supports DWARF Version 1, which is substantially
8677different than Version 2 and later.  For historical reasons, some
8678other DWARF-related options such as
8679@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8680in their names, but apply to all currently-supported versions of DWARF.
8681
8682@item -gstabs
8683@opindex gstabs
8684Produce debugging information in stabs format (if that is supported),
8685without GDB extensions.  This is the format used by DBX on most BSD
8686systems.  On MIPS, Alpha and System V Release 4 systems this option
8687produces stabs debugging output that is not understood by DBX@.
8688On System V Release 4 systems this option requires the GNU assembler.
8689
8690@item -gstabs+
8691@opindex gstabs+
8692Produce debugging information in stabs format (if that is supported),
8693using GNU extensions understood only by the GNU debugger (GDB)@.  The
8694use of these extensions is likely to make other debuggers crash or
8695refuse to read the program.
8696
8697@item -gxcoff
8698@opindex gxcoff
8699Produce debugging information in XCOFF format (if that is supported).
8700This is the format used by the DBX debugger on IBM RS/6000 systems.
8701
8702@item -gxcoff+
8703@opindex gxcoff+
8704Produce debugging information in XCOFF format (if that is supported),
8705using GNU extensions understood only by the GNU debugger (GDB)@.  The
8706use of these extensions is likely to make other debuggers crash or
8707refuse to read the program, and may cause assemblers other than the GNU
8708assembler (GAS) to fail with an error.
8709
8710@item -gvms
8711@opindex gvms
8712Produce debugging information in Alpha/VMS debug format (if that is
8713supported).  This is the format used by DEBUG on Alpha/VMS systems.
8714
8715@item -g@var{level}
8716@itemx -ggdb@var{level}
8717@itemx -gstabs@var{level}
8718@itemx -gxcoff@var{level}
8719@itemx -gvms@var{level}
8720Request debugging information and also use @var{level} to specify how
8721much information.  The default level is 2.
8722
8723Level 0 produces no debug information at all.  Thus, @option{-g0} negates
8724@option{-g}.
8725
8726Level 1 produces minimal information, enough for making backtraces in
8727parts of the program that you don't plan to debug.  This includes
8728descriptions of functions and external variables, and line number
8729tables, but no information about local variables.
8730
8731Level 3 includes extra information, such as all the macro definitions
8732present in the program.  Some debuggers support macro expansion when
8733you use @option{-g3}.
8734
8735If you use multiple @option{-g} options, with or without level numbers,
8736the last such option is the one that is effective.
8737
8738@option{-gdwarf} does not accept a concatenated debug level, to avoid
8739confusion with @option{-gdwarf-@var{level}}.
8740Instead use an additional @option{-g@var{level}} option to change the
8741debug level for DWARF.
8742
8743@item -fno-eliminate-unused-debug-symbols
8744@opindex feliminate-unused-debug-symbols
8745@opindex fno-eliminate-unused-debug-symbols
8746By default, no debug information is produced for symbols that are not actually
8747used. Use this option if you want debug information for all symbols.
8748
8749@item -femit-class-debug-always
8750@opindex femit-class-debug-always
8751Instead of emitting debugging information for a C++ class in only one
8752object file, emit it in all object files using the class.  This option
8753should be used only with debuggers that are unable to handle the way GCC
8754normally emits debugging information for classes because using this
8755option increases the size of debugging information by as much as a
8756factor of two.
8757
8758@item -fno-merge-debug-strings
8759@opindex fmerge-debug-strings
8760@opindex fno-merge-debug-strings
8761Direct the linker to not merge together strings in the debugging
8762information that are identical in different object files.  Merging is
8763not supported by all assemblers or linkers.  Merging decreases the size
8764of the debug information in the output file at the cost of increasing
8765link processing time.  Merging is enabled by default.
8766
8767@item -fdebug-prefix-map=@var{old}=@var{new}
8768@opindex fdebug-prefix-map
8769When compiling files residing in directory @file{@var{old}}, record
8770debugging information describing them as if the files resided in
8771directory @file{@var{new}} instead.  This can be used to replace a
8772build-time path with an install-time path in the debug info.  It can
8773also be used to change an absolute path to a relative path by using
8774@file{.} for @var{new}.  This can give more reproducible builds, which
8775are location independent, but may require an extra command to tell GDB
8776where to find the source files. See also @option{-ffile-prefix-map}.
8777
8778@item -fvar-tracking
8779@opindex fvar-tracking
8780Run variable tracking pass.  It computes where variables are stored at each
8781position in code.  Better debugging information is then generated
8782(if the debugging information format supports this information).
8783
8784It is enabled by default when compiling with optimization (@option{-Os},
8785@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8786the debug info format supports it.
8787
8788@item -fvar-tracking-assignments
8789@opindex fvar-tracking-assignments
8790@opindex fno-var-tracking-assignments
8791Annotate assignments to user variables early in the compilation and
8792attempt to carry the annotations over throughout the compilation all the
8793way to the end, in an attempt to improve debug information while
8794optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
8795
8796It can be enabled even if var-tracking is disabled, in which case
8797annotations are created and maintained, but discarded at the end.
8798By default, this flag is enabled together with @option{-fvar-tracking},
8799except when selective scheduling is enabled.
8800
8801@item -gsplit-dwarf
8802@opindex gsplit-dwarf
8803Separate as much DWARF debugging information as possible into a
8804separate output file with the extension @file{.dwo}.  This option allows
8805the build system to avoid linking files with debug information.  To
8806be useful, this option requires a debugger capable of reading @file{.dwo}
8807files.
8808
8809@item -gdescribe-dies
8810@opindex gdescribe-dies
8811Add description attributes to some DWARF DIEs that have no name attribute,
8812such as artificial variables, external references and call site
8813parameter DIEs.
8814
8815@item -gpubnames
8816@opindex gpubnames
8817Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8818
8819@item -ggnu-pubnames
8820@opindex ggnu-pubnames
8821Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8822suitable for conversion into a GDB@ index.  This option is only useful
8823with a linker that can produce GDB@ index version 7.
8824
8825@item -fdebug-types-section
8826@opindex fdebug-types-section
8827@opindex fno-debug-types-section
8828When using DWARF Version 4 or higher, type DIEs can be put into
8829their own @code{.debug_types} section instead of making them part of the
8830@code{.debug_info} section.  It is more efficient to put them in a separate
8831comdat section since the linker can then remove duplicates.
8832But not all DWARF consumers support @code{.debug_types} sections yet
8833and on some objects @code{.debug_types} produces larger instead of smaller
8834debugging information.
8835
8836@item -grecord-gcc-switches
8837@itemx -gno-record-gcc-switches
8838@opindex grecord-gcc-switches
8839@opindex gno-record-gcc-switches
8840This switch causes the command-line options used to invoke the
8841compiler that may affect code generation to be appended to the
8842DW_AT_producer attribute in DWARF debugging information.  The options
8843are concatenated with spaces separating them from each other and from
8844the compiler version.
8845It is enabled by default.
8846See also @option{-frecord-gcc-switches} for another
8847way of storing compiler options into the object file.
8848
8849@item -gstrict-dwarf
8850@opindex gstrict-dwarf
8851Disallow using extensions of later DWARF standard version than selected
8852with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
8853DWARF extensions from later standard versions is allowed.
8854
8855@item -gno-strict-dwarf
8856@opindex gno-strict-dwarf
8857Allow using extensions of later DWARF standard version than selected with
8858@option{-gdwarf-@var{version}}.
8859
8860@item -gas-loc-support
8861@opindex gas-loc-support
8862Inform the compiler that the assembler supports @code{.loc} directives.
8863It may then use them for the assembler to generate DWARF2+ line number
8864tables.
8865
8866This is generally desirable, because assembler-generated line-number
8867tables are a lot more compact than those the compiler can generate
8868itself.
8869
8870This option will be enabled by default if, at GCC configure time, the
8871assembler was found to support such directives.
8872
8873@item -gno-as-loc-support
8874@opindex gno-as-loc-support
8875Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8876line number tables are to be generated.
8877
8878@item -gas-locview-support
8879@opindex gas-locview-support
8880Inform the compiler that the assembler supports @code{view} assignment
8881and reset assertion checking in @code{.loc} directives.
8882
8883This option will be enabled by default if, at GCC configure time, the
8884assembler was found to support them.
8885
8886@item -gno-as-locview-support
8887Force GCC to assign view numbers internally, if
8888@option{-gvariable-location-views} are explicitly requested.
8889
8890@item -gcolumn-info
8891@itemx -gno-column-info
8892@opindex gcolumn-info
8893@opindex gno-column-info
8894Emit location column information into DWARF debugging information, rather
8895than just file and line.
8896This option is enabled by default.
8897
8898@item -gstatement-frontiers
8899@itemx -gno-statement-frontiers
8900@opindex gstatement-frontiers
8901@opindex gno-statement-frontiers
8902This option causes GCC to create markers in the internal representation
8903at the beginning of statements, and to keep them roughly in place
8904throughout compilation, using them to guide the output of @code{is_stmt}
8905markers in the line number table.  This is enabled by default when
8906compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8907@dots{}), and outputting DWARF 2 debug information at the normal level.
8908
8909@item -gvariable-location-views
8910@itemx -gvariable-location-views=incompat5
8911@itemx -gno-variable-location-views
8912@opindex gvariable-location-views
8913@opindex gvariable-location-views=incompat5
8914@opindex gno-variable-location-views
8915Augment variable location lists with progressive view numbers implied
8916from the line number table.  This enables debug information consumers to
8917inspect state at certain points of the program, even if no instructions
8918associated with the corresponding source locations are present at that
8919point.  If the assembler lacks support for view numbers in line number
8920tables, this will cause the compiler to emit the line number table,
8921which generally makes them somewhat less compact.  The augmented line
8922number tables and location lists are fully backward-compatible, so they
8923can be consumed by debug information consumers that are not aware of
8924these augmentations, but they won't derive any benefit from them either.
8925
8926This is enabled by default when outputting DWARF 2 debug information at
8927the normal level, as long as there is assembler support,
8928@option{-fvar-tracking-assignments} is enabled and
8929@option{-gstrict-dwarf} is not.  When assembler support is not
8930available, this may still be enabled, but it will force GCC to output
8931internal line number tables, and if
8932@option{-ginternal-reset-location-views} is not enabled, that will most
8933certainly lead to silently mismatching location views.
8934
8935There is a proposed representation for view numbers that is not backward
8936compatible with the location list format introduced in DWARF 5, that can
8937be enabled with @option{-gvariable-location-views=incompat5}.  This
8938option may be removed in the future, is only provided as a reference
8939implementation of the proposed representation.  Debug information
8940consumers are not expected to support this extended format, and they
8941would be rendered unable to decode location lists using it.
8942
8943@item -ginternal-reset-location-views
8944@itemx -gno-internal-reset-location-views
8945@opindex ginternal-reset-location-views
8946@opindex gno-internal-reset-location-views
8947Attempt to determine location views that can be omitted from location
8948view lists.  This requires the compiler to have very accurate insn
8949length estimates, which isn't always the case, and it may cause
8950incorrect view lists to be generated silently when using an assembler
8951that does not support location view lists.  The GNU assembler will flag
8952any such error as a @code{view number mismatch}.  This is only enabled
8953on ports that define a reliable estimation function.
8954
8955@item -ginline-points
8956@itemx -gno-inline-points
8957@opindex ginline-points
8958@opindex gno-inline-points
8959Generate extended debug information for inlined functions.  Location
8960view tracking markers are inserted at inlined entry points, so that
8961address and view numbers can be computed and output in debug
8962information.  This can be enabled independently of location views, in
8963which case the view numbers won't be output, but it can only be enabled
8964along with statement frontiers, and it is only enabled by default if
8965location views are enabled.
8966
8967@item -gz@r{[}=@var{type}@r{]}
8968@opindex gz
8969Produce compressed debug sections in DWARF format, if that is supported.
8970If @var{type} is not given, the default type depends on the capabilities
8971of the assembler and linker used.  @var{type} may be one of
8972@samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8973compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8974compression in traditional GNU format).  If the linker doesn't support
8975writing compressed debug sections, the option is rejected.  Otherwise,
8976if the assembler does not support them, @option{-gz} is silently ignored
8977when producing object files.
8978
8979@item -femit-struct-debug-baseonly
8980@opindex femit-struct-debug-baseonly
8981Emit debug information for struct-like types
8982only when the base name of the compilation source file
8983matches the base name of file in which the struct is defined.
8984
8985This option substantially reduces the size of debugging information,
8986but at significant potential loss in type information to the debugger.
8987See @option{-femit-struct-debug-reduced} for a less aggressive option.
8988See @option{-femit-struct-debug-detailed} for more detailed control.
8989
8990This option works only with DWARF debug output.
8991
8992@item -femit-struct-debug-reduced
8993@opindex femit-struct-debug-reduced
8994Emit debug information for struct-like types
8995only when the base name of the compilation source file
8996matches the base name of file in which the type is defined,
8997unless the struct is a template or defined in a system header.
8998
8999This option significantly reduces the size of debugging information,
9000with some potential loss in type information to the debugger.
9001See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9002See @option{-femit-struct-debug-detailed} for more detailed control.
9003
9004This option works only with DWARF debug output.
9005
9006@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9007@opindex femit-struct-debug-detailed
9008Specify the struct-like types
9009for which the compiler generates debug information.
9010The intent is to reduce duplicate struct debug information
9011between different object files within the same program.
9012
9013This option is a detailed version of
9014@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9015which serves for most needs.
9016
9017A specification has the syntax@*
9018[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9019
9020The optional first word limits the specification to
9021structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9022A struct type is used directly when it is the type of a variable, member.
9023Indirect uses arise through pointers to structs.
9024That is, when use of an incomplete struct is valid, the use is indirect.
9025An example is
9026@samp{struct one direct; struct two * indirect;}.
9027
9028The optional second word limits the specification to
9029ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9030Generic structs are a bit complicated to explain.
9031For C++, these are non-explicit specializations of template classes,
9032or non-template classes within the above.
9033Other programming languages have generics,
9034but @option{-femit-struct-debug-detailed} does not yet implement them.
9035
9036The third word specifies the source files for those
9037structs for which the compiler should emit debug information.
9038The values @samp{none} and @samp{any} have the normal meaning.
9039The value @samp{base} means that
9040the base of name of the file in which the type declaration appears
9041must match the base of the name of the main compilation file.
9042In practice, this means that when compiling @file{foo.c}, debug information
9043is generated for types declared in that file and @file{foo.h},
9044but not other header files.
9045The value @samp{sys} means those types satisfying @samp{base}
9046or declared in system or compiler headers.
9047
9048You may need to experiment to determine the best settings for your application.
9049
9050The default is @option{-femit-struct-debug-detailed=all}.
9051
9052This option works only with DWARF debug output.
9053
9054@item -fno-dwarf2-cfi-asm
9055@opindex fdwarf2-cfi-asm
9056@opindex fno-dwarf2-cfi-asm
9057Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9058instead of using GAS @code{.cfi_*} directives.
9059
9060@item -fno-eliminate-unused-debug-types
9061@opindex feliminate-unused-debug-types
9062@opindex fno-eliminate-unused-debug-types
9063Normally, when producing DWARF output, GCC avoids producing debug symbol
9064output for types that are nowhere used in the source file being compiled.
9065Sometimes it is useful to have GCC emit debugging
9066information for all types declared in a compilation
9067unit, regardless of whether or not they are actually used
9068in that compilation unit, for example
9069if, in the debugger, you want to cast a value to a type that is
9070not actually used in your program (but is declared).  More often,
9071however, this results in a significant amount of wasted space.
9072@end table
9073
9074@node Optimize Options
9075@section Options That Control Optimization
9076@cindex optimize options
9077@cindex options, optimization
9078
9079These options control various sorts of optimizations.
9080
9081Without any optimization option, the compiler's goal is to reduce the
9082cost of compilation and to make debugging produce the expected
9083results.  Statements are independent: if you stop the program with a
9084breakpoint between statements, you can then assign a new value to any
9085variable or change the program counter to any other statement in the
9086function and get exactly the results you expect from the source
9087code.
9088
9089Turning on optimization flags makes the compiler attempt to improve
9090the performance and/or code size at the expense of compilation time
9091and possibly the ability to debug the program.
9092
9093The compiler performs optimization based on the knowledge it has of the
9094program.  Compiling multiple files at once to a single output file mode allows
9095the compiler to use information gained from all of the files when compiling
9096each of them.
9097
9098Not all optimizations are controlled directly by a flag.  Only
9099optimizations that have a flag are listed in this section.
9100
9101Most optimizations are completely disabled at @option{-O0} or if an
9102@option{-O} level is not set on the command line, even if individual
9103optimization flags are specified.  Similarly, @option{-Og} suppresses
9104many optimization passes.
9105
9106Depending on the target and how GCC was configured, a slightly different
9107set of optimizations may be enabled at each @option{-O} level than
9108those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
9109to find out the exact set of optimizations that are enabled at each level.
9110@xref{Overall Options}, for examples.
9111
9112@table @gcctabopt
9113@item -O
9114@itemx -O1
9115@opindex O
9116@opindex O1
9117Optimize.  Optimizing compilation takes somewhat more time, and a lot
9118more memory for a large function.
9119
9120With @option{-O}, the compiler tries to reduce code size and execution
9121time, without performing any optimizations that take a great deal of
9122compilation time.
9123
9124@c Note that in addition to the default_options_table list in opts.c,
9125@c several optimization flags default to true but control optimization
9126@c passes that are explicitly disabled at -O0.
9127
9128@option{-O} turns on the following optimization flags:
9129
9130@c Please keep the following list alphabetized.
9131@gccoptlist{-fauto-inc-dec @gol
9132-fbranch-count-reg @gol
9133-fcombine-stack-adjustments @gol
9134-fcompare-elim @gol
9135-fcprop-registers @gol
9136-fdce @gol
9137-fdefer-pop @gol
9138-fdelayed-branch @gol
9139-fdse @gol
9140-fforward-propagate @gol
9141-fguess-branch-probability @gol
9142-fif-conversion @gol
9143-fif-conversion2 @gol
9144-finline-functions-called-once @gol
9145-fipa-profile @gol
9146-fipa-pure-const @gol
9147-fipa-reference @gol
9148-fipa-reference-addressable @gol
9149-fmerge-constants @gol
9150-fmove-loop-invariants @gol
9151-fomit-frame-pointer @gol
9152-freorder-blocks @gol
9153-fshrink-wrap @gol
9154-fshrink-wrap-separate @gol
9155-fsplit-wide-types @gol
9156-fssa-backprop @gol
9157-fssa-phiopt @gol
9158-ftree-bit-ccp @gol
9159-ftree-ccp @gol
9160-ftree-ch @gol
9161-ftree-coalesce-vars @gol
9162-ftree-copy-prop @gol
9163-ftree-dce @gol
9164-ftree-dominator-opts @gol
9165-ftree-dse @gol
9166-ftree-forwprop @gol
9167-ftree-fre @gol
9168-ftree-phiprop @gol
9169-ftree-pta @gol
9170-ftree-scev-cprop @gol
9171-ftree-sink @gol
9172-ftree-slsr @gol
9173-ftree-sra @gol
9174-ftree-ter @gol
9175-funit-at-a-time}
9176
9177@item -O2
9178@opindex O2
9179Optimize even more.  GCC performs nearly all supported optimizations
9180that do not involve a space-speed tradeoff.
9181As compared to @option{-O}, this option increases both compilation time
9182and the performance of the generated code.
9183
9184@option{-O2} turns on all optimization flags specified by @option{-O}.  It
9185also turns on the following optimization flags:
9186
9187@c Please keep the following list alphabetized!
9188@gccoptlist{-falign-functions  -falign-jumps @gol
9189-falign-labels  -falign-loops @gol
9190-fcaller-saves @gol
9191-fcode-hoisting @gol
9192-fcrossjumping @gol
9193-fcse-follow-jumps  -fcse-skip-blocks @gol
9194-fdelete-null-pointer-checks @gol
9195-fdevirtualize  -fdevirtualize-speculatively @gol
9196-fexpensive-optimizations @gol
9197-ffinite-loops @gol
9198-fgcse  -fgcse-lm  @gol
9199-fhoist-adjacent-loads @gol
9200-finline-functions @gol
9201-finline-small-functions @gol
9202-findirect-inlining @gol
9203-fipa-bit-cp  -fipa-cp  -fipa-icf @gol
9204-fipa-ra  -fipa-sra  -fipa-vrp @gol
9205-fisolate-erroneous-paths-dereference @gol
9206-flra-remat @gol
9207-foptimize-sibling-calls @gol
9208-foptimize-strlen @gol
9209-fpartial-inlining @gol
9210-fpeephole2 @gol
9211-freorder-blocks-algorithm=stc @gol
9212-freorder-blocks-and-partition  -freorder-functions @gol
9213-frerun-cse-after-loop  @gol
9214-fschedule-insns  -fschedule-insns2 @gol
9215-fsched-interblock  -fsched-spec @gol
9216-fstore-merging @gol
9217-fstrict-aliasing @gol
9218-fthread-jumps @gol
9219-ftree-builtin-call-dce @gol
9220-ftree-pre @gol
9221-ftree-switch-conversion  -ftree-tail-merge @gol
9222-ftree-vrp}
9223
9224Please note the warning under @option{-fgcse} about
9225invoking @option{-O2} on programs that use computed gotos.
9226
9227@item -O3
9228@opindex O3
9229Optimize yet more.  @option{-O3} turns on all optimizations specified
9230by @option{-O2} and also turns on the following optimization flags:
9231
9232@c Please keep the following list alphabetized!
9233@gccoptlist{-fgcse-after-reload @gol
9234-fipa-cp-clone
9235-floop-interchange @gol
9236-floop-unroll-and-jam @gol
9237-fpeel-loops @gol
9238-fpredictive-commoning @gol
9239-fsplit-loops @gol
9240-fsplit-paths @gol
9241-ftree-loop-distribution @gol
9242-ftree-loop-vectorize @gol
9243-ftree-partial-pre @gol
9244-ftree-slp-vectorize @gol
9245-funswitch-loops @gol
9246-fvect-cost-model @gol
9247-fvect-cost-model=dynamic @gol
9248-fversion-loops-for-strides}
9249
9250@item -O0
9251@opindex O0
9252Reduce compilation time and make debugging produce the expected
9253results.  This is the default.
9254
9255@item -Os
9256@opindex Os
9257Optimize for size.  @option{-Os} enables all @option{-O2} optimizations
9258except those that often increase code size:
9259
9260@gccoptlist{-falign-functions  -falign-jumps @gol
9261-falign-labels  -falign-loops @gol
9262-fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
9263
9264It also enables @option{-finline-functions}, causes the compiler to tune for
9265code size rather than execution speed, and performs further optimizations
9266designed to reduce code size.
9267
9268@item -Ofast
9269@opindex Ofast
9270Disregard strict standards compliance.  @option{-Ofast} enables all
9271@option{-O3} optimizations.  It also enables optimizations that are not
9272valid for all standard-compliant programs.
9273It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9274and the Fortran-specific @option{-fstack-arrays}, unless
9275@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9276
9277@item -Og
9278@opindex Og
9279Optimize debugging experience.  @option{-Og} should be the optimization
9280level of choice for the standard edit-compile-debug cycle, offering
9281a reasonable level of optimization while maintaining fast compilation
9282and a good debugging experience.  It is a better choice than @option{-O0}
9283for producing debuggable code because some compiler passes
9284that collect debug information are disabled at @option{-O0}.
9285
9286Like @option{-O0}, @option{-Og} completely disables a number of
9287optimization passes so that individual options controlling them have
9288no effect.  Otherwise @option{-Og} enables all @option{-O1}
9289optimization flags except for those that may interfere with debugging:
9290
9291@gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
9292-fdse  -fif-conversion  -fif-conversion2  @gol
9293-finline-functions-called-once @gol
9294-fmove-loop-invariants  -fssa-phiopt @gol
9295-ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
9296
9297@end table
9298
9299If you use multiple @option{-O} options, with or without level numbers,
9300the last such option is the one that is effective.
9301
9302Options of the form @option{-f@var{flag}} specify machine-independent
9303flags.  Most flags have both positive and negative forms; the negative
9304form of @option{-ffoo} is @option{-fno-foo}.  In the table
9305below, only one of the forms is listed---the one you typically
9306use.  You can figure out the other form by either removing @samp{no-}
9307or adding it.
9308
9309The following options control specific optimizations.  They are either
9310activated by @option{-O} options or are related to ones that are.  You
9311can use the following flags in the rare cases when ``fine-tuning'' of
9312optimizations to be performed is desired.
9313
9314@table @gcctabopt
9315@item -fno-defer-pop
9316@opindex fno-defer-pop
9317@opindex fdefer-pop
9318For machines that must pop arguments after a function call, always pop
9319the arguments as soon as each function returns.
9320At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9321this allows the compiler to let arguments accumulate on the stack for several
9322function calls and pop them all at once.
9323
9324@item -fforward-propagate
9325@opindex fforward-propagate
9326Perform a forward propagation pass on RTL@.  The pass tries to combine two
9327instructions and checks if the result can be simplified.  If loop unrolling
9328is active, two passes are performed and the second is scheduled after
9329loop unrolling.
9330
9331This option is enabled by default at optimization levels @option{-O},
9332@option{-O2}, @option{-O3}, @option{-Os}.
9333
9334@item -ffp-contract=@var{style}
9335@opindex ffp-contract
9336@option{-ffp-contract=off} disables floating-point expression contraction.
9337@option{-ffp-contract=fast} enables floating-point expression contraction
9338such as forming of fused multiply-add operations if the target has
9339native support for them.
9340@option{-ffp-contract=on} enables floating-point expression contraction
9341if allowed by the language standard.  This is currently not implemented
9342and treated equal to @option{-ffp-contract=off}.
9343
9344The default is @option{-ffp-contract=fast}.
9345
9346@item -fomit-frame-pointer
9347@opindex fomit-frame-pointer
9348Omit the frame pointer in functions that don't need one.  This avoids the
9349instructions to save, set up and restore the frame pointer; on many targets
9350it also makes an extra register available.
9351
9352On some targets this flag has no effect because the standard calling sequence
9353always uses a frame pointer, so it cannot be omitted.
9354
9355Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9356is used in all functions.  Several targets always omit the frame pointer in
9357leaf functions.
9358
9359Enabled by default at @option{-O} and higher.
9360
9361@item -foptimize-sibling-calls
9362@opindex foptimize-sibling-calls
9363Optimize sibling and tail recursive calls.
9364
9365Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9366
9367@item -foptimize-strlen
9368@opindex foptimize-strlen
9369Optimize various standard C string functions (e.g.@: @code{strlen},
9370@code{strchr} or @code{strcpy}) and
9371their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9372
9373Enabled at levels @option{-O2}, @option{-O3}.
9374
9375@item -fno-inline
9376@opindex fno-inline
9377@opindex finline
9378Do not expand any functions inline apart from those marked with
9379the @code{always_inline} attribute.  This is the default when not
9380optimizing.
9381
9382Single functions can be exempted from inlining by marking them
9383with the @code{noinline} attribute.
9384
9385@item -finline-small-functions
9386@opindex finline-small-functions
9387Integrate functions into their callers when their body is smaller than expected
9388function call code (so overall size of program gets smaller).  The compiler
9389heuristically decides which functions are simple enough to be worth integrating
9390in this way.  This inlining applies to all functions, even those not declared
9391inline.
9392
9393Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9394
9395@item -findirect-inlining
9396@opindex findirect-inlining
9397Inline also indirect calls that are discovered to be known at compile
9398time thanks to previous inlining.  This option has any effect only
9399when inlining itself is turned on by the @option{-finline-functions}
9400or @option{-finline-small-functions} options.
9401
9402Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9403
9404@item -finline-functions
9405@opindex finline-functions
9406Consider all functions for inlining, even if they are not declared inline.
9407The compiler heuristically decides which functions are worth integrating
9408in this way.
9409
9410If all calls to a given function are integrated, and the function is
9411declared @code{static}, then the function is normally not output as
9412assembler code in its own right.
9413
9414Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
9415by @option{-fprofile-use} and @option{-fauto-profile}.
9416
9417@item -finline-functions-called-once
9418@opindex finline-functions-called-once
9419Consider all @code{static} functions called once for inlining into their
9420caller even if they are not marked @code{inline}.  If a call to a given
9421function is integrated, then the function is not output as assembler code
9422in its own right.
9423
9424Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9425but not @option{-Og}.
9426
9427@item -fearly-inlining
9428@opindex fearly-inlining
9429Inline functions marked by @code{always_inline} and functions whose body seems
9430smaller than the function call overhead early before doing
9431@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
9432makes profiling significantly cheaper and usually inlining faster on programs
9433having large chains of nested wrapper functions.
9434
9435Enabled by default.
9436
9437@item -fipa-sra
9438@opindex fipa-sra
9439Perform interprocedural scalar replacement of aggregates, removal of
9440unused parameters and replacement of parameters passed by reference
9441by parameters passed by value.
9442
9443Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9444
9445@item -finline-limit=@var{n}
9446@opindex finline-limit
9447By default, GCC limits the size of functions that can be inlined.  This flag
9448allows coarse control of this limit.  @var{n} is the size of functions that
9449can be inlined in number of pseudo instructions.
9450
9451Inlining is actually controlled by a number of parameters, which may be
9452specified individually by using @option{--param @var{name}=@var{value}}.
9453The @option{-finline-limit=@var{n}} option sets some of these parameters
9454as follows:
9455
9456@table @gcctabopt
9457@item max-inline-insns-single
9458is set to @var{n}/2.
9459@item max-inline-insns-auto
9460is set to @var{n}/2.
9461@end table
9462
9463See below for a documentation of the individual
9464parameters controlling inlining and for the defaults of these parameters.
9465
9466@emph{Note:} there may be no value to @option{-finline-limit} that results
9467in default behavior.
9468
9469@emph{Note:} pseudo instruction represents, in this particular context, an
9470abstract measurement of function's size.  In no way does it represent a count
9471of assembly instructions and as such its exact meaning might change from one
9472release to an another.
9473
9474@item -fno-keep-inline-dllexport
9475@opindex fno-keep-inline-dllexport
9476@opindex fkeep-inline-dllexport
9477This is a more fine-grained version of @option{-fkeep-inline-functions},
9478which applies only to functions that are declared using the @code{dllexport}
9479attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
9480Functions}.
9481
9482@item -fkeep-inline-functions
9483@opindex fkeep-inline-functions
9484In C, emit @code{static} functions that are declared @code{inline}
9485into the object file, even if the function has been inlined into all
9486of its callers.  This switch does not affect functions using the
9487@code{extern inline} extension in GNU C90@.  In C++, emit any and all
9488inline functions into the object file.
9489
9490@item -fkeep-static-functions
9491@opindex fkeep-static-functions
9492Emit @code{static} functions into the object file, even if the function
9493is never used.
9494
9495@item -fkeep-static-consts
9496@opindex fkeep-static-consts
9497Emit variables declared @code{static const} when optimization isn't turned
9498on, even if the variables aren't referenced.
9499
9500GCC enables this option by default.  If you want to force the compiler to
9501check if a variable is referenced, regardless of whether or not
9502optimization is turned on, use the @option{-fno-keep-static-consts} option.
9503
9504@item -fmerge-constants
9505@opindex fmerge-constants
9506Attempt to merge identical constants (string constants and floating-point
9507constants) across compilation units.
9508
9509This option is the default for optimized compilation if the assembler and
9510linker support it.  Use @option{-fno-merge-constants} to inhibit this
9511behavior.
9512
9513Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9514
9515@item -fmerge-all-constants
9516@opindex fmerge-all-constants
9517Attempt to merge identical constants and identical variables.
9518
9519This option implies @option{-fmerge-constants}.  In addition to
9520@option{-fmerge-constants} this considers e.g.@: even constant initialized
9521arrays or initialized constant variables with integral or floating-point
9522types.  Languages like C or C++ require each variable, including multiple
9523instances of the same variable in recursive calls, to have distinct locations,
9524so using this option results in non-conforming
9525behavior.
9526
9527@item -fmodulo-sched
9528@opindex fmodulo-sched
9529Perform swing modulo scheduling immediately before the first scheduling
9530pass.  This pass looks at innermost loops and reorders their
9531instructions by overlapping different iterations.
9532
9533@item -fmodulo-sched-allow-regmoves
9534@opindex fmodulo-sched-allow-regmoves
9535Perform more aggressive SMS-based modulo scheduling with register moves
9536allowed.  By setting this flag certain anti-dependences edges are
9537deleted, which triggers the generation of reg-moves based on the
9538life-range analysis.  This option is effective only with
9539@option{-fmodulo-sched} enabled.
9540
9541@item -fno-branch-count-reg
9542@opindex fno-branch-count-reg
9543@opindex fbranch-count-reg
9544Disable the optimization pass that scans for opportunities to use
9545``decrement and branch'' instructions on a count register instead of
9546instruction sequences that decrement a register, compare it against zero, and
9547then branch based upon the result.  This option is only meaningful on
9548architectures that support such instructions, which include x86, PowerPC,
9549IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
9550doesn't remove the decrement and branch instructions from the generated
9551instruction stream introduced by other optimization passes.
9552
9553The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9554except for @option{-Og}.
9555
9556@item -fno-function-cse
9557@opindex fno-function-cse
9558@opindex ffunction-cse
9559Do not put function addresses in registers; make each instruction that
9560calls a constant function contain the function's address explicitly.
9561
9562This option results in less efficient code, but some strange hacks
9563that alter the assembler output may be confused by the optimizations
9564performed when this option is not used.
9565
9566The default is @option{-ffunction-cse}
9567
9568@item -fno-zero-initialized-in-bss
9569@opindex fno-zero-initialized-in-bss
9570@opindex fzero-initialized-in-bss
9571If the target supports a BSS section, GCC by default puts variables that
9572are initialized to zero into BSS@.  This can save space in the resulting
9573code.
9574
9575This option turns off this behavior because some programs explicitly
9576rely on variables going to the data section---e.g., so that the
9577resulting executable can find the beginning of that section and/or make
9578assumptions based on that.
9579
9580The default is @option{-fzero-initialized-in-bss}.
9581
9582@item -fthread-jumps
9583@opindex fthread-jumps
9584Perform optimizations that check to see if a jump branches to a
9585location where another comparison subsumed by the first is found.  If
9586so, the first branch is redirected to either the destination of the
9587second branch or a point immediately following it, depending on whether
9588the condition is known to be true or false.
9589
9590Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9591
9592@item -fsplit-wide-types
9593@opindex fsplit-wide-types
9594When using a type that occupies multiple registers, such as @code{long
9595long} on a 32-bit system, split the registers apart and allocate them
9596independently.  This normally generates better code for those types,
9597but may make debugging more difficult.
9598
9599Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9600@option{-Os}.
9601
9602@item -fsplit-wide-types-early
9603@opindex fsplit-wide-types-early
9604Fully split wide types early, instead of very late.
9605This option has no effect unless @option{-fsplit-wide-types} is turned on.
9606
9607This is the default on some targets.
9608
9609@item -fcse-follow-jumps
9610@opindex fcse-follow-jumps
9611In common subexpression elimination (CSE), scan through jump instructions
9612when the target of the jump is not reached by any other path.  For
9613example, when CSE encounters an @code{if} statement with an
9614@code{else} clause, CSE follows the jump when the condition
9615tested is false.
9616
9617Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9618
9619@item -fcse-skip-blocks
9620@opindex fcse-skip-blocks
9621This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9622follow jumps that conditionally skip over blocks.  When CSE
9623encounters a simple @code{if} statement with no else clause,
9624@option{-fcse-skip-blocks} causes CSE to follow the jump around the
9625body of the @code{if}.
9626
9627Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9628
9629@item -frerun-cse-after-loop
9630@opindex frerun-cse-after-loop
9631Re-run common subexpression elimination after loop optimizations are
9632performed.
9633
9634Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9635
9636@item -fgcse
9637@opindex fgcse
9638Perform a global common subexpression elimination pass.
9639This pass also performs global constant and copy propagation.
9640
9641@emph{Note:} When compiling a program using computed gotos, a GCC
9642extension, you may get better run-time performance if you disable
9643the global common subexpression elimination pass by adding
9644@option{-fno-gcse} to the command line.
9645
9646Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9647
9648@item -fgcse-lm
9649@opindex fgcse-lm
9650When @option{-fgcse-lm} is enabled, global common subexpression elimination
9651attempts to move loads that are only killed by stores into themselves.  This
9652allows a loop containing a load/store sequence to be changed to a load outside
9653the loop, and a copy/store within the loop.
9654
9655Enabled by default when @option{-fgcse} is enabled.
9656
9657@item -fgcse-sm
9658@opindex fgcse-sm
9659When @option{-fgcse-sm} is enabled, a store motion pass is run after
9660global common subexpression elimination.  This pass attempts to move
9661stores out of loops.  When used in conjunction with @option{-fgcse-lm},
9662loops containing a load/store sequence can be changed to a load before
9663the loop and a store after the loop.
9664
9665Not enabled at any optimization level.
9666
9667@item -fgcse-las
9668@opindex fgcse-las
9669When @option{-fgcse-las} is enabled, the global common subexpression
9670elimination pass eliminates redundant loads that come after stores to the
9671same memory location (both partial and full redundancies).
9672
9673Not enabled at any optimization level.
9674
9675@item -fgcse-after-reload
9676@opindex fgcse-after-reload
9677When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9678pass is performed after reload.  The purpose of this pass is to clean up
9679redundant spilling.
9680
9681Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9682
9683@item -faggressive-loop-optimizations
9684@opindex faggressive-loop-optimizations
9685This option tells the loop optimizer to use language constraints to
9686derive bounds for the number of iterations of a loop.  This assumes that
9687loop code does not invoke undefined behavior by for example causing signed
9688integer overflows or out-of-bound array accesses.  The bounds for the
9689number of iterations of a loop are used to guide loop unrolling and peeling
9690and loop exit test optimizations.
9691This option is enabled by default.
9692
9693@item -funconstrained-commons
9694@opindex funconstrained-commons
9695This option tells the compiler that variables declared in common blocks
9696(e.g.@: Fortran) may later be overridden with longer trailing arrays. This
9697prevents certain optimizations that depend on knowing the array bounds.
9698
9699@item -fcrossjumping
9700@opindex fcrossjumping
9701Perform cross-jumping transformation.
9702This transformation unifies equivalent code and saves code size.  The
9703resulting code may or may not perform better than without cross-jumping.
9704
9705Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9706
9707@item -fauto-inc-dec
9708@opindex fauto-inc-dec
9709Combine increments or decrements of addresses with memory accesses.
9710This pass is always skipped on architectures that do not have
9711instructions to support this.  Enabled by default at @option{-O} and
9712higher on architectures that support this.
9713
9714@item -fdce
9715@opindex fdce
9716Perform dead code elimination (DCE) on RTL@.
9717Enabled by default at @option{-O} and higher.
9718
9719@item -fdse
9720@opindex fdse
9721Perform dead store elimination (DSE) on RTL@.
9722Enabled by default at @option{-O} and higher.
9723
9724@item -fif-conversion
9725@opindex fif-conversion
9726Attempt to transform conditional jumps into branch-less equivalents.  This
9727includes use of conditional moves, min, max, set flags and abs instructions, and
9728some tricks doable by standard arithmetics.  The use of conditional execution
9729on chips where it is available is controlled by @option{-fif-conversion2}.
9730
9731Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9732not with @option{-Og}.
9733
9734@item -fif-conversion2
9735@opindex fif-conversion2
9736Use conditional execution (where available) to transform conditional jumps into
9737branch-less equivalents.
9738
9739Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9740not with @option{-Og}.
9741
9742@item -fdeclone-ctor-dtor
9743@opindex fdeclone-ctor-dtor
9744The C++ ABI requires multiple entry points for constructors and
9745destructors: one for a base subobject, one for a complete object, and
9746one for a virtual destructor that calls operator delete afterwards.
9747For a hierarchy with virtual bases, the base and complete variants are
9748clones, which means two copies of the function.  With this option, the
9749base and complete variants are changed to be thunks that call a common
9750implementation.
9751
9752Enabled by @option{-Os}.
9753
9754@item -fdelete-null-pointer-checks
9755@opindex fdelete-null-pointer-checks
9756Assume that programs cannot safely dereference null pointers, and that
9757no code or data element resides at address zero.
9758This option enables simple constant
9759folding optimizations at all optimization levels.  In addition, other
9760optimization passes in GCC use this flag to control global dataflow
9761analyses that eliminate useless checks for null pointers; these assume
9762that a memory access to address zero always results in a trap, so
9763that if a pointer is checked after it has already been dereferenced,
9764it cannot be null.
9765
9766Note however that in some environments this assumption is not true.
9767Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9768for programs that depend on that behavior.
9769
9770This option is enabled by default on most targets.  On Nios II ELF, it
9771defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
9772
9773Passes that use the dataflow information
9774are enabled independently at different optimization levels.
9775
9776@item -fdevirtualize
9777@opindex fdevirtualize
9778Attempt to convert calls to virtual functions to direct calls.  This
9779is done both within a procedure and interprocedurally as part of
9780indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9781propagation (@option{-fipa-cp}).
9782Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9783
9784@item -fdevirtualize-speculatively
9785@opindex fdevirtualize-speculatively
9786Attempt to convert calls to virtual functions to speculative direct calls.
9787Based on the analysis of the type inheritance graph, determine for a given call
9788the set of likely targets. If the set is small, preferably of size 1, change
9789the call into a conditional deciding between direct and indirect calls.  The
9790speculative calls enable more optimizations, such as inlining.  When they seem
9791useless after further optimization, they are converted back into original form.
9792
9793@item -fdevirtualize-at-ltrans
9794@opindex fdevirtualize-at-ltrans
9795Stream extra information needed for aggressive devirtualization when running
9796the link-time optimizer in local transformation mode.
9797This option enables more devirtualization but
9798significantly increases the size of streamed data. For this reason it is
9799disabled by default.
9800
9801@item -fexpensive-optimizations
9802@opindex fexpensive-optimizations
9803Perform a number of minor optimizations that are relatively expensive.
9804
9805Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9806
9807@item -free
9808@opindex free
9809Attempt to remove redundant extension instructions.  This is especially
9810helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9811registers after writing to their lower 32-bit half.
9812
9813Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9814@option{-O3}, @option{-Os}.
9815
9816@item -fno-lifetime-dse
9817@opindex fno-lifetime-dse
9818@opindex flifetime-dse
9819In C++ the value of an object is only affected by changes within its
9820lifetime: when the constructor begins, the object has an indeterminate
9821value, and any changes during the lifetime of the object are dead when
9822the object is destroyed.  Normally dead store elimination will take
9823advantage of this; if your code relies on the value of the object
9824storage persisting beyond the lifetime of the object, you can use this
9825flag to disable this optimization.  To preserve stores before the
9826constructor starts (e.g.@: because your operator new clears the object
9827storage) but still treat the object as dead after the destructor, you
9828can use @option{-flifetime-dse=1}.  The default behavior can be
9829explicitly selected with @option{-flifetime-dse=2}.
9830@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9831
9832@item -flive-range-shrinkage
9833@opindex flive-range-shrinkage
9834Attempt to decrease register pressure through register live range
9835shrinkage.  This is helpful for fast processors with small or moderate
9836size register sets.
9837
9838@item -fira-algorithm=@var{algorithm}
9839@opindex fira-algorithm
9840Use the specified coloring algorithm for the integrated register
9841allocator.  The @var{algorithm} argument can be @samp{priority}, which
9842specifies Chow's priority coloring, or @samp{CB}, which specifies
9843Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
9844for all architectures, but for those targets that do support it, it is
9845the default because it generates better code.
9846
9847@item -fira-region=@var{region}
9848@opindex fira-region
9849Use specified regions for the integrated register allocator.  The
9850@var{region} argument should be one of the following:
9851
9852@table @samp
9853
9854@item all
9855Use all loops as register allocation regions.
9856This can give the best results for machines with a small and/or
9857irregular register set.
9858
9859@item mixed
9860Use all loops except for loops with small register pressure
9861as the regions.  This value usually gives
9862the best results in most cases and for most architectures,
9863and is enabled by default when compiling with optimization for speed
9864(@option{-O}, @option{-O2}, @dots{}).
9865
9866@item one
9867Use all functions as a single region.
9868This typically results in the smallest code size, and is enabled by default for
9869@option{-Os} or @option{-O0}.
9870
9871@end table
9872
9873@item -fira-hoist-pressure
9874@opindex fira-hoist-pressure
9875Use IRA to evaluate register pressure in the code hoisting pass for
9876decisions to hoist expressions.  This option usually results in smaller
9877code, but it can slow the compiler down.
9878
9879This option is enabled at level @option{-Os} for all targets.
9880
9881@item -fira-loop-pressure
9882@opindex fira-loop-pressure
9883Use IRA to evaluate register pressure in loops for decisions to move
9884loop invariants.  This option usually results in generation
9885of faster and smaller code on machines with large register files (>= 32
9886registers), but it can slow the compiler down.
9887
9888This option is enabled at level @option{-O3} for some targets.
9889
9890@item -fno-ira-share-save-slots
9891@opindex fno-ira-share-save-slots
9892@opindex fira-share-save-slots
9893Disable sharing of stack slots used for saving call-used hard
9894registers living through a call.  Each hard register gets a
9895separate stack slot, and as a result function stack frames are
9896larger.
9897
9898@item -fno-ira-share-spill-slots
9899@opindex fno-ira-share-spill-slots
9900@opindex fira-share-spill-slots
9901Disable sharing of stack slots allocated for pseudo-registers.  Each
9902pseudo-register that does not get a hard register gets a separate
9903stack slot, and as a result function stack frames are larger.
9904
9905@item -flra-remat
9906@opindex flra-remat
9907Enable CFG-sensitive rematerialization in LRA.  Instead of loading
9908values of spilled pseudos, LRA tries to rematerialize (recalculate)
9909values if it is profitable.
9910
9911Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9912
9913@item -fdelayed-branch
9914@opindex fdelayed-branch
9915If supported for the target machine, attempt to reorder instructions
9916to exploit instruction slots available after delayed branch
9917instructions.
9918
9919Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9920but not at @option{-Og}.
9921
9922@item -fschedule-insns
9923@opindex fschedule-insns
9924If supported for the target machine, attempt to reorder instructions to
9925eliminate execution stalls due to required data being unavailable.  This
9926helps machines that have slow floating point or memory load instructions
9927by allowing other instructions to be issued until the result of the load
9928or floating-point instruction is required.
9929
9930Enabled at levels @option{-O2}, @option{-O3}.
9931
9932@item -fschedule-insns2
9933@opindex fschedule-insns2
9934Similar to @option{-fschedule-insns}, but requests an additional pass of
9935instruction scheduling after register allocation has been done.  This is
9936especially useful on machines with a relatively small number of
9937registers and where memory load instructions take more than one cycle.
9938
9939Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9940
9941@item -fno-sched-interblock
9942@opindex fno-sched-interblock
9943@opindex fsched-interblock
9944Disable instruction scheduling across basic blocks, which
9945is normally enabled when scheduling before register allocation, i.e.@:
9946with @option{-fschedule-insns} or at @option{-O2} or higher.
9947
9948@item -fno-sched-spec
9949@opindex fno-sched-spec
9950@opindex fsched-spec
9951Disable speculative motion of non-load instructions, which
9952is normally enabled when scheduling before register allocation, i.e.@:
9953with @option{-fschedule-insns} or at @option{-O2} or higher.
9954
9955@item -fsched-pressure
9956@opindex fsched-pressure
9957Enable register pressure sensitive insn scheduling before register
9958allocation.  This only makes sense when scheduling before register
9959allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9960@option{-O2} or higher.  Usage of this option can improve the
9961generated code and decrease its size by preventing register pressure
9962increase above the number of available hard registers and subsequent
9963spills in register allocation.
9964
9965@item -fsched-spec-load
9966@opindex fsched-spec-load
9967Allow speculative motion of some load instructions.  This only makes
9968sense when scheduling before register allocation, i.e.@: with
9969@option{-fschedule-insns} or at @option{-O2} or higher.
9970
9971@item -fsched-spec-load-dangerous
9972@opindex fsched-spec-load-dangerous
9973Allow speculative motion of more load instructions.  This only makes
9974sense when scheduling before register allocation, i.e.@: with
9975@option{-fschedule-insns} or at @option{-O2} or higher.
9976
9977@item -fsched-stalled-insns
9978@itemx -fsched-stalled-insns=@var{n}
9979@opindex fsched-stalled-insns
9980Define how many insns (if any) can be moved prematurely from the queue
9981of stalled insns into the ready list during the second scheduling pass.
9982@option{-fno-sched-stalled-insns} means that no insns are moved
9983prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9984on how many queued insns can be moved prematurely.
9985@option{-fsched-stalled-insns} without a value is equivalent to
9986@option{-fsched-stalled-insns=1}.
9987
9988@item -fsched-stalled-insns-dep
9989@itemx -fsched-stalled-insns-dep=@var{n}
9990@opindex fsched-stalled-insns-dep
9991Define how many insn groups (cycles) are examined for a dependency
9992on a stalled insn that is a candidate for premature removal from the queue
9993of stalled insns.  This has an effect only during the second scheduling pass,
9994and only if @option{-fsched-stalled-insns} is used.
9995@option{-fno-sched-stalled-insns-dep} is equivalent to
9996@option{-fsched-stalled-insns-dep=0}.
9997@option{-fsched-stalled-insns-dep} without a value is equivalent to
9998@option{-fsched-stalled-insns-dep=1}.
9999
10000@item -fsched2-use-superblocks
10001@opindex fsched2-use-superblocks
10002When scheduling after register allocation, use superblock scheduling.
10003This allows motion across basic block boundaries,
10004resulting in faster schedules.  This option is experimental, as not all machine
10005descriptions used by GCC model the CPU closely enough to avoid unreliable
10006results from the algorithm.
10007
10008This only makes sense when scheduling after register allocation, i.e.@: with
10009@option{-fschedule-insns2} or at @option{-O2} or higher.
10010
10011@item -fsched-group-heuristic
10012@opindex fsched-group-heuristic
10013Enable the group heuristic in the scheduler.  This heuristic favors
10014the instruction that belongs to a schedule group.  This is enabled
10015by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10016or @option{-fschedule-insns2} or at @option{-O2} or higher.
10017
10018@item -fsched-critical-path-heuristic
10019@opindex fsched-critical-path-heuristic
10020Enable the critical-path heuristic in the scheduler.  This heuristic favors
10021instructions on the critical path.  This is enabled by default when
10022scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10023or @option{-fschedule-insns2} or at @option{-O2} or higher.
10024
10025@item -fsched-spec-insn-heuristic
10026@opindex fsched-spec-insn-heuristic
10027Enable the speculative instruction heuristic in the scheduler.  This
10028heuristic favors speculative instructions with greater dependency weakness.
10029This is enabled by default when scheduling is enabled, i.e.@:
10030with @option{-fschedule-insns} or @option{-fschedule-insns2}
10031or at @option{-O2} or higher.
10032
10033@item -fsched-rank-heuristic
10034@opindex fsched-rank-heuristic
10035Enable the rank heuristic in the scheduler.  This heuristic favors
10036the instruction belonging to a basic block with greater size or frequency.
10037This is enabled by default when scheduling is enabled, i.e.@:
10038with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10039at @option{-O2} or higher.
10040
10041@item -fsched-last-insn-heuristic
10042@opindex fsched-last-insn-heuristic
10043Enable the last-instruction heuristic in the scheduler.  This heuristic
10044favors the instruction that is less dependent on the last instruction
10045scheduled.  This is enabled by default when scheduling is enabled,
10046i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10047at @option{-O2} or higher.
10048
10049@item -fsched-dep-count-heuristic
10050@opindex fsched-dep-count-heuristic
10051Enable the dependent-count heuristic in the scheduler.  This heuristic
10052favors the instruction that has more instructions depending on it.
10053This is enabled by default when scheduling is enabled, i.e.@:
10054with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10055at @option{-O2} or higher.
10056
10057@item -freschedule-modulo-scheduled-loops
10058@opindex freschedule-modulo-scheduled-loops
10059Modulo scheduling is performed before traditional scheduling.  If a loop
10060is modulo scheduled, later scheduling passes may change its schedule.
10061Use this option to control that behavior.
10062
10063@item -fselective-scheduling
10064@opindex fselective-scheduling
10065Schedule instructions using selective scheduling algorithm.  Selective
10066scheduling runs instead of the first scheduler pass.
10067
10068@item -fselective-scheduling2
10069@opindex fselective-scheduling2
10070Schedule instructions using selective scheduling algorithm.  Selective
10071scheduling runs instead of the second scheduler pass.
10072
10073@item -fsel-sched-pipelining
10074@opindex fsel-sched-pipelining
10075Enable software pipelining of innermost loops during selective scheduling.
10076This option has no effect unless one of @option{-fselective-scheduling} or
10077@option{-fselective-scheduling2} is turned on.
10078
10079@item -fsel-sched-pipelining-outer-loops
10080@opindex fsel-sched-pipelining-outer-loops
10081When pipelining loops during selective scheduling, also pipeline outer loops.
10082This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10083
10084@item -fsemantic-interposition
10085@opindex fsemantic-interposition
10086Some object formats, like ELF, allow interposing of symbols by the
10087dynamic linker.
10088This means that for symbols exported from the DSO, the compiler cannot perform
10089interprocedural propagation, inlining and other optimizations in anticipation
10090that the function or variable in question may change. While this feature is
10091useful, for example, to rewrite memory allocation functions by a debugging
10092implementation, it is expensive in the terms of code quality.
10093With @option{-fno-semantic-interposition} the compiler assumes that
10094if interposition happens for functions the overwriting function will have
10095precisely the same semantics (and side effects).
10096Similarly if interposition happens
10097for variables, the constructor of the variable will be the same. The flag
10098has no effect for functions explicitly declared inline
10099(where it is never allowed for interposition to change semantics)
10100and for symbols explicitly declared weak.
10101
10102@item -fshrink-wrap
10103@opindex fshrink-wrap
10104Emit function prologues only before parts of the function that need it,
10105rather than at the top of the function.  This flag is enabled by default at
10106@option{-O} and higher.
10107
10108@item -fshrink-wrap-separate
10109@opindex fshrink-wrap-separate
10110Shrink-wrap separate parts of the prologue and epilogue separately, so that
10111those parts are only executed when needed.
10112This option is on by default, but has no effect unless @option{-fshrink-wrap}
10113is also turned on and the target supports this.
10114
10115@item -fcaller-saves
10116@opindex fcaller-saves
10117Enable allocation of values to registers that are clobbered by
10118function calls, by emitting extra instructions to save and restore the
10119registers around such calls.  Such allocation is done only when it
10120seems to result in better code.
10121
10122This option is always enabled by default on certain machines, usually
10123those which have no call-preserved registers to use instead.
10124
10125Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10126
10127@item -fcombine-stack-adjustments
10128@opindex fcombine-stack-adjustments
10129Tracks stack adjustments (pushes and pops) and stack memory references
10130and then tries to find ways to combine them.
10131
10132Enabled by default at @option{-O1} and higher.
10133
10134@item -fipa-ra
10135@opindex fipa-ra
10136Use caller save registers for allocation if those registers are not used by
10137any called function.  In that case it is not necessary to save and restore
10138them around calls.  This is only possible if called functions are part of
10139same compilation unit as current function and they are compiled before it.
10140
10141Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10142is disabled if generated code will be instrumented for profiling
10143(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10144exactly (this happens on targets that do not expose prologues
10145and epilogues in RTL).
10146
10147@item -fconserve-stack
10148@opindex fconserve-stack
10149Attempt to minimize stack usage.  The compiler attempts to use less
10150stack space, even if that makes the program slower.  This option
10151implies setting the @option{large-stack-frame} parameter to 100
10152and the @option{large-stack-frame-growth} parameter to 400.
10153
10154@item -ftree-reassoc
10155@opindex ftree-reassoc
10156Perform reassociation on trees.  This flag is enabled by default
10157at @option{-O} and higher.
10158
10159@item -fcode-hoisting
10160@opindex fcode-hoisting
10161Perform code hoisting.  Code hoisting tries to move the
10162evaluation of expressions executed on all paths to the function exit
10163as early as possible.  This is especially useful as a code size
10164optimization, but it often helps for code speed as well.
10165This flag is enabled by default at @option{-O2} and higher.
10166
10167@item -ftree-pre
10168@opindex ftree-pre
10169Perform partial redundancy elimination (PRE) on trees.  This flag is
10170enabled by default at @option{-O2} and @option{-O3}.
10171
10172@item -ftree-partial-pre
10173@opindex ftree-partial-pre
10174Make partial redundancy elimination (PRE) more aggressive.  This flag is
10175enabled by default at @option{-O3}.
10176
10177@item -ftree-forwprop
10178@opindex ftree-forwprop
10179Perform forward propagation on trees.  This flag is enabled by default
10180at @option{-O} and higher.
10181
10182@item -ftree-fre
10183@opindex ftree-fre
10184Perform full redundancy elimination (FRE) on trees.  The difference
10185between FRE and PRE is that FRE only considers expressions
10186that are computed on all paths leading to the redundant computation.
10187This analysis is faster than PRE, though it exposes fewer redundancies.
10188This flag is enabled by default at @option{-O} and higher.
10189
10190@item -ftree-phiprop
10191@opindex ftree-phiprop
10192Perform hoisting of loads from conditional pointers on trees.  This
10193pass is enabled by default at @option{-O} and higher.
10194
10195@item -fhoist-adjacent-loads
10196@opindex fhoist-adjacent-loads
10197Speculatively hoist loads from both branches of an if-then-else if the
10198loads are from adjacent locations in the same structure and the target
10199architecture has a conditional move instruction.  This flag is enabled
10200by default at @option{-O2} and higher.
10201
10202@item -ftree-copy-prop
10203@opindex ftree-copy-prop
10204Perform copy propagation on trees.  This pass eliminates unnecessary
10205copy operations.  This flag is enabled by default at @option{-O} and
10206higher.
10207
10208@item -fipa-pure-const
10209@opindex fipa-pure-const
10210Discover which functions are pure or constant.
10211Enabled by default at @option{-O} and higher.
10212
10213@item -fipa-reference
10214@opindex fipa-reference
10215Discover which static variables do not escape the
10216compilation unit.
10217Enabled by default at @option{-O} and higher.
10218
10219@item -fipa-reference-addressable
10220@opindex fipa-reference-addressable
10221Discover read-only, write-only and non-addressable static variables.
10222Enabled by default at @option{-O} and higher.
10223
10224@item -fipa-stack-alignment
10225@opindex fipa-stack-alignment
10226Reduce stack alignment on call sites if possible.
10227Enabled by default.
10228
10229@item -fipa-pta
10230@opindex fipa-pta
10231Perform interprocedural pointer analysis and interprocedural modification
10232and reference analysis.  This option can cause excessive memory and
10233compile-time usage on large compilation units.  It is not enabled by
10234default at any optimization level.
10235
10236@item -fipa-profile
10237@opindex fipa-profile
10238Perform interprocedural profile propagation.  The functions called only from
10239cold functions are marked as cold. Also functions executed once (such as
10240@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10241functions and loop less parts of functions executed once are then optimized for
10242size.
10243Enabled by default at @option{-O} and higher.
10244
10245@item -fipa-cp
10246@opindex fipa-cp
10247Perform interprocedural constant propagation.
10248This optimization analyzes the program to determine when values passed
10249to functions are constants and then optimizes accordingly.
10250This optimization can substantially increase performance
10251if the application has constants passed to functions.
10252This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10253It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10254
10255@item -fipa-cp-clone
10256@opindex fipa-cp-clone
10257Perform function cloning to make interprocedural constant propagation stronger.
10258When enabled, interprocedural constant propagation performs function cloning
10259when externally visible function can be called with constant arguments.
10260Because this optimization can create multiple copies of functions,
10261it may significantly increase code size
10262(see @option{--param ipa-cp-unit-growth=@var{value}}).
10263This flag is enabled by default at @option{-O3}.
10264It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10265
10266@item -fipa-bit-cp
10267@opindex fipa-bit-cp
10268When enabled, perform interprocedural bitwise constant
10269propagation. This flag is enabled by default at @option{-O2} and
10270by @option{-fprofile-use} and @option{-fauto-profile}.
10271It requires that @option{-fipa-cp} is enabled.
10272
10273@item -fipa-vrp
10274@opindex fipa-vrp
10275When enabled, perform interprocedural propagation of value
10276ranges. This flag is enabled by default at @option{-O2}. It requires
10277that @option{-fipa-cp} is enabled.
10278
10279@item -fipa-icf
10280@opindex fipa-icf
10281Perform Identical Code Folding for functions and read-only variables.
10282The optimization reduces code size and may disturb unwind stacks by replacing
10283a function by equivalent one with a different name. The optimization works
10284more effectively with link-time optimization enabled.
10285
10286Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10287works on different levels and thus the optimizations are not same - there are
10288equivalences that are found only by GCC and equivalences found only by Gold.
10289
10290This flag is enabled by default at @option{-O2} and @option{-Os}.
10291
10292@item -flive-patching=@var{level}
10293@opindex flive-patching
10294Control GCC's optimizations to produce output suitable for live-patching.
10295
10296If the compiler's optimization uses a function's body or information extracted
10297from its body to optimize/change another function, the latter is called an
10298impacted function of the former.  If a function is patched, its impacted
10299functions should be patched too.
10300
10301The impacted functions are determined by the compiler's interprocedural
10302optimizations.  For example, a caller is impacted when inlining a function
10303into its caller,
10304cloning a function and changing its caller to call this new clone,
10305or extracting a function's pureness/constness information to optimize
10306its direct or indirect callers, etc.
10307
10308Usually, the more IPA optimizations enabled, the larger the number of
10309impacted functions for each function.  In order to control the number of
10310impacted functions and more easily compute the list of impacted function,
10311IPA optimizations can be partially enabled at two different levels.
10312
10313The @var{level} argument should be one of the following:
10314
10315@table @samp
10316
10317@item inline-clone
10318
10319Only enable inlining and cloning optimizations, which includes inlining,
10320cloning, interprocedural scalar replacement of aggregates and partial inlining.
10321As a result, when patching a function, all its callers and its clones'
10322callers are impacted, therefore need to be patched as well.
10323
10324@option{-flive-patching=inline-clone} disables the following optimization flags:
10325@gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
10326-fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
10327-fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
10328-fipa-stack-alignment}
10329
10330@item inline-only-static
10331
10332Only enable inlining of static functions.
10333As a result, when patching a static function, all its callers are impacted
10334and so need to be patched as well.
10335
10336In addition to all the flags that @option{-flive-patching=inline-clone}
10337disables,
10338@option{-flive-patching=inline-only-static} disables the following additional
10339optimization flags:
10340@gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
10341
10342@end table
10343
10344When @option{-flive-patching} is specified without any value, the default value
10345is @var{inline-clone}.
10346
10347This flag is disabled by default.
10348
10349Note that @option{-flive-patching} is not supported with link-time optimization
10350(@option{-flto}).
10351
10352@item -fisolate-erroneous-paths-dereference
10353@opindex fisolate-erroneous-paths-dereference
10354Detect paths that trigger erroneous or undefined behavior due to
10355dereferencing a null pointer.  Isolate those paths from the main control
10356flow and turn the statement with erroneous or undefined behavior into a trap.
10357This flag is enabled by default at @option{-O2} and higher and depends on
10358@option{-fdelete-null-pointer-checks} also being enabled.
10359
10360@item -fisolate-erroneous-paths-attribute
10361@opindex fisolate-erroneous-paths-attribute
10362Detect paths that trigger erroneous or undefined behavior due to a null value
10363being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10364attribute.  Isolate those paths from the main control flow and turn the
10365statement with erroneous or undefined behavior into a trap.  This is not
10366currently enabled, but may be enabled by @option{-O2} in the future.
10367
10368@item -ftree-sink
10369@opindex ftree-sink
10370Perform forward store motion on trees.  This flag is
10371enabled by default at @option{-O} and higher.
10372
10373@item -ftree-bit-ccp
10374@opindex ftree-bit-ccp
10375Perform sparse conditional bit constant propagation on trees and propagate
10376pointer alignment information.
10377This pass only operates on local scalar variables and is enabled by default
10378at @option{-O1} and higher, except for @option{-Og}.
10379It requires that @option{-ftree-ccp} is enabled.
10380
10381@item -ftree-ccp
10382@opindex ftree-ccp
10383Perform sparse conditional constant propagation (CCP) on trees.  This
10384pass only operates on local scalar variables and is enabled by default
10385at @option{-O} and higher.
10386
10387@item -fssa-backprop
10388@opindex fssa-backprop
10389Propagate information about uses of a value up the definition chain
10390in order to simplify the definitions.  For example, this pass strips
10391sign operations if the sign of a value never matters.  The flag is
10392enabled by default at @option{-O} and higher.
10393
10394@item -fssa-phiopt
10395@opindex fssa-phiopt
10396Perform pattern matching on SSA PHI nodes to optimize conditional
10397code.  This pass is enabled by default at @option{-O1} and higher,
10398except for @option{-Og}.
10399
10400@item -ftree-switch-conversion
10401@opindex ftree-switch-conversion
10402Perform conversion of simple initializations in a switch to
10403initializations from a scalar array.  This flag is enabled by default
10404at @option{-O2} and higher.
10405
10406@item -ftree-tail-merge
10407@opindex ftree-tail-merge
10408Look for identical code sequences.  When found, replace one with a jump to the
10409other.  This optimization is known as tail merging or cross jumping.  This flag
10410is enabled by default at @option{-O2} and higher.  The compilation time
10411in this pass can
10412be limited using @option{max-tail-merge-comparisons} parameter and
10413@option{max-tail-merge-iterations} parameter.
10414
10415@item -ftree-dce
10416@opindex ftree-dce
10417Perform dead code elimination (DCE) on trees.  This flag is enabled by
10418default at @option{-O} and higher.
10419
10420@item -ftree-builtin-call-dce
10421@opindex ftree-builtin-call-dce
10422Perform conditional dead code elimination (DCE) for calls to built-in functions
10423that may set @code{errno} but are otherwise free of side effects.  This flag is
10424enabled by default at @option{-O2} and higher if @option{-Os} is not also
10425specified.
10426
10427@item -ffinite-loops
10428@opindex ffinite-loops
10429@opindex fno-finite-loops
10430Assume that a loop with an exit will eventually take the exit and not loop
10431indefinitely.  This allows the compiler to remove loops that otherwise have
10432no side-effects, not considering eventual endless looping as such.
10433
10434This option is enabled by default at @option{-O2} for C++ with -std=c++11
10435or higher.
10436
10437@item -ftree-dominator-opts
10438@opindex ftree-dominator-opts
10439Perform a variety of simple scalar cleanups (constant/copy
10440propagation, redundancy elimination, range propagation and expression
10441simplification) based on a dominator tree traversal.  This also
10442performs jump threading (to reduce jumps to jumps). This flag is
10443enabled by default at @option{-O} and higher.
10444
10445@item -ftree-dse
10446@opindex ftree-dse
10447Perform dead store elimination (DSE) on trees.  A dead store is a store into
10448a memory location that is later overwritten by another store without
10449any intervening loads.  In this case the earlier store can be deleted.  This
10450flag is enabled by default at @option{-O} and higher.
10451
10452@item -ftree-ch
10453@opindex ftree-ch
10454Perform loop header copying on trees.  This is beneficial since it increases
10455effectiveness of code motion optimizations.  It also saves one jump.  This flag
10456is enabled by default at @option{-O} and higher.  It is not enabled
10457for @option{-Os}, since it usually increases code size.
10458
10459@item -ftree-loop-optimize
10460@opindex ftree-loop-optimize
10461Perform loop optimizations on trees.  This flag is enabled by default
10462at @option{-O} and higher.
10463
10464@item -ftree-loop-linear
10465@itemx -floop-strip-mine
10466@itemx -floop-block
10467@opindex ftree-loop-linear
10468@opindex floop-strip-mine
10469@opindex floop-block
10470Perform loop nest optimizations.  Same as
10471@option{-floop-nest-optimize}.  To use this code transformation, GCC has
10472to be configured with @option{--with-isl} to enable the Graphite loop
10473transformation infrastructure.
10474
10475@item -fgraphite-identity
10476@opindex fgraphite-identity
10477Enable the identity transformation for graphite.  For every SCoP we generate
10478the polyhedral representation and transform it back to gimple.  Using
10479@option{-fgraphite-identity} we can check the costs or benefits of the
10480GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
10481are also performed by the code generator isl, like index splitting and
10482dead code elimination in loops.
10483
10484@item -floop-nest-optimize
10485@opindex floop-nest-optimize
10486Enable the isl based loop nest optimizer.  This is a generic loop nest
10487optimizer based on the Pluto optimization algorithms.  It calculates a loop
10488structure optimized for data-locality and parallelism.  This option
10489is experimental.
10490
10491@item -floop-parallelize-all
10492@opindex floop-parallelize-all
10493Use the Graphite data dependence analysis to identify loops that can
10494be parallelized.  Parallelize all the loops that can be analyzed to
10495not contain loop carried dependences without checking that it is
10496profitable to parallelize the loops.
10497
10498@item -ftree-coalesce-vars
10499@opindex ftree-coalesce-vars
10500While transforming the program out of the SSA representation, attempt to
10501reduce copying by coalescing versions of different user-defined
10502variables, instead of just compiler temporaries.  This may severely
10503limit the ability to debug an optimized program compiled with
10504@option{-fno-var-tracking-assignments}.  In the negated form, this flag
10505prevents SSA coalescing of user variables.  This option is enabled by
10506default if optimization is enabled, and it does very little otherwise.
10507
10508@item -ftree-loop-if-convert
10509@opindex ftree-loop-if-convert
10510Attempt to transform conditional jumps in the innermost loops to
10511branch-less equivalents.  The intent is to remove control-flow from
10512the innermost loops in order to improve the ability of the
10513vectorization pass to handle these loops.  This is enabled by default
10514if vectorization is enabled.
10515
10516@item -ftree-loop-distribution
10517@opindex ftree-loop-distribution
10518Perform loop distribution.  This flag can improve cache performance on
10519big loop bodies and allow further loop optimizations, like
10520parallelization or vectorization, to take place.  For example, the loop
10521@smallexample
10522DO I = 1, N
10523  A(I) = B(I) + C
10524  D(I) = E(I) * F
10525ENDDO
10526@end smallexample
10527is transformed to
10528@smallexample
10529DO I = 1, N
10530   A(I) = B(I) + C
10531ENDDO
10532DO I = 1, N
10533   D(I) = E(I) * F
10534ENDDO
10535@end smallexample
10536This flag is enabled by default at @option{-O3}.
10537It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10538
10539@item -ftree-loop-distribute-patterns
10540@opindex ftree-loop-distribute-patterns
10541Perform loop distribution of patterns that can be code generated with
10542calls to a library.  This flag is enabled by default at @option{-O2} and
10543higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10544
10545This pass distributes the initialization loops and generates a call to
10546memset zero.  For example, the loop
10547@smallexample
10548DO I = 1, N
10549  A(I) = 0
10550  B(I) = A(I) + I
10551ENDDO
10552@end smallexample
10553is transformed to
10554@smallexample
10555DO I = 1, N
10556   A(I) = 0
10557ENDDO
10558DO I = 1, N
10559   B(I) = A(I) + I
10560ENDDO
10561@end smallexample
10562and the initialization loop is transformed into a call to memset zero.
10563This flag is enabled by default at @option{-O3}.
10564It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10565
10566@item -floop-interchange
10567@opindex floop-interchange
10568Perform loop interchange outside of graphite.  This flag can improve cache
10569performance on loop nest and allow further loop optimizations, like
10570vectorization, to take place.  For example, the loop
10571@smallexample
10572for (int i = 0; i < N; i++)
10573  for (int j = 0; j < N; j++)
10574    for (int k = 0; k < N; k++)
10575      c[i][j] = c[i][j] + a[i][k]*b[k][j];
10576@end smallexample
10577is transformed to
10578@smallexample
10579for (int i = 0; i < N; i++)
10580  for (int k = 0; k < N; k++)
10581    for (int j = 0; j < N; j++)
10582      c[i][j] = c[i][j] + a[i][k]*b[k][j];
10583@end smallexample
10584This flag is enabled by default at @option{-O3}.
10585It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10586
10587@item -floop-unroll-and-jam
10588@opindex floop-unroll-and-jam
10589Apply unroll and jam transformations on feasible loops.  In a loop
10590nest this unrolls the outer loop by some factor and fuses the resulting
10591multiple inner loops.  This flag is enabled by default at @option{-O3}.
10592It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10593
10594@item -ftree-loop-im
10595@opindex ftree-loop-im
10596Perform loop invariant motion on trees.  This pass moves only invariants that
10597are hard to handle at RTL level (function calls, operations that expand to
10598nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
10599operands of conditions that are invariant out of the loop, so that we can use
10600just trivial invariantness analysis in loop unswitching.  The pass also includes
10601store motion.
10602
10603@item -ftree-loop-ivcanon
10604@opindex ftree-loop-ivcanon
10605Create a canonical counter for number of iterations in loops for which
10606determining number of iterations requires complicated analysis.  Later
10607optimizations then may determine the number easily.  Useful especially
10608in connection with unrolling.
10609
10610@item -ftree-scev-cprop
10611@opindex ftree-scev-cprop
10612Perform final value replacement.  If a variable is modified in a loop
10613in such a way that its value when exiting the loop can be determined using
10614only its initial value and the number of loop iterations, replace uses of
10615the final value by such a computation, provided it is sufficiently cheap.
10616This reduces data dependencies and may allow further simplifications.
10617Enabled by default at @option{-O} and higher.
10618
10619@item -fivopts
10620@opindex fivopts
10621Perform induction variable optimizations (strength reduction, induction
10622variable merging and induction variable elimination) on trees.
10623
10624@item -ftree-parallelize-loops=n
10625@opindex ftree-parallelize-loops
10626Parallelize loops, i.e., split their iteration space to run in n threads.
10627This is only possible for loops whose iterations are independent
10628and can be arbitrarily reordered.  The optimization is only
10629profitable on multiprocessor machines, for loops that are CPU-intensive,
10630rather than constrained e.g.@: by memory bandwidth.  This option
10631implies @option{-pthread}, and thus is only supported on targets
10632that have support for @option{-pthread}.
10633
10634@item -ftree-pta
10635@opindex ftree-pta
10636Perform function-local points-to analysis on trees.  This flag is
10637enabled by default at @option{-O1} and higher, except for @option{-Og}.
10638
10639@item -ftree-sra
10640@opindex ftree-sra
10641Perform scalar replacement of aggregates.  This pass replaces structure
10642references with scalars to prevent committing structures to memory too
10643early.  This flag is enabled by default at @option{-O1} and higher,
10644except for @option{-Og}.
10645
10646@item -fstore-merging
10647@opindex fstore-merging
10648Perform merging of narrow stores to consecutive memory addresses.  This pass
10649merges contiguous stores of immediate values narrower than a word into fewer
10650wider stores to reduce the number of instructions.  This is enabled by default
10651at @option{-O2} and higher as well as @option{-Os}.
10652
10653@item -ftree-ter
10654@opindex ftree-ter
10655Perform temporary expression replacement during the SSA->normal phase.  Single
10656use/single def temporaries are replaced at their use location with their
10657defining expression.  This results in non-GIMPLE code, but gives the expanders
10658much more complex trees to work on resulting in better RTL generation.  This is
10659enabled by default at @option{-O} and higher.
10660
10661@item -ftree-slsr
10662@opindex ftree-slsr
10663Perform straight-line strength reduction on trees.  This recognizes related
10664expressions involving multiplications and replaces them by less expensive
10665calculations when possible.  This is enabled by default at @option{-O} and
10666higher.
10667
10668@item -ftree-vectorize
10669@opindex ftree-vectorize
10670Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10671and @option{-ftree-slp-vectorize} if not explicitly specified.
10672
10673@item -ftree-loop-vectorize
10674@opindex ftree-loop-vectorize
10675Perform loop vectorization on trees. This flag is enabled by default at
10676@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10677and @option{-fauto-profile}.
10678
10679@item -ftree-slp-vectorize
10680@opindex ftree-slp-vectorize
10681Perform basic block vectorization on trees. This flag is enabled by default at
10682@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10683and @option{-fauto-profile}.
10684
10685@item -fvect-cost-model=@var{model}
10686@opindex fvect-cost-model
10687Alter the cost model used for vectorization.  The @var{model} argument
10688should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10689With the @samp{unlimited} model the vectorized code-path is assumed
10690to be profitable while with the @samp{dynamic} model a runtime check
10691guards the vectorized code-path to enable it only for iteration
10692counts that will likely execute faster than when executing the original
10693scalar loop.  The @samp{cheap} model disables vectorization of
10694loops where doing so would be cost prohibitive for example due to
10695required runtime checks for data dependence or alignment but otherwise
10696is equal to the @samp{dynamic} model.
10697The default cost model depends on other optimization flags and is
10698either @samp{dynamic} or @samp{cheap}.
10699
10700@item -fsimd-cost-model=@var{model}
10701@opindex fsimd-cost-model
10702Alter the cost model used for vectorization of loops marked with the OpenMP
10703simd directive.  The @var{model} argument should be one of
10704@samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
10705have the same meaning as described in @option{-fvect-cost-model} and by
10706default a cost model defined with @option{-fvect-cost-model} is used.
10707
10708@item -ftree-vrp
10709@opindex ftree-vrp
10710Perform Value Range Propagation on trees.  This is similar to the
10711constant propagation pass, but instead of values, ranges of values are
10712propagated.  This allows the optimizers to remove unnecessary range
10713checks like array bound checks and null pointer checks.  This is
10714enabled by default at @option{-O2} and higher.  Null pointer check
10715elimination is only done if @option{-fdelete-null-pointer-checks} is
10716enabled.
10717
10718@item -fsplit-paths
10719@opindex fsplit-paths
10720Split paths leading to loop backedges.  This can improve dead code
10721elimination and common subexpression elimination.  This is enabled by
10722default at @option{-O3} and above.
10723
10724@item -fsplit-ivs-in-unroller
10725@opindex fsplit-ivs-in-unroller
10726Enables expression of values of induction variables in later iterations
10727of the unrolled loop using the value in the first iteration.  This breaks
10728long dependency chains, thus improving efficiency of the scheduling passes.
10729
10730A combination of @option{-fweb} and CSE is often sufficient to obtain the
10731same effect.  However, that is not reliable in cases where the loop body
10732is more complicated than a single basic block.  It also does not work at all
10733on some architectures due to restrictions in the CSE pass.
10734
10735This optimization is enabled by default.
10736
10737@item -fvariable-expansion-in-unroller
10738@opindex fvariable-expansion-in-unroller
10739With this option, the compiler creates multiple copies of some
10740local variables when unrolling a loop, which can result in superior code.
10741
10742This optimization is enabled by default for PowerPC targets, but disabled
10743by default otherwise.
10744
10745@item -fpartial-inlining
10746@opindex fpartial-inlining
10747Inline parts of functions.  This option has any effect only
10748when inlining itself is turned on by the @option{-finline-functions}
10749or @option{-finline-small-functions} options.
10750
10751Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10752
10753@item -fpredictive-commoning
10754@opindex fpredictive-commoning
10755Perform predictive commoning optimization, i.e., reusing computations
10756(especially memory loads and stores) performed in previous
10757iterations of loops.
10758
10759This option is enabled at level @option{-O3}.
10760It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10761
10762@item -fprefetch-loop-arrays
10763@opindex fprefetch-loop-arrays
10764If supported by the target machine, generate instructions to prefetch
10765memory to improve the performance of loops that access large arrays.
10766
10767This option may generate better or worse code; results are highly
10768dependent on the structure of loops within the source code.
10769
10770Disabled at level @option{-Os}.
10771
10772@item -fno-printf-return-value
10773@opindex fno-printf-return-value
10774@opindex fprintf-return-value
10775Do not substitute constants for known return value of formatted output
10776functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10777@code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
10778transformation allows GCC to optimize or even eliminate branches based
10779on the known return value of these functions called with arguments that
10780are either constant, or whose values are known to be in a range that
10781makes determining the exact return value possible.  For example, when
10782@option{-fprintf-return-value} is in effect, both the branch and the
10783body of the @code{if} statement (but not the call to @code{snprint})
10784can be optimized away when @code{i} is a 32-bit or smaller integer
10785because the return value is guaranteed to be at most 8.
10786
10787@smallexample
10788char buf[9];
10789if (snprintf (buf, "%08x", i) >= sizeof buf)
10790  @dots{}
10791@end smallexample
10792
10793The @option{-fprintf-return-value} option relies on other optimizations
10794and yields best results with @option{-O2} and above.  It works in tandem
10795with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10796options.  The @option{-fprintf-return-value} option is enabled by default.
10797
10798@item -fno-peephole
10799@itemx -fno-peephole2
10800@opindex fno-peephole
10801@opindex fpeephole
10802@opindex fno-peephole2
10803@opindex fpeephole2
10804Disable any machine-specific peephole optimizations.  The difference
10805between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10806are implemented in the compiler; some targets use one, some use the
10807other, a few use both.
10808
10809@option{-fpeephole} is enabled by default.
10810@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10811
10812@item -fno-guess-branch-probability
10813@opindex fno-guess-branch-probability
10814@opindex fguess-branch-probability
10815Do not guess branch probabilities using heuristics.
10816
10817GCC uses heuristics to guess branch probabilities if they are
10818not provided by profiling feedback (@option{-fprofile-arcs}).  These
10819heuristics are based on the control flow graph.  If some branch probabilities
10820are specified by @code{__builtin_expect}, then the heuristics are
10821used to guess branch probabilities for the rest of the control flow graph,
10822taking the @code{__builtin_expect} info into account.  The interactions
10823between the heuristics and @code{__builtin_expect} can be complex, and in
10824some cases, it may be useful to disable the heuristics so that the effects
10825of @code{__builtin_expect} are easier to understand.
10826
10827It is also possible to specify expected probability of the expression
10828with @code{__builtin_expect_with_probability} built-in function.
10829
10830The default is @option{-fguess-branch-probability} at levels
10831@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10832
10833@item -freorder-blocks
10834@opindex freorder-blocks
10835Reorder basic blocks in the compiled function in order to reduce number of
10836taken branches and improve code locality.
10837
10838Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10839
10840@item -freorder-blocks-algorithm=@var{algorithm}
10841@opindex freorder-blocks-algorithm
10842Use the specified algorithm for basic block reordering.  The
10843@var{algorithm} argument can be @samp{simple}, which does not increase
10844code size (except sometimes due to secondary effects like alignment),
10845or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10846put all often executed code together, minimizing the number of branches
10847executed by making extra copies of code.
10848
10849The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10850@samp{stc} at levels @option{-O2}, @option{-O3}.
10851
10852@item -freorder-blocks-and-partition
10853@opindex freorder-blocks-and-partition
10854In addition to reordering basic blocks in the compiled function, in order
10855to reduce number of taken branches, partitions hot and cold basic blocks
10856into separate sections of the assembly and @file{.o} files, to improve
10857paging and cache locality performance.
10858
10859This optimization is automatically turned off in the presence of
10860exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10861section attribute and on any architecture that does not support named
10862sections.  When @option{-fsplit-stack} is used this option is not
10863enabled by default (to avoid linker errors), but may be enabled
10864explicitly (if using a working linker).
10865
10866Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10867
10868@item -freorder-functions
10869@opindex freorder-functions
10870Reorder functions in the object file in order to
10871improve code locality.  This is implemented by using special
10872subsections @code{.text.hot} for most frequently executed functions and
10873@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
10874the linker so object file format must support named sections and linker must
10875place them in a reasonable way.
10876
10877This option isn't effective unless you either provide profile feedback
10878(see @option{-fprofile-arcs} for details) or manually annotate functions with
10879@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10880
10881Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10882
10883@item -fstrict-aliasing
10884@opindex fstrict-aliasing
10885Allow the compiler to assume the strictest aliasing rules applicable to
10886the language being compiled.  For C (and C++), this activates
10887optimizations based on the type of expressions.  In particular, an
10888object of one type is assumed never to reside at the same address as an
10889object of a different type, unless the types are almost the same.  For
10890example, an @code{unsigned int} can alias an @code{int}, but not a
10891@code{void*} or a @code{double}.  A character type may alias any other
10892type.
10893
10894@anchor{Type-punning}Pay special attention to code like this:
10895@smallexample
10896union a_union @{
10897  int i;
10898  double d;
10899@};
10900
10901int f() @{
10902  union a_union t;
10903  t.d = 3.0;
10904  return t.i;
10905@}
10906@end smallexample
10907The practice of reading from a different union member than the one most
10908recently written to (called ``type-punning'') is common.  Even with
10909@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10910is accessed through the union type.  So, the code above works as
10911expected.  @xref{Structures unions enumerations and bit-fields
10912implementation}.  However, this code might not:
10913@smallexample
10914int f() @{
10915  union a_union t;
10916  int* ip;
10917  t.d = 3.0;
10918  ip = &t.i;
10919  return *ip;
10920@}
10921@end smallexample
10922
10923Similarly, access by taking the address, casting the resulting pointer
10924and dereferencing the result has undefined behavior, even if the cast
10925uses a union type, e.g.:
10926@smallexample
10927int f() @{
10928  double d = 3.0;
10929  return ((union a_union *) &d)->i;
10930@}
10931@end smallexample
10932
10933The @option{-fstrict-aliasing} option is enabled at levels
10934@option{-O2}, @option{-O3}, @option{-Os}.
10935
10936@item -falign-functions
10937@itemx -falign-functions=@var{n}
10938@itemx -falign-functions=@var{n}:@var{m}
10939@itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10940@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10941@opindex falign-functions
10942Align the start of functions to the next power-of-two greater than or
10943equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
10944least the first @var{m} bytes of the function can be fetched by the CPU
10945without crossing an @var{n}-byte alignment boundary.
10946
10947If @var{m} is not specified, it defaults to @var{n}.
10948
10949Examples: @option{-falign-functions=32} aligns functions to the next
1095032-byte boundary, @option{-falign-functions=24} aligns to the next
1095132-byte boundary only if this can be done by skipping 23 bytes or less,
10952@option{-falign-functions=32:7} aligns to the next
1095332-byte boundary only if this can be done by skipping 6 bytes or less.
10954
10955The second pair of @var{n2}:@var{m2} values allows you to specify
10956a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10957the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10958otherwise aligns to the next 32-byte boundary if this can be done
10959by skipping 2 bytes or less.
10960If @var{m2} is not specified, it defaults to @var{n2}.
10961
10962Some assemblers only support this flag when @var{n} is a power of two;
10963in that case, it is rounded up.
10964
10965@option{-fno-align-functions} and @option{-falign-functions=1} are
10966equivalent and mean that functions are not aligned.
10967
10968If @var{n} is not specified or is zero, use a machine-dependent default.
10969The maximum allowed @var{n} option value is 65536.
10970
10971Enabled at levels @option{-O2}, @option{-O3}.
10972
10973@item -flimit-function-alignment
10974If this option is enabled, the compiler tries to avoid unnecessarily
10975overaligning functions. It attempts to instruct the assembler to align
10976by the amount specified by @option{-falign-functions}, but not to
10977skip more bytes than the size of the function.
10978
10979@item -falign-labels
10980@itemx -falign-labels=@var{n}
10981@itemx -falign-labels=@var{n}:@var{m}
10982@itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10983@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10984@opindex falign-labels
10985Align all branch targets to a power-of-two boundary.
10986
10987Parameters of this option are analogous to the @option{-falign-functions} option.
10988@option{-fno-align-labels} and @option{-falign-labels=1} are
10989equivalent and mean that labels are not aligned.
10990
10991If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10992are greater than this value, then their values are used instead.
10993
10994If @var{n} is not specified or is zero, use a machine-dependent default
10995which is very likely to be @samp{1}, meaning no alignment.
10996The maximum allowed @var{n} option value is 65536.
10997
10998Enabled at levels @option{-O2}, @option{-O3}.
10999
11000@item -falign-loops
11001@itemx -falign-loops=@var{n}
11002@itemx -falign-loops=@var{n}:@var{m}
11003@itemx -falign-loops=@var{n}:@var{m}:@var{n2}
11004@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11005@opindex falign-loops
11006Align loops to a power-of-two boundary.  If the loops are executed
11007many times, this makes up for any execution of the dummy padding
11008instructions.
11009
11010If @option{-falign-labels} is greater than this value, then its value
11011is used instead.
11012
11013Parameters of this option are analogous to the @option{-falign-functions} option.
11014@option{-fno-align-loops} and @option{-falign-loops=1} are
11015equivalent and mean that loops are not aligned.
11016The maximum allowed @var{n} option value is 65536.
11017
11018If @var{n} is not specified or is zero, use a machine-dependent default.
11019
11020Enabled at levels @option{-O2}, @option{-O3}.
11021
11022@item -falign-jumps
11023@itemx -falign-jumps=@var{n}
11024@itemx -falign-jumps=@var{n}:@var{m}
11025@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11026@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11027@opindex falign-jumps
11028Align branch targets to a power-of-two boundary, for branch targets
11029where the targets can only be reached by jumping.  In this case,
11030no dummy operations need be executed.
11031
11032If @option{-falign-labels} is greater than this value, then its value
11033is used instead.
11034
11035Parameters of this option are analogous to the @option{-falign-functions} option.
11036@option{-fno-align-jumps} and @option{-falign-jumps=1} are
11037equivalent and mean that loops are not aligned.
11038
11039If @var{n} is not specified or is zero, use a machine-dependent default.
11040The maximum allowed @var{n} option value is 65536.
11041
11042Enabled at levels @option{-O2}, @option{-O3}.
11043
11044@item -fno-allocation-dce
11045@opindex fno-allocation-dce
11046Do not remove unused C++ allocations in dead code elimination.
11047
11048@item -fallow-store-data-races
11049@opindex fallow-store-data-races
11050Allow the compiler to introduce new data races on stores.
11051
11052Enabled at level @option{-Ofast}.
11053
11054@item -funit-at-a-time
11055@opindex funit-at-a-time
11056This option is left for compatibility reasons. @option{-funit-at-a-time}
11057has no effect, while @option{-fno-unit-at-a-time} implies
11058@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11059
11060Enabled by default.
11061
11062@item -fno-toplevel-reorder
11063@opindex fno-toplevel-reorder
11064@opindex ftoplevel-reorder
11065Do not reorder top-level functions, variables, and @code{asm}
11066statements.  Output them in the same order that they appear in the
11067input file.  When this option is used, unreferenced static variables
11068are not removed.  This option is intended to support existing code
11069that relies on a particular ordering.  For new code, it is better to
11070use attributes when possible.
11071
11072@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11073also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11074Additionally @option{-fno-toplevel-reorder} implies
11075@option{-fno-section-anchors}.
11076
11077@item -fweb
11078@opindex fweb
11079Constructs webs as commonly used for register allocation purposes and assign
11080each web individual pseudo register.  This allows the register allocation pass
11081to operate on pseudos directly, but also strengthens several other optimization
11082passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
11083however, make debugging impossible, since variables no longer stay in a
11084``home register''.
11085
11086Enabled by default with @option{-funroll-loops}.
11087
11088@item -fwhole-program
11089@opindex fwhole-program
11090Assume that the current compilation unit represents the whole program being
11091compiled.  All public functions and variables with the exception of @code{main}
11092and those merged by attribute @code{externally_visible} become static functions
11093and in effect are optimized more aggressively by interprocedural optimizers.
11094
11095This option should not be used in combination with @option{-flto}.
11096Instead relying on a linker plugin should provide safer and more precise
11097information.
11098
11099@item -flto[=@var{n}]
11100@opindex flto
11101This option runs the standard link-time optimizer.  When invoked
11102with source code, it generates GIMPLE (one of GCC's internal
11103representations) and writes it to special ELF sections in the object
11104file.  When the object files are linked together, all the function
11105bodies are read from these ELF sections and instantiated as if they
11106had been part of the same translation unit.
11107
11108To use the link-time optimizer, @option{-flto} and optimization
11109options should be specified at compile time and during the final link.
11110It is recommended that you compile all the files participating in the
11111same link with the same options and also specify those options at
11112link time.
11113For example:
11114
11115@smallexample
11116gcc -c -O2 -flto foo.c
11117gcc -c -O2 -flto bar.c
11118gcc -o myprog -flto -O2 foo.o bar.o
11119@end smallexample
11120
11121The first two invocations to GCC save a bytecode representation
11122of GIMPLE into special ELF sections inside @file{foo.o} and
11123@file{bar.o}.  The final invocation reads the GIMPLE bytecode from
11124@file{foo.o} and @file{bar.o}, merges the two files into a single
11125internal image, and compiles the result as usual.  Since both
11126@file{foo.o} and @file{bar.o} are merged into a single image, this
11127causes all the interprocedural analyses and optimizations in GCC to
11128work across the two files as if they were a single one.  This means,
11129for example, that the inliner is able to inline functions in
11130@file{bar.o} into functions in @file{foo.o} and vice-versa.
11131
11132Another (simpler) way to enable link-time optimization is:
11133
11134@smallexample
11135gcc -o myprog -flto -O2 foo.c bar.c
11136@end smallexample
11137
11138The above generates bytecode for @file{foo.c} and @file{bar.c},
11139merges them together into a single GIMPLE representation and optimizes
11140them as usual to produce @file{myprog}.
11141
11142The important thing to keep in mind is that to enable link-time
11143optimizations you need to use the GCC driver to perform the link step.
11144GCC automatically performs link-time optimization if any of the
11145objects involved were compiled with the @option{-flto} command-line option.
11146You can always override
11147the automatic decision to do link-time optimization
11148by passing @option{-fno-lto} to the link command.
11149
11150To make whole program optimization effective, it is necessary to make
11151certain whole program assumptions.  The compiler needs to know
11152what functions and variables can be accessed by libraries and runtime
11153outside of the link-time optimized unit.  When supported by the linker,
11154the linker plugin (see @option{-fuse-linker-plugin}) passes information
11155to the compiler about used and externally visible symbols.  When
11156the linker plugin is not available, @option{-fwhole-program} should be
11157used to allow the compiler to make these assumptions, which leads
11158to more aggressive optimization decisions.
11159
11160When a file is compiled with @option{-flto} without
11161@option{-fuse-linker-plugin}, the generated object file is larger than
11162a regular object file because it contains GIMPLE bytecodes and the usual
11163final code (see @option{-ffat-lto-objects}.  This means that
11164object files with LTO information can be linked as normal object
11165files; if @option{-fno-lto} is passed to the linker, no
11166interprocedural optimizations are applied.  Note that when
11167@option{-fno-fat-lto-objects} is enabled the compile stage is faster
11168but you cannot perform a regular, non-LTO link on them.
11169
11170When producing the final binary, GCC only
11171applies link-time optimizations to those files that contain bytecode.
11172Therefore, you can mix and match object files and libraries with
11173GIMPLE bytecodes and final object code.  GCC automatically selects
11174which files to optimize in LTO mode and which files to link without
11175further processing.
11176
11177Generally, options specified at link time override those
11178specified at compile time, although in some cases GCC attempts to infer
11179link-time options from the settings used to compile the input files.
11180
11181If you do not specify an optimization level option @option{-O} at
11182link time, then GCC uses the highest optimization level
11183used when compiling the object files.  Note that it is generally
11184ineffective to specify an optimization level option only at link time and
11185not at compile time, for two reasons.  First, compiling without
11186optimization suppresses compiler passes that gather information
11187needed for effective optimization at link time.  Second, some early
11188optimization passes can be performed only at compile time and
11189not at link time.
11190
11191There are some code generation flags preserved by GCC when
11192generating bytecodes, as they need to be used during the final link.
11193Currently, the following options and their settings are taken from
11194the first object file that explicitly specifies them:
11195@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11196@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11197and all the @option{-m} target flags.
11198
11199Certain ABI-changing flags are required to match in all compilation units,
11200and trying to override this at link time with a conflicting value
11201is ignored.  This includes options such as @option{-freg-struct-return}
11202and @option{-fpcc-struct-return}.
11203
11204Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11205@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11206are passed through to the link stage and merged conservatively for
11207conflicting translation units.  Specifically
11208@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11209precedence; and for example @option{-ffp-contract=off} takes precedence
11210over @option{-ffp-contract=fast}.  You can override them at link time.
11211
11212Diagnostic options such as @option{-Wstringop-overflow} are passed
11213through to the link stage and their setting matches that of the
11214compile-step at function granularity.  Note that this matters only
11215for diagnostics emitted during optimization.  Note that code
11216transforms such as inlining can lead to warnings being enabled
11217or disabled for regions if code not consistent with the setting
11218at compile time.
11219
11220When you need to pass options to the assembler via @option{-Wa} or
11221@option{-Xassembler} make sure to either compile such translation
11222units with @option{-fno-lto} or consistently use the same assembler
11223options on all translation units.  You can alternatively also
11224specify assembler options at LTO link time.
11225
11226To enable debug info generation you need to supply @option{-g} at
11227compile time.  If any of the input files at link time were built
11228with debug info generation enabled the link will enable debug info
11229generation as well.  Any elaborate debug info settings
11230like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11231at the linker command line and mixing different settings in different
11232translation units is discouraged.
11233
11234If LTO encounters objects with C linkage declared with incompatible
11235types in separate translation units to be linked together (undefined
11236behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11237issued.  The behavior is still undefined at run time.  Similar
11238diagnostics may be raised for other languages.
11239
11240Another feature of LTO is that it is possible to apply interprocedural
11241optimizations on files written in different languages:
11242
11243@smallexample
11244gcc -c -flto foo.c
11245g++ -c -flto bar.cc
11246gfortran -c -flto baz.f90
11247g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11248@end smallexample
11249
11250Notice that the final link is done with @command{g++} to get the C++
11251runtime libraries and @option{-lgfortran} is added to get the Fortran
11252runtime libraries.  In general, when mixing languages in LTO mode, you
11253should use the same link command options as when mixing languages in a
11254regular (non-LTO) compilation.
11255
11256If object files containing GIMPLE bytecode are stored in a library archive, say
11257@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11258are using a linker with plugin support.  To create static libraries suitable
11259for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11260and @command{ranlib};
11261to show the symbols of object files with GIMPLE bytecode, use
11262@command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
11263and @command{nm} have been compiled with plugin support.  At link time, use the
11264flag @option{-fuse-linker-plugin} to ensure that the library participates in
11265the LTO optimization process:
11266
11267@smallexample
11268gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11269@end smallexample
11270
11271With the linker plugin enabled, the linker extracts the needed
11272GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11273to make them part of the aggregated GIMPLE image to be optimized.
11274
11275If you are not using a linker with plugin support and/or do not
11276enable the linker plugin, then the objects inside @file{libfoo.a}
11277are extracted and linked as usual, but they do not participate
11278in the LTO optimization process.  In order to make a static library suitable
11279for both LTO optimization and usual linkage, compile its object files with
11280@option{-flto} @option{-ffat-lto-objects}.
11281
11282Link-time optimizations do not require the presence of the whole program to
11283operate.  If the program does not require any symbols to be exported, it is
11284possible to combine @option{-flto} and @option{-fwhole-program} to allow
11285the interprocedural optimizers to use more aggressive assumptions which may
11286lead to improved optimization opportunities.
11287Use of @option{-fwhole-program} is not needed when linker plugin is
11288active (see @option{-fuse-linker-plugin}).
11289
11290The current implementation of LTO makes no
11291attempt to generate bytecode that is portable between different
11292types of hosts.  The bytecode files are versioned and there is a
11293strict version check, so bytecode files generated in one version of
11294GCC do not work with an older or newer version of GCC.
11295
11296Link-time optimization does not work well with generation of debugging
11297information on systems other than those using a combination of ELF and
11298DWARF.
11299
11300If you specify the optional @var{n}, the optimization and code
11301generation done at link time is executed in parallel using @var{n}
11302parallel jobs by utilizing an installed @command{make} program.  The
11303environment variable @env{MAKE} may be used to override the program
11304used.
11305
11306You can also specify @option{-flto=jobserver} to use GNU make's
11307job server mode to determine the number of parallel jobs. This
11308is useful when the Makefile calling GCC is already executing in parallel.
11309You must prepend a @samp{+} to the command recipe in the parent Makefile
11310for this to work.  This option likely only works if @env{MAKE} is
11311GNU make.  Even without the option value, GCC tries to automatically
11312detect a running GNU make's job server.
11313
11314Use @option{-flto=auto} to use GNU make's job server, if available,
11315or otherwise fall back to autodetection of the number of CPU threads
11316present in your system.
11317
11318@item -flto-partition=@var{alg}
11319@opindex flto-partition
11320Specify the partitioning algorithm used by the link-time optimizer.
11321The value is either @samp{1to1} to specify a partitioning mirroring
11322the original source files or @samp{balanced} to specify partitioning
11323into equally sized chunks (whenever possible) or @samp{max} to create
11324new partition for every symbol where possible.  Specifying @samp{none}
11325as an algorithm disables partitioning and streaming completely.
11326The default value is @samp{balanced}. While @samp{1to1} can be used
11327as an workaround for various code ordering issues, the @samp{max}
11328partitioning is intended for internal testing only.
11329The value @samp{one} specifies that exactly one partition should be
11330used while the value @samp{none} bypasses partitioning and executes
11331the link-time optimization step directly from the WPA phase.
11332
11333@item -flto-compression-level=@var{n}
11334@opindex flto-compression-level
11335This option specifies the level of compression used for intermediate
11336language written to LTO object files, and is only meaningful in
11337conjunction with LTO mode (@option{-flto}).  Valid
11338values are 0 (no compression) to 9 (maximum compression).  Values
11339outside this range are clamped to either 0 or 9.  If the option is not
11340given, a default balanced compression setting is used.
11341
11342@item -fuse-linker-plugin
11343@opindex fuse-linker-plugin
11344Enables the use of a linker plugin during link-time optimization.  This
11345option relies on plugin support in the linker, which is available in gold
11346or in GNU ld 2.21 or newer.
11347
11348This option enables the extraction of object files with GIMPLE bytecode out
11349of library archives. This improves the quality of optimization by exposing
11350more code to the link-time optimizer.  This information specifies what
11351symbols can be accessed externally (by non-LTO object or during dynamic
11352linking).  Resulting code quality improvements on binaries (and shared
11353libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11354See @option{-flto} for a description of the effect of this flag and how to
11355use it.
11356
11357This option is enabled by default when LTO support in GCC is enabled
11358and GCC was configured for use with
11359a linker supporting plugins (GNU ld 2.21 or newer or gold).
11360
11361@item -ffat-lto-objects
11362@opindex ffat-lto-objects
11363Fat LTO objects are object files that contain both the intermediate language
11364and the object code. This makes them usable for both LTO linking and normal
11365linking. This option is effective only when compiling with @option{-flto}
11366and is ignored at link time.
11367
11368@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11369requires the complete toolchain to be aware of LTO. It requires a linker with
11370linker plugin support for basic functionality.  Additionally,
11371@command{nm}, @command{ar} and @command{ranlib}
11372need to support linker plugins to allow a full-featured build environment
11373(capable of building static libraries etc).  GCC provides the @command{gcc-ar},
11374@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11375to these tools. With non fat LTO makefiles need to be modified to use them.
11376
11377Note that modern binutils provide plugin auto-load mechanism.
11378Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11379effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11380@command{gcc-ranlib}).
11381
11382The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11383support.
11384
11385@item -fcompare-elim
11386@opindex fcompare-elim
11387After register allocation and post-register allocation instruction splitting,
11388identify arithmetic instructions that compute processor flags similar to a
11389comparison operation based on that arithmetic.  If possible, eliminate the
11390explicit comparison operation.
11391
11392This pass only applies to certain targets that cannot explicitly represent
11393the comparison operation before register allocation is complete.
11394
11395Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11396
11397@item -fcprop-registers
11398@opindex fcprop-registers
11399After register allocation and post-register allocation instruction splitting,
11400perform a copy-propagation pass to try to reduce scheduling dependencies
11401and occasionally eliminate the copy.
11402
11403Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11404
11405@item -fprofile-correction
11406@opindex fprofile-correction
11407Profiles collected using an instrumented binary for multi-threaded programs may
11408be inconsistent due to missed counter updates. When this option is specified,
11409GCC uses heuristics to correct or smooth out such inconsistencies. By
11410default, GCC emits an error message when an inconsistent profile is detected.
11411
11412This option is enabled by @option{-fauto-profile}.
11413
11414@item -fprofile-partial-training
11415@opindex fprofile-partial-training
11416With @code{-fprofile-use} all portions of programs not executed during train
11417run are optimized agressively for size rather than speed.  In some cases it is
11418not practical to train all possible hot paths in the program. (For
11419example, program may contain functions specific for a given hardware and
11420trianing may not cover all hardware configurations program is run on.)  With
11421@code{-fprofile-partial-training} profile feedback will be ignored for all
11422functions not executed during the train run leading them to be optimized as if
11423they were compiled without profile feedback. This leads to better performance
11424when train run is not representative but also leads to significantly bigger
11425code.
11426
11427@item -fprofile-use
11428@itemx -fprofile-use=@var{path}
11429@opindex fprofile-use
11430Enable profile feedback-directed optimizations,
11431and the following optimizations, many of which
11432are generally profitable only with profile feedback available:
11433
11434@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11435-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11436-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11437-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11438-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11439-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11440-fprofile-reorder-functions}
11441
11442Before you can use this option, you must first generate profiling information.
11443@xref{Instrumentation Options}, for information about the
11444@option{-fprofile-generate} option.
11445
11446By default, GCC emits an error message if the feedback profiles do not
11447match the source code.  This error can be turned into a warning by using
11448@option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
11449optimized code.  Additionally, by default, GCC also emits a warning message if
11450the feedback profiles do not exist (see @option{-Wmissing-profile}).
11451
11452If @var{path} is specified, GCC looks at the @var{path} to find
11453the profile feedback data files. See @option{-fprofile-dir}.
11454
11455@item -fauto-profile
11456@itemx -fauto-profile=@var{path}
11457@opindex fauto-profile
11458Enable sampling-based feedback-directed optimizations,
11459and the following optimizations,
11460many of which are generally profitable only with profile feedback available:
11461
11462@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
11463-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
11464-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
11465-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
11466-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
11467-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
11468-fprofile-correction}
11469
11470@var{path} is the name of a file containing AutoFDO profile information.
11471If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11472
11473Producing an AutoFDO profile data file requires running your program
11474with the @command{perf} utility on a supported GNU/Linux target system.
11475For more information, see @uref{https://perf.wiki.kernel.org/}.
11476
11477E.g.
11478@smallexample
11479perf record -e br_inst_retired:near_taken -b -o perf.data \
11480    -- your_program
11481@end smallexample
11482
11483Then use the @command{create_gcov} tool to convert the raw profile data
11484to a format that can be used by GCC.@  You must also supply the
11485unstripped binary for your program to this tool.
11486See @uref{https://github.com/google/autofdo}.
11487
11488E.g.
11489@smallexample
11490create_gcov --binary=your_program.unstripped --profile=perf.data \
11491    --gcov=profile.afdo
11492@end smallexample
11493@end table
11494
11495The following options control compiler behavior regarding floating-point
11496arithmetic.  These options trade off between speed and
11497correctness.  All must be specifically enabled.
11498
11499@table @gcctabopt
11500@item -ffloat-store
11501@opindex ffloat-store
11502Do not store floating-point variables in registers, and inhibit other
11503options that might change whether a floating-point value is taken from a
11504register or memory.
11505
11506@cindex floating-point precision
11507This option prevents undesirable excess precision on machines such as
11508the 68000 where the floating registers (of the 68881) keep more
11509precision than a @code{double} is supposed to have.  Similarly for the
11510x86 architecture.  For most programs, the excess precision does only
11511good, but a few programs rely on the precise definition of IEEE floating
11512point.  Use @option{-ffloat-store} for such programs, after modifying
11513them to store all pertinent intermediate computations into variables.
11514
11515@item -fexcess-precision=@var{style}
11516@opindex fexcess-precision
11517This option allows further control over excess precision on machines
11518where floating-point operations occur in a format with more precision or
11519range than the IEEE standard and interchange floating-point types.  By
11520default, @option{-fexcess-precision=fast} is in effect; this means that
11521operations may be carried out in a wider precision than the types specified
11522in the source if that would result in faster code, and it is unpredictable
11523when rounding to the types specified in the source code takes place.
11524When compiling C, if @option{-fexcess-precision=standard} is specified then
11525excess precision follows the rules specified in ISO C99; in particular,
11526both casts and assignments cause values to be rounded to their
11527semantic types (whereas @option{-ffloat-store} only affects
11528assignments).  This option is enabled by default for C if a strict
11529conformance option such as @option{-std=c99} is used.
11530@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11531regardless of whether a strict conformance option is used.
11532
11533@opindex mfpmath
11534@option{-fexcess-precision=standard} is not implemented for languages
11535other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
11536or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11537semantics apply without excess precision, and in the latter, rounding
11538is unpredictable.
11539
11540@item -ffast-math
11541@opindex ffast-math
11542Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11543@option{-ffinite-math-only}, @option{-fno-rounding-math},
11544@option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11545@option{-fexcess-precision=fast}.
11546
11547This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11548
11549This option is not turned on by any @option{-O} option besides
11550@option{-Ofast} since it can result in incorrect output for programs
11551that depend on an exact implementation of IEEE or ISO rules/specifications
11552for math functions. It may, however, yield faster code for programs
11553that do not require the guarantees of these specifications.
11554
11555@item -fno-math-errno
11556@opindex fno-math-errno
11557@opindex fmath-errno
11558Do not set @code{errno} after calling math functions that are executed
11559with a single instruction, e.g., @code{sqrt}.  A program that relies on
11560IEEE exceptions for math error handling may want to use this flag
11561for speed while maintaining IEEE arithmetic compatibility.
11562
11563This option is not turned on by any @option{-O} option since
11564it can result in incorrect output for programs that depend on
11565an exact implementation of IEEE or ISO rules/specifications for
11566math functions. It may, however, yield faster code for programs
11567that do not require the guarantees of these specifications.
11568
11569The default is @option{-fmath-errno}.
11570
11571On Darwin systems, the math library never sets @code{errno}.  There is
11572therefore no reason for the compiler to consider the possibility that
11573it might, and @option{-fno-math-errno} is the default.
11574
11575@item -funsafe-math-optimizations
11576@opindex funsafe-math-optimizations
11577
11578Allow optimizations for floating-point arithmetic that (a) assume
11579that arguments and results are valid and (b) may violate IEEE or
11580ANSI standards.  When used at link time, it may include libraries
11581or startup files that change the default FPU control word or other
11582similar optimizations.
11583
11584This option is not turned on by any @option{-O} option since
11585it can result in incorrect output for programs that depend on
11586an exact implementation of IEEE or ISO rules/specifications for
11587math functions. It may, however, yield faster code for programs
11588that do not require the guarantees of these specifications.
11589Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11590@option{-fassociative-math} and @option{-freciprocal-math}.
11591
11592The default is @option{-fno-unsafe-math-optimizations}.
11593
11594@item -fassociative-math
11595@opindex fassociative-math
11596
11597Allow re-association of operands in series of floating-point operations.
11598This violates the ISO C and C++ language standard by possibly changing
11599computation result.  NOTE: re-ordering may change the sign of zero as
11600well as ignore NaNs and inhibit or create underflow or overflow (and
11601thus cannot be used on code that relies on rounding behavior like
11602@code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
11603and thus may not be used when ordered comparisons are required.
11604This option requires that both @option{-fno-signed-zeros} and
11605@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
11606much sense with @option{-frounding-math}. For Fortran the option
11607is automatically enabled when both @option{-fno-signed-zeros} and
11608@option{-fno-trapping-math} are in effect.
11609
11610The default is @option{-fno-associative-math}.
11611
11612@item -freciprocal-math
11613@opindex freciprocal-math
11614
11615Allow the reciprocal of a value to be used instead of dividing by
11616the value if this enables optimizations.  For example @code{x / y}
11617can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11618is subject to common subexpression elimination.  Note that this loses
11619precision and increases the number of flops operating on the value.
11620
11621The default is @option{-fno-reciprocal-math}.
11622
11623@item -ffinite-math-only
11624@opindex ffinite-math-only
11625Allow optimizations for floating-point arithmetic that assume
11626that arguments and results are not NaNs or +-Infs.
11627
11628This option is not turned on by any @option{-O} option since
11629it can result in incorrect output for programs that depend on
11630an exact implementation of IEEE or ISO rules/specifications for
11631math functions. It may, however, yield faster code for programs
11632that do not require the guarantees of these specifications.
11633
11634The default is @option{-fno-finite-math-only}.
11635
11636@item -fno-signed-zeros
11637@opindex fno-signed-zeros
11638@opindex fsigned-zeros
11639Allow optimizations for floating-point arithmetic that ignore the
11640signedness of zero.  IEEE arithmetic specifies the behavior of
11641distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11642of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11643This option implies that the sign of a zero result isn't significant.
11644
11645The default is @option{-fsigned-zeros}.
11646
11647@item -fno-trapping-math
11648@opindex fno-trapping-math
11649@opindex ftrapping-math
11650Compile code assuming that floating-point operations cannot generate
11651user-visible traps.  These traps include division by zero, overflow,
11652underflow, inexact result and invalid operation.  This option requires
11653that @option{-fno-signaling-nans} be in effect.  Setting this option may
11654allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11655
11656This option should never be turned on by any @option{-O} option since
11657it can result in incorrect output for programs that depend on
11658an exact implementation of IEEE or ISO rules/specifications for
11659math functions.
11660
11661The default is @option{-ftrapping-math}.
11662
11663@item -frounding-math
11664@opindex frounding-math
11665Disable transformations and optimizations that assume default floating-point
11666rounding behavior.  This is round-to-zero for all floating point
11667to integer conversions, and round-to-nearest for all other arithmetic
11668truncations.  This option should be specified for programs that change
11669the FP rounding mode dynamically, or that may be executed with a
11670non-default rounding mode.  This option disables constant folding of
11671floating-point expressions at compile time (which may be affected by
11672rounding mode) and arithmetic transformations that are unsafe in the
11673presence of sign-dependent rounding modes.
11674
11675The default is @option{-fno-rounding-math}.
11676
11677This option is experimental and does not currently guarantee to
11678disable all GCC optimizations that are affected by rounding mode.
11679Future versions of GCC may provide finer control of this setting
11680using C99's @code{FENV_ACCESS} pragma.  This command-line option
11681will be used to specify the default state for @code{FENV_ACCESS}.
11682
11683@item -fsignaling-nans
11684@opindex fsignaling-nans
11685Compile code assuming that IEEE signaling NaNs may generate user-visible
11686traps during floating-point operations.  Setting this option disables
11687optimizations that may change the number of exceptions visible with
11688signaling NaNs.  This option implies @option{-ftrapping-math}.
11689
11690This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11691be defined.
11692
11693The default is @option{-fno-signaling-nans}.
11694
11695This option is experimental and does not currently guarantee to
11696disable all GCC optimizations that affect signaling NaN behavior.
11697
11698@item -fno-fp-int-builtin-inexact
11699@opindex fno-fp-int-builtin-inexact
11700@opindex ffp-int-builtin-inexact
11701Do not allow the built-in functions @code{ceil}, @code{floor},
11702@code{round} and @code{trunc}, and their @code{float} and @code{long
11703double} variants, to generate code that raises the ``inexact''
11704floating-point exception for noninteger arguments.  ISO C99 and C11
11705allow these functions to raise the ``inexact'' exception, but ISO/IEC
11706TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
11707ISO C2X, does not allow these functions to do so.
11708
11709The default is @option{-ffp-int-builtin-inexact}, allowing the
11710exception to be raised, unless C2X or a later C standard is selected.
11711This option does nothing unless @option{-ftrapping-math} is in effect.
11712
11713Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
11714generate a call to a library function then the ``inexact'' exception
11715may be raised if the library implementation does not follow TS 18661.
11716
11717@item -fsingle-precision-constant
11718@opindex fsingle-precision-constant
11719Treat floating-point constants as single precision instead of
11720implicitly converting them to double-precision constants.
11721
11722@item -fcx-limited-range
11723@opindex fcx-limited-range
11724When enabled, this option states that a range reduction step is not
11725needed when performing complex division.  Also, there is no checking
11726whether the result of a complex multiplication or division is @code{NaN
11727+ I*NaN}, with an attempt to rescue the situation in that case.  The
11728default is @option{-fno-cx-limited-range}, but is enabled by
11729@option{-ffast-math}.
11730
11731This option controls the default setting of the ISO C99
11732@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
11733all languages.
11734
11735@item -fcx-fortran-rules
11736@opindex fcx-fortran-rules
11737Complex multiplication and division follow Fortran rules.  Range
11738reduction is done as part of complex division, but there is no checking
11739whether the result of a complex multiplication or division is @code{NaN
11740+ I*NaN}, with an attempt to rescue the situation in that case.
11741
11742The default is @option{-fno-cx-fortran-rules}.
11743
11744@end table
11745
11746The following options control optimizations that may improve
11747performance, but are not enabled by any @option{-O} options.  This
11748section includes experimental options that may produce broken code.
11749
11750@table @gcctabopt
11751@item -fbranch-probabilities
11752@opindex fbranch-probabilities
11753After running a program compiled with @option{-fprofile-arcs}
11754(@pxref{Instrumentation Options}),
11755you can compile it a second time using
11756@option{-fbranch-probabilities}, to improve optimizations based on
11757the number of times each branch was taken.  When a program
11758compiled with @option{-fprofile-arcs} exits, it saves arc execution
11759counts to a file called @file{@var{sourcename}.gcda} for each source
11760file.  The information in this data file is very dependent on the
11761structure of the generated code, so you must use the same source code
11762and the same optimization options for both compilations.
11763
11764With @option{-fbranch-probabilities}, GCC puts a
11765@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
11766These can be used to improve optimization.  Currently, they are only
11767used in one place: in @file{reorg.c}, instead of guessing which path a
11768branch is most likely to take, the @samp{REG_BR_PROB} values are used to
11769exactly determine which path is taken more often.
11770
11771Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11772
11773@item -fprofile-values
11774@opindex fprofile-values
11775If combined with @option{-fprofile-arcs}, it adds code so that some
11776data about values of expressions in the program is gathered.
11777
11778With @option{-fbranch-probabilities}, it reads back the data gathered
11779from profiling values of expressions for usage in optimizations.
11780
11781Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
11782@option{-fauto-profile}.
11783
11784@item -fprofile-reorder-functions
11785@opindex fprofile-reorder-functions
11786Function reordering based on profile instrumentation collects
11787first time of execution of a function and orders these functions
11788in ascending order.
11789
11790Enabled with @option{-fprofile-use}.
11791
11792@item -fvpt
11793@opindex fvpt
11794If combined with @option{-fprofile-arcs}, this option instructs the compiler
11795to add code to gather information about values of expressions.
11796
11797With @option{-fbranch-probabilities}, it reads back the data gathered
11798and actually performs the optimizations based on them.
11799Currently the optimizations include specialization of division operations
11800using the knowledge about the value of the denominator.
11801
11802Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
11803
11804@item -frename-registers
11805@opindex frename-registers
11806Attempt to avoid false dependencies in scheduled code by making use
11807of registers left over after register allocation.  This optimization
11808most benefits processors with lots of registers.  Depending on the
11809debug information format adopted by the target, however, it can
11810make debugging impossible, since variables no longer stay in
11811a ``home register''.
11812
11813Enabled by default with @option{-funroll-loops}.
11814
11815@item -fschedule-fusion
11816@opindex fschedule-fusion
11817Performs a target dependent pass over the instruction stream to schedule
11818instructions of same type together because target machine can execute them
11819more efficiently if they are adjacent to each other in the instruction flow.
11820
11821Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11822
11823@item -ftracer
11824@opindex ftracer
11825Perform tail duplication to enlarge superblock size.  This transformation
11826simplifies the control flow of the function allowing other optimizations to do
11827a better job.
11828
11829Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11830
11831@item -funroll-loops
11832@opindex funroll-loops
11833Unroll loops whose number of iterations can be determined at compile time or
11834upon entry to the loop.  @option{-funroll-loops} implies
11835@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11836It also turns on complete loop peeling (i.e.@: complete removal of loops with
11837a small constant number of iterations).  This option makes code larger, and may
11838or may not make it run faster.
11839
11840Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11841
11842@item -funroll-all-loops
11843@opindex funroll-all-loops
11844Unroll all loops, even if their number of iterations is uncertain when
11845the loop is entered.  This usually makes programs run more slowly.
11846@option{-funroll-all-loops} implies the same options as
11847@option{-funroll-loops}.
11848
11849@item -fpeel-loops
11850@opindex fpeel-loops
11851Peels loops for which there is enough information that they do not
11852roll much (from profile feedback or static analysis).  It also turns on
11853complete loop peeling (i.e.@: complete removal of loops with small constant
11854number of iterations).
11855
11856Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11857
11858@item -fmove-loop-invariants
11859@opindex fmove-loop-invariants
11860Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
11861at level @option{-O1} and higher, except for @option{-Og}.
11862
11863@item -fsplit-loops
11864@opindex fsplit-loops
11865Split a loop into two if it contains a condition that's always true
11866for one side of the iteration space and false for the other.
11867
11868Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11869
11870@item -funswitch-loops
11871@opindex funswitch-loops
11872Move branches with loop invariant conditions out of the loop, with duplicates
11873of the loop on both branches (modified according to result of the condition).
11874
11875Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11876
11877@item -fversion-loops-for-strides
11878@opindex fversion-loops-for-strides
11879If a loop iterates over an array with a variable stride, create another
11880version of the loop that assumes the stride is always one.  For example:
11881
11882@smallexample
11883for (int i = 0; i < n; ++i)
11884  x[i * stride] = @dots{};
11885@end smallexample
11886
11887becomes:
11888
11889@smallexample
11890if (stride == 1)
11891  for (int i = 0; i < n; ++i)
11892    x[i] = @dots{};
11893else
11894  for (int i = 0; i < n; ++i)
11895    x[i * stride] = @dots{};
11896@end smallexample
11897
11898This is particularly useful for assumed-shape arrays in Fortran where
11899(for example) it allows better vectorization assuming contiguous accesses.
11900This flag is enabled by default at @option{-O3}.
11901It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11902
11903@item -ffunction-sections
11904@itemx -fdata-sections
11905@opindex ffunction-sections
11906@opindex fdata-sections
11907Place each function or data item into its own section in the output
11908file if the target supports arbitrary sections.  The name of the
11909function or the name of the data item determines the section's name
11910in the output file.
11911
11912Use these options on systems where the linker can perform optimizations to
11913improve locality of reference in the instruction space.  Most systems using the
11914ELF object format have linkers with such optimizations.  On AIX, the linker
11915rearranges sections (CSECTs) based on the call graph.  The performance impact
11916varies.
11917
11918Together with a linker garbage collection (linker @option{--gc-sections}
11919option) these options may lead to smaller statically-linked executables (after
11920stripping).
11921
11922On ELF/DWARF systems these options do not degenerate the quality of the debug
11923information.  There could be issues with other object files/debug info formats.
11924
11925Only use these options when there are significant benefits from doing so.  When
11926you specify these options, the assembler and linker create larger object and
11927executable files and are also slower.  These options affect code generation.
11928They prevent optimizations by the compiler and assembler using relative
11929locations inside a translation unit since the locations are unknown until
11930link time.  An example of such an optimization is relaxing calls to short call
11931instructions.
11932
11933@item -fstdarg-opt
11934@opindex fstdarg-opt
11935Optimize the prologue of variadic argument functions with respect to usage of
11936those arguments.
11937
11938@item -fsection-anchors
11939@opindex fsection-anchors
11940Try to reduce the number of symbolic address calculations by using
11941shared ``anchor'' symbols to address nearby objects.  This transformation
11942can help to reduce the number of GOT entries and GOT accesses on some
11943targets.
11944
11945For example, the implementation of the following function @code{foo}:
11946
11947@smallexample
11948static int a, b, c;
11949int foo (void) @{ return a + b + c; @}
11950@end smallexample
11951
11952@noindent
11953usually calculates the addresses of all three variables, but if you
11954compile it with @option{-fsection-anchors}, it accesses the variables
11955from a common anchor point instead.  The effect is similar to the
11956following pseudocode (which isn't valid C):
11957
11958@smallexample
11959int foo (void)
11960@{
11961  register int *xr = &x;
11962  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11963@}
11964@end smallexample
11965
11966Not all targets support this option.
11967
11968@item --param @var{name}=@var{value}
11969@opindex param
11970In some places, GCC uses various constants to control the amount of
11971optimization that is done.  For example, GCC does not inline functions
11972that contain more than a certain number of instructions.  You can
11973control some of these constants on the command line using the
11974@option{--param} option.
11975
11976The names of specific parameters, and the meaning of the values, are
11977tied to the internals of the compiler, and are subject to change
11978without notice in future releases.
11979
11980In order to get minimal, maximal and default value of a parameter,
11981one can use @option{--help=param -Q} options.
11982
11983In each case, the @var{value} is an integer.  The following choices
11984of @var{name} are recognized for all targets:
11985
11986@table @gcctabopt
11987@item predictable-branch-outcome
11988When branch is predicted to be taken with probability lower than this threshold
11989(in percent), then it is considered well predictable.
11990
11991@item max-rtl-if-conversion-insns
11992RTL if-conversion tries to remove conditional branches around a block and
11993replace them with conditionally executed instructions.  This parameter
11994gives the maximum number of instructions in a block which should be
11995considered for if-conversion.  The compiler will
11996also use other heuristics to decide whether if-conversion is likely to be
11997profitable.
11998
11999@item max-rtl-if-conversion-predictable-cost
12000@itemx max-rtl-if-conversion-unpredictable-cost
12001RTL if-conversion will try to remove conditional branches around a block
12002and replace them with conditionally executed instructions.  These parameters
12003give the maximum permissible cost for the sequence that would be generated
12004by if-conversion depending on whether the branch is statically determined
12005to be predictable or not.  The units for this parameter are the same as
12006those for the GCC internal seq_cost metric.  The compiler will try to
12007provide a reasonable default for this parameter using the BRANCH_COST
12008target macro.
12009
12010@item max-crossjump-edges
12011The maximum number of incoming edges to consider for cross-jumping.
12012The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
12013the number of edges incoming to each block.  Increasing values mean
12014more aggressive optimization, making the compilation time increase with
12015probably small improvement in executable size.
12016
12017@item min-crossjump-insns
12018The minimum number of instructions that must be matched at the end
12019of two blocks before cross-jumping is performed on them.  This
12020value is ignored in the case where all instructions in the block being
12021cross-jumped from are matched.
12022
12023@item max-grow-copy-bb-insns
12024The maximum code size expansion factor when copying basic blocks
12025instead of jumping.  The expansion is relative to a jump instruction.
12026
12027@item max-goto-duplication-insns
12028The maximum number of instructions to duplicate to a block that jumps
12029to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
12030passes, GCC factors computed gotos early in the compilation process,
12031and unfactors them as late as possible.  Only computed jumps at the
12032end of a basic blocks with no more than max-goto-duplication-insns are
12033unfactored.
12034
12035@item max-delay-slot-insn-search
12036The maximum number of instructions to consider when looking for an
12037instruction to fill a delay slot.  If more than this arbitrary number of
12038instructions are searched, the time savings from filling the delay slot
12039are minimal, so stop searching.  Increasing values mean more
12040aggressive optimization, making the compilation time increase with probably
12041small improvement in execution time.
12042
12043@item max-delay-slot-live-search
12044When trying to fill delay slots, the maximum number of instructions to
12045consider when searching for a block with valid live register
12046information.  Increasing this arbitrarily chosen value means more
12047aggressive optimization, increasing the compilation time.  This parameter
12048should be removed when the delay slot code is rewritten to maintain the
12049control-flow graph.
12050
12051@item max-gcse-memory
12052The approximate maximum amount of memory that can be allocated in
12053order to perform the global common subexpression elimination
12054optimization.  If more memory than specified is required, the
12055optimization is not done.
12056
12057@item max-gcse-insertion-ratio
12058If the ratio of expression insertions to deletions is larger than this value
12059for any expression, then RTL PRE inserts or removes the expression and thus
12060leaves partially redundant computations in the instruction stream.
12061
12062@item max-pending-list-length
12063The maximum number of pending dependencies scheduling allows
12064before flushing the current state and starting over.  Large functions
12065with few branches or calls can create excessively large lists which
12066needlessly consume memory and resources.
12067
12068@item max-modulo-backtrack-attempts
12069The maximum number of backtrack attempts the scheduler should make
12070when modulo scheduling a loop.  Larger values can exponentially increase
12071compilation time.
12072
12073@item max-inline-insns-single
12074Several parameters control the tree inliner used in GCC@.  This number sets the
12075maximum number of instructions (counted in GCC's internal representation) in a
12076single function that the tree inliner considers for inlining.  This only
12077affects functions declared inline and methods implemented in a class
12078declaration (C++).
12079
12080
12081@item max-inline-insns-auto
12082When you use @option{-finline-functions} (included in @option{-O3}),
12083a lot of functions that would otherwise not be considered for inlining
12084by the compiler are investigated.  To those functions, a different
12085(more restrictive) limit compared to functions declared inline can
12086be applied (@option{--param max-inline-insns-auto}).
12087
12088@item max-inline-insns-small
12089This is bound applied to calls which are considered relevant with
12090@option{-finline-small-functions}.
12091
12092@item max-inline-insns-size
12093This is bound applied to calls which are optimized for size. Small growth
12094may be desirable to anticipate optimization oppurtunities exposed by inlining.
12095
12096@item uninlined-function-insns
12097Number of instructions accounted by inliner for function overhead such as
12098function prologue and epilogue.
12099
12100@item uninlined-function-time
12101Extra time accounted by inliner for function overhead such as time needed to
12102execute function prologue and epilogue
12103
12104@item inline-heuristics-hint-percent
12105The scale (in percents) applied to @option{inline-insns-single},
12106@option{inline-insns-single-O2}, @option{inline-insns-auto}
12107when inline heuristics hints that inlining is
12108very profitable (will enable later optimizations).
12109
12110@item uninlined-thunk-insns
12111@item uninlined-thunk-time
12112Same as @option{--param uninlined-function-insns} and
12113@option{--param uninlined-function-time} but applied to function thunks
12114
12115@item inline-min-speedup
12116When estimated performance improvement of caller + callee runtime exceeds this
12117threshold (in percent), the function can be inlined regardless of the limit on
12118@option{--param max-inline-insns-single} and @option{--param
12119max-inline-insns-auto}.
12120
12121@item large-function-insns
12122The limit specifying really large functions.  For functions larger than this
12123limit after inlining, inlining is constrained by
12124@option{--param large-function-growth}.  This parameter is useful primarily
12125to avoid extreme compilation time caused by non-linear algorithms used by the
12126back end.
12127
12128@item large-function-growth
12129Specifies maximal growth of large function caused by inlining in percents.
12130For example, parameter value 100 limits large function growth to 2.0 times
12131the original size.
12132
12133@item large-unit-insns
12134The limit specifying large translation unit.  Growth caused by inlining of
12135units larger than this limit is limited by @option{--param inline-unit-growth}.
12136For small units this might be too tight.
12137For example, consider a unit consisting of function A
12138that is inline and B that just calls A three times.  If B is small relative to
12139A, the growth of unit is 300\% and yet such inlining is very sane.  For very
12140large units consisting of small inlineable functions, however, the overall unit
12141growth limit is needed to avoid exponential explosion of code size.  Thus for
12142smaller units, the size is increased to @option{--param large-unit-insns}
12143before applying @option{--param inline-unit-growth}.
12144
12145@item inline-unit-growth
12146Specifies maximal overall growth of the compilation unit caused by inlining.
12147For example, parameter value 20 limits unit growth to 1.2 times the original
12148size. Cold functions (either marked cold via an attribute or by profile
12149feedback) are not accounted into the unit size.
12150
12151@item ipa-cp-unit-growth
12152Specifies maximal overall growth of the compilation unit caused by
12153interprocedural constant propagation.  For example, parameter value 10 limits
12154unit growth to 1.1 times the original size.
12155
12156@item large-stack-frame
12157The limit specifying large stack frames.  While inlining the algorithm is trying
12158to not grow past this limit too much.
12159
12160@item large-stack-frame-growth
12161Specifies maximal growth of large stack frames caused by inlining in percents.
12162For example, parameter value 1000 limits large stack frame growth to 11 times
12163the original size.
12164
12165@item max-inline-insns-recursive
12166@itemx max-inline-insns-recursive-auto
12167Specifies the maximum number of instructions an out-of-line copy of a
12168self-recursive inline
12169function can grow into by performing recursive inlining.
12170
12171@option{--param max-inline-insns-recursive} applies to functions
12172declared inline.
12173For functions not declared inline, recursive inlining
12174happens only when @option{-finline-functions} (included in @option{-O3}) is
12175enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12176
12177@item max-inline-recursive-depth
12178@itemx max-inline-recursive-depth-auto
12179Specifies the maximum recursion depth used for recursive inlining.
12180
12181@option{--param max-inline-recursive-depth} applies to functions
12182declared inline.  For functions not declared inline, recursive inlining
12183happens only when @option{-finline-functions} (included in @option{-O3}) is
12184enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12185
12186@item min-inline-recursive-probability
12187Recursive inlining is profitable only for function having deep recursion
12188in average and can hurt for function having little recursion depth by
12189increasing the prologue size or complexity of function body to other
12190optimizers.
12191
12192When profile feedback is available (see @option{-fprofile-generate}) the actual
12193recursion depth can be guessed from the probability that function recurses
12194via a given call expression.  This parameter limits inlining only to call
12195expressions whose probability exceeds the given threshold (in percents).
12196
12197@item early-inlining-insns
12198Specify growth that the early inliner can make.  In effect it increases
12199the amount of inlining for code having a large abstraction penalty.
12200
12201@item max-early-inliner-iterations
12202Limit of iterations of the early inliner.  This basically bounds
12203the number of nested indirect calls the early inliner can resolve.
12204Deeper chains are still handled by late inlining.
12205
12206@item comdat-sharing-probability
12207Probability (in percent) that C++ inline function with comdat visibility
12208are shared across multiple compilation units.
12209
12210@item profile-func-internal-id
12211A parameter to control whether to use function internal id in profile
12212database lookup. If the value is 0, the compiler uses an id that
12213is based on function assembler name and filename, which makes old profile
12214data more tolerant to source changes such as function reordering etc.
12215
12216@item min-vect-loop-bound
12217The minimum number of iterations under which loops are not vectorized
12218when @option{-ftree-vectorize} is used.  The number of iterations after
12219vectorization needs to be greater than the value specified by this option
12220to allow vectorization.
12221
12222@item gcse-cost-distance-ratio
12223Scaling factor in calculation of maximum distance an expression
12224can be moved by GCSE optimizations.  This is currently supported only in the
12225code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
12226is with simple expressions, i.e., the expressions that have cost
12227less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
12228hoisting of simple expressions.
12229
12230@item gcse-unrestricted-cost
12231Cost, roughly measured as the cost of a single typical machine
12232instruction, at which GCSE optimizations do not constrain
12233the distance an expression can travel.  This is currently
12234supported only in the code hoisting pass.  The lesser the cost,
12235the more aggressive code hoisting is.  Specifying 0
12236allows all expressions to travel unrestricted distances.
12237
12238@item max-hoist-depth
12239The depth of search in the dominator tree for expressions to hoist.
12240This is used to avoid quadratic behavior in hoisting algorithm.
12241The value of 0 does not limit on the search, but may slow down compilation
12242of huge functions.
12243
12244@item max-tail-merge-comparisons
12245The maximum amount of similar bbs to compare a bb with.  This is used to
12246avoid quadratic behavior in tree tail merging.
12247
12248@item max-tail-merge-iterations
12249The maximum amount of iterations of the pass over the function.  This is used to
12250limit compilation time in tree tail merging.
12251
12252@item store-merging-allow-unaligned
12253Allow the store merging pass to introduce unaligned stores if it is legal to
12254do so.
12255
12256@item max-stores-to-merge
12257The maximum number of stores to attempt to merge into wider stores in the store
12258merging pass.
12259
12260@item max-unrolled-insns
12261The maximum number of instructions that a loop may have to be unrolled.
12262If a loop is unrolled, this parameter also determines how many times
12263the loop code is unrolled.
12264
12265@item max-average-unrolled-insns
12266The maximum number of instructions biased by probabilities of their execution
12267that a loop may have to be unrolled.  If a loop is unrolled,
12268this parameter also determines how many times the loop code is unrolled.
12269
12270@item max-unroll-times
12271The maximum number of unrollings of a single loop.
12272
12273@item max-peeled-insns
12274The maximum number of instructions that a loop may have to be peeled.
12275If a loop is peeled, this parameter also determines how many times
12276the loop code is peeled.
12277
12278@item max-peel-times
12279The maximum number of peelings of a single loop.
12280
12281@item max-peel-branches
12282The maximum number of branches on the hot path through the peeled sequence.
12283
12284@item max-completely-peeled-insns
12285The maximum number of insns of a completely peeled loop.
12286
12287@item max-completely-peel-times
12288The maximum number of iterations of a loop to be suitable for complete peeling.
12289
12290@item max-completely-peel-loop-nest-depth
12291The maximum depth of a loop nest suitable for complete peeling.
12292
12293@item max-unswitch-insns
12294The maximum number of insns of an unswitched loop.
12295
12296@item max-unswitch-level
12297The maximum number of branches unswitched in a single loop.
12298
12299@item lim-expensive
12300The minimum cost of an expensive expression in the loop invariant motion.
12301
12302@item min-loop-cond-split-prob
12303When FDO profile information is available, @option{min-loop-cond-split-prob}
12304specifies minimum threshold for probability of semi-invariant condition
12305statement to trigger loop split.
12306
12307@item iv-consider-all-candidates-bound
12308Bound on number of candidates for induction variables, below which
12309all candidates are considered for each use in induction variable
12310optimizations.  If there are more candidates than this,
12311only the most relevant ones are considered to avoid quadratic time complexity.
12312
12313@item iv-max-considered-uses
12314The induction variable optimizations give up on loops that contain more
12315induction variable uses.
12316
12317@item iv-always-prune-cand-set-bound
12318If the number of candidates in the set is smaller than this value,
12319always try to remove unnecessary ivs from the set
12320when adding a new one.
12321
12322@item avg-loop-niter
12323Average number of iterations of a loop.
12324
12325@item dse-max-object-size
12326Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12327Larger values may result in larger compilation times.
12328
12329@item dse-max-alias-queries-per-store
12330Maximum number of queries into the alias oracle per store.
12331Larger values result in larger compilation times and may result in more
12332removed dead stores.
12333
12334@item scev-max-expr-size
12335Bound on size of expressions used in the scalar evolutions analyzer.
12336Large expressions slow the analyzer.
12337
12338@item scev-max-expr-complexity
12339Bound on the complexity of the expressions in the scalar evolutions analyzer.
12340Complex expressions slow the analyzer.
12341
12342@item max-tree-if-conversion-phi-args
12343Maximum number of arguments in a PHI supported by TREE if conversion
12344unless the loop is marked with simd pragma.
12345
12346@item vect-max-version-for-alignment-checks
12347The maximum number of run-time checks that can be performed when
12348doing loop versioning for alignment in the vectorizer.
12349
12350@item vect-max-version-for-alias-checks
12351The maximum number of run-time checks that can be performed when
12352doing loop versioning for alias in the vectorizer.
12353
12354@item vect-max-peeling-for-alignment
12355The maximum number of loop peels to enhance access alignment
12356for vectorizer. Value -1 means no limit.
12357
12358@item max-iterations-to-track
12359The maximum number of iterations of a loop the brute-force algorithm
12360for analysis of the number of iterations of the loop tries to evaluate.
12361
12362@item hot-bb-count-fraction
12363The denominator n of fraction 1/n of the maximal execution count of a
12364basic block in the entire program that a basic block needs to at least
12365have in order to be considered hot.  The default is 10000, which means
12366that a basic block is considered hot if its execution count is greater
12367than 1/10000 of the maximal execution count.  0 means that it is never
12368considered hot.  Used in non-LTO mode.
12369
12370@item hot-bb-count-ws-permille
12371The number of most executed permilles, ranging from 0 to 1000, of the
12372profiled execution of the entire program to which the execution count
12373of a basic block must be part of in order to be considered hot.  The
12374default is 990, which means that a basic block is considered hot if
12375its execution count contributes to the upper 990 permilles, or 99.0%,
12376of the profiled execution of the entire program.  0 means that it is
12377never considered hot.  Used in LTO mode.
12378
12379@item hot-bb-frequency-fraction
12380The denominator n of fraction 1/n of the execution frequency of the
12381entry block of a function that a basic block of this function needs
12382to at least have in order to be considered hot.  The default is 1000,
12383which means that a basic block is considered hot in a function if it
12384is executed more frequently than 1/1000 of the frequency of the entry
12385block of the function.  0 means that it is never considered hot.
12386
12387@item unlikely-bb-count-fraction
12388The denominator n of fraction 1/n of the number of profiled runs of
12389the entire program below which the execution count of a basic block
12390must be in order for the basic block to be considered unlikely executed.
12391The default is 20, which means that a basic block is considered unlikely
12392executed if it is executed in fewer than 1/20, or 5%, of the runs of
12393the program.  0 means that it is always considered unlikely executed.
12394
12395@item max-predicted-iterations
12396The maximum number of loop iterations we predict statically.  This is useful
12397in cases where a function contains a single loop with known bound and
12398another loop with unknown bound.
12399The known number of iterations is predicted correctly, while
12400the unknown number of iterations average to roughly 10.  This means that the
12401loop without bounds appears artificially cold relative to the other one.
12402
12403@item builtin-expect-probability
12404Control the probability of the expression having the specified value. This
12405parameter takes a percentage (i.e.@: 0 ... 100) as input.
12406
12407@item builtin-string-cmp-inline-length
12408The maximum length of a constant string for a builtin string cmp call
12409eligible for inlining.
12410
12411@item align-threshold
12412
12413Select fraction of the maximal frequency of executions of a basic block in
12414a function to align the basic block.
12415
12416@item align-loop-iterations
12417
12418A loop expected to iterate at least the selected number of iterations is
12419aligned.
12420
12421@item tracer-dynamic-coverage
12422@itemx tracer-dynamic-coverage-feedback
12423
12424This value is used to limit superblock formation once the given percentage of
12425executed instructions is covered.  This limits unnecessary code size
12426expansion.
12427
12428The @option{tracer-dynamic-coverage-feedback} parameter
12429is used only when profile
12430feedback is available.  The real profiles (as opposed to statically estimated
12431ones) are much less balanced allowing the threshold to be larger value.
12432
12433@item tracer-max-code-growth
12434Stop tail duplication once code growth has reached given percentage.  This is
12435a rather artificial limit, as most of the duplicates are eliminated later in
12436cross jumping, so it may be set to much higher values than is the desired code
12437growth.
12438
12439@item tracer-min-branch-ratio
12440
12441Stop reverse growth when the reverse probability of best edge is less than this
12442threshold (in percent).
12443
12444@item tracer-min-branch-probability
12445@itemx tracer-min-branch-probability-feedback
12446
12447Stop forward growth if the best edge has probability lower than this
12448threshold.
12449
12450Similarly to @option{tracer-dynamic-coverage} two parameters are
12451provided.  @option{tracer-min-branch-probability-feedback} is used for
12452compilation with profile feedback and @option{tracer-min-branch-probability}
12453compilation without.  The value for compilation with profile feedback
12454needs to be more conservative (higher) in order to make tracer
12455effective.
12456
12457@item stack-clash-protection-guard-size
12458Specify the size of the operating system provided stack guard as
124592 raised to @var{num} bytes.  Higher values may reduce the
12460number of explicit probes, but a value larger than the operating system
12461provided guard will leave code vulnerable to stack clash style attacks.
12462
12463@item stack-clash-protection-probe-interval
12464Stack clash protection involves probing stack space as it is allocated.  This
12465param controls the maximum distance between probes into the stack as 2 raised
12466to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
12467larger than the operating system provided guard will leave code vulnerable to
12468stack clash style attacks.
12469
12470@item max-cse-path-length
12471
12472The maximum number of basic blocks on path that CSE considers.
12473
12474@item max-cse-insns
12475The maximum number of instructions CSE processes before flushing.
12476
12477@item ggc-min-expand
12478
12479GCC uses a garbage collector to manage its own memory allocation.  This
12480parameter specifies the minimum percentage by which the garbage
12481collector's heap should be allowed to expand between collections.
12482Tuning this may improve compilation speed; it has no effect on code
12483generation.
12484
12485The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12486RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
12487the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
12488GCC is not able to calculate RAM on a particular platform, the lower
12489bound of 30% is used.  Setting this parameter and
12490@option{ggc-min-heapsize} to zero causes a full collection to occur at
12491every opportunity.  This is extremely slow, but can be useful for
12492debugging.
12493
12494@item ggc-min-heapsize
12495
12496Minimum size of the garbage collector's heap before it begins bothering
12497to collect garbage.  The first collection occurs after the heap expands
12498by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
12499tuning this may improve compilation speed, and has no effect on code
12500generation.
12501
12502The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12503tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12504with a lower bound of 4096 (four megabytes) and an upper bound of
12505131072 (128 megabytes).  If GCC is not able to calculate RAM on a
12506particular platform, the lower bound is used.  Setting this parameter
12507very large effectively disables garbage collection.  Setting this
12508parameter and @option{ggc-min-expand} to zero causes a full collection
12509to occur at every opportunity.
12510
12511@item max-reload-search-insns
12512The maximum number of instruction reload should look backward for equivalent
12513register.  Increasing values mean more aggressive optimization, making the
12514compilation time increase with probably slightly better performance.
12515
12516@item max-cselib-memory-locations
12517The maximum number of memory locations cselib should take into account.
12518Increasing values mean more aggressive optimization, making the compilation time
12519increase with probably slightly better performance.
12520
12521@item max-sched-ready-insns
12522The maximum number of instructions ready to be issued the scheduler should
12523consider at any given time during the first scheduling pass.  Increasing
12524values mean more thorough searches, making the compilation time increase
12525with probably little benefit.
12526
12527@item max-sched-region-blocks
12528The maximum number of blocks in a region to be considered for
12529interblock scheduling.
12530
12531@item max-pipeline-region-blocks
12532The maximum number of blocks in a region to be considered for
12533pipelining in the selective scheduler.
12534
12535@item max-sched-region-insns
12536The maximum number of insns in a region to be considered for
12537interblock scheduling.
12538
12539@item max-pipeline-region-insns
12540The maximum number of insns in a region to be considered for
12541pipelining in the selective scheduler.
12542
12543@item min-spec-prob
12544The minimum probability (in percents) of reaching a source block
12545for interblock speculative scheduling.
12546
12547@item max-sched-extend-regions-iters
12548The maximum number of iterations through CFG to extend regions.
12549A value of 0 disables region extensions.
12550
12551@item max-sched-insn-conflict-delay
12552The maximum conflict delay for an insn to be considered for speculative motion.
12553
12554@item sched-spec-prob-cutoff
12555The minimal probability of speculation success (in percents), so that
12556speculative insns are scheduled.
12557
12558@item sched-state-edge-prob-cutoff
12559The minimum probability an edge must have for the scheduler to save its
12560state across it.
12561
12562@item sched-mem-true-dep-cost
12563Minimal distance (in CPU cycles) between store and load targeting same
12564memory locations.
12565
12566@item selsched-max-lookahead
12567The maximum size of the lookahead window of selective scheduling.  It is a
12568depth of search for available instructions.
12569
12570@item selsched-max-sched-times
12571The maximum number of times that an instruction is scheduled during
12572selective scheduling.  This is the limit on the number of iterations
12573through which the instruction may be pipelined.
12574
12575@item selsched-insns-to-rename
12576The maximum number of best instructions in the ready list that are considered
12577for renaming in the selective scheduler.
12578
12579@item sms-min-sc
12580The minimum value of stage count that swing modulo scheduler
12581generates.
12582
12583@item max-last-value-rtl
12584The maximum size measured as number of RTLs that can be recorded in an expression
12585in combiner for a pseudo register as last known value of that register.
12586
12587@item max-combine-insns
12588The maximum number of instructions the RTL combiner tries to combine.
12589
12590@item integer-share-limit
12591Small integer constants can use a shared data structure, reducing the
12592compiler's memory usage and increasing its speed.  This sets the maximum
12593value of a shared integer constant.
12594
12595@item ssp-buffer-size
12596The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12597protection when @option{-fstack-protection} is used.
12598
12599@item min-size-for-stack-sharing
12600The minimum size of variables taking part in stack slot sharing when not
12601optimizing.
12602
12603@item max-jump-thread-duplication-stmts
12604Maximum number of statements allowed in a block that needs to be
12605duplicated when threading jumps.
12606
12607@item max-fields-for-field-sensitive
12608Maximum number of fields in a structure treated in
12609a field sensitive manner during pointer analysis.
12610
12611@item prefetch-latency
12612Estimate on average number of instructions that are executed before
12613prefetch finishes.  The distance prefetched ahead is proportional
12614to this constant.  Increasing this number may also lead to less
12615streams being prefetched (see @option{simultaneous-prefetches}).
12616
12617@item simultaneous-prefetches
12618Maximum number of prefetches that can run at the same time.
12619
12620@item l1-cache-line-size
12621The size of cache line in L1 data cache, in bytes.
12622
12623@item l1-cache-size
12624The size of L1 data cache, in kilobytes.
12625
12626@item l2-cache-size
12627The size of L2 data cache, in kilobytes.
12628
12629@item prefetch-dynamic-strides
12630Whether the loop array prefetch pass should issue software prefetch hints
12631for strides that are non-constant.  In some cases this may be
12632beneficial, though the fact the stride is non-constant may make it
12633hard to predict when there is clear benefit to issuing these hints.
12634
12635Set to 1 if the prefetch hints should be issued for non-constant
12636strides.  Set to 0 if prefetch hints should be issued only for strides that
12637are known to be constant and below @option{prefetch-minimum-stride}.
12638
12639@item prefetch-minimum-stride
12640Minimum constant stride, in bytes, to start using prefetch hints for.  If
12641the stride is less than this threshold, prefetch hints will not be issued.
12642
12643This setting is useful for processors that have hardware prefetchers, in
12644which case there may be conflicts between the hardware prefetchers and
12645the software prefetchers.  If the hardware prefetchers have a maximum
12646stride they can handle, it should be used here to improve the use of
12647software prefetchers.
12648
12649A value of -1 means we don't have a threshold and therefore
12650prefetch hints can be issued for any constant stride.
12651
12652This setting is only useful for strides that are known and constant.
12653
12654@item loop-interchange-max-num-stmts
12655The maximum number of stmts in a loop to be interchanged.
12656
12657@item loop-interchange-stride-ratio
12658The minimum ratio between stride of two loops for interchange to be profitable.
12659
12660@item min-insn-to-prefetch-ratio
12661The minimum ratio between the number of instructions and the
12662number of prefetches to enable prefetching in a loop.
12663
12664@item prefetch-min-insn-to-mem-ratio
12665The minimum ratio between the number of instructions and the
12666number of memory references to enable prefetching in a loop.
12667
12668@item use-canonical-types
12669Whether the compiler should use the ``canonical'' type system.
12670Should always be 1, which uses a more efficient internal
12671mechanism for comparing types in C++ and Objective-C++.  However, if
12672bugs in the canonical type system are causing compilation failures,
12673set this value to 0 to disable canonical types.
12674
12675@item switch-conversion-max-branch-ratio
12676Switch initialization conversion refuses to create arrays that are
12677bigger than @option{switch-conversion-max-branch-ratio} times the number of
12678branches in the switch.
12679
12680@item max-partial-antic-length
12681Maximum length of the partial antic set computed during the tree
12682partial redundancy elimination optimization (@option{-ftree-pre}) when
12683optimizing at @option{-O3} and above.  For some sorts of source code
12684the enhanced partial redundancy elimination optimization can run away,
12685consuming all of the memory available on the host machine.  This
12686parameter sets a limit on the length of the sets that are computed,
12687which prevents the runaway behavior.  Setting a value of 0 for
12688this parameter allows an unlimited set length.
12689
12690@item rpo-vn-max-loop-depth
12691Maximum loop depth that is value-numbered optimistically.
12692When the limit hits the innermost
12693@var{rpo-vn-max-loop-depth} loops and the outermost loop in the
12694loop nest are value-numbered optimistically and the remaining ones not.
12695
12696@item sccvn-max-alias-queries-per-access
12697Maximum number of alias-oracle queries we perform when looking for
12698redundancies for loads and stores.  If this limit is hit the search
12699is aborted and the load or store is not considered redundant.  The
12700number of queries is algorithmically limited to the number of
12701stores on all paths from the load to the function entry.
12702
12703@item ira-max-loops-num
12704IRA uses regional register allocation by default.  If a function
12705contains more loops than the number given by this parameter, only at most
12706the given number of the most frequently-executed loops form regions
12707for regional register allocation.
12708
12709@item ira-max-conflict-table-size
12710Although IRA uses a sophisticated algorithm to compress the conflict
12711table, the table can still require excessive amounts of memory for
12712huge functions.  If the conflict table for a function could be more
12713than the size in MB given by this parameter, the register allocator
12714instead uses a faster, simpler, and lower-quality
12715algorithm that does not require building a pseudo-register conflict table.
12716
12717@item ira-loop-reserved-regs
12718IRA can be used to evaluate more accurate register pressure in loops
12719for decisions to move loop invariants (see @option{-O3}).  The number
12720of available registers reserved for some other purposes is given
12721by this parameter.  Default of the parameter
12722is the best found from numerous experiments.
12723
12724@item lra-inheritance-ebb-probability-cutoff
12725LRA tries to reuse values reloaded in registers in subsequent insns.
12726This optimization is called inheritance.  EBB is used as a region to
12727do this optimization.  The parameter defines a minimal fall-through
12728edge probability in percentage used to add BB to inheritance EBB in
12729LRA.  The default value was chosen
12730from numerous runs of SPEC2000 on x86-64.
12731
12732@item loop-invariant-max-bbs-in-loop
12733Loop invariant motion can be very expensive, both in compilation time and
12734in amount of needed compile-time memory, with very large loops.  Loops
12735with more basic blocks than this parameter won't have loop invariant
12736motion optimization performed on them.
12737
12738@item loop-max-datarefs-for-datadeps
12739Building data dependencies is expensive for very large loops.  This
12740parameter limits the number of data references in loops that are
12741considered for data dependence analysis.  These large loops are no
12742handled by the optimizations using loop data dependencies.
12743
12744@item max-vartrack-size
12745Sets a maximum number of hash table slots to use during variable
12746tracking dataflow analysis of any function.  If this limit is exceeded
12747with variable tracking at assignments enabled, analysis for that
12748function is retried without it, after removing all debug insns from
12749the function.  If the limit is exceeded even without debug insns, var
12750tracking analysis is completely disabled for the function.  Setting
12751the parameter to zero makes it unlimited.
12752
12753@item max-vartrack-expr-depth
12754Sets a maximum number of recursion levels when attempting to map
12755variable names or debug temporaries to value expressions.  This trades
12756compilation time for more complete debug information.  If this is set too
12757low, value expressions that are available and could be represented in
12758debug information may end up not being used; setting this higher may
12759enable the compiler to find more complex debug expressions, but compile
12760time and memory use may grow.
12761
12762@item max-debug-marker-count
12763Sets a threshold on the number of debug markers (e.g.@: begin stmt
12764markers) to avoid complexity explosion at inlining or expanding to RTL.
12765If a function has more such gimple stmts than the set limit, such stmts
12766will be dropped from the inlined copy of a function, and from its RTL
12767expansion.
12768
12769@item min-nondebug-insn-uid
12770Use uids starting at this parameter for nondebug insns.  The range below
12771the parameter is reserved exclusively for debug insns created by
12772@option{-fvar-tracking-assignments}, but debug insns may get
12773(non-overlapping) uids above it if the reserved range is exhausted.
12774
12775@item ipa-sra-ptr-growth-factor
12776IPA-SRA replaces a pointer to an aggregate with one or more new
12777parameters only when their cumulative size is less or equal to
12778@option{ipa-sra-ptr-growth-factor} times the size of the original
12779pointer parameter.
12780
12781@item ipa-sra-max-replacements
12782Maximum pieces of an aggregate that IPA-SRA tracks.  As a
12783consequence, it is also the maximum number of replacements of a formal
12784parameter.
12785
12786@item sra-max-scalarization-size-Ospeed
12787@itemx sra-max-scalarization-size-Osize
12788The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12789replace scalar parts of aggregates with uses of independent scalar
12790variables.  These parameters control the maximum size, in storage units,
12791of aggregate which is considered for replacement when compiling for
12792speed
12793(@option{sra-max-scalarization-size-Ospeed}) or size
12794(@option{sra-max-scalarization-size-Osize}) respectively.
12795
12796@item sra-max-propagations
12797The maximum number of artificial accesses that Scalar Replacement of
12798Aggregates (SRA) will track, per one local variable, in order to
12799facilitate copy propagation.
12800
12801@item tm-max-aggregate-size
12802When making copies of thread-local variables in a transaction, this
12803parameter specifies the size in bytes after which variables are
12804saved with the logging functions as opposed to save/restore code
12805sequence pairs.  This option only applies when using
12806@option{-fgnu-tm}.
12807
12808@item graphite-max-nb-scop-params
12809To avoid exponential effects in the Graphite loop transforms, the
12810number of parameters in a Static Control Part (SCoP) is bounded.
12811A value of zero can be used to lift
12812the bound.  A variable whose value is unknown at compilation time and
12813defined outside a SCoP is a parameter of the SCoP.
12814
12815@item loop-block-tile-size
12816Loop blocking or strip mining transforms, enabled with
12817@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12818loop in the loop nest by a given number of iterations.  The strip
12819length can be changed using the @option{loop-block-tile-size}
12820parameter.
12821
12822@item ipa-cp-value-list-size
12823IPA-CP attempts to track all possible values and types passed to a function's
12824parameter in order to propagate them and perform devirtualization.
12825@option{ipa-cp-value-list-size} is the maximum number of values and types it
12826stores per one formal parameter of a function.
12827
12828@item ipa-cp-eval-threshold
12829IPA-CP calculates its own score of cloning profitability heuristics
12830and performs those cloning opportunities with scores that exceed
12831@option{ipa-cp-eval-threshold}.
12832
12833@item ipa-cp-max-recursive-depth
12834Maximum depth of recursive cloning for self-recursive function.
12835
12836@item ipa-cp-min-recursive-probability
12837Recursive cloning only when the probability of call being executed exceeds
12838the parameter.
12839
12840@item ipa-cp-recursion-penalty
12841Percentage penalty the recursive functions will receive when they
12842are evaluated for cloning.
12843
12844@item ipa-cp-single-call-penalty
12845Percentage penalty functions containing a single call to another
12846function will receive when they are evaluated for cloning.
12847
12848@item ipa-max-agg-items
12849IPA-CP is also capable to propagate a number of scalar values passed
12850in an aggregate. @option{ipa-max-agg-items} controls the maximum
12851number of such values per one parameter.
12852
12853@item ipa-cp-loop-hint-bonus
12854When IPA-CP determines that a cloning candidate would make the number
12855of iterations of a loop known, it adds a bonus of
12856@option{ipa-cp-loop-hint-bonus} to the profitability score of
12857the candidate.
12858
12859@item ipa-max-aa-steps
12860During its analysis of function bodies, IPA-CP employs alias analysis
12861in order to track values pointed to by function parameters.  In order
12862not spend too much time analyzing huge functions, it gives up and
12863consider all memory clobbered after examining
12864@option{ipa-max-aa-steps} statements modifying memory.
12865
12866@item ipa-max-switch-predicate-bounds
12867Maximal number of boundary endpoints of case ranges of switch statement.
12868For switch exceeding this limit, IPA-CP will not construct cloning cost
12869predicate, which is used to estimate cloning benefit, for default case
12870of the switch statement.
12871
12872@item ipa-max-param-expr-ops
12873IPA-CP will analyze conditional statement that references some function
12874parameter to estimate benefit for cloning upon certain constant value.
12875But if number of operations in a parameter expression exceeds
12876@option{ipa-max-param-expr-ops}, the expression is treated as complicated
12877one, and is not handled by IPA analysis.
12878
12879@item lto-partitions
12880Specify desired number of partitions produced during WHOPR compilation.
12881The number of partitions should exceed the number of CPUs used for compilation.
12882
12883@item lto-min-partition
12884Size of minimal partition for WHOPR (in estimated instructions).
12885This prevents expenses of splitting very small programs into too many
12886partitions.
12887
12888@item lto-max-partition
12889Size of max partition for WHOPR (in estimated instructions).
12890to provide an upper bound for individual size of partition.
12891Meant to be used only with balanced partitioning.
12892
12893@item lto-max-streaming-parallelism
12894Maximal number of parallel processes used for LTO streaming.
12895
12896@item cxx-max-namespaces-for-diagnostic-help
12897The maximum number of namespaces to consult for suggestions when C++
12898name lookup fails for an identifier.
12899
12900@item sink-frequency-threshold
12901The maximum relative execution frequency (in percents) of the target block
12902relative to a statement's original block to allow statement sinking of a
12903statement.  Larger numbers result in more aggressive statement sinking.
12904A small positive adjustment is applied for
12905statements with memory operands as those are even more profitable so sink.
12906
12907@item max-stores-to-sink
12908The maximum number of conditional store pairs that can be sunk.  Set to 0
12909if either vectorization (@option{-ftree-vectorize}) or if-conversion
12910(@option{-ftree-loop-if-convert}) is disabled.
12911
12912@item case-values-threshold
12913The smallest number of different values for which it is best to use a
12914jump-table instead of a tree of conditional branches.  If the value is
129150, use the default for the machine.
12916
12917@item jump-table-max-growth-ratio-for-size
12918The maximum code size growth ratio when expanding
12919into a jump table (in percent).  The parameter is used when
12920optimizing for size.
12921
12922@item jump-table-max-growth-ratio-for-speed
12923The maximum code size growth ratio when expanding
12924into a jump table (in percent).  The parameter is used when
12925optimizing for speed.
12926
12927@item tree-reassoc-width
12928Set the maximum number of instructions executed in parallel in
12929reassociated tree. This parameter overrides target dependent
12930heuristics used by default if has non zero value.
12931
12932@item sched-pressure-algorithm
12933Choose between the two available implementations of
12934@option{-fsched-pressure}.  Algorithm 1 is the original implementation
12935and is the more likely to prevent instructions from being reordered.
12936Algorithm 2 was designed to be a compromise between the relatively
12937conservative approach taken by algorithm 1 and the rather aggressive
12938approach taken by the default scheduler.  It relies more heavily on
12939having a regular register file and accurate register pressure classes.
12940See @file{haifa-sched.c} in the GCC sources for more details.
12941
12942The default choice depends on the target.
12943
12944@item max-slsr-cand-scan
12945Set the maximum number of existing candidates that are considered when
12946seeking a basis for a new straight-line strength reduction candidate.
12947
12948@item asan-globals
12949Enable buffer overflow detection for global objects.  This kind
12950of protection is enabled by default if you are using
12951@option{-fsanitize=address} option.
12952To disable global objects protection use @option{--param asan-globals=0}.
12953
12954@item asan-stack
12955Enable buffer overflow detection for stack objects.  This kind of
12956protection is enabled by default when using @option{-fsanitize=address}.
12957To disable stack protection use @option{--param asan-stack=0} option.
12958
12959@item asan-instrument-reads
12960Enable buffer overflow detection for memory reads.  This kind of
12961protection is enabled by default when using @option{-fsanitize=address}.
12962To disable memory reads protection use
12963@option{--param asan-instrument-reads=0}.
12964
12965@item asan-instrument-writes
12966Enable buffer overflow detection for memory writes.  This kind of
12967protection is enabled by default when using @option{-fsanitize=address}.
12968To disable memory writes protection use
12969@option{--param asan-instrument-writes=0} option.
12970
12971@item asan-memintrin
12972Enable detection for built-in functions.  This kind of protection
12973is enabled by default when using @option{-fsanitize=address}.
12974To disable built-in functions protection use
12975@option{--param asan-memintrin=0}.
12976
12977@item asan-use-after-return
12978Enable detection of use-after-return.  This kind of protection
12979is enabled by default when using the @option{-fsanitize=address} option.
12980To disable it use @option{--param asan-use-after-return=0}.
12981
12982Note: By default the check is disabled at run time.  To enable it,
12983add @code{detect_stack_use_after_return=1} to the environment variable
12984@env{ASAN_OPTIONS}.
12985
12986@item asan-instrumentation-with-call-threshold
12987If number of memory accesses in function being instrumented
12988is greater or equal to this number, use callbacks instead of inline checks.
12989E.g. to disable inline code use
12990@option{--param asan-instrumentation-with-call-threshold=0}.
12991
12992@item use-after-scope-direct-emission-threshold
12993If the size of a local variable in bytes is smaller or equal to this
12994number, directly poison (or unpoison) shadow memory instead of using
12995run-time callbacks.
12996
12997@item max-fsm-thread-path-insns
12998Maximum number of instructions to copy when duplicating blocks on a
12999finite state automaton jump thread path.
13000
13001@item max-fsm-thread-length
13002Maximum number of basic blocks on a finite state automaton jump thread
13003path.
13004
13005@item max-fsm-thread-paths
13006Maximum number of new jump thread paths to create for a finite state
13007automaton.
13008
13009@item parloops-chunk-size
13010Chunk size of omp schedule for loops parallelized by parloops.
13011
13012@item parloops-schedule
13013Schedule type of omp schedule for loops parallelized by parloops (static,
13014dynamic, guided, auto, runtime).
13015
13016@item parloops-min-per-thread
13017The minimum number of iterations per thread of an innermost parallelized
13018loop for which the parallelized variant is preferred over the single threaded
13019one.  Note that for a parallelized loop nest the
13020minimum number of iterations of the outermost loop per thread is two.
13021
13022@item max-ssa-name-query-depth
13023Maximum depth of recursion when querying properties of SSA names in things
13024like fold routines.  One level of recursion corresponds to following a
13025use-def chain.
13026
13027@item hsa-gen-debug-stores
13028Enable emission of special debug stores within HSA kernels which are
13029then read and reported by libgomp plugin.  Generation of these stores
13030is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
13031enable it.
13032
13033@item max-speculative-devirt-maydefs
13034The maximum number of may-defs we analyze when looking for a must-def
13035specifying the dynamic type of an object that invokes a virtual call
13036we may be able to devirtualize speculatively.
13037
13038@item max-vrp-switch-assertions
13039The maximum number of assertions to add along the default edge of a switch
13040statement during VRP.
13041
13042@item unroll-jam-min-percent
13043The minimum percentage of memory references that must be optimized
13044away for the unroll-and-jam transformation to be considered profitable.
13045
13046@item unroll-jam-max-unroll
13047The maximum number of times the outer loop should be unrolled by
13048the unroll-and-jam transformation.
13049
13050@item max-rtl-if-conversion-unpredictable-cost
13051Maximum permissible cost for the sequence that would be generated
13052by the RTL if-conversion pass for a branch that is considered unpredictable.
13053
13054@item max-variable-expansions-in-unroller
13055If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13056of times that an individual variable will be expanded during loop unrolling.
13057
13058@item tracer-min-branch-probability-feedback
13059Stop forward growth if the probability of best edge is less than
13060this threshold (in percent). Used when profile feedback is available.
13061
13062@item partial-inlining-entry-probability
13063Maximum probability of the entry BB of split region
13064(in percent relative to entry BB of the function)
13065to make partial inlining happen.
13066
13067@item max-tracked-strlens
13068Maximum number of strings for which strlen optimization pass will
13069track string lengths.
13070
13071@item gcse-after-reload-partial-fraction
13072The threshold ratio for performing partial redundancy
13073elimination after reload.
13074
13075@item gcse-after-reload-critical-fraction
13076The threshold ratio of critical edges execution count that
13077permit performing redundancy elimination after reload.
13078
13079@item max-loop-header-insns
13080The maximum number of insns in loop header duplicated
13081by the copy loop headers pass.
13082
13083@item vect-epilogues-nomask
13084Enable loop epilogue vectorization using smaller vector size.
13085
13086@item slp-max-insns-in-bb
13087Maximum number of instructions in basic block to be
13088considered for SLP vectorization.
13089
13090@item avoid-fma-max-bits
13091Maximum number of bits for which we avoid creating FMAs.
13092
13093@item sms-loop-average-count-threshold
13094A threshold on the average loop count considered by the swing modulo scheduler.
13095
13096@item sms-dfa-history
13097The number of cycles the swing modulo scheduler considers when checking
13098conflicts using DFA.
13099
13100@item max-inline-insns-recursive-auto
13101The maximum number of instructions non-inline function
13102can grow to via recursive inlining.
13103
13104@item graphite-allow-codegen-errors
13105Whether codegen errors should be ICEs when @option{-fchecking}.
13106
13107@item sms-max-ii-factor
13108A factor for tuning the upper bound that swing modulo scheduler
13109uses for scheduling a loop.
13110
13111@item lra-max-considered-reload-pseudos
13112The max number of reload pseudos which are considered during
13113spilling a non-reload pseudo.
13114
13115@item max-pow-sqrt-depth
13116Maximum depth of sqrt chains to use when synthesizing exponentiation
13117by a real constant.
13118
13119@item max-dse-active-local-stores
13120Maximum number of active local stores in RTL dead store elimination.
13121
13122@item asan-instrument-allocas
13123Enable asan allocas/VLAs protection.
13124
13125@item max-iterations-computation-cost
13126Bound on the cost of an expression to compute the number of iterations.
13127
13128@item max-isl-operations
13129Maximum number of isl operations, 0 means unlimited.
13130
13131@item graphite-max-arrays-per-scop
13132Maximum number of arrays per scop.
13133
13134@item max-vartrack-reverse-op-size
13135Max. size of loc list for which reverse ops should be added.
13136
13137@item tracer-dynamic-coverage-feedback
13138The percentage of function, weighted by execution frequency,
13139that must be covered by trace formation.
13140Used when profile feedback is available.
13141
13142@item max-inline-recursive-depth-auto
13143The maximum depth of recursive inlining for non-inline functions.
13144
13145@item fsm-scale-path-stmts
13146Scale factor to apply to the number of statements in a threading path
13147when comparing to the number of (scaled) blocks.
13148
13149@item fsm-maximum-phi-arguments
13150Maximum number of arguments a PHI may have before the FSM threader
13151will not try to thread through its block.
13152
13153@item uninit-control-dep-attempts
13154Maximum number of nested calls to search for control dependencies
13155during uninitialized variable analysis.
13156
13157@item sra-max-scalarization-size-Osize
13158Maximum size, in storage units, of an aggregate
13159which should be considered for scalarization when compiling for size.
13160
13161@item fsm-scale-path-blocks
13162Scale factor to apply to the number of blocks in a threading path
13163when comparing to the number of (scaled) statements.
13164
13165@item sched-autopref-queue-depth
13166Hardware autoprefetcher scheduler model control flag.
13167Number of lookahead cycles the model looks into; at '
13168' only enable instruction sorting heuristic.
13169
13170@item loop-versioning-max-inner-insns
13171The maximum number of instructions that an inner loop can have
13172before the loop versioning pass considers it too big to copy.
13173
13174@item loop-versioning-max-outer-insns
13175The maximum number of instructions that an outer loop can have
13176before the loop versioning pass considers it too big to copy,
13177discounting any instructions in inner loops that directly benefit
13178from versioning.
13179
13180@item ssa-name-def-chain-limit
13181The maximum number of SSA_NAME assignments to follow in determining
13182a property of a variable such as its value.  This limits the number
13183of iterations or recursive calls GCC performs when optimizing certain
13184statements or when determining their validity prior to issuing
13185diagnostics.
13186
13187@item store-merging-max-size
13188Maximum size of a single store merging region in bytes.
13189
13190@item hash-table-verification-limit
13191The number of elements for which hash table verification is done
13192for each searched element.
13193
13194@item max-find-base-term-values
13195Maximum number of VALUEs handled during a single find_base_term call.
13196
13197@item analyzer-max-enodes-per-program-point
13198The maximum number of exploded nodes per program point within
13199the analyzer, before terminating analysis of that point.
13200
13201@item analyzer-min-snodes-for-call-summary
13202The minimum number of supernodes within a function for the
13203analyzer to consider summarizing its effects at call sites.
13204
13205@item analyzer-max-recursion-depth
13206The maximum number of times a callsite can appear in a call stack
13207within the analyzer, before terminating analysis of a call that would
13208recurse deeper.
13209
13210@item gimple-fe-computed-hot-bb-threshold
13211The number of executions of a basic block which is considered hot.
13212The parameter is used only in GIMPLE FE.
13213
13214@item analyzer-bb-explosion-factor
13215The maximum number of 'after supernode' exploded nodes within the analyzer
13216per supernode, before terminating analysis.
13217
13218@end table
13219
13220The following choices of @var{name} are available on AArch64 targets:
13221
13222@table @gcctabopt
13223@item aarch64-sve-compare-costs
13224When vectorizing for SVE, consider using ``unpacked'' vectors for
13225smaller elements and use the cost model to pick the cheapest approach.
13226Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13227
13228Using unpacked vectors includes storing smaller elements in larger
13229containers and accessing elements with extending loads and truncating
13230stores.
13231
13232@item aarch64-float-recp-precision
13233The number of Newton iterations for calculating the reciprocal for float type.
13234The precision of division is proportional to this param when division
13235approximation is enabled.  The default value is 1.
13236
13237@item aarch64-double-recp-precision
13238The number of Newton iterations for calculating the reciprocal for double type.
13239The precision of division is propotional to this param when division
13240approximation is enabled.  The default value is 2.
13241
13242@item aarch64-autovec-preference
13243Force an ISA selection strategy for auto-vectorization.  Accepts values from
132440 to 4, inclusive.
13245@table @samp
13246@item 0
13247Use the default heuristics.
13248@item 1
13249Use only Advanced SIMD for auto-vectorization.
13250@item 2
13251Use only SVE for auto-vectorization.
13252@item 3
13253Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
13254deemed equal.
13255@item 4
13256Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
13257@end table
13258The default value is 0.
13259
13260@end table
13261
13262@end table
13263
13264@node Instrumentation Options
13265@section Program Instrumentation Options
13266@cindex instrumentation options
13267@cindex program instrumentation options
13268@cindex run-time error checking options
13269@cindex profiling options
13270@cindex options, program instrumentation
13271@cindex options, run-time error checking
13272@cindex options, profiling
13273
13274GCC supports a number of command-line options that control adding
13275run-time instrumentation to the code it normally generates.
13276For example, one purpose of instrumentation is collect profiling
13277statistics for use in finding program hot spots, code coverage
13278analysis, or profile-guided optimizations.
13279Another class of program instrumentation is adding run-time checking
13280to detect programming errors like invalid pointer
13281dereferences or out-of-bounds array accesses, as well as deliberately
13282hostile attacks such as stack smashing or C++ vtable hijacking.
13283There is also a general hook which can be used to implement other
13284forms of tracing or function-level instrumentation for debug or
13285program analysis purposes.
13286
13287@table @gcctabopt
13288@cindex @command{prof}
13289@cindex @command{gprof}
13290@item -p
13291@itemx -pg
13292@opindex p
13293@opindex pg
13294Generate extra code to write profile information suitable for the
13295analysis program @command{prof} (for @option{-p}) or @command{gprof}
13296(for @option{-pg}).  You must use this option when compiling
13297the source files you want data about, and you must also use it when
13298linking.
13299
13300You can use the function attribute @code{no_instrument_function} to
13301suppress profiling of individual functions when compiling with these options.
13302@xref{Common Function Attributes}.
13303
13304@item -fprofile-arcs
13305@opindex fprofile-arcs
13306Add code so that program flow @dfn{arcs} are instrumented.  During
13307execution the program records how many times each branch and call is
13308executed and how many times it is taken or returns.  On targets that support
13309constructors with priority support, profiling properly handles constructors,
13310destructors and C++ constructors (and destructors) of classes which are used
13311as a type of a global variable.
13312
13313When the compiled
13314program exits it saves this data to a file called
13315@file{@var{auxname}.gcda} for each source file.  The data may be used for
13316profile-directed optimizations (@option{-fbranch-probabilities}), or for
13317test coverage analysis (@option{-ftest-coverage}).  Each object file's
13318@var{auxname} is generated from the name of the output file, if
13319explicitly specified and it is not the final executable, otherwise it is
13320the basename of the source file.  In both cases any suffix is removed
13321(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13322@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13323@xref{Cross-profiling}.
13324
13325@cindex @command{gcov}
13326@item --coverage
13327@opindex coverage
13328
13329This option is used to compile and link code instrumented for coverage
13330analysis.  The option is a synonym for @option{-fprofile-arcs}
13331@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13332linking).  See the documentation for those options for more details.
13333
13334@itemize
13335
13336@item
13337Compile the source files with @option{-fprofile-arcs} plus optimization
13338and code generation options.  For test coverage analysis, use the
13339additional @option{-ftest-coverage} option.  You do not need to profile
13340every source file in a program.
13341
13342@item
13343Compile the source files additionally with @option{-fprofile-abs-path}
13344to create absolute path names in the @file{.gcno} files.  This allows
13345@command{gcov} to find the correct sources in projects where compilations
13346occur with different working directories.
13347
13348@item
13349Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13350(the latter implies the former).
13351
13352@item
13353Run the program on a representative workload to generate the arc profile
13354information.  This may be repeated any number of times.  You can run
13355concurrent instances of your program, and provided that the file system
13356supports locking, the data files will be correctly updated.  Unless
13357a strict ISO C dialect option is in effect, @code{fork} calls are
13358detected and correctly handled without double counting.
13359
13360@item
13361For profile-directed optimizations, compile the source files again with
13362the same optimization and code generation options plus
13363@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13364Control Optimization}).
13365
13366@item
13367For test coverage analysis, use @command{gcov} to produce human readable
13368information from the @file{.gcno} and @file{.gcda} files.  Refer to the
13369@command{gcov} documentation for further information.
13370
13371@end itemize
13372
13373With @option{-fprofile-arcs}, for each function of your program GCC
13374creates a program flow graph, then finds a spanning tree for the graph.
13375Only arcs that are not on the spanning tree have to be instrumented: the
13376compiler adds code to count the number of times that these arcs are
13377executed.  When an arc is the only exit or only entrance to a block, the
13378instrumentation code can be added to the block; otherwise, a new basic
13379block must be created to hold the instrumentation code.
13380
13381@need 2000
13382@item -ftest-coverage
13383@opindex ftest-coverage
13384Produce a notes file that the @command{gcov} code-coverage utility
13385(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13386show program coverage.  Each source file's note file is called
13387@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
13388above for a description of @var{auxname} and instructions on how to
13389generate test coverage data.  Coverage data matches the source files
13390more closely if you do not optimize.
13391
13392@item -fprofile-abs-path
13393@opindex fprofile-abs-path
13394Automatically convert relative source file names to absolute path names
13395in the @file{.gcno} files.  This allows @command{gcov} to find the correct
13396sources in projects where compilations occur with different working
13397directories.
13398
13399@item -fprofile-dir=@var{path}
13400@opindex fprofile-dir
13401
13402Set the directory to search for the profile data files in to @var{path}.
13403This option affects only the profile data generated by
13404@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13405and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13406and its related options.  Both absolute and relative paths can be used.
13407By default, GCC uses the current directory as @var{path}, thus the
13408profile data file appears in the same directory as the object file.
13409In order to prevent the file name clashing, if the object file name is
13410not an absolute path, we mangle the absolute path of the
13411@file{@var{sourcename}.gcda} file and use it as the file name of a
13412@file{.gcda} file.  See similar option @option{-fprofile-note}.
13413
13414When an executable is run in a massive parallel environment, it is recommended
13415to save profile to different folders.  That can be done with variables
13416in @var{path} that are exported during run-time:
13417
13418@table @gcctabopt
13419
13420@item %p
13421process ID.
13422
13423@item %q@{VAR@}
13424value of environment variable @var{VAR}
13425
13426@end table
13427
13428@item -fprofile-generate
13429@itemx -fprofile-generate=@var{path}
13430@opindex fprofile-generate
13431
13432Enable options usually used for instrumenting application to produce
13433profile useful for later recompilation with profile feedback based
13434optimization.  You must use @option{-fprofile-generate} both when
13435compiling and when linking your program.
13436
13437The following options are enabled:
13438@option{-fprofile-arcs}, @option{-fprofile-values},
13439@option{-finline-functions}, and @option{-fipa-bit-cp}.
13440
13441If @var{path} is specified, GCC looks at the @var{path} to find
13442the profile feedback data files. See @option{-fprofile-dir}.
13443
13444To optimize the program based on the collected profile information, use
13445@option{-fprofile-use}.  @xref{Optimize Options}, for more information.
13446
13447@item -fprofile-note=@var{path}
13448@opindex fprofile-note
13449
13450If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13451location.  If you combine the option with multiple source files,
13452the @file{.gcno} file will be overwritten.
13453
13454@item -fprofile-prefix-path=@var{path}
13455@opindex fprofile-prefix-path
13456
13457This option can be used in combination with
13458@option{profile-generate=}@var{profile_dir} and
13459@option{profile-use=}@var{profile_dir} to inform GCC where is the base
13460directory of built source tree.  By default @var{profile_dir} will contain
13461files with mangled absolute paths of all object files in the built project.
13462This is not desirable when directory used to build the instrumented binary
13463differs from the directory used to build the binary optimized with profile
13464feedback because the profile data will not be found during the optimized build.
13465In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
13466pointing to the base directory of the build can be used to strip the irrelevant
13467part of the path and keep all file names relative to the main build directory.
13468
13469@item -fprofile-update=@var{method}
13470@opindex fprofile-update
13471
13472Alter the update method for an application instrumented for profile
13473feedback based optimization.  The @var{method} argument should be one of
13474@samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13475The first one is useful for single-threaded applications,
13476while the second one prevents profile corruption by emitting thread-safe code.
13477
13478@strong{Warning:} When an application does not properly join all threads
13479(or creates an detached thread), a profile file can be still corrupted.
13480
13481Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13482when supported by a target, or to @samp{single} otherwise.  The GCC driver
13483automatically selects @samp{prefer-atomic} when @option{-pthread}
13484is present in the command line.
13485
13486@item -fprofile-filter-files=@var{regex}
13487@opindex fprofile-filter-files
13488
13489Instrument only functions from files where names match
13490any regular expression (separated by a semi-colon).
13491
13492For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13493only @file{main.c} and all C files starting with 'module'.
13494
13495@item -fprofile-exclude-files=@var{regex}
13496@opindex fprofile-exclude-files
13497
13498Instrument only functions from files where names do not match
13499all the regular expressions (separated by a semi-colon).
13500
13501For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13502of all files that are located in @file{/usr/} folder.
13503
13504@item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
13505@opindex fprofile-reproducible
13506Control level of reproducibility of profile gathered by
13507@code{-fprofile-generate}.  This makes it possible to rebuild program
13508with same outcome which is useful, for example, for distribution
13509packages.
13510
13511With @option{-fprofile-reproducible=serial} the profile gathered by
13512@option{-fprofile-generate} is reproducible provided the trained program
13513behaves the same at each invocation of the train run, it is not
13514multi-threaded and profile data streaming is always done in the same
13515order.  Note that profile streaming happens at the end of program run but
13516also before @code{fork} function is invoked.
13517
13518Note that it is quite common that execution counts of some part of
13519programs depends, for example, on length of temporary file names or
13520memory space randomization (that may affect hash-table collision rate).
13521Such non-reproducible part of programs may be annotated by
13522@code{no_instrument_function} function attribute. @code{gcov-dump} with
13523@option{-l} can be used to dump gathered data and verify that they are
13524indeed reproducible.
13525
13526With @option{-fprofile-reproducible=parallel-runs} collected profile
13527stays reproducible regardless the order of streaming of the data into
13528gcda files.  This setting makes it possible to run multiple instances of
13529instrumented program in parallel (such as with @code{make -j}). This
13530reduces quality of gathered data, in particular of indirect call
13531profiling.
13532
13533@item -fsanitize=address
13534@opindex fsanitize=address
13535Enable AddressSanitizer, a fast memory error detector.
13536Memory access instructions are instrumented to detect
13537out-of-bounds and use-after-free bugs.
13538The option enables @option{-fsanitize-address-use-after-scope}.
13539See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13540more details.  The run-time behavior can be influenced using the
13541@env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
13542the available options are shown at startup of the instrumented program.  See
13543@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13544for a list of supported options.
13545The option cannot be combined with @option{-fsanitize=thread}.
13546
13547@item -fsanitize=kernel-address
13548@opindex fsanitize=kernel-address
13549Enable AddressSanitizer for Linux kernel.
13550See @uref{https://github.com/google/kasan/wiki} for more details.
13551
13552@item -fsanitize=pointer-compare
13553@opindex fsanitize=pointer-compare
13554Instrument comparison operation (<, <=, >, >=) with pointer operands.
13555The option must be combined with either @option{-fsanitize=kernel-address} or
13556@option{-fsanitize=address}
13557The option cannot be combined with @option{-fsanitize=thread}.
13558Note: By default the check is disabled at run time.  To enable it,
13559add @code{detect_invalid_pointer_pairs=2} to the environment variable
13560@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13561invalid operation only when both pointers are non-null.
13562
13563@item -fsanitize=pointer-subtract
13564@opindex fsanitize=pointer-subtract
13565Instrument subtraction with pointer operands.
13566The option must be combined with either @option{-fsanitize=kernel-address} or
13567@option{-fsanitize=address}
13568The option cannot be combined with @option{-fsanitize=thread}.
13569Note: By default the check is disabled at run time.  To enable it,
13570add @code{detect_invalid_pointer_pairs=2} to the environment variable
13571@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13572invalid operation only when both pointers are non-null.
13573
13574@item -fsanitize=thread
13575@opindex fsanitize=thread
13576Enable ThreadSanitizer, a fast data race detector.
13577Memory access instructions are instrumented to detect
13578data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13579details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13580environment variable; see
13581@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13582supported options.
13583The option cannot be combined with @option{-fsanitize=address},
13584@option{-fsanitize=leak}.
13585
13586Note that sanitized atomic builtins cannot throw exceptions when
13587operating on invalid memory addresses with non-call exceptions
13588(@option{-fnon-call-exceptions}).
13589
13590@item -fsanitize=leak
13591@opindex fsanitize=leak
13592Enable LeakSanitizer, a memory leak detector.
13593This option only matters for linking of executables and
13594the executable is linked against a library that overrides @code{malloc}
13595and other allocator functions.  See
13596@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13597details.  The run-time behavior can be influenced using the
13598@env{LSAN_OPTIONS} environment variable.
13599The option cannot be combined with @option{-fsanitize=thread}.
13600
13601@item -fsanitize=undefined
13602@opindex fsanitize=undefined
13603Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13604Various computations are instrumented to detect undefined behavior
13605at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
13606@env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
13607
13608@table @gcctabopt
13609
13610@item -fsanitize=shift
13611@opindex fsanitize=shift
13612This option enables checking that the result of a shift operation is
13613not undefined.  Note that what exactly is considered undefined differs
13614slightly between C and C++, as well as between ISO C90 and C99, etc.
13615This option has two suboptions, @option{-fsanitize=shift-base} and
13616@option{-fsanitize=shift-exponent}.
13617
13618@item -fsanitize=shift-exponent
13619@opindex fsanitize=shift-exponent
13620This option enables checking that the second argument of a shift operation
13621is not negative and is smaller than the precision of the promoted first
13622argument.
13623
13624@item -fsanitize=shift-base
13625@opindex fsanitize=shift-base
13626If the second argument of a shift operation is within range, check that the
13627result of a shift operation is not undefined.  Note that what exactly is
13628considered undefined differs slightly between C and C++, as well as between
13629ISO C90 and C99, etc.
13630
13631@item -fsanitize=integer-divide-by-zero
13632@opindex fsanitize=integer-divide-by-zero
13633Detect integer division by zero as well as @code{INT_MIN / -1} division.
13634
13635@item -fsanitize=unreachable
13636@opindex fsanitize=unreachable
13637With this option, the compiler turns the @code{__builtin_unreachable}
13638call into a diagnostics message call instead.  When reaching the
13639@code{__builtin_unreachable} call, the behavior is undefined.
13640
13641@item -fsanitize=vla-bound
13642@opindex fsanitize=vla-bound
13643This option instructs the compiler to check that the size of a variable
13644length array is positive.
13645
13646@item -fsanitize=null
13647@opindex fsanitize=null
13648This option enables pointer checking.  Particularly, the application
13649built with this option turned on will issue an error message when it
13650tries to dereference a NULL pointer, or if a reference (possibly an
13651rvalue reference) is bound to a NULL pointer, or if a method is invoked
13652on an object pointed by a NULL pointer.
13653
13654@item -fsanitize=return
13655@opindex fsanitize=return
13656This option enables return statement checking.  Programs
13657built with this option turned on will issue an error message
13658when the end of a non-void function is reached without actually
13659returning a value.  This option works in C++ only.
13660
13661@item -fsanitize=signed-integer-overflow
13662@opindex fsanitize=signed-integer-overflow
13663This option enables signed integer overflow checking.  We check that
13664the result of @code{+}, @code{*}, and both unary and binary @code{-}
13665does not overflow in the signed arithmetics.  Note, integer promotion
13666rules must be taken into account.  That is, the following is not an
13667overflow:
13668@smallexample
13669signed char a = SCHAR_MAX;
13670a++;
13671@end smallexample
13672
13673@item -fsanitize=bounds
13674@opindex fsanitize=bounds
13675This option enables instrumentation of array bounds.  Various out of bounds
13676accesses are detected.  Flexible array members, flexible array member-like
13677arrays, and initializers of variables with static storage are not instrumented.
13678
13679@item -fsanitize=bounds-strict
13680@opindex fsanitize=bounds-strict
13681This option enables strict instrumentation of array bounds.  Most out of bounds
13682accesses are detected, including flexible array members and flexible array
13683member-like arrays.  Initializers of variables with static storage are not
13684instrumented.
13685
13686@item -fsanitize=alignment
13687@opindex fsanitize=alignment
13688
13689This option enables checking of alignment of pointers when they are
13690dereferenced, or when a reference is bound to insufficiently aligned target,
13691or when a method or constructor is invoked on insufficiently aligned object.
13692
13693@item -fsanitize=object-size
13694@opindex fsanitize=object-size
13695This option enables instrumentation of memory references using the
13696@code{__builtin_object_size} function.  Various out of bounds pointer
13697accesses are detected.
13698
13699@item -fsanitize=float-divide-by-zero
13700@opindex fsanitize=float-divide-by-zero
13701Detect floating-point division by zero.  Unlike other similar options,
13702@option{-fsanitize=float-divide-by-zero} is not enabled by
13703@option{-fsanitize=undefined}, since floating-point division by zero can
13704be a legitimate way of obtaining infinities and NaNs.
13705
13706@item -fsanitize=float-cast-overflow
13707@opindex fsanitize=float-cast-overflow
13708This option enables floating-point type to integer conversion checking.
13709We check that the result of the conversion does not overflow.
13710Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13711not enabled by @option{-fsanitize=undefined}.
13712This option does not work well with @code{FE_INVALID} exceptions enabled.
13713
13714@item -fsanitize=nonnull-attribute
13715@opindex fsanitize=nonnull-attribute
13716
13717This option enables instrumentation of calls, checking whether null values
13718are not passed to arguments marked as requiring a non-null value by the
13719@code{nonnull} function attribute.
13720
13721@item -fsanitize=returns-nonnull-attribute
13722@opindex fsanitize=returns-nonnull-attribute
13723
13724This option enables instrumentation of return statements in functions
13725marked with @code{returns_nonnull} function attribute, to detect returning
13726of null values from such functions.
13727
13728@item -fsanitize=bool
13729@opindex fsanitize=bool
13730
13731This option enables instrumentation of loads from bool.  If a value other
13732than 0/1 is loaded, a run-time error is issued.
13733
13734@item -fsanitize=enum
13735@opindex fsanitize=enum
13736
13737This option enables instrumentation of loads from an enum type.  If
13738a value outside the range of values for the enum type is loaded,
13739a run-time error is issued.
13740
13741@item -fsanitize=vptr
13742@opindex fsanitize=vptr
13743
13744This option enables instrumentation of C++ member function calls, member
13745accesses and some conversions between pointers to base and derived classes,
13746to verify the referenced object has the correct dynamic type.
13747
13748@item -fsanitize=pointer-overflow
13749@opindex fsanitize=pointer-overflow
13750
13751This option enables instrumentation of pointer arithmetics.  If the pointer
13752arithmetics overflows, a run-time error is issued.
13753
13754@item -fsanitize=builtin
13755@opindex fsanitize=builtin
13756
13757This option enables instrumentation of arguments to selected builtin
13758functions.  If an invalid value is passed to such arguments, a run-time
13759error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
13760or @code{__builtin_clz} invokes undefined behavior and is diagnosed
13761by this option.
13762
13763@end table
13764
13765While @option{-ftrapv} causes traps for signed overflows to be emitted,
13766@option{-fsanitize=undefined} gives a diagnostic message.
13767This currently works only for the C family of languages.
13768
13769@item -fno-sanitize=all
13770@opindex fno-sanitize=all
13771
13772This option disables all previously enabled sanitizers.
13773@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
13774together.
13775
13776@item -fasan-shadow-offset=@var{number}
13777@opindex fasan-shadow-offset
13778This option forces GCC to use custom shadow offset in AddressSanitizer checks.
13779It is useful for experimenting with different shadow memory layouts in
13780Kernel AddressSanitizer.
13781
13782@item -fsanitize-sections=@var{s1},@var{s2},...
13783@opindex fsanitize-sections
13784Sanitize global variables in selected user-defined sections.  @var{si} may
13785contain wildcards.
13786
13787@item -fsanitize-recover@r{[}=@var{opts}@r{]}
13788@opindex fsanitize-recover
13789@opindex fno-sanitize-recover
13790@option{-fsanitize-recover=} controls error recovery mode for sanitizers
13791mentioned in comma-separated list of @var{opts}.  Enabling this option
13792for a sanitizer component causes it to attempt to continue
13793running the program as if no error happened.  This means multiple
13794runtime errors can be reported in a single program run, and the exit
13795code of the program may indicate success even when errors
13796have been reported.  The @option{-fno-sanitize-recover=} option
13797can be used to alter
13798this behavior: only the first detected error is reported
13799and program then exits with a non-zero exit code.
13800
13801Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
13802except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
13803@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
13804@option{-fsanitize=bounds-strict},
13805@option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
13806For these sanitizers error recovery is turned on by default,
13807except @option{-fsanitize=address}, for which this feature is experimental.
13808@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
13809accepted, the former enables recovery for all sanitizers that support it,
13810the latter disables recovery for all sanitizers that support it.
13811
13812Even if a recovery mode is turned on the compiler side, it needs to be also
13813enabled on the runtime library side, otherwise the failures are still fatal.
13814The runtime library defaults to @code{halt_on_error=0} for
13815ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
13816AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
13817setting the @code{halt_on_error} flag in the corresponding environment variable.
13818
13819Syntax without an explicit @var{opts} parameter is deprecated.  It is
13820equivalent to specifying an @var{opts} list of:
13821
13822@smallexample
13823undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13824@end smallexample
13825
13826@item -fsanitize-address-use-after-scope
13827@opindex fsanitize-address-use-after-scope
13828Enable sanitization of local variables to detect use-after-scope bugs.
13829The option sets @option{-fstack-reuse} to @samp{none}.
13830
13831@item -fsanitize-undefined-trap-on-error
13832@opindex fsanitize-undefined-trap-on-error
13833The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
13834report undefined behavior using @code{__builtin_trap} rather than
13835a @code{libubsan} library routine.  The advantage of this is that the
13836@code{libubsan} library is not needed and is not linked in, so this
13837is usable even in freestanding environments.
13838
13839@item -fsanitize-coverage=trace-pc
13840@opindex fsanitize-coverage=trace-pc
13841Enable coverage-guided fuzzing code instrumentation.
13842Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
13843
13844@item -fsanitize-coverage=trace-cmp
13845@opindex fsanitize-coverage=trace-cmp
13846Enable dataflow guided fuzzing code instrumentation.
13847Inserts a call to @code{__sanitizer_cov_trace_cmp1},
13848@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
13849@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
13850variable or @code{__sanitizer_cov_trace_const_cmp1},
13851@code{__sanitizer_cov_trace_const_cmp2},
13852@code{__sanitizer_cov_trace_const_cmp4} or
13853@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
13854operand constant, @code{__sanitizer_cov_trace_cmpf} or
13855@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
13856@code{__sanitizer_cov_trace_switch} for switch statements.
13857
13858@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
13859@opindex fcf-protection
13860Enable code instrumentation of control-flow transfers to increase
13861program security by checking that target addresses of control-flow
13862transfer instructions (such as indirect function call, function return,
13863indirect jump) are valid.  This prevents diverting the flow of control
13864to an unexpected target.  This is intended to protect against such
13865threats as Return-oriented Programming (ROP), and similarly
13866call/jmp-oriented programming (COP/JOP).
13867
13868The value @code{branch} tells the compiler to implement checking of
13869validity of control-flow transfer at the point of indirect branch
13870instructions, i.e.@: call/jmp instructions.  The value @code{return}
13871implements checking of validity at the point of returning from a
13872function.  The value @code{full} is an alias for specifying both
13873@code{branch} and @code{return}. The value @code{none} turns off
13874instrumentation.
13875
13876The value @code{check} is used for the final link with link-time
13877optimization (LTO).  An error is issued if LTO object files are
13878compiled with different @option{-fcf-protection} values.  The
13879value @code{check} is ignored at the compile time.
13880
13881The macro @code{__CET__} is defined when @option{-fcf-protection} is
13882used.  The first bit of @code{__CET__} is set to 1 for the value
13883@code{branch} and the second bit of @code{__CET__} is set to 1 for
13884the @code{return}.
13885
13886You can also use the @code{nocf_check} attribute to identify
13887which functions and calls should be skipped from instrumentation
13888(@pxref{Function Attributes}).
13889
13890Currently the x86 GNU/Linux target provides an implementation based
13891on Intel Control-flow Enforcement Technology (CET) which works for
13892i686 processor or newer.
13893
13894@item -fstack-protector
13895@opindex fstack-protector
13896Emit extra code to check for buffer overflows, such as stack smashing
13897attacks.  This is done by adding a guard variable to functions with
13898vulnerable objects.  This includes functions that call @code{alloca}, and
13899functions with buffers larger than or equal to 8 bytes.  The guards are
13900initialized when a function is entered and then checked when the function
13901exits.  If a guard check fails, an error message is printed and the program
13902exits.  Only variables that are actually allocated on the stack are
13903considered, optimized away variables or variables allocated in registers
13904don't count.
13905
13906@item -fstack-protector-all
13907@opindex fstack-protector-all
13908Like @option{-fstack-protector} except that all functions are protected.
13909
13910@item -fstack-protector-strong
13911@opindex fstack-protector-strong
13912Like @option{-fstack-protector} but includes additional functions to
13913be protected --- those that have local array definitions, or have
13914references to local frame addresses.  Only variables that are actually
13915allocated on the stack are considered, optimized away variables or variables
13916allocated in registers don't count.
13917
13918@item -fstack-protector-explicit
13919@opindex fstack-protector-explicit
13920Like @option{-fstack-protector} but only protects those functions which
13921have the @code{stack_protect} attribute.
13922
13923@item -fstack-check
13924@opindex fstack-check
13925Generate code to verify that you do not go beyond the boundary of the
13926stack.  You should specify this flag if you are running in an
13927environment with multiple threads, but you only rarely need to specify it in
13928a single-threaded environment since stack overflow is automatically
13929detected on nearly all systems if there is only one stack.
13930
13931Note that this switch does not actually cause checking to be done; the
13932operating system or the language runtime must do that.  The switch causes
13933generation of code to ensure that they see the stack being extended.
13934
13935You can additionally specify a string parameter: @samp{no} means no
13936checking, @samp{generic} means force the use of old-style checking,
13937@samp{specific} means use the best checking method and is equivalent
13938to bare @option{-fstack-check}.
13939
13940Old-style checking is a generic mechanism that requires no specific
13941target support in the compiler but comes with the following drawbacks:
13942
13943@enumerate
13944@item
13945Modified allocation strategy for large objects: they are always
13946allocated dynamically if their size exceeds a fixed threshold.  Note this
13947may change the semantics of some code.
13948
13949@item
13950Fixed limit on the size of the static frame of functions: when it is
13951topped by a particular function, stack checking is not reliable and
13952a warning is issued by the compiler.
13953
13954@item
13955Inefficiency: because of both the modified allocation strategy and the
13956generic implementation, code performance is hampered.
13957@end enumerate
13958
13959Note that old-style stack checking is also the fallback method for
13960@samp{specific} if no target support has been added in the compiler.
13961
13962@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13963and stack overflows.  @samp{specific} is an excellent choice when compiling
13964Ada code.  It is not generally sufficient to protect against stack-clash
13965attacks.  To protect against those you want @samp{-fstack-clash-protection}.
13966
13967@item -fstack-clash-protection
13968@opindex fstack-clash-protection
13969Generate code to prevent stack clash style attacks.  When this option is
13970enabled, the compiler will only allocate one page of stack space at a time
13971and each page is accessed immediately after allocation.  Thus, it prevents
13972allocations from jumping over any stack guard page provided by the
13973operating system.
13974
13975Most targets do not fully support stack clash protection.  However, on
13976those targets @option{-fstack-clash-protection} will protect dynamic stack
13977allocations.  @option{-fstack-clash-protection} may also provide limited
13978protection for static stack allocations if the target supports
13979@option{-fstack-check=specific}.
13980
13981@item -fstack-limit-register=@var{reg}
13982@itemx -fstack-limit-symbol=@var{sym}
13983@itemx -fno-stack-limit
13984@opindex fstack-limit-register
13985@opindex fstack-limit-symbol
13986@opindex fno-stack-limit
13987Generate code to ensure that the stack does not grow beyond a certain value,
13988either the value of a register or the address of a symbol.  If a larger
13989stack is required, a signal is raised at run time.  For most targets,
13990the signal is raised before the stack overruns the boundary, so
13991it is possible to catch the signal without taking special precautions.
13992
13993For instance, if the stack starts at absolute address @samp{0x80000000}
13994and grows downwards, you can use the flags
13995@option{-fstack-limit-symbol=__stack_limit} and
13996@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13997of 128KB@.  Note that this may only work with the GNU linker.
13998
13999You can locally override stack limit checking by using the
14000@code{no_stack_limit} function attribute (@pxref{Function Attributes}).
14001
14002@item -fsplit-stack
14003@opindex fsplit-stack
14004Generate code to automatically split the stack before it overflows.
14005The resulting program has a discontiguous stack which can only
14006overflow if the program is unable to allocate any more memory.  This
14007is most useful when running threaded programs, as it is no longer
14008necessary to calculate a good stack size to use for each thread.  This
14009is currently only implemented for the x86 targets running
14010GNU/Linux.
14011
14012When code compiled with @option{-fsplit-stack} calls code compiled
14013without @option{-fsplit-stack}, there may not be much stack space
14014available for the latter code to run.  If compiling all code,
14015including library code, with @option{-fsplit-stack} is not an option,
14016then the linker can fix up these calls so that the code compiled
14017without @option{-fsplit-stack} always has a large stack.  Support for
14018this is implemented in the gold linker in GNU binutils release 2.21
14019and later.
14020
14021@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
14022@opindex fvtable-verify
14023This option is only available when compiling C++ code.
14024It turns on (or off, if using @option{-fvtable-verify=none}) the security
14025feature that verifies at run time, for every virtual call, that
14026the vtable pointer through which the call is made is valid for the type of
14027the object, and has not been corrupted or overwritten.  If an invalid vtable
14028pointer is detected at run time, an error is reported and execution of the
14029program is immediately halted.
14030
14031This option causes run-time data structures to be built at program startup,
14032which are used for verifying the vtable pointers.
14033The options @samp{std} and @samp{preinit}
14034control the timing of when these data structures are built.  In both cases the
14035data structures are built before execution reaches @code{main}.  Using
14036@option{-fvtable-verify=std} causes the data structures to be built after
14037shared libraries have been loaded and initialized.
14038@option{-fvtable-verify=preinit} causes them to be built before shared
14039libraries have been loaded and initialized.
14040
14041If this option appears multiple times in the command line with different
14042values specified, @samp{none} takes highest priority over both @samp{std} and
14043@samp{preinit}; @samp{preinit} takes priority over @samp{std}.
14044
14045@item -fvtv-debug
14046@opindex fvtv-debug
14047When used in conjunction with @option{-fvtable-verify=std} or
14048@option{-fvtable-verify=preinit}, causes debug versions of the
14049runtime functions for the vtable verification feature to be called.
14050This flag also causes the compiler to log information about which
14051vtable pointers it finds for each class.
14052This information is written to a file named @file{vtv_set_ptr_data.log}
14053in the directory named by the environment variable @env{VTV_LOGS_DIR}
14054if that is defined or the current working directory otherwise.
14055
14056Note:  This feature @emph{appends} data to the log file. If you want a fresh log
14057file, be sure to delete any existing one.
14058
14059@item -fvtv-counts
14060@opindex fvtv-counts
14061This is a debugging flag.  When used in conjunction with
14062@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
14063causes the compiler to keep track of the total number of virtual calls
14064it encounters and the number of verifications it inserts.  It also
14065counts the number of calls to certain run-time library functions
14066that it inserts and logs this information for each compilation unit.
14067The compiler writes this information to a file named
14068@file{vtv_count_data.log} in the directory named by the environment
14069variable @env{VTV_LOGS_DIR} if that is defined or the current working
14070directory otherwise.  It also counts the size of the vtable pointer sets
14071for each class, and writes this information to @file{vtv_class_set_sizes.log}
14072in the same directory.
14073
14074Note:  This feature @emph{appends} data to the log files.  To get fresh log
14075files, be sure to delete any existing ones.
14076
14077@item -finstrument-functions
14078@opindex finstrument-functions
14079Generate instrumentation calls for entry and exit to functions.  Just
14080after function entry and just before function exit, the following
14081profiling functions are called with the address of the current
14082function and its call site.  (On some platforms,
14083@code{__builtin_return_address} does not work beyond the current
14084function, so the call site information may not be available to the
14085profiling functions otherwise.)
14086
14087@smallexample
14088void __cyg_profile_func_enter (void *this_fn,
14089                               void *call_site);
14090void __cyg_profile_func_exit  (void *this_fn,
14091                               void *call_site);
14092@end smallexample
14093
14094The first argument is the address of the start of the current function,
14095which may be looked up exactly in the symbol table.
14096
14097This instrumentation is also done for functions expanded inline in other
14098functions.  The profiling calls indicate where, conceptually, the
14099inline function is entered and exited.  This means that addressable
14100versions of such functions must be available.  If all your uses of a
14101function are expanded inline, this may mean an additional expansion of
14102code size.  If you use @code{extern inline} in your C code, an
14103addressable version of such functions must be provided.  (This is
14104normally the case anyway, but if you get lucky and the optimizer always
14105expands the functions inline, you might have gotten away without
14106providing static copies.)
14107
14108A function may be given the attribute @code{no_instrument_function}, in
14109which case this instrumentation is not done.  This can be used, for
14110example, for the profiling functions listed above, high-priority
14111interrupt routines, and any functions from which the profiling functions
14112cannot safely be called (perhaps signal handlers, if the profiling
14113routines generate output or allocate memory).
14114@xref{Common Function Attributes}.
14115
14116@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14117@opindex finstrument-functions-exclude-file-list
14118
14119Set the list of functions that are excluded from instrumentation (see
14120the description of @option{-finstrument-functions}).  If the file that
14121contains a function definition matches with one of @var{file}, then
14122that function is not instrumented.  The match is done on substrings:
14123if the @var{file} parameter is a substring of the file name, it is
14124considered to be a match.
14125
14126For example:
14127
14128@smallexample
14129-finstrument-functions-exclude-file-list=/bits/stl,include/sys
14130@end smallexample
14131
14132@noindent
14133excludes any inline function defined in files whose pathnames
14134contain @file{/bits/stl} or @file{include/sys}.
14135
14136If, for some reason, you want to include letter @samp{,} in one of
14137@var{sym}, write @samp{\,}. For example,
14138@option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14139(note the single quote surrounding the option).
14140
14141@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14142@opindex finstrument-functions-exclude-function-list
14143
14144This is similar to @option{-finstrument-functions-exclude-file-list},
14145but this option sets the list of function names to be excluded from
14146instrumentation.  The function name to be matched is its user-visible
14147name, such as @code{vector<int> blah(const vector<int> &)}, not the
14148internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
14149match is done on substrings: if the @var{sym} parameter is a substring
14150of the function name, it is considered to be a match.  For C99 and C++
14151extended identifiers, the function name must be given in UTF-8, not
14152using universal character names.
14153
14154@item -fpatchable-function-entry=@var{N}[,@var{M}]
14155@opindex fpatchable-function-entry
14156Generate @var{N} NOPs right at the beginning
14157of each function, with the function entry point before the @var{M}th NOP.
14158If @var{M} is omitted, it defaults to @code{0} so the
14159function entry points to the address just at the first NOP.
14160The NOP instructions reserve extra space which can be used to patch in
14161any desired instrumentation at run time, provided that the code segment
14162is writable.  The amount of space is controllable indirectly via
14163the number of NOPs; the NOP instruction used corresponds to the instruction
14164emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
14165is target-specific and may also depend on the architecture variant and/or
14166other compilation options.
14167
14168For run-time identification, the starting addresses of these areas,
14169which correspond to their respective function entries minus @var{M},
14170are additionally collected in the @code{__patchable_function_entries}
14171section of the resulting binary.
14172
14173Note that the value of @code{__attribute__ ((patchable_function_entry
14174(N,M)))} takes precedence over command-line option
14175@option{-fpatchable-function-entry=N,M}.  This can be used to increase
14176the area size or to remove it completely on a single function.
14177If @code{N=0}, no pad location is recorded.
14178
14179The NOP instructions are inserted at---and maybe before, depending on
14180@var{M}---the function entry address, even before the prologue.
14181
14182@end table
14183
14184
14185@node Preprocessor Options
14186@section Options Controlling the Preprocessor
14187@cindex preprocessor options
14188@cindex options, preprocessor
14189
14190These options control the C preprocessor, which is run on each C source
14191file before actual compilation.
14192
14193If you use the @option{-E} option, nothing is done except preprocessing.
14194Some of these options make sense only together with @option{-E} because
14195they cause the preprocessor output to be unsuitable for actual
14196compilation.
14197
14198In addition to the options listed here, there are a number of options
14199to control search paths for include files documented in
14200@ref{Directory Options}.
14201Options to control preprocessor diagnostics are listed in
14202@ref{Warning Options}.
14203
14204@table @gcctabopt
14205@include cppopts.texi
14206
14207@item -Wp,@var{option}
14208@opindex Wp
14209You can use @option{-Wp,@var{option}} to bypass the compiler driver
14210and pass @var{option} directly through to the preprocessor.  If
14211@var{option} contains commas, it is split into multiple options at the
14212commas.  However, many options are modified, translated or interpreted
14213by the compiler driver before being passed to the preprocessor, and
14214@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
14215interface is undocumented and subject to change, so whenever possible
14216you should avoid using @option{-Wp} and let the driver handle the
14217options instead.
14218
14219@item -Xpreprocessor @var{option}
14220@opindex Xpreprocessor
14221Pass @var{option} as an option to the preprocessor.  You can use this to
14222supply system-specific preprocessor options that GCC does not
14223recognize.
14224
14225If you want to pass an option that takes an argument, you must use
14226@option{-Xpreprocessor} twice, once for the option and once for the argument.
14227
14228@item -no-integrated-cpp
14229@opindex no-integrated-cpp
14230Perform preprocessing as a separate pass before compilation.
14231By default, GCC performs preprocessing as an integrated part of
14232input tokenization and parsing.
14233If this option is provided, the appropriate language front end
14234(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14235and Objective-C, respectively) is instead invoked twice,
14236once for preprocessing only and once for actual compilation
14237of the preprocessed input.
14238This option may be useful in conjunction with the @option{-B} or
14239@option{-wrapper} options to specify an alternate preprocessor or
14240perform additional processing of the program source between
14241normal preprocessing and compilation.
14242
14243@end table
14244
14245@node Assembler Options
14246@section Passing Options to the Assembler
14247
14248@c prevent bad page break with this line
14249You can pass options to the assembler.
14250
14251@table @gcctabopt
14252@item -Wa,@var{option}
14253@opindex Wa
14254Pass @var{option} as an option to the assembler.  If @var{option}
14255contains commas, it is split into multiple options at the commas.
14256
14257@item -Xassembler @var{option}
14258@opindex Xassembler
14259Pass @var{option} as an option to the assembler.  You can use this to
14260supply system-specific assembler options that GCC does not
14261recognize.
14262
14263If you want to pass an option that takes an argument, you must use
14264@option{-Xassembler} twice, once for the option and once for the argument.
14265
14266@end table
14267
14268@node Link Options
14269@section Options for Linking
14270@cindex link options
14271@cindex options, linking
14272
14273These options come into play when the compiler links object files into
14274an executable output file.  They are meaningless if the compiler is
14275not doing a link step.
14276
14277@table @gcctabopt
14278@cindex file names
14279@item @var{object-file-name}
14280A file name that does not end in a special recognized suffix is
14281considered to name an object file or library.  (Object files are
14282distinguished from libraries by the linker according to the file
14283contents.)  If linking is done, these object files are used as input
14284to the linker.
14285
14286@item -c
14287@itemx -S
14288@itemx -E
14289@opindex c
14290@opindex S
14291@opindex E
14292If any of these options is used, then the linker is not run, and
14293object file names should not be used as arguments.  @xref{Overall
14294Options}.
14295
14296@item -flinker-output=@var{type}
14297@opindex flinker-output
14298This option controls code generation of the link-time optimizer.  By
14299default the linker output is automatically determined by the linker
14300plugin.  For debugging the compiler and if incremental linking with a
14301non-LTO object file is desired, it may be useful to control the type
14302manually.
14303
14304If @var{type} is @samp{exec}, code generation produces a static
14305binary. In this case @option{-fpic} and @option{-fpie} are both
14306disabled.
14307
14308If @var{type} is @samp{dyn}, code generation produces a shared
14309library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
14310but not enabled automatically.  This allows to build shared libraries
14311without position-independent code on architectures where this is
14312possible, i.e.@: on x86.
14313
14314If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14315executable. This results in similar optimizations as @samp{exec}
14316except that @option{-fpie} is not disabled if specified at compilation
14317time.
14318
14319If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14320done.  The sections containing intermediate code for link-time optimization are
14321merged, pre-optimized, and output to the resulting object file. In addition, if
14322@option{-ffat-lto-objects} is specified, binary code is produced for future
14323non-LTO linking. The object file produced by incremental linking is smaller
14324than a static library produced from the same object files.  At link time the
14325result of incremental linking also loads faster than a static
14326library assuming that the majority of objects in the library are used.
14327
14328Finally @samp{nolto-rel} configures the compiler for incremental linking where
14329code generation is forced, a final binary is produced, and the intermediate
14330code for later link-time optimization is stripped. When multiple object files
14331are linked together the resulting code is better optimized than with
14332link-time optimizations disabled (for example, cross-module inlining
14333happens), but most of benefits of whole program optimizations are lost.
14334
14335During the incremental link (by @option{-r}) the linker plugin defaults to
14336@option{rel}. With current interfaces to GNU Binutils it is however not
14337possible to incrementally link LTO objects and non-LTO objects into a single
14338mixed object file.  If any of object files in incremental link cannot
14339be used for link-time optimization, the linker plugin issues a warning and
14340uses @samp{nolto-rel}. To maintain whole program optimization, it is
14341recommended to link such objects into static library instead. Alternatively it
14342is possible to use H.J. Lu's binutils with support for mixed objects.
14343
14344@item -fuse-ld=bfd
14345@opindex fuse-ld=bfd
14346Use the @command{bfd} linker instead of the default linker.
14347
14348@item -fuse-ld=gold
14349@opindex fuse-ld=gold
14350Use the @command{gold} linker instead of the default linker.
14351
14352@item -fuse-ld=lld
14353@opindex fuse-ld=lld
14354Use the LLVM @command{lld} linker instead of the default linker.
14355
14356@cindex Libraries
14357@item -l@var{library}
14358@itemx -l @var{library}
14359@opindex l
14360Search the library named @var{library} when linking.  (The second
14361alternative with the library as a separate argument is only for
14362POSIX compliance and is not recommended.)
14363
14364The @option{-l} option is passed directly to the linker by GCC.  Refer
14365to your linker documentation for exact details.  The general
14366description below applies to the GNU linker.
14367
14368The linker searches a standard list of directories for the library.
14369The directories searched include several standard system directories
14370plus any that you specify with @option{-L}.
14371
14372Static libraries are archives of object files, and have file names
14373like @file{lib@var{library}.a}.  Some targets also support shared
14374libraries, which typically have names like @file{lib@var{library}.so}.
14375If both static and shared libraries are found, the linker gives
14376preference to linking with the shared library unless the
14377@option{-static} option is used.
14378
14379It makes a difference where in the command you write this option; the
14380linker searches and processes libraries and object files in the order they
14381are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14382after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
14383to functions in @samp{z}, those functions may not be loaded.
14384
14385@item -lobjc
14386@opindex lobjc
14387You need this special case of the @option{-l} option in order to
14388link an Objective-C or Objective-C++ program.
14389
14390@item -nostartfiles
14391@opindex nostartfiles
14392Do not use the standard system startup files when linking.
14393The standard system libraries are used normally, unless @option{-nostdlib},
14394@option{-nolibc}, or @option{-nodefaultlibs} is used.
14395
14396@item -nodefaultlibs
14397@opindex nodefaultlibs
14398Do not use the standard system libraries when linking.
14399Only the libraries you specify are passed to the linker, and options
14400specifying linkage of the system libraries, such as @option{-static-libgcc}
14401or @option{-shared-libgcc}, are ignored.
14402The standard startup files are used normally, unless @option{-nostartfiles}
14403is used.
14404
14405The compiler may generate calls to @code{memcmp},
14406@code{memset}, @code{memcpy} and @code{memmove}.
14407These entries are usually resolved by entries in
14408libc.  These entry points should be supplied through some other
14409mechanism when this option is specified.
14410
14411@item -nolibc
14412@opindex nolibc
14413Do not use the C library or system libraries tightly coupled with it when
14414linking.  Still link with the startup files, @file{libgcc} or toolchain
14415provided language support libraries such as @file{libgnat}, @file{libgfortran}
14416or @file{libstdc++} unless options preventing their inclusion are used as
14417well.  This typically removes @option{-lc} from the link command line, as well
14418as system libraries that normally go with it and become meaningless when
14419absence of a C library is assumed, for example @option{-lpthread} or
14420@option{-lm} in some configurations.  This is intended for bare-board
14421targets when there is indeed no C library available.
14422
14423@item -nostdlib
14424@opindex nostdlib
14425Do not use the standard system startup files or libraries when linking.
14426No startup files and only the libraries you specify are passed to
14427the linker, and options specifying linkage of the system libraries, such as
14428@option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14429
14430The compiler may generate calls to @code{memcmp}, @code{memset},
14431@code{memcpy} and @code{memmove}.
14432These entries are usually resolved by entries in
14433libc.  These entry points should be supplied through some other
14434mechanism when this option is specified.
14435
14436@cindex @option{-lgcc}, use with @option{-nostdlib}
14437@cindex @option{-nostdlib} and unresolved references
14438@cindex unresolved references and @option{-nostdlib}
14439@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14440@cindex @option{-nodefaultlibs} and unresolved references
14441@cindex unresolved references and @option{-nodefaultlibs}
14442One of the standard libraries bypassed by @option{-nostdlib} and
14443@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14444which GCC uses to overcome shortcomings of particular machines, or special
14445needs for some languages.
14446(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14447Collection (GCC) Internals},
14448for more discussion of @file{libgcc.a}.)
14449In most cases, you need @file{libgcc.a} even when you want to avoid
14450other standard libraries.  In other words, when you specify @option{-nostdlib}
14451or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14452This ensures that you have no unresolved references to internal GCC
14453library subroutines.
14454(An example of such an internal subroutine is @code{__main}, used to ensure C++
14455constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14456GNU Compiler Collection (GCC) Internals}.)
14457
14458@item -e @var{entry}
14459@itemx --entry=@var{entry}
14460@opindex e
14461@opindex entry
14462
14463Specify that the program entry point is @var{entry}.  The argument is
14464interpreted by the linker; the GNU linker accepts either a symbol name
14465or an address.
14466
14467@item -pie
14468@opindex pie
14469Produce a dynamically linked position independent executable on targets
14470that support it.  For predictable results, you must also specify the same
14471set of options used for compilation (@option{-fpie}, @option{-fPIE},
14472or model suboptions) when you specify this linker option.
14473
14474@item -no-pie
14475@opindex no-pie
14476Don't produce a dynamically linked position independent executable.
14477
14478@item -static-pie
14479@opindex static-pie
14480Produce a static position independent executable on targets that support
14481it.  A static position independent executable is similar to a static
14482executable, but can be loaded at any address without a dynamic linker.
14483For predictable results, you must also specify the same set of options
14484used for compilation (@option{-fpie}, @option{-fPIE}, or model
14485suboptions) when you specify this linker option.
14486
14487@item -pthread
14488@opindex pthread
14489Link with the POSIX threads library.  This option is supported on
14490GNU/Linux targets, most other Unix derivatives, and also on
14491x86 Cygwin and MinGW targets.  On some targets this option also sets
14492flags for the preprocessor, so it should be used consistently for both
14493compilation and linking.
14494
14495@item -r
14496@opindex r
14497Produce a relocatable object as output.  This is also known as partial
14498linking.
14499
14500@item -rdynamic
14501@opindex rdynamic
14502Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14503that support it. This instructs the linker to add all symbols, not
14504only used ones, to the dynamic symbol table. This option is needed
14505for some uses of @code{dlopen} or to allow obtaining backtraces
14506from within a program.
14507
14508@item -s
14509@opindex s
14510Remove all symbol table and relocation information from the executable.
14511
14512@item -static
14513@opindex static
14514On systems that support dynamic linking, this overrides @option{-pie}
14515and prevents linking with the shared libraries.  On other systems, this
14516option has no effect.
14517
14518@item -shared
14519@opindex shared
14520Produce a shared object which can then be linked with other objects to
14521form an executable.  Not all systems support this option.  For predictable
14522results, you must also specify the same set of options used for compilation
14523(@option{-fpic}, @option{-fPIC}, or model suboptions) when
14524you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14525needs to build supplementary stub code for constructors to work.  On
14526multi-libbed systems, @samp{gcc -shared} must select the correct support
14527libraries to link against.  Failing to supply the correct flags may lead
14528to subtle defects.  Supplying them in cases where they are not necessary
14529is innocuous.}
14530
14531@item -shared-libgcc
14532@itemx -static-libgcc
14533@opindex shared-libgcc
14534@opindex static-libgcc
14535On systems that provide @file{libgcc} as a shared library, these options
14536force the use of either the shared or static version, respectively.
14537If no shared version of @file{libgcc} was built when the compiler was
14538configured, these options have no effect.
14539
14540There are several situations in which an application should use the
14541shared @file{libgcc} instead of the static version.  The most common
14542of these is when the application wishes to throw and catch exceptions
14543across different shared libraries.  In that case, each of the libraries
14544as well as the application itself should use the shared @file{libgcc}.
14545
14546Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14547whenever you build a shared library or a main executable, because C++
14548programs typically use exceptions, so this is the right thing to do.
14549
14550If, instead, you use the GCC driver to create shared libraries, you may
14551find that they are not always linked with the shared @file{libgcc}.
14552If GCC finds, at its configuration time, that you have a non-GNU linker
14553or a GNU linker that does not support option @option{--eh-frame-hdr},
14554it links the shared version of @file{libgcc} into shared libraries
14555by default.  Otherwise, it takes advantage of the linker and optimizes
14556away the linking with the shared version of @file{libgcc}, linking with
14557the static version of libgcc by default.  This allows exceptions to
14558propagate through such shared libraries, without incurring relocation
14559costs at library load time.
14560
14561However, if a library or main executable is supposed to throw or catch
14562exceptions, you must link it using the G++ driver, or using the option
14563@option{-shared-libgcc}, such that it is linked with the shared
14564@file{libgcc}.
14565
14566@item -static-libasan
14567@opindex static-libasan
14568When the @option{-fsanitize=address} option is used to link a program,
14569the GCC driver automatically links against @option{libasan}.  If
14570@file{libasan} is available as a shared library, and the @option{-static}
14571option is not used, then this links against the shared version of
14572@file{libasan}.  The @option{-static-libasan} option directs the GCC
14573driver to link @file{libasan} statically, without necessarily linking
14574other libraries statically.
14575
14576@item -static-libtsan
14577@opindex static-libtsan
14578When the @option{-fsanitize=thread} option is used to link a program,
14579the GCC driver automatically links against @option{libtsan}.  If
14580@file{libtsan} is available as a shared library, and the @option{-static}
14581option is not used, then this links against the shared version of
14582@file{libtsan}.  The @option{-static-libtsan} option directs the GCC
14583driver to link @file{libtsan} statically, without necessarily linking
14584other libraries statically.
14585
14586@item -static-liblsan
14587@opindex static-liblsan
14588When the @option{-fsanitize=leak} option is used to link a program,
14589the GCC driver automatically links against @option{liblsan}.  If
14590@file{liblsan} is available as a shared library, and the @option{-static}
14591option is not used, then this links against the shared version of
14592@file{liblsan}.  The @option{-static-liblsan} option directs the GCC
14593driver to link @file{liblsan} statically, without necessarily linking
14594other libraries statically.
14595
14596@item -static-libubsan
14597@opindex static-libubsan
14598When the @option{-fsanitize=undefined} option is used to link a program,
14599the GCC driver automatically links against @option{libubsan}.  If
14600@file{libubsan} is available as a shared library, and the @option{-static}
14601option is not used, then this links against the shared version of
14602@file{libubsan}.  The @option{-static-libubsan} option directs the GCC
14603driver to link @file{libubsan} statically, without necessarily linking
14604other libraries statically.
14605
14606@item -static-libstdc++
14607@opindex static-libstdc++
14608When the @command{g++} program is used to link a C++ program, it
14609normally automatically links against @option{libstdc++}.  If
14610@file{libstdc++} is available as a shared library, and the
14611@option{-static} option is not used, then this links against the
14612shared version of @file{libstdc++}.  That is normally fine.  However, it
14613is sometimes useful to freeze the version of @file{libstdc++} used by
14614the program without going all the way to a fully static link.  The
14615@option{-static-libstdc++} option directs the @command{g++} driver to
14616link @file{libstdc++} statically, without necessarily linking other
14617libraries statically.
14618
14619@item -symbolic
14620@opindex symbolic
14621Bind references to global symbols when building a shared object.  Warn
14622about any unresolved references (unless overridden by the link editor
14623option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
14624this option.
14625
14626@item -T @var{script}
14627@opindex T
14628@cindex linker script
14629Use @var{script} as the linker script.  This option is supported by most
14630systems using the GNU linker.  On some targets, such as bare-board
14631targets without an operating system, the @option{-T} option may be required
14632when linking to avoid references to undefined symbols.
14633
14634@item -Xlinker @var{option}
14635@opindex Xlinker
14636Pass @var{option} as an option to the linker.  You can use this to
14637supply system-specific linker options that GCC does not recognize.
14638
14639If you want to pass an option that takes a separate argument, you must use
14640@option{-Xlinker} twice, once for the option and once for the argument.
14641For example, to pass @option{-assert definitions}, you must write
14642@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
14643@option{-Xlinker "-assert definitions"}, because this passes the entire
14644string as a single argument, which is not what the linker expects.
14645
14646When using the GNU linker, it is usually more convenient to pass
14647arguments to linker options using the @option{@var{option}=@var{value}}
14648syntax than as separate arguments.  For example, you can specify
14649@option{-Xlinker -Map=output.map} rather than
14650@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
14651this syntax for command-line options.
14652
14653@item -Wl,@var{option}
14654@opindex Wl
14655Pass @var{option} as an option to the linker.  If @var{option} contains
14656commas, it is split into multiple options at the commas.  You can use this
14657syntax to pass an argument to the option.
14658For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14659linker.  When using the GNU linker, you can also get the same effect with
14660@option{-Wl,-Map=output.map}.
14661
14662@item -u @var{symbol}
14663@opindex u
14664Pretend the symbol @var{symbol} is undefined, to force linking of
14665library modules to define it.  You can use @option{-u} multiple times with
14666different symbols to force loading of additional library modules.
14667
14668@item -z @var{keyword}
14669@opindex z
14670@option{-z} is passed directly on to the linker along with the keyword
14671@var{keyword}. See the section in the documentation of your linker for
14672permitted values and their meanings.
14673@end table
14674
14675@node Directory Options
14676@section Options for Directory Search
14677@cindex directory options
14678@cindex options, directory search
14679@cindex search path
14680
14681These options specify directories to search for header files, for
14682libraries and for parts of the compiler:
14683
14684@table @gcctabopt
14685@include cppdiropts.texi
14686
14687@item -iplugindir=@var{dir}
14688@opindex iplugindir=
14689Set the directory to search for plugins that are passed
14690by @option{-fplugin=@var{name}} instead of
14691@option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
14692to be used by the user, but only passed by the driver.
14693
14694@item -L@var{dir}
14695@opindex L
14696Add directory @var{dir} to the list of directories to be searched
14697for @option{-l}.
14698
14699@item -B@var{prefix}
14700@opindex B
14701This option specifies where to find the executables, libraries,
14702include files, and data files of the compiler itself.
14703
14704The compiler driver program runs one or more of the subprograms
14705@command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
14706@var{prefix} as a prefix for each program it tries to run, both with and
14707without @samp{@var{machine}/@var{version}/} for the corresponding target
14708machine and compiler version.
14709
14710For each subprogram to be run, the compiler driver first tries the
14711@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
14712is not specified, the driver tries two standard prefixes,
14713@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
14714those results in a file name that is found, the unmodified program
14715name is searched for using the directories specified in your
14716@env{PATH} environment variable.
14717
14718The compiler checks to see if the path provided by @option{-B}
14719refers to a directory, and if necessary it adds a directory
14720separator character at the end of the path.
14721
14722@option{-B} prefixes that effectively specify directory names also apply
14723to libraries in the linker, because the compiler translates these
14724options into @option{-L} options for the linker.  They also apply to
14725include files in the preprocessor, because the compiler translates these
14726options into @option{-isystem} options for the preprocessor.  In this case,
14727the compiler appends @samp{include} to the prefix.
14728
14729The runtime support file @file{libgcc.a} can also be searched for using
14730the @option{-B} prefix, if needed.  If it is not found there, the two
14731standard prefixes above are tried, and that is all.  The file is left
14732out of the link if it is not found by those means.
14733
14734Another way to specify a prefix much like the @option{-B} prefix is to use
14735the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
14736Variables}.
14737
14738As a special kludge, if the path provided by @option{-B} is
14739@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
147409, then it is replaced by @file{[dir/]include}.  This is to help
14741with boot-strapping the compiler.
14742
14743@item -no-canonical-prefixes
14744@opindex no-canonical-prefixes
14745Do not expand any symbolic links, resolve references to @samp{/../}
14746or @samp{/./}, or make the path absolute when generating a relative
14747prefix.
14748
14749@item --sysroot=@var{dir}
14750@opindex sysroot
14751Use @var{dir} as the logical root directory for headers and libraries.
14752For example, if the compiler normally searches for headers in
14753@file{/usr/include} and libraries in @file{/usr/lib}, it instead
14754searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14755
14756If you use both this option and the @option{-isysroot} option, then
14757the @option{--sysroot} option applies to libraries, but the
14758@option{-isysroot} option applies to header files.
14759
14760The GNU linker (beginning with version 2.16) has the necessary support
14761for this option.  If your linker does not support this option, the
14762header file aspect of @option{--sysroot} still works, but the
14763library aspect does not.
14764
14765@item --no-sysroot-suffix
14766@opindex no-sysroot-suffix
14767For some targets, a suffix is added to the root directory specified
14768with @option{--sysroot}, depending on the other options used, so that
14769headers may for example be found in
14770@file{@var{dir}/@var{suffix}/usr/include} instead of
14771@file{@var{dir}/usr/include}.  This option disables the addition of
14772such a suffix.
14773
14774@end table
14775
14776@node Code Gen Options
14777@section Options for Code Generation Conventions
14778@cindex code generation conventions
14779@cindex options, code generation
14780@cindex run-time options
14781
14782These machine-independent options control the interface conventions
14783used in code generation.
14784
14785Most of them have both positive and negative forms; the negative form
14786of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
14787one of the forms is listed---the one that is not the default.  You
14788can figure out the other form by either removing @samp{no-} or adding
14789it.
14790
14791@table @gcctabopt
14792@item -fstack-reuse=@var{reuse-level}
14793@opindex fstack_reuse
14794This option controls stack space reuse for user declared local/auto variables
14795and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
14796@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
14797local variables and temporaries, @samp{named_vars} enables the reuse only for
14798user defined local variables with names, and @samp{none} disables stack reuse
14799completely. The default value is @samp{all}. The option is needed when the
14800program extends the lifetime of a scoped local variable or a compiler generated
14801temporary beyond the end point defined by the language.  When a lifetime of
14802a variable ends, and if the variable lives in memory, the optimizing compiler
14803has the freedom to reuse its stack space with other temporaries or scoped
14804local variables whose live range does not overlap with it. Legacy code extending
14805local lifetime is likely to break with the stack reuse optimization.
14806
14807For example,
14808
14809@smallexample
14810   int *p;
14811   @{
14812     int local1;
14813
14814     p = &local1;
14815     local1 = 10;
14816     ....
14817   @}
14818   @{
14819      int local2;
14820      local2 = 20;
14821      ...
14822   @}
14823
14824   if (*p == 10)  // out of scope use of local1
14825     @{
14826
14827     @}
14828@end smallexample
14829
14830Another example:
14831@smallexample
14832
14833   struct A
14834   @{
14835       A(int k) : i(k), j(k) @{ @}
14836       int i;
14837       int j;
14838   @};
14839
14840   A *ap;
14841
14842   void foo(const A& ar)
14843   @{
14844      ap = &ar;
14845   @}
14846
14847   void bar()
14848   @{
14849      foo(A(10)); // temp object's lifetime ends when foo returns
14850
14851      @{
14852        A a(20);
14853        ....
14854      @}
14855      ap->i+= 10;  // ap references out of scope temp whose space
14856                   // is reused with a. What is the value of ap->i?
14857   @}
14858
14859@end smallexample
14860
14861The lifetime of a compiler generated temporary is well defined by the C++
14862standard. When a lifetime of a temporary ends, and if the temporary lives
14863in memory, the optimizing compiler has the freedom to reuse its stack
14864space with other temporaries or scoped local variables whose live range
14865does not overlap with it. However some of the legacy code relies on
14866the behavior of older compilers in which temporaries' stack space is
14867not reused, the aggressive stack reuse can lead to runtime errors. This
14868option is used to control the temporary stack reuse optimization.
14869
14870@item -ftrapv
14871@opindex ftrapv
14872This option generates traps for signed overflow on addition, subtraction,
14873multiplication operations.
14874The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14875@option{-ftrapv} @option{-fwrapv} on the command-line results in
14876@option{-fwrapv} being effective.  Note that only active options override, so
14877using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14878results in @option{-ftrapv} being effective.
14879
14880@item -fwrapv
14881@opindex fwrapv
14882This option instructs the compiler to assume that signed arithmetic
14883overflow of addition, subtraction and multiplication wraps around
14884using twos-complement representation.  This flag enables some optimizations
14885and disables others.
14886The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14887@option{-ftrapv} @option{-fwrapv} on the command-line results in
14888@option{-fwrapv} being effective.  Note that only active options override, so
14889using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14890results in @option{-ftrapv} being effective.
14891
14892@item -fwrapv-pointer
14893@opindex fwrapv-pointer
14894This option instructs the compiler to assume that pointer arithmetic
14895overflow on addition and subtraction wraps around using twos-complement
14896representation.  This flag disables some optimizations which assume
14897pointer overflow is invalid.
14898
14899@item -fstrict-overflow
14900@opindex fstrict-overflow
14901This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
14902negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
14903
14904@item -fexceptions
14905@opindex fexceptions
14906Enable exception handling.  Generates extra code needed to propagate
14907exceptions.  For some targets, this implies GCC generates frame
14908unwind information for all functions, which can produce significant data
14909size overhead, although it does not affect execution.  If you do not
14910specify this option, GCC enables it by default for languages like
14911C++ that normally require exception handling, and disables it for
14912languages like C that do not normally require it.  However, you may need
14913to enable this option when compiling C code that needs to interoperate
14914properly with exception handlers written in C++.  You may also wish to
14915disable this option if you are compiling older C++ programs that don't
14916use exception handling.
14917
14918@item -fnon-call-exceptions
14919@opindex fnon-call-exceptions
14920Generate code that allows trapping instructions to throw exceptions.
14921Note that this requires platform-specific runtime support that does
14922not exist everywhere.  Moreover, it only allows @emph{trapping}
14923instructions to throw exceptions, i.e.@: memory references or floating-point
14924instructions.  It does not allow exceptions to be thrown from
14925arbitrary signal handlers such as @code{SIGALRM}.
14926
14927@item -fdelete-dead-exceptions
14928@opindex fdelete-dead-exceptions
14929Consider that instructions that may throw exceptions but don't otherwise
14930contribute to the execution of the program can be optimized away.
14931This option is enabled by default for the Ada front end, as permitted by
14932the Ada language specification.
14933Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14934
14935@item -funwind-tables
14936@opindex funwind-tables
14937Similar to @option{-fexceptions}, except that it just generates any needed
14938static data, but does not affect the generated code in any other way.
14939You normally do not need to enable this option; instead, a language processor
14940that needs this handling enables it on your behalf.
14941
14942@item -fasynchronous-unwind-tables
14943@opindex fasynchronous-unwind-tables
14944Generate unwind table in DWARF format, if supported by target machine.  The
14945table is exact at each instruction boundary, so it can be used for stack
14946unwinding from asynchronous events (such as debugger or garbage collector).
14947
14948@item -fno-gnu-unique
14949@opindex fno-gnu-unique
14950@opindex fgnu-unique
14951On systems with recent GNU assembler and C library, the C++ compiler
14952uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14953of template static data members and static local variables in inline
14954functions are unique even in the presence of @code{RTLD_LOCAL}; this
14955is necessary to avoid problems with a library used by two different
14956@code{RTLD_LOCAL} plugins depending on a definition in one of them and
14957therefore disagreeing with the other one about the binding of the
14958symbol.  But this causes @code{dlclose} to be ignored for affected
14959DSOs; if your program relies on reinitialization of a DSO via
14960@code{dlclose} and @code{dlopen}, you can use
14961@option{-fno-gnu-unique}.
14962
14963@item -fpcc-struct-return
14964@opindex fpcc-struct-return
14965Return ``short'' @code{struct} and @code{union} values in memory like
14966longer ones, rather than in registers.  This convention is less
14967efficient, but it has the advantage of allowing intercallability between
14968GCC-compiled files and files compiled with other compilers, particularly
14969the Portable C Compiler (pcc).
14970
14971The precise convention for returning structures in memory depends
14972on the target configuration macros.
14973
14974Short structures and unions are those whose size and alignment match
14975that of some integer type.
14976
14977@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14978switch is not binary compatible with code compiled with the
14979@option{-freg-struct-return} switch.
14980Use it to conform to a non-default application binary interface.
14981
14982@item -freg-struct-return
14983@opindex freg-struct-return
14984Return @code{struct} and @code{union} values in registers when possible.
14985This is more efficient for small structures than
14986@option{-fpcc-struct-return}.
14987
14988If you specify neither @option{-fpcc-struct-return} nor
14989@option{-freg-struct-return}, GCC defaults to whichever convention is
14990standard for the target.  If there is no standard convention, GCC
14991defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14992the principal compiler.  In those cases, we can choose the standard, and
14993we chose the more efficient register return alternative.
14994
14995@strong{Warning:} code compiled with the @option{-freg-struct-return}
14996switch is not binary compatible with code compiled with the
14997@option{-fpcc-struct-return} switch.
14998Use it to conform to a non-default application binary interface.
14999
15000@item -fshort-enums
15001@opindex fshort-enums
15002Allocate to an @code{enum} type only as many bytes as it needs for the
15003declared range of possible values.  Specifically, the @code{enum} type
15004is equivalent to the smallest integer type that has enough room.
15005
15006@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
15007code that is not binary compatible with code generated without that switch.
15008Use it to conform to a non-default application binary interface.
15009
15010@item -fshort-wchar
15011@opindex fshort-wchar
15012Override the underlying type for @code{wchar_t} to be @code{short
15013unsigned int} instead of the default for the target.  This option is
15014useful for building programs to run under WINE@.
15015
15016@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
15017code that is not binary compatible with code generated without that switch.
15018Use it to conform to a non-default application binary interface.
15019
15020@item -fcommon
15021@opindex fcommon
15022@opindex fno-common
15023@cindex tentative definitions
15024In C code, this option controls the placement of global variables
15025defined without an initializer, known as @dfn{tentative definitions}
15026in the C standard.  Tentative definitions are distinct from declarations
15027of a variable with the @code{extern} keyword, which do not allocate storage.
15028
15029The default is @option{-fno-common}, which specifies that the compiler places
15030uninitialized global variables in the BSS section of the object file.
15031This inhibits the merging of tentative definitions by the linker so you get a
15032multiple-definition error if the same variable is accidentally defined in more
15033than one compilation unit.
15034
15035The @option{-fcommon} places uninitialized global variables in a common block.
15036This allows the linker to resolve all tentative definitions of the same variable
15037in different compilation units to the same object, or to a non-tentative
15038definition.  This behavior is inconsistent with C++, and on many targets implies
15039a speed and code size penalty on global variable references.  It is mainly
15040useful to enable legacy code to link without errors.
15041
15042@item -fno-ident
15043@opindex fno-ident
15044@opindex fident
15045Ignore the @code{#ident} directive.
15046
15047@item -finhibit-size-directive
15048@opindex finhibit-size-directive
15049Don't output a @code{.size} assembler directive, or anything else that
15050would cause trouble if the function is split in the middle, and the
15051two halves are placed at locations far apart in memory.  This option is
15052used when compiling @file{crtstuff.c}; you should not need to use it
15053for anything else.
15054
15055@item -fverbose-asm
15056@opindex fverbose-asm
15057Put extra commentary information in the generated assembly code to
15058make it more readable.  This option is generally only of use to those
15059who actually need to read the generated assembly code (perhaps while
15060debugging the compiler itself).
15061
15062@option{-fno-verbose-asm}, the default, causes the
15063extra information to be omitted and is useful when comparing two assembler
15064files.
15065
15066The added comments include:
15067
15068@itemize @bullet
15069
15070@item
15071information on the compiler version and command-line options,
15072
15073@item
15074the source code lines associated with the assembly instructions,
15075in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15076
15077@item
15078hints on which high-level expressions correspond to
15079the various assembly instruction operands.
15080
15081@end itemize
15082
15083For example, given this C source file:
15084
15085@smallexample
15086int test (int n)
15087@{
15088  int i;
15089  int total = 0;
15090
15091  for (i = 0; i < n; i++)
15092    total += i * i;
15093
15094  return total;
15095@}
15096@end smallexample
15097
15098compiling to (x86_64) assembly via @option{-S} and emitting the result
15099direct to stdout via @option{-o} @option{-}
15100
15101@smallexample
15102gcc -S test.c -fverbose-asm -Os -o -
15103@end smallexample
15104
15105gives output similar to this:
15106
15107@smallexample
15108	.file	"test.c"
15109# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15110  [...snip...]
15111# options passed:
15112  [...snip...]
15113
15114	.text
15115	.globl	test
15116	.type	test, @@function
15117test:
15118.LFB0:
15119	.cfi_startproc
15120# test.c:4:   int total = 0;
15121	xorl	%eax, %eax	# <retval>
15122# test.c:6:   for (i = 0; i < n; i++)
15123	xorl	%edx, %edx	# i
15124.L2:
15125# test.c:6:   for (i = 0; i < n; i++)
15126	cmpl	%edi, %edx	# n, i
15127	jge	.L5	#,
15128# test.c:7:     total += i * i;
15129	movl	%edx, %ecx	# i, tmp92
15130	imull	%edx, %ecx	# i, tmp92
15131# test.c:6:   for (i = 0; i < n; i++)
15132	incl	%edx	# i
15133# test.c:7:     total += i * i;
15134	addl	%ecx, %eax	# tmp92, <retval>
15135	jmp	.L2	#
15136.L5:
15137# test.c:10: @}
15138	ret
15139	.cfi_endproc
15140.LFE0:
15141	.size	test, .-test
15142	.ident	"GCC: (GNU) 7.0.0 20160809 (experimental)"
15143	.section	.note.GNU-stack,"",@@progbits
15144@end smallexample
15145
15146The comments are intended for humans rather than machines and hence the
15147precise format of the comments is subject to change.
15148
15149@item -frecord-gcc-switches
15150@opindex frecord-gcc-switches
15151This switch causes the command line used to invoke the
15152compiler to be recorded into the object file that is being created.
15153This switch is only implemented on some targets and the exact format
15154of the recording is target and binary file format dependent, but it
15155usually takes the form of a section containing ASCII text.  This
15156switch is related to the @option{-fverbose-asm} switch, but that
15157switch only records information in the assembler output file as
15158comments, so it never reaches the object file.
15159See also @option{-grecord-gcc-switches} for another
15160way of storing compiler options into the object file.
15161
15162@item -fpic
15163@opindex fpic
15164@cindex global offset table
15165@cindex PIC
15166Generate position-independent code (PIC) suitable for use in a shared
15167library, if supported for the target machine.  Such code accesses all
15168constant addresses through a global offset table (GOT)@.  The dynamic
15169loader resolves the GOT entries when the program starts (the dynamic
15170loader is not part of GCC; it is part of the operating system).  If
15171the GOT size for the linked executable exceeds a machine-specific
15172maximum size, you get an error message from the linker indicating that
15173@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15174instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15175on the m68k and RS/6000.  The x86 has no such limit.)
15176
15177Position-independent code requires special support, and therefore works
15178only on certain machines.  For the x86, GCC supports PIC for System V
15179but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
15180position-independent.
15181
15182When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15183are defined to 1.
15184
15185@item -fPIC
15186@opindex fPIC
15187If supported for the target machine, emit position-independent code,
15188suitable for dynamic linking and avoiding any limit on the size of the
15189global offset table.  This option makes a difference on AArch64, m68k,
15190PowerPC and SPARC@.
15191
15192Position-independent code requires special support, and therefore works
15193only on certain machines.
15194
15195When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15196are defined to 2.
15197
15198@item -fpie
15199@itemx -fPIE
15200@opindex fpie
15201@opindex fPIE
15202These options are similar to @option{-fpic} and @option{-fPIC}, but the
15203generated position-independent code can be only linked into executables.
15204Usually these options are used to compile code that will be linked using
15205the @option{-pie} GCC option.
15206
15207@option{-fpie} and @option{-fPIE} both define the macros
15208@code{__pie__} and @code{__PIE__}.  The macros have the value 1
15209for @option{-fpie} and 2 for @option{-fPIE}.
15210
15211@item -fno-plt
15212@opindex fno-plt
15213@opindex fplt
15214Do not use the PLT for external function calls in position-independent code.
15215Instead, load the callee address at call sites from the GOT and branch to it.
15216This leads to more efficient code by eliminating PLT stubs and exposing
15217GOT loads to optimizations.  On architectures such as 32-bit x86 where
15218PLT stubs expect the GOT pointer in a specific register, this gives more
15219register allocation freedom to the compiler.
15220Lazy binding requires use of the PLT;
15221with @option{-fno-plt} all external symbols are resolved at load time.
15222
15223Alternatively, the function attribute @code{noplt} can be used to avoid calls
15224through the PLT for specific external functions.
15225
15226In position-dependent code, a few targets also convert calls to
15227functions that are marked to not use the PLT to use the GOT instead.
15228
15229@item -fno-jump-tables
15230@opindex fno-jump-tables
15231@opindex fjump-tables
15232Do not use jump tables for switch statements even where it would be
15233more efficient than other code generation strategies.  This option is
15234of use in conjunction with @option{-fpic} or @option{-fPIC} for
15235building code that forms part of a dynamic linker and cannot
15236reference the address of a jump table.  On some targets, jump tables
15237do not require a GOT and this option is not needed.
15238
15239@item -ffixed-@var{reg}
15240@opindex ffixed
15241Treat the register named @var{reg} as a fixed register; generated code
15242should never refer to it (except perhaps as a stack pointer, frame
15243pointer or in some other fixed role).
15244
15245@var{reg} must be the name of a register.  The register names accepted
15246are machine-specific and are defined in the @code{REGISTER_NAMES}
15247macro in the machine description macro file.
15248
15249This flag does not have a negative form, because it specifies a
15250three-way choice.
15251
15252@item -fcall-used-@var{reg}
15253@opindex fcall-used
15254Treat the register named @var{reg} as an allocable register that is
15255clobbered by function calls.  It may be allocated for temporaries or
15256variables that do not live across a call.  Functions compiled this way
15257do not save and restore the register @var{reg}.
15258
15259It is an error to use this flag with the frame pointer or stack pointer.
15260Use of this flag for other registers that have fixed pervasive roles in
15261the machine's execution model produces disastrous results.
15262
15263This flag does not have a negative form, because it specifies a
15264three-way choice.
15265
15266@item -fcall-saved-@var{reg}
15267@opindex fcall-saved
15268Treat the register named @var{reg} as an allocable register saved by
15269functions.  It may be allocated even for temporaries or variables that
15270live across a call.  Functions compiled this way save and restore
15271the register @var{reg} if they use it.
15272
15273It is an error to use this flag with the frame pointer or stack pointer.
15274Use of this flag for other registers that have fixed pervasive roles in
15275the machine's execution model produces disastrous results.
15276
15277A different sort of disaster results from the use of this flag for
15278a register in which function values may be returned.
15279
15280This flag does not have a negative form, because it specifies a
15281three-way choice.
15282
15283@item -fpack-struct[=@var{n}]
15284@opindex fpack-struct
15285Without a value specified, pack all structure members together without
15286holes.  When a value is specified (which must be a small power of two), pack
15287structure members according to this value, representing the maximum
15288alignment (that is, objects with default alignment requirements larger than
15289this are output potentially unaligned at the next fitting location.
15290
15291@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15292code that is not binary compatible with code generated without that switch.
15293Additionally, it makes the code suboptimal.
15294Use it to conform to a non-default application binary interface.
15295
15296@item -fleading-underscore
15297@opindex fleading-underscore
15298This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15299change the way C symbols are represented in the object file.  One use
15300is to help link with legacy assembly code.
15301
15302@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15303generate code that is not binary compatible with code generated without that
15304switch.  Use it to conform to a non-default application binary interface.
15305Not all targets provide complete support for this switch.
15306
15307@item -ftls-model=@var{model}
15308@opindex ftls-model
15309Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15310The @var{model} argument should be one of @samp{global-dynamic},
15311@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15312Note that the choice is subject to optimization: the compiler may use
15313a more efficient model for symbols not visible outside of the translation
15314unit, or if @option{-fpic} is not given on the command line.
15315
15316The default without @option{-fpic} is @samp{initial-exec}; with
15317@option{-fpic} the default is @samp{global-dynamic}.
15318
15319@item -ftrampolines
15320@opindex ftrampolines
15321For targets that normally need trampolines for nested functions, always
15322generate them instead of using descriptors.  Otherwise, for targets that
15323do not need them, like for example HP-PA or IA-64, do nothing.
15324
15325A trampoline is a small piece of code that is created at run time on the
15326stack when the address of a nested function is taken, and is used to call
15327the nested function indirectly.  Therefore, it requires the stack to be
15328made executable in order for the program to work properly.
15329
15330@option{-fno-trampolines} is enabled by default on a language by language
15331basis to let the compiler avoid generating them, if it computes that this
15332is safe, and replace them with descriptors.  Descriptors are made up of data
15333only, but the generated code must be prepared to deal with them.  As of this
15334writing, @option{-fno-trampolines} is enabled by default only for Ada.
15335
15336Moreover, code compiled with @option{-ftrampolines} and code compiled with
15337@option{-fno-trampolines} are not binary compatible if nested functions are
15338present.  This option must therefore be used on a program-wide basis and be
15339manipulated with extreme care.
15340
15341@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15342@opindex fvisibility
15343Set the default ELF image symbol visibility to the specified option---all
15344symbols are marked with this unless overridden within the code.
15345Using this feature can very substantially improve linking and
15346load times of shared object libraries, produce more optimized
15347code, provide near-perfect API export and prevent symbol clashes.
15348It is @strong{strongly} recommended that you use this in any shared objects
15349you distribute.
15350
15351Despite the nomenclature, @samp{default} always means public; i.e.,
15352available to be linked against from outside the shared object.
15353@samp{protected} and @samp{internal} are pretty useless in real-world
15354usage so the only other commonly used option is @samp{hidden}.
15355The default if @option{-fvisibility} isn't specified is
15356@samp{default}, i.e., make every symbol public.
15357
15358A good explanation of the benefits offered by ensuring ELF
15359symbols have the correct visibility is given by ``How To Write
15360Shared Libraries'' by Ulrich Drepper (which can be found at
15361@w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15362solution made possible by this option to marking things hidden when
15363the default is public is to make the default hidden and mark things
15364public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15365and @code{__attribute__ ((visibility("default")))} instead of
15366@code{__declspec(dllexport)} you get almost identical semantics with
15367identical syntax.  This is a great boon to those working with
15368cross-platform projects.
15369
15370For those adding visibility support to existing code, you may find
15371@code{#pragma GCC visibility} of use.  This works by you enclosing
15372the declarations you wish to set visibility for with (for example)
15373@code{#pragma GCC visibility push(hidden)} and
15374@code{#pragma GCC visibility pop}.
15375Bear in mind that symbol visibility should be viewed @strong{as
15376part of the API interface contract} and thus all new code should
15377always specify visibility when it is not the default; i.e., declarations
15378only for use within the local DSO should @strong{always} be marked explicitly
15379as hidden as so to avoid PLT indirection overheads---making this
15380abundantly clear also aids readability and self-documentation of the code.
15381Note that due to ISO C++ specification requirements, @code{operator new} and
15382@code{operator delete} must always be of default visibility.
15383
15384Be aware that headers from outside your project, in particular system
15385headers and headers from any other library you use, may not be
15386expecting to be compiled with visibility other than the default.  You
15387may need to explicitly say @code{#pragma GCC visibility push(default)}
15388before including any such headers.
15389
15390@code{extern} declarations are not affected by @option{-fvisibility}, so
15391a lot of code can be recompiled with @option{-fvisibility=hidden} with
15392no modifications.  However, this means that calls to @code{extern}
15393functions with no explicit visibility use the PLT, so it is more
15394effective to use @code{__attribute ((visibility))} and/or
15395@code{#pragma GCC visibility} to tell the compiler which @code{extern}
15396declarations should be treated as hidden.
15397
15398Note that @option{-fvisibility} does affect C++ vague linkage
15399entities. This means that, for instance, an exception class that is
15400be thrown between DSOs must be explicitly marked with default
15401visibility so that the @samp{type_info} nodes are unified between
15402the DSOs.
15403
15404An overview of these techniques, their benefits and how to use them
15405is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15406
15407@item -fstrict-volatile-bitfields
15408@opindex fstrict-volatile-bitfields
15409This option should be used if accesses to volatile bit-fields (or other
15410structure fields, although the compiler usually honors those types
15411anyway) should use a single access of the width of the
15412field's type, aligned to a natural alignment if possible.  For
15413example, targets with memory-mapped peripheral registers might require
15414all such accesses to be 16 bits wide; with this flag you can
15415declare all peripheral bit-fields as @code{unsigned short} (assuming short
15416is 16 bits on these targets) to force GCC to use 16-bit accesses
15417instead of, perhaps, a more efficient 32-bit access.
15418
15419If this option is disabled, the compiler uses the most efficient
15420instruction.  In the previous example, that might be a 32-bit load
15421instruction, even though that accesses bytes that do not contain
15422any portion of the bit-field, or memory-mapped registers unrelated to
15423the one being updated.
15424
15425In some cases, such as when the @code{packed} attribute is applied to a
15426structure field, it may not be possible to access the field with a single
15427read or write that is correctly aligned for the target machine.  In this
15428case GCC falls back to generating multiple accesses rather than code that
15429will fault or truncate the result at run time.
15430
15431Note:  Due to restrictions of the C/C++11 memory model, write accesses are
15432not allowed to touch non bit-field members.  It is therefore recommended
15433to define all bits of the field's type as bit-field members.
15434
15435The default value of this option is determined by the application binary
15436interface for the target processor.
15437
15438@item -fsync-libcalls
15439@opindex fsync-libcalls
15440This option controls whether any out-of-line instance of the @code{__sync}
15441family of functions may be used to implement the C++11 @code{__atomic}
15442family of functions.
15443
15444The default value of this option is enabled, thus the only useful form
15445of the option is @option{-fno-sync-libcalls}.  This option is used in
15446the implementation of the @file{libatomic} runtime library.
15447
15448@end table
15449
15450@node Developer Options
15451@section GCC Developer Options
15452@cindex developer options
15453@cindex debugging GCC
15454@cindex debug dump options
15455@cindex dump options
15456@cindex compilation statistics
15457
15458This section describes command-line options that are primarily of
15459interest to GCC developers, including options to support compiler
15460testing and investigation of compiler bugs and compile-time
15461performance problems.  This includes options that produce debug dumps
15462at various points in the compilation; that print statistics such as
15463memory use and execution time; and that print information about GCC's
15464configuration, such as where it searches for libraries.  You should
15465rarely need to use any of these options for ordinary compilation and
15466linking tasks.
15467
15468Many developer options that cause GCC to dump output to a file take an
15469optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15470or @samp{-} to dump to standard output, and @samp{stderr} for standard
15471error.
15472
15473If @samp{=@var{filename}} is omitted, a default dump file name is
15474constructed by concatenating the base dump file name, a pass number,
15475phase letter, and pass name.  The base dump file name is the name of
15476output file produced by the compiler if explicitly specified and not
15477an executable; otherwise it is the source file name.
15478The pass number is determined by the order passes are registered with
15479the compiler's pass manager.
15480This is generally the same as the order of execution, but passes
15481registered by plugins, target-specific passes, or passes that are
15482otherwise registered late are numbered higher than the pass named
15483@samp{final}, even if they are executed earlier.  The phase letter is
15484one of @samp{i} (inter-procedural analysis), @samp{l}
15485(language-specific), @samp{r} (RTL), or @samp{t} (tree).
15486The files are created in the directory of the output file.
15487
15488@table @gcctabopt
15489
15490@item -fcallgraph-info
15491@itemx -fcallgraph-info=@var{MARKERS}
15492@opindex fcallgraph-info
15493Makes the compiler output callgraph information for the program, on a
15494per-object-file basis.  The information is generated in the common VCG
15495format.  It can be decorated with additional, per-node and/or per-edge
15496information, if a list of comma-separated markers is additionally
15497specified.  When the @code{su} marker is specified, the callgraph is
15498decorated with stack usage information; it is equivalent to
15499@option{-fstack-usage}.  When the @code{da} marker is specified, the
15500callgraph is decorated with information about dynamically allocated
15501objects.
15502
15503When compiling with @option{-flto}, no callgraph information is output
15504along with the object file.  At LTO link time, @option{-fcallgraph-info}
15505may generate multiple callgraph information files next to intermediate
15506LTO output files.
15507
15508@item -d@var{letters}
15509@itemx -fdump-rtl-@var{pass}
15510@itemx -fdump-rtl-@var{pass}=@var{filename}
15511@opindex d
15512@opindex fdump-rtl-@var{pass}
15513Says to make debugging dumps during compilation at times specified by
15514@var{letters}.  This is used for debugging the RTL-based passes of the
15515compiler.
15516
15517Some @option{-d@var{letters}} switches have different meaning when
15518@option{-E} is used for preprocessing.  @xref{Preprocessor Options},
15519for information about preprocessor-specific dump options.
15520
15521Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15522@option{-d} option @var{letters}.  Here are the possible
15523letters for use in @var{pass} and @var{letters}, and their meanings:
15524
15525@table @gcctabopt
15526
15527@item -fdump-rtl-alignments
15528@opindex fdump-rtl-alignments
15529Dump after branch alignments have been computed.
15530
15531@item -fdump-rtl-asmcons
15532@opindex fdump-rtl-asmcons
15533Dump after fixing rtl statements that have unsatisfied in/out constraints.
15534
15535@item -fdump-rtl-auto_inc_dec
15536@opindex fdump-rtl-auto_inc_dec
15537Dump after auto-inc-dec discovery.  This pass is only run on
15538architectures that have auto inc or auto dec instructions.
15539
15540@item -fdump-rtl-barriers
15541@opindex fdump-rtl-barriers
15542Dump after cleaning up the barrier instructions.
15543
15544@item -fdump-rtl-bbpart
15545@opindex fdump-rtl-bbpart
15546Dump after partitioning hot and cold basic blocks.
15547
15548@item -fdump-rtl-bbro
15549@opindex fdump-rtl-bbro
15550Dump after block reordering.
15551
15552@item -fdump-rtl-btl1
15553@itemx -fdump-rtl-btl2
15554@opindex fdump-rtl-btl2
15555@opindex fdump-rtl-btl2
15556@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15557after the two branch
15558target load optimization passes.
15559
15560@item -fdump-rtl-bypass
15561@opindex fdump-rtl-bypass
15562Dump after jump bypassing and control flow optimizations.
15563
15564@item -fdump-rtl-combine
15565@opindex fdump-rtl-combine
15566Dump after the RTL instruction combination pass.
15567
15568@item -fdump-rtl-compgotos
15569@opindex fdump-rtl-compgotos
15570Dump after duplicating the computed gotos.
15571
15572@item -fdump-rtl-ce1
15573@itemx -fdump-rtl-ce2
15574@itemx -fdump-rtl-ce3
15575@opindex fdump-rtl-ce1
15576@opindex fdump-rtl-ce2
15577@opindex fdump-rtl-ce3
15578@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15579@option{-fdump-rtl-ce3} enable dumping after the three
15580if conversion passes.
15581
15582@item -fdump-rtl-cprop_hardreg
15583@opindex fdump-rtl-cprop_hardreg
15584Dump after hard register copy propagation.
15585
15586@item -fdump-rtl-csa
15587@opindex fdump-rtl-csa
15588Dump after combining stack adjustments.
15589
15590@item -fdump-rtl-cse1
15591@itemx -fdump-rtl-cse2
15592@opindex fdump-rtl-cse1
15593@opindex fdump-rtl-cse2
15594@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15595the two common subexpression elimination passes.
15596
15597@item -fdump-rtl-dce
15598@opindex fdump-rtl-dce
15599Dump after the standalone dead code elimination passes.
15600
15601@item -fdump-rtl-dbr
15602@opindex fdump-rtl-dbr
15603Dump after delayed branch scheduling.
15604
15605@item -fdump-rtl-dce1
15606@itemx -fdump-rtl-dce2
15607@opindex fdump-rtl-dce1
15608@opindex fdump-rtl-dce2
15609@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15610the two dead store elimination passes.
15611
15612@item -fdump-rtl-eh
15613@opindex fdump-rtl-eh
15614Dump after finalization of EH handling code.
15615
15616@item -fdump-rtl-eh_ranges
15617@opindex fdump-rtl-eh_ranges
15618Dump after conversion of EH handling range regions.
15619
15620@item -fdump-rtl-expand
15621@opindex fdump-rtl-expand
15622Dump after RTL generation.
15623
15624@item -fdump-rtl-fwprop1
15625@itemx -fdump-rtl-fwprop2
15626@opindex fdump-rtl-fwprop1
15627@opindex fdump-rtl-fwprop2
15628@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15629dumping after the two forward propagation passes.
15630
15631@item -fdump-rtl-gcse1
15632@itemx -fdump-rtl-gcse2
15633@opindex fdump-rtl-gcse1
15634@opindex fdump-rtl-gcse2
15635@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15636after global common subexpression elimination.
15637
15638@item -fdump-rtl-init-regs
15639@opindex fdump-rtl-init-regs
15640Dump after the initialization of the registers.
15641
15642@item -fdump-rtl-initvals
15643@opindex fdump-rtl-initvals
15644Dump after the computation of the initial value sets.
15645
15646@item -fdump-rtl-into_cfglayout
15647@opindex fdump-rtl-into_cfglayout
15648Dump after converting to cfglayout mode.
15649
15650@item -fdump-rtl-ira
15651@opindex fdump-rtl-ira
15652Dump after iterated register allocation.
15653
15654@item -fdump-rtl-jump
15655@opindex fdump-rtl-jump
15656Dump after the second jump optimization.
15657
15658@item -fdump-rtl-loop2
15659@opindex fdump-rtl-loop2
15660@option{-fdump-rtl-loop2} enables dumping after the rtl
15661loop optimization passes.
15662
15663@item -fdump-rtl-mach
15664@opindex fdump-rtl-mach
15665Dump after performing the machine dependent reorganization pass, if that
15666pass exists.
15667
15668@item -fdump-rtl-mode_sw
15669@opindex fdump-rtl-mode_sw
15670Dump after removing redundant mode switches.
15671
15672@item -fdump-rtl-rnreg
15673@opindex fdump-rtl-rnreg
15674Dump after register renumbering.
15675
15676@item -fdump-rtl-outof_cfglayout
15677@opindex fdump-rtl-outof_cfglayout
15678Dump after converting from cfglayout mode.
15679
15680@item -fdump-rtl-peephole2
15681@opindex fdump-rtl-peephole2
15682Dump after the peephole pass.
15683
15684@item -fdump-rtl-postreload
15685@opindex fdump-rtl-postreload
15686Dump after post-reload optimizations.
15687
15688@item -fdump-rtl-pro_and_epilogue
15689@opindex fdump-rtl-pro_and_epilogue
15690Dump after generating the function prologues and epilogues.
15691
15692@item -fdump-rtl-sched1
15693@itemx -fdump-rtl-sched2
15694@opindex fdump-rtl-sched1
15695@opindex fdump-rtl-sched2
15696@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15697after the basic block scheduling passes.
15698
15699@item -fdump-rtl-ree
15700@opindex fdump-rtl-ree
15701Dump after sign/zero extension elimination.
15702
15703@item -fdump-rtl-seqabstr
15704@opindex fdump-rtl-seqabstr
15705Dump after common sequence discovery.
15706
15707@item -fdump-rtl-shorten
15708@opindex fdump-rtl-shorten
15709Dump after shortening branches.
15710
15711@item -fdump-rtl-sibling
15712@opindex fdump-rtl-sibling
15713Dump after sibling call optimizations.
15714
15715@item -fdump-rtl-split1
15716@itemx -fdump-rtl-split2
15717@itemx -fdump-rtl-split3
15718@itemx -fdump-rtl-split4
15719@itemx -fdump-rtl-split5
15720@opindex fdump-rtl-split1
15721@opindex fdump-rtl-split2
15722@opindex fdump-rtl-split3
15723@opindex fdump-rtl-split4
15724@opindex fdump-rtl-split5
15725These options enable dumping after five rounds of
15726instruction splitting.
15727
15728@item -fdump-rtl-sms
15729@opindex fdump-rtl-sms
15730Dump after modulo scheduling.  This pass is only run on some
15731architectures.
15732
15733@item -fdump-rtl-stack
15734@opindex fdump-rtl-stack
15735Dump after conversion from GCC's ``flat register file'' registers to the
15736x87's stack-like registers.  This pass is only run on x86 variants.
15737
15738@item -fdump-rtl-subreg1
15739@itemx -fdump-rtl-subreg2
15740@opindex fdump-rtl-subreg1
15741@opindex fdump-rtl-subreg2
15742@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
15743the two subreg expansion passes.
15744
15745@item -fdump-rtl-unshare
15746@opindex fdump-rtl-unshare
15747Dump after all rtl has been unshared.
15748
15749@item -fdump-rtl-vartrack
15750@opindex fdump-rtl-vartrack
15751Dump after variable tracking.
15752
15753@item -fdump-rtl-vregs
15754@opindex fdump-rtl-vregs
15755Dump after converting virtual registers to hard registers.
15756
15757@item -fdump-rtl-web
15758@opindex fdump-rtl-web
15759Dump after live range splitting.
15760
15761@item -fdump-rtl-regclass
15762@itemx -fdump-rtl-subregs_of_mode_init
15763@itemx -fdump-rtl-subregs_of_mode_finish
15764@itemx -fdump-rtl-dfinit
15765@itemx -fdump-rtl-dfinish
15766@opindex fdump-rtl-regclass
15767@opindex fdump-rtl-subregs_of_mode_init
15768@opindex fdump-rtl-subregs_of_mode_finish
15769@opindex fdump-rtl-dfinit
15770@opindex fdump-rtl-dfinish
15771These dumps are defined but always produce empty files.
15772
15773@item -da
15774@itemx -fdump-rtl-all
15775@opindex da
15776@opindex fdump-rtl-all
15777Produce all the dumps listed above.
15778
15779@item -dA
15780@opindex dA
15781Annotate the assembler output with miscellaneous debugging information.
15782
15783@item -dD
15784@opindex dD
15785Dump all macro definitions, at the end of preprocessing, in addition to
15786normal output.
15787
15788@item -dH
15789@opindex dH
15790Produce a core dump whenever an error occurs.
15791
15792@item -dp
15793@opindex dp
15794Annotate the assembler output with a comment indicating which
15795pattern and alternative is used.  The length and cost of each instruction are
15796also printed.
15797
15798@item -dP
15799@opindex dP
15800Dump the RTL in the assembler output as a comment before each instruction.
15801Also turns on @option{-dp} annotation.
15802
15803@item -dx
15804@opindex dx
15805Just generate RTL for a function instead of compiling it.  Usually used
15806with @option{-fdump-rtl-expand}.
15807@end table
15808
15809@item -fdump-debug
15810@opindex fdump-debug
15811Dump debugging information generated during the debug
15812generation phase.
15813
15814@item -fdump-earlydebug
15815@opindex fdump-earlydebug
15816Dump debugging information generated during the early debug
15817generation phase.
15818
15819@item -fdump-noaddr
15820@opindex fdump-noaddr
15821When doing debugging dumps, suppress address output.  This makes it more
15822feasible to use diff on debugging dumps for compiler invocations with
15823different compiler binaries and/or different
15824text / bss / data / heap / stack / dso start locations.
15825
15826@item -freport-bug
15827@opindex freport-bug
15828Collect and dump debug information into a temporary file if an
15829internal compiler error (ICE) occurs.
15830
15831@item -fdump-unnumbered
15832@opindex fdump-unnumbered
15833When doing debugging dumps, suppress instruction numbers and address output.
15834This makes it more feasible to use diff on debugging dumps for compiler
15835invocations with different options, in particular with and without
15836@option{-g}.
15837
15838@item -fdump-unnumbered-links
15839@opindex fdump-unnumbered-links
15840When doing debugging dumps (see @option{-d} option above), suppress
15841instruction numbers for the links to the previous and next instructions
15842in a sequence.
15843
15844@item -fdump-ipa-@var{switch}
15845@itemx -fdump-ipa-@var{switch}-@var{options}
15846@opindex fdump-ipa
15847Control the dumping at various stages of inter-procedural analysis
15848language tree to a file.  The file name is generated by appending a
15849switch specific suffix to the source file name, and the file is created
15850in the same directory as the output file.  The following dumps are
15851possible:
15852
15853@table @samp
15854@item all
15855Enables all inter-procedural analysis dumps.
15856
15857@item cgraph
15858Dumps information about call-graph optimization, unused function removal,
15859and inlining decisions.
15860
15861@item inline
15862Dump after function inlining.
15863
15864@end table
15865
15866Additionally, the options @option{-optimized}, @option{-missed},
15867@option{-note}, and @option{-all} can be provided, with the same meaning
15868as for @option{-fopt-info}, defaulting to @option{-optimized}.
15869
15870For example, @option{-fdump-ipa-inline-optimized-missed} will emit
15871information on callsites that were inlined, along with callsites
15872that were not inlined.
15873
15874By default, the dump will contain messages about successful
15875optimizations (equivalent to @option{-optimized}) together with
15876low-level details about the analysis.
15877
15878@item -fdump-lang-all
15879@itemx -fdump-lang-@var{switch}
15880@itemx -fdump-lang-@var{switch}-@var{options}
15881@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
15882@opindex fdump-lang-all
15883@opindex fdump-lang
15884Control the dumping of language-specific information.  The @var{options}
15885and @var{filename} portions behave as described in the
15886@option{-fdump-tree} option.  The following @var{switch} values are
15887accepted:
15888
15889@table @samp
15890@item all
15891
15892Enable all language-specific dumps.
15893
15894@item class
15895Dump class hierarchy information.  Virtual table information is emitted
15896unless '@option{slim}' is specified.  This option is applicable to C++ only.
15897
15898@item raw
15899Dump the raw internal tree data.  This option is applicable to C++ only.
15900
15901@end table
15902
15903@item -fdump-passes
15904@opindex fdump-passes
15905Print on @file{stderr} the list of optimization passes that are turned
15906on and off by the current command-line options.
15907
15908@item -fdump-statistics-@var{option}
15909@opindex fdump-statistics
15910Enable and control dumping of pass statistics in a separate file.  The
15911file name is generated by appending a suffix ending in
15912@samp{.statistics} to the source file name, and the file is created in
15913the same directory as the output file.  If the @samp{-@var{option}}
15914form is used, @samp{-stats} causes counters to be summed over the
15915whole compilation unit while @samp{-details} dumps every event as
15916the passes generate them.  The default with no option is to sum
15917counters for each function compiled.
15918
15919@item -fdump-tree-all
15920@itemx -fdump-tree-@var{switch}
15921@itemx -fdump-tree-@var{switch}-@var{options}
15922@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15923@opindex fdump-tree-all
15924@opindex fdump-tree
15925Control the dumping at various stages of processing the intermediate
15926language tree to a file.  If the @samp{-@var{options}}
15927form is used, @var{options} is a list of @samp{-} separated options
15928which control the details of the dump.  Not all options are applicable
15929to all dumps; those that are not meaningful are ignored.  The
15930following options are available
15931
15932@table @samp
15933@item address
15934Print the address of each node.  Usually this is not meaningful as it
15935changes according to the environment and source file.  Its primary use
15936is for tying up a dump file with a debug environment.
15937@item asmname
15938If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15939in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
15940use working backward from mangled names in the assembly file.
15941@item slim
15942When dumping front-end intermediate representations, inhibit dumping
15943of members of a scope or body of a function merely because that scope
15944has been reached.  Only dump such items when they are directly reachable
15945by some other path.
15946
15947When dumping pretty-printed trees, this option inhibits dumping the
15948bodies of control structures.
15949
15950When dumping RTL, print the RTL in slim (condensed) form instead of
15951the default LISP-like representation.
15952@item raw
15953Print a raw representation of the tree.  By default, trees are
15954pretty-printed into a C-like representation.
15955@item details
15956Enable more detailed dumps (not honored by every dump option). Also
15957include information from the optimization passes.
15958@item stats
15959Enable dumping various statistics about the pass (not honored by every dump
15960option).
15961@item blocks
15962Enable showing basic block boundaries (disabled in raw dumps).
15963@item graph
15964For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15965dump a representation of the control flow graph suitable for viewing with
15966GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
15967the file is pretty-printed as a subgraph, so that GraphViz can render them
15968all in a single plot.
15969
15970This option currently only works for RTL dumps, and the RTL is always
15971dumped in slim form.
15972@item vops
15973Enable showing virtual operands for every statement.
15974@item lineno
15975Enable showing line numbers for statements.
15976@item uid
15977Enable showing the unique ID (@code{DECL_UID}) for each variable.
15978@item verbose
15979Enable showing the tree dump for each statement.
15980@item eh
15981Enable showing the EH region number holding each statement.
15982@item scev
15983Enable showing scalar evolution analysis details.
15984@item optimized
15985Enable showing optimization information (only available in certain
15986passes).
15987@item missed
15988Enable showing missed optimization information (only available in certain
15989passes).
15990@item note
15991Enable other detailed optimization information (only available in
15992certain passes).
15993@item all
15994Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15995and @option{lineno}.
15996@item optall
15997Turn on all optimization options, i.e., @option{optimized},
15998@option{missed}, and @option{note}.
15999@end table
16000
16001To determine what tree dumps are available or find the dump for a pass
16002of interest follow the steps below.
16003
16004@enumerate
16005@item
16006Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
16007look for a code that corresponds to the pass you are interested in.
16008For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
16009@code{tree-vrp2} correspond to the three Value Range Propagation passes.
16010The number at the end distinguishes distinct invocations of the same pass.
16011@item
16012To enable the creation of the dump file, append the pass code to
16013the @option{-fdump-} option prefix and invoke GCC with it.  For example,
16014to enable the dump from the Early Value Range Propagation pass, invoke
16015GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
16016specify the name of the dump file.  If you don't specify one, GCC
16017creates as described below.
16018@item
16019Find the pass dump in a file whose name is composed of three components
16020separated by a period: the name of the source file GCC was invoked to
16021compile, a numeric suffix indicating the pass number followed by the
16022letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
16023and finally the pass code.  For example, the Early VRP pass dump might
16024be in a file named @file{myfile.c.038t.evrp} in the current working
16025directory.  Note that the numeric codes are not stable and may change
16026from one version of GCC to another.
16027@end enumerate
16028
16029@item -fopt-info
16030@itemx -fopt-info-@var{options}
16031@itemx -fopt-info-@var{options}=@var{filename}
16032@opindex fopt-info
16033Controls optimization dumps from various optimization passes. If the
16034@samp{-@var{options}} form is used, @var{options} is a list of
16035@samp{-} separated option keywords to select the dump details and
16036optimizations.
16037
16038The @var{options} can be divided into three groups:
16039@enumerate
16040@item
16041options describing what kinds of messages should be emitted,
16042@item
16043options describing the verbosity of the dump, and
16044@item
16045options describing which optimizations should be included.
16046@end enumerate
16047The options from each group can be freely mixed as they are
16048non-overlapping. However, in case of any conflicts,
16049the later options override the earlier options on the command
16050line.
16051
16052The following options control which kinds of messages should be emitted:
16053
16054@table @samp
16055@item optimized
16056Print information when an optimization is successfully applied. It is
16057up to a pass to decide which information is relevant. For example, the
16058vectorizer passes print the source location of loops which are
16059successfully vectorized.
16060@item missed
16061Print information about missed optimizations. Individual passes
16062control which information to include in the output.
16063@item note
16064Print verbose information about optimizations, such as certain
16065transformations, more detailed messages about decisions etc.
16066@item all
16067Print detailed optimization information. This includes
16068@samp{optimized}, @samp{missed}, and @samp{note}.
16069@end table
16070
16071The following option controls the dump verbosity:
16072
16073@table @samp
16074@item internals
16075By default, only ``high-level'' messages are emitted. This option enables
16076additional, more detailed, messages, which are likely to only be of interest
16077to GCC developers.
16078@end table
16079
16080One or more of the following option keywords can be used to describe a
16081group of optimizations:
16082
16083@table @samp
16084@item ipa
16085Enable dumps from all interprocedural optimizations.
16086@item loop
16087Enable dumps from all loop optimizations.
16088@item inline
16089Enable dumps from all inlining optimizations.
16090@item omp
16091Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16092@item vec
16093Enable dumps from all vectorization optimizations.
16094@item optall
16095Enable dumps from all optimizations. This is a superset of
16096the optimization groups listed above.
16097@end table
16098
16099If @var{options} is
16100omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16101about successful optimizations from all the passes, omitting messages
16102that are treated as ``internals''.
16103
16104If the @var{filename} is provided, then the dumps from all the
16105applicable optimizations are concatenated into the @var{filename}.
16106Otherwise the dump is output onto @file{stderr}. Though multiple
16107@option{-fopt-info} options are accepted, only one of them can include
16108a @var{filename}. If other filenames are provided then all but the
16109first such option are ignored.
16110
16111Note that the output @var{filename} is overwritten
16112in case of multiple translation units. If a combined output from
16113multiple translation units is desired, @file{stderr} should be used
16114instead.
16115
16116In the following example, the optimization info is output to
16117@file{stderr}:
16118
16119@smallexample
16120gcc -O3 -fopt-info
16121@end smallexample
16122
16123This example:
16124@smallexample
16125gcc -O3 -fopt-info-missed=missed.all
16126@end smallexample
16127
16128@noindent
16129outputs missed optimization report from all the passes into
16130@file{missed.all}, and this one:
16131
16132@smallexample
16133gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16134@end smallexample
16135
16136@noindent
16137prints information about missed optimization opportunities from
16138vectorization passes on @file{stderr}.
16139Note that @option{-fopt-info-vec-missed} is equivalent to
16140@option{-fopt-info-missed-vec}.  The order of the optimization group
16141names and message types listed after @option{-fopt-info} does not matter.
16142
16143As another example,
16144@smallexample
16145gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16146@end smallexample
16147
16148@noindent
16149outputs information about missed optimizations as well as
16150optimized locations from all the inlining passes into
16151@file{inline.txt}.
16152
16153Finally, consider:
16154
16155@smallexample
16156gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16157@end smallexample
16158
16159@noindent
16160Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16161in conflict since only one output file is allowed. In this case, only
16162the first option takes effect and the subsequent options are
16163ignored. Thus only @file{vec.miss} is produced which contains
16164dumps from the vectorizer about missed opportunities.
16165
16166@item -fsave-optimization-record
16167@opindex fsave-optimization-record
16168Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16169were performed, for those optimizations that support @option{-fopt-info}.
16170
16171This option is experimental and the format of the data within the
16172compressed JSON file is subject to change.
16173
16174It is roughly equivalent to a machine-readable version of
16175@option{-fopt-info-all}, as a collection of messages with source file,
16176line number and column number, with the following additional data for
16177each message:
16178
16179@itemize @bullet
16180
16181@item
16182the execution count of the code being optimized, along with metadata about
16183whether this was from actual profile data, or just an estimate, allowing
16184consumers to prioritize messages by code hotness,
16185
16186@item
16187the function name of the code being optimized, where applicable,
16188
16189@item
16190the ``inlining chain'' for the code being optimized, so that when
16191a function is inlined into several different places (which might
16192themselves be inlined), the reader can distinguish between the copies,
16193
16194@item
16195objects identifying those parts of the message that refer to expressions,
16196statements or symbol-table nodes, which of these categories they are, and,
16197when available, their source code location,
16198
16199@item
16200the GCC pass that emitted the message, and
16201
16202@item
16203the location in GCC's own code from which the message was emitted
16204
16205@end itemize
16206
16207Additionally, some messages are logically nested within other
16208messages, reflecting implementation details of the optimization
16209passes.
16210
16211@item -fsched-verbose=@var{n}
16212@opindex fsched-verbose
16213On targets that use instruction scheduling, this option controls the
16214amount of debugging output the scheduler prints to the dump files.
16215
16216For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16217same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16218For @var{n} greater than one, it also output basic block probabilities,
16219detailed ready list information and unit/insn info.  For @var{n} greater
16220than two, it includes RTL at abort point, control-flow and regions info.
16221And for @var{n} over four, @option{-fsched-verbose} also includes
16222dependence info.
16223
16224
16225
16226@item -fenable-@var{kind}-@var{pass}
16227@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16228@opindex fdisable-
16229@opindex fenable-
16230
16231This is a set of options that are used to explicitly disable/enable
16232optimization passes.  These options are intended for use for debugging GCC.
16233Compiler users should use regular options for enabling/disabling
16234passes instead.
16235
16236@table @gcctabopt
16237
16238@item -fdisable-ipa-@var{pass}
16239Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
16240statically invoked in the compiler multiple times, the pass name should be
16241appended with a sequential number starting from 1.
16242
16243@item -fdisable-rtl-@var{pass}
16244@itemx -fdisable-rtl-@var{pass}=@var{range-list}
16245Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16246statically invoked in the compiler multiple times, the pass name should be
16247appended with a sequential number starting from 1.  @var{range-list} is a
16248comma-separated list of function ranges or assembler names.  Each range is a number
16249pair separated by a colon.  The range is inclusive in both ends.  If the range
16250is trivial, the number pair can be simplified as a single number.  If the
16251function's call graph node's @var{uid} falls within one of the specified ranges,
16252the @var{pass} is disabled for that function.  The @var{uid} is shown in the
16253function header of a dump file, and the pass names can be dumped by using
16254option @option{-fdump-passes}.
16255
16256@item -fdisable-tree-@var{pass}
16257@itemx -fdisable-tree-@var{pass}=@var{range-list}
16258Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
16259option arguments.
16260
16261@item -fenable-ipa-@var{pass}
16262Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
16263statically invoked in the compiler multiple times, the pass name should be
16264appended with a sequential number starting from 1.
16265
16266@item -fenable-rtl-@var{pass}
16267@itemx -fenable-rtl-@var{pass}=@var{range-list}
16268Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
16269description and examples.
16270
16271@item -fenable-tree-@var{pass}
16272@itemx -fenable-tree-@var{pass}=@var{range-list}
16273Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
16274of option arguments.
16275
16276@end table
16277
16278Here are some examples showing uses of these options.
16279
16280@smallexample
16281
16282# disable ccp1 for all functions
16283   -fdisable-tree-ccp1
16284# disable complete unroll for function whose cgraph node uid is 1
16285   -fenable-tree-cunroll=1
16286# disable gcse2 for functions at the following ranges [1,1],
16287# [300,400], and [400,1000]
16288# disable gcse2 for functions foo and foo2
16289   -fdisable-rtl-gcse2=foo,foo2
16290# disable early inlining
16291   -fdisable-tree-einline
16292# disable ipa inlining
16293   -fdisable-ipa-inline
16294# enable tree full unroll
16295   -fenable-tree-unroll
16296
16297@end smallexample
16298
16299@item -fchecking
16300@itemx -fchecking=@var{n}
16301@opindex fchecking
16302@opindex fno-checking
16303Enable internal consistency checking.  The default depends on
16304the compiler configuration.  @option{-fchecking=2} enables further
16305internal consistency checking that might affect code generation.
16306
16307@item -frandom-seed=@var{string}
16308@opindex frandom-seed
16309This option provides a seed that GCC uses in place of
16310random numbers in generating certain symbol names
16311that have to be different in every compiled file.  It is also used to
16312place unique stamps in coverage data files and the object files that
16313produce them.  You can use the @option{-frandom-seed} option to produce
16314reproducibly identical object files.
16315
16316The @var{string} can either be a number (decimal, octal or hex) or an
16317arbitrary string (in which case it's converted to a number by
16318computing CRC32).
16319
16320The @var{string} should be different for every file you compile.
16321
16322@item -save-temps
16323@itemx -save-temps=cwd
16324@opindex save-temps
16325Store the usual ``temporary'' intermediate files permanently; place them
16326in the current directory and name them based on the source file.  Thus,
16327compiling @file{foo.c} with @option{-c -save-temps} produces files
16328@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
16329preprocessed @file{foo.i} output file even though the compiler now
16330normally uses an integrated preprocessor.
16331
16332When used in combination with the @option{-x} command-line option,
16333@option{-save-temps} is sensible enough to avoid over writing an
16334input source file with the same extension as an intermediate file.
16335The corresponding intermediate file may be obtained by renaming the
16336source file before using @option{-save-temps}.
16337
16338If you invoke GCC in parallel, compiling several different source
16339files that share a common base name in different subdirectories or the
16340same source file compiled for multiple output destinations, it is
16341likely that the different parallel compilers will interfere with each
16342other, and overwrite the temporary files.  For instance:
16343
16344@smallexample
16345gcc -save-temps -o outdir1/foo.o indir1/foo.c&
16346gcc -save-temps -o outdir2/foo.o indir2/foo.c&
16347@end smallexample
16348
16349may result in @file{foo.i} and @file{foo.o} being written to
16350simultaneously by both compilers.
16351
16352@item -save-temps=obj
16353@opindex save-temps=obj
16354Store the usual ``temporary'' intermediate files permanently.  If the
16355@option{-o} option is used, the temporary files are based on the
16356object file.  If the @option{-o} option is not used, the
16357@option{-save-temps=obj} switch behaves like @option{-save-temps}.
16358
16359For example:
16360
16361@smallexample
16362gcc -save-temps=obj -c foo.c
16363gcc -save-temps=obj -c bar.c -o dir/xbar.o
16364gcc -save-temps=obj foobar.c -o dir2/yfoobar
16365@end smallexample
16366
16367@noindent
16368creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
16369@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
16370@file{dir2/yfoobar.o}.
16371
16372@item -time@r{[}=@var{file}@r{]}
16373@opindex time
16374Report the CPU time taken by each subprocess in the compilation
16375sequence.  For C source files, this is the compiler proper and assembler
16376(plus the linker if linking is done).
16377
16378Without the specification of an output file, the output looks like this:
16379
16380@smallexample
16381# cc1 0.12 0.01
16382# as 0.00 0.01
16383@end smallexample
16384
16385The first number on each line is the ``user time'', that is time spent
16386executing the program itself.  The second number is ``system time'',
16387time spent executing operating system routines on behalf of the program.
16388Both numbers are in seconds.
16389
16390With the specification of an output file, the output is appended to the
16391named file, and it looks like this:
16392
16393@smallexample
163940.12 0.01 cc1 @var{options}
163950.00 0.01 as @var{options}
16396@end smallexample
16397
16398The ``user time'' and the ``system time'' are moved before the program
16399name, and the options passed to the program are displayed, so that one
16400can later tell what file was being compiled, and with which options.
16401
16402@item -fdump-final-insns@r{[}=@var{file}@r{]}
16403@opindex fdump-final-insns
16404Dump the final internal representation (RTL) to @var{file}.  If the
16405optional argument is omitted (or if @var{file} is @code{.}), the name
16406of the dump file is determined by appending @code{.gkd} to the
16407compilation output file name.
16408
16409@item -fcompare-debug@r{[}=@var{opts}@r{]}
16410@opindex fcompare-debug
16411@opindex fno-compare-debug
16412If no error occurs during compilation, run the compiler a second time,
16413adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16414passed to the second compilation.  Dump the final internal
16415representation in both compilations, and print an error if they differ.
16416
16417If the equal sign is omitted, the default @option{-gtoggle} is used.
16418
16419The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16420and nonzero, implicitly enables @option{-fcompare-debug}.  If
16421@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16422then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16423is used.
16424
16425@option{-fcompare-debug=}, with the equal sign but without @var{opts},
16426is equivalent to @option{-fno-compare-debug}, which disables the dumping
16427of the final representation and the second compilation, preventing even
16428@env{GCC_COMPARE_DEBUG} from taking effect.
16429
16430To verify full coverage during @option{-fcompare-debug} testing, set
16431@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16432which GCC rejects as an invalid option in any actual compilation
16433(rather than preprocessing, assembly or linking).  To get just a
16434warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16435not overridden} will do.
16436
16437@item -fcompare-debug-second
16438@opindex fcompare-debug-second
16439This option is implicitly passed to the compiler for the second
16440compilation requested by @option{-fcompare-debug}, along with options to
16441silence warnings, and omitting other options that would cause the compiler
16442to produce output to files or to standard output as a side effect.  Dump
16443files and preserved temporary files are renamed so as to contain the
16444@code{.gk} additional extension during the second compilation, to avoid
16445overwriting those generated by the first.
16446
16447When this option is passed to the compiler driver, it causes the
16448@emph{first} compilation to be skipped, which makes it useful for little
16449other than debugging the compiler proper.
16450
16451@item -gtoggle
16452@opindex gtoggle
16453Turn off generation of debug info, if leaving out this option
16454generates it, or turn it on at level 2 otherwise.  The position of this
16455argument in the command line does not matter; it takes effect after all
16456other options are processed, and it does so only once, no matter how
16457many times it is given.  This is mainly intended to be used with
16458@option{-fcompare-debug}.
16459
16460@item -fvar-tracking-assignments-toggle
16461@opindex fvar-tracking-assignments-toggle
16462@opindex fno-var-tracking-assignments-toggle
16463Toggle @option{-fvar-tracking-assignments}, in the same way that
16464@option{-gtoggle} toggles @option{-g}.
16465
16466@item -Q
16467@opindex Q
16468Makes the compiler print out each function name as it is compiled, and
16469print some statistics about each pass when it finishes.
16470
16471@item -ftime-report
16472@opindex ftime-report
16473Makes the compiler print some statistics about the time consumed by each
16474pass when it finishes.
16475
16476@item -ftime-report-details
16477@opindex ftime-report-details
16478Record the time consumed by infrastructure parts separately for each pass.
16479
16480@item -fira-verbose=@var{n}
16481@opindex fira-verbose
16482Control the verbosity of the dump file for the integrated register allocator.
16483The default value is 5.  If the value @var{n} is greater or equal to 10,
16484the dump output is sent to stderr using the same format as @var{n} minus 10.
16485
16486@item -flto-report
16487@opindex flto-report
16488Prints a report with internal details on the workings of the link-time
16489optimizer.  The contents of this report vary from version to version.
16490It is meant to be useful to GCC developers when processing object
16491files in LTO mode (via @option{-flto}).
16492
16493Disabled by default.
16494
16495@item -flto-report-wpa
16496@opindex flto-report-wpa
16497Like @option{-flto-report}, but only print for the WPA phase of link-time
16498optimization.
16499
16500@item -fmem-report
16501@opindex fmem-report
16502Makes the compiler print some statistics about permanent memory
16503allocation when it finishes.
16504
16505@item -fmem-report-wpa
16506@opindex fmem-report-wpa
16507Makes the compiler print some statistics about permanent memory
16508allocation for the WPA phase only.
16509
16510@item -fpre-ipa-mem-report
16511@opindex fpre-ipa-mem-report
16512@item -fpost-ipa-mem-report
16513@opindex fpost-ipa-mem-report
16514Makes the compiler print some statistics about permanent memory
16515allocation before or after interprocedural optimization.
16516
16517@item -fprofile-report
16518@opindex fprofile-report
16519Makes the compiler print some statistics about consistency of the
16520(estimated) profile and effect of individual passes.
16521
16522@item -fstack-usage
16523@opindex fstack-usage
16524Makes the compiler output stack usage information for the program, on a
16525per-function basis.  The filename for the dump is made by appending
16526@file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
16527the output file, if explicitly specified and it is not an executable,
16528otherwise it is the basename of the source file.  An entry is made up
16529of three fields:
16530
16531@itemize
16532@item
16533The name of the function.
16534@item
16535A number of bytes.
16536@item
16537One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16538@end itemize
16539
16540The qualifier @code{static} means that the function manipulates the stack
16541statically: a fixed number of bytes are allocated for the frame on function
16542entry and released on function exit; no stack adjustments are otherwise made
16543in the function.  The second field is this fixed number of bytes.
16544
16545The qualifier @code{dynamic} means that the function manipulates the stack
16546dynamically: in addition to the static allocation described above, stack
16547adjustments are made in the body of the function, for example to push/pop
16548arguments around function calls.  If the qualifier @code{bounded} is also
16549present, the amount of these adjustments is bounded at compile time and
16550the second field is an upper bound of the total amount of stack used by
16551the function.  If it is not present, the amount of these adjustments is
16552not bounded at compile time and the second field only represents the
16553bounded part.
16554
16555@item -fstats
16556@opindex fstats
16557Emit statistics about front-end processing at the end of the compilation.
16558This option is supported only by the C++ front end, and
16559the information is generally only useful to the G++ development team.
16560
16561@item -fdbg-cnt-list
16562@opindex fdbg-cnt-list
16563Print the name and the counter upper bound for all debug counters.
16564
16565
16566@item -fdbg-cnt=@var{counter-value-list}
16567@opindex fdbg-cnt
16568Set the internal debug counter lower and upper bound.  @var{counter-value-list}
16569is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16570[:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16571the name of the counter and list of closed intervals.
16572The @var{lower_bound} is optional and is zero
16573initialized if not set.
16574For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16575@code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16576eleventh invocation.
16577For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16578
16579@item -print-file-name=@var{library}
16580@opindex print-file-name
16581Print the full absolute name of the library file @var{library} that
16582would be used when linking---and don't do anything else.  With this
16583option, GCC does not compile or link anything; it just prints the
16584file name.
16585
16586@item -print-multi-directory
16587@opindex print-multi-directory
16588Print the directory name corresponding to the multilib selected by any
16589other switches present in the command line.  This directory is supposed
16590to exist in @env{GCC_EXEC_PREFIX}.
16591
16592@item -print-multi-lib
16593@opindex print-multi-lib
16594Print the mapping from multilib directory names to compiler switches
16595that enable them.  The directory name is separated from the switches by
16596@samp{;}, and each switch starts with an @samp{@@} instead of the
16597@samp{-}, without spaces between multiple switches.  This is supposed to
16598ease shell processing.
16599
16600@item -print-multi-os-directory
16601@opindex print-multi-os-directory
16602Print the path to OS libraries for the selected
16603multilib, relative to some @file{lib} subdirectory.  If OS libraries are
16604present in the @file{lib} subdirectory and no multilibs are used, this is
16605usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16606sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16607@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16608subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16609
16610@item -print-multiarch
16611@opindex print-multiarch
16612Print the path to OS libraries for the selected multiarch,
16613relative to some @file{lib} subdirectory.
16614
16615@item -print-prog-name=@var{program}
16616@opindex print-prog-name
16617Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16618
16619@item -print-libgcc-file-name
16620@opindex print-libgcc-file-name
16621Same as @option{-print-file-name=libgcc.a}.
16622
16623This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16624but you do want to link with @file{libgcc.a}.  You can do:
16625
16626@smallexample
16627gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16628@end smallexample
16629
16630@item -print-search-dirs
16631@opindex print-search-dirs
16632Print the name of the configured installation directory and a list of
16633program and library directories @command{gcc} searches---and don't do anything else.
16634
16635This is useful when @command{gcc} prints the error message
16636@samp{installation problem, cannot exec cpp0: No such file or directory}.
16637To resolve this you either need to put @file{cpp0} and the other compiler
16638components where @command{gcc} expects to find them, or you can set the environment
16639variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16640Don't forget the trailing @samp{/}.
16641@xref{Environment Variables}.
16642
16643@item -print-sysroot
16644@opindex print-sysroot
16645Print the target sysroot directory that is used during
16646compilation.  This is the target sysroot specified either at configure
16647time or using the @option{--sysroot} option, possibly with an extra
16648suffix that depends on compilation options.  If no target sysroot is
16649specified, the option prints nothing.
16650
16651@item -print-sysroot-headers-suffix
16652@opindex print-sysroot-headers-suffix
16653Print the suffix added to the target sysroot when searching for
16654headers, or give an error if the compiler is not configured with such
16655a suffix---and don't do anything else.
16656
16657@item -dumpmachine
16658@opindex dumpmachine
16659Print the compiler's target machine (for example,
16660@samp{i686-pc-linux-gnu})---and don't do anything else.
16661
16662@item -dumpversion
16663@opindex dumpversion
16664Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16665anything else.  This is the compiler version used in filesystem paths and
16666specs. Depending on how the compiler has been configured it can be just
16667a single number (major version), two numbers separated by a dot (major and
16668minor version) or three numbers separated by dots (major, minor and patchlevel
16669version).
16670
16671@item -dumpfullversion
16672@opindex dumpfullversion
16673Print the full compiler version---and don't do anything else. The output is
16674always three numbers separated by dots, major, minor and patchlevel version.
16675
16676@item -dumpspecs
16677@opindex dumpspecs
16678Print the compiler's built-in specs---and don't do anything else.  (This
16679is used when GCC itself is being built.)  @xref{Spec Files}.
16680@end table
16681
16682@node Submodel Options
16683@section Machine-Dependent Options
16684@cindex submodel options
16685@cindex specifying hardware config
16686@cindex hardware models and configurations, specifying
16687@cindex target-dependent options
16688@cindex machine-dependent options
16689
16690Each target machine supported by GCC can have its own options---for
16691example, to allow you to compile for a particular processor variant or
16692ABI, or to control optimizations specific to that machine.  By
16693convention, the names of machine-specific options start with
16694@samp{-m}.
16695
16696Some configurations of the compiler also support additional target-specific
16697options, usually for compatibility with other compilers on the same
16698platform.
16699
16700@c This list is ordered alphanumerically by subsection name.
16701@c It should be the same order and spelling as these options are listed
16702@c in Machine Dependent Options
16703
16704@menu
16705* AArch64 Options::
16706* Adapteva Epiphany Options::
16707* AMD GCN Options::
16708* ARC Options::
16709* ARM Options::
16710* AVR Options::
16711* Blackfin Options::
16712* C6X Options::
16713* CRIS Options::
16714* CR16 Options::
16715* C-SKY Options::
16716* Darwin Options::
16717* DEC Alpha Options::
16718* eBPF Options::
16719* FR30 Options::
16720* FT32 Options::
16721* FRV Options::
16722* GNU/Linux Options::
16723* H8/300 Options::
16724* HPPA Options::
16725* IA-64 Options::
16726* LM32 Options::
16727* M32C Options::
16728* M32R/D Options::
16729* M680x0 Options::
16730* MCore Options::
16731* MeP Options::
16732* MicroBlaze Options::
16733* MIPS Options::
16734* MMIX Options::
16735* MN10300 Options::
16736* Moxie Options::
16737* MSP430 Options::
16738* NDS32 Options::
16739* Nios II Options::
16740* Nvidia PTX Options::
16741* OpenRISC Options::
16742* PDP-11 Options::
16743* picoChip Options::
16744* PowerPC Options::
16745* PRU Options::
16746* RISC-V Options::
16747* RL78 Options::
16748* RS/6000 and PowerPC Options::
16749* RX Options::
16750* S/390 and zSeries Options::
16751* Score Options::
16752* SH Options::
16753* Solaris 2 Options::
16754* SPARC Options::
16755* System V Options::
16756* TILE-Gx Options::
16757* TILEPro Options::
16758* V850 Options::
16759* VAX Options::
16760* Visium Options::
16761* VMS Options::
16762* VxWorks Options::
16763* x86 Options::
16764* x86 Windows Options::
16765* Xstormy16 Options::
16766* Xtensa Options::
16767* zSeries Options::
16768@end menu
16769
16770@node AArch64 Options
16771@subsection AArch64 Options
16772@cindex AArch64 Options
16773
16774These options are defined for AArch64 implementations:
16775
16776@table @gcctabopt
16777
16778@item -mabi=@var{name}
16779@opindex mabi
16780Generate code for the specified data model.  Permissible values
16781are @samp{ilp32} for SysV-like data model where int, long int and pointers
16782are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
16783but long int and pointers are 64 bits.
16784
16785The default depends on the specific target configuration.  Note that
16786the LP64 and ILP32 ABIs are not link-compatible; you must compile your
16787entire program with the same ABI, and link with a compatible set of libraries.
16788
16789@item -mbig-endian
16790@opindex mbig-endian
16791Generate big-endian code.  This is the default when GCC is configured for an
16792@samp{aarch64_be-*-*} target.
16793
16794@item -mgeneral-regs-only
16795@opindex mgeneral-regs-only
16796Generate code which uses only the general-purpose registers.  This will prevent
16797the compiler from using floating-point and Advanced SIMD registers but will not
16798impose any restrictions on the assembler.
16799
16800@item -mlittle-endian
16801@opindex mlittle-endian
16802Generate little-endian code.  This is the default when GCC is configured for an
16803@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
16804
16805@item -mcmodel=tiny
16806@opindex mcmodel=tiny
16807Generate code for the tiny code model.  The program and its statically defined
16808symbols must be within 1MB of each other.  Programs can be statically or
16809dynamically linked.
16810
16811@item -mcmodel=small
16812@opindex mcmodel=small
16813Generate code for the small code model.  The program and its statically defined
16814symbols must be within 4GB of each other.  Programs can be statically or
16815dynamically linked.  This is the default code model.
16816
16817@item -mcmodel=large
16818@opindex mcmodel=large
16819Generate code for the large code model.  This makes no assumptions about
16820addresses and sizes of sections.  Programs can be statically linked only.  The
16821@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
16822@option{-fpic} and @option{-fPIC}.
16823
16824@item -mstrict-align
16825@itemx -mno-strict-align
16826@opindex mstrict-align
16827@opindex mno-strict-align
16828Avoid or allow generating memory accesses that may not be aligned on a natural
16829object boundary as described in the architecture specification.
16830
16831@item -momit-leaf-frame-pointer
16832@itemx -mno-omit-leaf-frame-pointer
16833@opindex momit-leaf-frame-pointer
16834@opindex mno-omit-leaf-frame-pointer
16835Omit or keep the frame pointer in leaf functions.  The former behavior is the
16836default.
16837
16838@item -mstack-protector-guard=@var{guard}
16839@itemx -mstack-protector-guard-reg=@var{reg}
16840@itemx -mstack-protector-guard-offset=@var{offset}
16841@opindex mstack-protector-guard
16842@opindex mstack-protector-guard-reg
16843@opindex mstack-protector-guard-offset
16844Generate stack protection code using canary at @var{guard}.  Supported
16845locations are @samp{global} for a global canary or @samp{sysreg} for a
16846canary in an appropriate system register.
16847
16848With the latter choice the options
16849@option{-mstack-protector-guard-reg=@var{reg}} and
16850@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16851which system register to use as base register for reading the canary,
16852and from what offset from that base register. There is no default
16853register or offset as this is entirely for use within the Linux
16854kernel.
16855
16856@item -mstack-protector-guard=@var{guard}
16857@itemx -mstack-protector-guard-reg=@var{reg}
16858@itemx -mstack-protector-guard-offset=@var{offset}
16859@opindex mstack-protector-guard
16860@opindex mstack-protector-guard-reg
16861@opindex mstack-protector-guard-offset
16862Generate stack protection code using canary at @var{guard}.  Supported
16863locations are @samp{global} for a global canary or @samp{sysreg} for a
16864canary in an appropriate system register.
16865
16866With the latter choice the options
16867@option{-mstack-protector-guard-reg=@var{reg}} and
16868@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16869which system register to use as base register for reading the canary,
16870and from what offset from that base register. There is no default
16871register or offset as this is entirely for use within the Linux
16872kernel.
16873
16874@item -mtls-dialect=desc
16875@opindex mtls-dialect=desc
16876Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
16877of TLS variables.  This is the default.
16878
16879@item -mtls-dialect=traditional
16880@opindex mtls-dialect=traditional
16881Use traditional TLS as the thread-local storage mechanism for dynamic accesses
16882of TLS variables.
16883
16884@item -mtls-size=@var{size}
16885@opindex mtls-size
16886Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
16887This option requires binutils 2.26 or newer.
16888
16889@item -mfix-cortex-a53-835769
16890@itemx -mno-fix-cortex-a53-835769
16891@opindex mfix-cortex-a53-835769
16892@opindex mno-fix-cortex-a53-835769
16893Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
16894This involves inserting a NOP instruction between memory instructions and
1689564-bit integer multiply-accumulate instructions.
16896
16897@item -mfix-cortex-a53-843419
16898@itemx -mno-fix-cortex-a53-843419
16899@opindex mfix-cortex-a53-843419
16900@opindex mno-fix-cortex-a53-843419
16901Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
16902This erratum workaround is made at link time and this will only pass the
16903corresponding flag to the linker.
16904
16905@item -mlow-precision-recip-sqrt
16906@itemx -mno-low-precision-recip-sqrt
16907@opindex mlow-precision-recip-sqrt
16908@opindex mno-low-precision-recip-sqrt
16909Enable or disable the reciprocal square root approximation.
16910This option only has an effect if @option{-ffast-math} or
16911@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16912precision of reciprocal square root results to about 16 bits for
16913single precision and to 32 bits for double precision.
16914
16915@item -mlow-precision-sqrt
16916@itemx -mno-low-precision-sqrt
16917@opindex mlow-precision-sqrt
16918@opindex mno-low-precision-sqrt
16919Enable or disable the square root approximation.
16920This option only has an effect if @option{-ffast-math} or
16921@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16922precision of square root results to about 16 bits for
16923single precision and to 32 bits for double precision.
16924If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16925
16926@item -mlow-precision-div
16927@itemx -mno-low-precision-div
16928@opindex mlow-precision-div
16929@opindex mno-low-precision-div
16930Enable or disable the division approximation.
16931This option only has an effect if @option{-ffast-math} or
16932@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
16933precision of division results to about 16 bits for
16934single precision and to 32 bits for double precision.
16935
16936@item -mtrack-speculation
16937@itemx -mno-track-speculation
16938Enable or disable generation of additional code to track speculative
16939execution through conditional branches.  The tracking state can then
16940be used by the compiler when expanding calls to
16941@code{__builtin_speculation_safe_copy} to permit a more efficient code
16942sequence to be generated.
16943
16944@item -moutline-atomics
16945@itemx -mno-outline-atomics
16946Enable or disable calls to out-of-line helpers to implement atomic operations.
16947These helpers will, at runtime, determine if the LSE instructions from
16948ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16949instructions that are present in the base ARMv8.0 ISA.
16950
16951This option is only applicable when compiling for the base ARMv8.0
16952instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
16953or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16954used directly.  The same applies when using @option{-mcpu=} when the
16955selected cpu supports the @samp{lse} feature.
16956This option is on by default.
16957
16958@item -march=@var{name}
16959@opindex march
16960Specify the name of the target architecture and, optionally, one or
16961more feature modifiers.  This option has the form
16962@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16963
16964The table below summarizes the permissible values for @var{arch}
16965and the features that they enable by default:
16966
16967@multitable @columnfractions 0.20 0.20 0.60
16968@headitem @var{arch} value @tab Architecture @tab Includes by default
16969@item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
16970@item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
16971@item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
16972@item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
16973@item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
16974@item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
16975@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
16976@end multitable
16977
16978The value @samp{native} is available on native AArch64 GNU/Linux and
16979causes the compiler to pick the architecture of the host system.  This
16980option has no effect if the compiler is unable to recognize the
16981architecture of the host system,
16982
16983The permissible values for @var{feature} are listed in the sub-section
16984on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16985Feature Modifiers}.  Where conflicting feature modifiers are
16986specified, the right-most feature is used.
16987
16988GCC uses @var{name} to determine what kind of instructions it can emit
16989when generating assembly code.  If @option{-march} is specified
16990without either of @option{-mtune} or @option{-mcpu} also being
16991specified, the code is tuned to perform well across a range of target
16992processors implementing the target architecture.
16993
16994@item -mtune=@var{name}
16995@opindex mtune
16996Specify the name of the target processor for which GCC should tune the
16997performance of the code.  Permissible values for this option are:
16998@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16999@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17000@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17001@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
17002@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
17003@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2},
17004@samp{neoverse-v1}, @samp{neoverse-v2}, @samp{neoverse-512tvb}, @samp{qdf24xx},
17005@samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
17006@samp{octeontx81},  @samp{octeontx83},
17007@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
17008@samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
17009@samp{octeontx2f95mm},
17010@samp{a64fx},
17011@samp{thunderx}, @samp{thunderxt88},
17012@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
17013@samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
17014@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17015@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17016@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
17017@samp{ampere1}, @samp{ampere1a}, @samp{native}.
17018
17019The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17020@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
17021@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
17022should tune for a big.LITTLE system.
17023
17024The value @samp{neoverse-512tvb} specifies that GCC should tune
17025for Neoverse cores that (a) implement SVE and (b) have a total vector
17026bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
17027tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
17028instructions a cycle and that can execute an equivalent number of SVE
17029arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
17030This is more general than tuning for a specific core like Neoverse V1
17031but is more specific than the default tuning described below.
17032
17033Additionally on native AArch64 GNU/Linux systems the value
17034@samp{native} tunes performance to the host system.  This option has no effect
17035if the compiler is unable to recognize the processor of the host system.
17036
17037Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
17038are specified, the code is tuned to perform well across a range
17039of target processors.
17040
17041This option cannot be suffixed by feature modifiers.
17042
17043@item -mcpu=@var{name}
17044@opindex mcpu
17045Specify the name of the target processor, optionally suffixed by one
17046or more feature modifiers.  This option has the form
17047@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
17048the permissible values for @var{cpu} are the same as those available
17049for @option{-mtune}.  The permissible values for @var{feature} are
17050documented in the sub-section on
17051@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
17052Feature Modifiers}.  Where conflicting feature modifiers are
17053specified, the right-most feature is used.
17054
17055GCC uses @var{name} to determine what kind of instructions it can emit when
17056generating assembly code (as if by @option{-march}) and to determine
17057the target processor for which to tune for performance (as if
17058by @option{-mtune}).  Where this option is used in conjunction
17059with @option{-march} or @option{-mtune}, those options take precedence
17060over the appropriate part of this option.
17061
17062@option{-mcpu=neoverse-512tvb} is special in that it does not refer
17063to a specific core, but instead refers to all Neoverse cores that
17064(a) implement SVE and (b) have a total vector bandwidth of 512 bits
17065a cycle.  Unless overridden by @option{-march},
17066@option{-mcpu=neoverse-512tvb} generates code that can run on a
17067Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
17068these properties.  Unless overridden by @option{-mtune},
17069@option{-mcpu=neoverse-512tvb} tunes code in the same way as for
17070@option{-mtune=neoverse-512tvb}.
17071
17072@item -moverride=@var{string}
17073@opindex moverride
17074Override tuning decisions made by the back-end in response to a
17075@option{-mtune=} switch.  The syntax, semantics, and accepted values
17076for @var{string} in this option are not guaranteed to be consistent
17077across releases.
17078
17079This option is only intended to be useful when developing GCC.
17080
17081@item -mverbose-cost-dump
17082@opindex mverbose-cost-dump
17083Enable verbose cost model dumping in the debug dump files.  This option is
17084provided for use in debugging the compiler.
17085
17086@item -mpc-relative-literal-loads
17087@itemx -mno-pc-relative-literal-loads
17088@opindex mpc-relative-literal-loads
17089@opindex mno-pc-relative-literal-loads
17090Enable or disable PC-relative literal loads.  With this option literal pools are
17091accessed using a single instruction and emitted after each function.  This
17092limits the maximum size of functions to 1MB.  This is enabled by default for
17093@option{-mcmodel=tiny}.
17094
17095@item -msign-return-address=@var{scope}
17096@opindex msign-return-address
17097Select the function scope on which return address signing will be applied.
17098Permissible values are @samp{none}, which disables return address signing,
17099@samp{non-leaf}, which enables pointer signing for functions which are not leaf
17100functions, and @samp{all}, which enables pointer signing for all functions.  The
17101default value is @samp{none}. This option has been deprecated by
17102-mbranch-protection.
17103
17104@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
17105@opindex mbranch-protection
17106Select the branch protection features to use.
17107@samp{none} is the default and turns off all types of branch protection.
17108@samp{standard} turns on all types of branch protection features.  If a feature
17109has additional tuning options, then @samp{standard} sets it to its standard
17110level.
17111@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
17112level: signing functions that save the return address to memory (non-leaf
17113functions will practically always do this) using the a-key.  The optional
17114argument @samp{leaf} can be used to extend the signing to include leaf
17115functions.  The optional argument @samp{b-key} can be used to sign the functions
17116with the B-key instead of the A-key.
17117@samp{bti} turns on branch target identification mechanism.
17118
17119@item -mharden-sls=@var{opts}
17120@opindex mharden-sls
17121Enable compiler hardening against straight line speculation (SLS).
17122@var{opts} is a comma-separated list of the following options:
17123@table @samp
17124@item retbr
17125@item blr
17126@end table
17127In addition, @samp{-mharden-sls=all} enables all SLS hardening while
17128@samp{-mharden-sls=none} disables all SLS hardening.
17129
17130@item -msve-vector-bits=@var{bits}
17131@opindex msve-vector-bits
17132Specify the number of bits in an SVE vector register.  This option only has
17133an effect when SVE is enabled.
17134
17135GCC supports two forms of SVE code generation: ``vector-length
17136agnostic'' output that works with any size of vector register and
17137``vector-length specific'' output that allows GCC to make assumptions
17138about the vector length when it is useful for optimization reasons.
17139The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17140@samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17141Specifying @samp{scalable} selects vector-length agnostic
17142output.  At present @samp{-msve-vector-bits=128} also generates vector-length
17143agnostic output for big-endian targets.  All other values generate
17144vector-length specific code.  The behavior of these values may change
17145in future releases and no value except @samp{scalable} should be
17146relied on for producing code that is portable across different
17147hardware SVE vector lengths.
17148
17149The default is @samp{-msve-vector-bits=scalable}, which produces
17150vector-length agnostic code.
17151@end table
17152
17153@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17154@anchor{aarch64-feature-modifiers}
17155@cindex @option{-march} feature modifiers
17156@cindex @option{-mcpu} feature modifiers
17157Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17158the following and their inverses @option{no@var{feature}}:
17159
17160@table @samp
17161@item crc
17162Enable CRC extension.  This is on by default for
17163@option{-march=armv8.1-a}.
17164@item crypto
17165Enable Crypto extension.  This also enables Advanced SIMD and floating-point
17166instructions.
17167@item fp
17168Enable floating-point instructions.  This is on by default for all possible
17169values for options @option{-march} and @option{-mcpu}.
17170@item simd
17171Enable Advanced SIMD instructions.  This also enables floating-point
17172instructions.  This is on by default for all possible values for options
17173@option{-march} and @option{-mcpu}.
17174@item sve
17175Enable Scalable Vector Extension instructions.  This also enables Advanced
17176SIMD and floating-point instructions.
17177@item lse
17178Enable Large System Extension instructions.  This is on by default for
17179@option{-march=armv8.1-a}.
17180@item rdma
17181Enable Round Double Multiply Accumulate instructions.  This is on by default
17182for @option{-march=armv8.1-a}.
17183@item fp16
17184Enable FP16 extension.  This also enables floating-point instructions.
17185@item fp16fml
17186Enable FP16 fmla extension.  This also enables FP16 extensions and
17187floating-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.
17188
17189@item rcpc
17190Enable the RcPc extension.  This does not change code generation from GCC,
17191but is passed on to the assembler, enabling inline asm statements to use
17192instructions from the RcPc extension.
17193@item dotprod
17194Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
17195@item aes
17196Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
17197SIMD instructions.
17198@item sha2
17199Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
17200@item sha3
17201Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
17202instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17203@item sm4
17204Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
17205Use of this option with architectures prior to Armv8.2-A is not supported.
17206@item profile
17207Enable the Statistical Profiling extension.  This option is only to enable the
17208extension at the assembler level and does not affect code generation.
17209@item rng
17210Enable the Armv8.5-a Random Number instructions.  This option is only to
17211enable the extension at the assembler level and does not affect code
17212generation.
17213@item memtag
17214Enable the Armv8.5-a Memory Tagging Extensions.
17215Use of this option with architectures prior to Armv8.5-A is not supported.
17216@item sb
17217Enable the Armv8-a Speculation Barrier instruction.  This option is only to
17218enable 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 ssbs
17221Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
17222is only to enable the extension at the assembler level and does not affect code
17223generation.  This option is enabled by default for @option{-march=armv8.5-a}.
17224@item predres
17225Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17226This option is only to enable the extension at the assembler level and does
17227not affect code generation.  This option is enabled by default for
17228@option{-march=armv8.5-a}.
17229@item sve2
17230Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
17231instructions.
17232@item sve2-bitperm
17233Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
17234@item sve2-sm4
17235Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
17236@item sve2-aes
17237Enable SVE2 aes instructions.  This also enables SVE2 instructions.
17238@item sve2-sha3
17239Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
17240@item tme
17241Enable the Transactional Memory Extension.
17242@item i8mm
17243Enable 8-bit Integer Matrix Multiply instructions.  This also enables
17244Advanced SIMD and floating-point instructions.  This option is enabled by
17245default for @option{-march=armv8.6-a}.  Use of this option with architectures
17246prior to Armv8.2-A is not supported.
17247@item f32mm
17248Enable 32-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 f64mm
17252Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
17253SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
17254not supported.
17255@item bf16
17256Enable brain half-precision floating-point instructions.  This also enables
17257Advanced SIMD and floating-point instructions.  This option is enabled by
17258default for @option{-march=armv8.6-a}.  Use of this option with architectures
17259prior to Armv8.2-A is not supported.
17260
17261@end table
17262
17263Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17264which implies @option{fp}.
17265Conversely, @option{nofp} implies @option{nosimd}, which implies
17266@option{nocrypto}, @option{noaes} and @option{nosha2}.
17267
17268@node Adapteva Epiphany Options
17269@subsection Adapteva Epiphany Options
17270
17271These @samp{-m} options are defined for Adapteva Epiphany:
17272
17273@table @gcctabopt
17274@item -mhalf-reg-file
17275@opindex mhalf-reg-file
17276Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17277That allows code to run on hardware variants that lack these registers.
17278
17279@item -mprefer-short-insn-regs
17280@opindex mprefer-short-insn-regs
17281Preferentially allocate registers that allow short instruction generation.
17282This can result in increased instruction count, so this may either reduce or
17283increase overall code size.
17284
17285@item -mbranch-cost=@var{num}
17286@opindex mbranch-cost
17287Set the cost of branches to roughly @var{num} ``simple'' instructions.
17288This cost is only a heuristic and is not guaranteed to produce
17289consistent results across releases.
17290
17291@item -mcmove
17292@opindex mcmove
17293Enable the generation of conditional moves.
17294
17295@item -mnops=@var{num}
17296@opindex mnops
17297Emit @var{num} NOPs before every other generated instruction.
17298
17299@item -mno-soft-cmpsf
17300@opindex mno-soft-cmpsf
17301@opindex msoft-cmpsf
17302For single-precision floating-point comparisons, emit an @code{fsub} instruction
17303and test the flags.  This is faster than a software comparison, but can
17304get incorrect results in the presence of NaNs, or when two different small
17305numbers are compared such that their difference is calculated as zero.
17306The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17307software comparisons.
17308
17309@item -mstack-offset=@var{num}
17310@opindex mstack-offset
17311Set the offset between the top of the stack and the stack pointer.
17312E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17313can be used by leaf functions without stack allocation.
17314Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17315Note also that this option changes the ABI; compiling a program with a
17316different stack offset than the libraries have been compiled with
17317generally does not work.
17318This option can be useful if you want to evaluate if a different stack
17319offset would give you better code, but to actually use a different stack
17320offset to build working programs, it is recommended to configure the
17321toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17322
17323@item -mno-round-nearest
17324@opindex mno-round-nearest
17325@opindex mround-nearest
17326Make the scheduler assume that the rounding mode has been set to
17327truncating.  The default is @option{-mround-nearest}.
17328
17329@item -mlong-calls
17330@opindex mlong-calls
17331If not otherwise specified by an attribute, assume all calls might be beyond
17332the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17333function address into a register before performing a (otherwise direct) call.
17334This is the default.
17335
17336@item -mshort-calls
17337@opindex short-calls
17338If not otherwise specified by an attribute, assume all direct calls are
17339in the range of the @code{b} / @code{bl} instructions, so use these instructions
17340for direct calls.  The default is @option{-mlong-calls}.
17341
17342@item -msmall16
17343@opindex msmall16
17344Assume addresses can be loaded as 16-bit unsigned values.  This does not
17345apply to function addresses for which @option{-mlong-calls} semantics
17346are in effect.
17347
17348@item -mfp-mode=@var{mode}
17349@opindex mfp-mode
17350Set the prevailing mode of the floating-point unit.
17351This determines the floating-point mode that is provided and expected
17352at function call and return time.  Making this mode match the mode you
17353predominantly need at function start can make your programs smaller and
17354faster by avoiding unnecessary mode switches.
17355
17356@var{mode} can be set to one the following values:
17357
17358@table @samp
17359@item caller
17360Any mode at function entry is valid, and retained or restored when
17361the function returns, and when it calls other functions.
17362This mode is useful for compiling libraries or other compilation units
17363you might want to incorporate into different programs with different
17364prevailing FPU modes, and the convenience of being able to use a single
17365object file outweighs the size and speed overhead for any extra
17366mode switching that might be needed, compared with what would be needed
17367with a more specific choice of prevailing FPU mode.
17368
17369@item truncate
17370This is the mode used for floating-point calculations with
17371truncating (i.e.@: round towards zero) rounding mode.  That includes
17372conversion from floating point to integer.
17373
17374@item round-nearest
17375This is the mode used for floating-point calculations with
17376round-to-nearest-or-even rounding mode.
17377
17378@item int
17379This is the mode used to perform integer calculations in the FPU, e.g.@:
17380integer multiply, or integer multiply-and-accumulate.
17381@end table
17382
17383The default is @option{-mfp-mode=caller}
17384
17385@item -mno-split-lohi
17386@itemx -mno-postinc
17387@itemx -mno-postmodify
17388@opindex mno-split-lohi
17389@opindex msplit-lohi
17390@opindex mno-postinc
17391@opindex mpostinc
17392@opindex mno-postmodify
17393@opindex mpostmodify
17394Code generation tweaks that disable, respectively, splitting of 32-bit
17395loads, generation of post-increment addresses, and generation of
17396post-modify addresses.  The defaults are @option{msplit-lohi},
17397@option{-mpost-inc}, and @option{-mpost-modify}.
17398
17399@item -mnovect-double
17400@opindex mno-vect-double
17401@opindex mvect-double
17402Change the preferred SIMD mode to SImode.  The default is
17403@option{-mvect-double}, which uses DImode as preferred SIMD mode.
17404
17405@item -max-vect-align=@var{num}
17406@opindex max-vect-align
17407The maximum alignment for SIMD vector mode types.
17408@var{num} may be 4 or 8.  The default is 8.
17409Note that this is an ABI change, even though many library function
17410interfaces are unaffected if they don't use SIMD vector modes
17411in places that affect size and/or alignment of relevant types.
17412
17413@item -msplit-vecmove-early
17414@opindex msplit-vecmove-early
17415Split vector moves into single word moves before reload.  In theory this
17416can give better register allocation, but so far the reverse seems to be
17417generally the case.
17418
17419@item -m1reg-@var{reg}
17420@opindex m1reg-
17421Specify a register to hold the constant @minus{}1, which makes loading small negative
17422constants and certain bitmasks faster.
17423Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17424which specify use of that register as a fixed register,
17425and @samp{none}, which means that no register is used for this
17426purpose.  The default is @option{-m1reg-none}.
17427
17428@end table
17429
17430@node AMD GCN Options
17431@subsection AMD GCN Options
17432@cindex AMD GCN Options
17433
17434These options are defined specifically for the AMD GCN port.
17435
17436@table @gcctabopt
17437
17438@item -march=@var{gpu}
17439@opindex march
17440@itemx -mtune=@var{gpu}
17441@opindex mtune
17442Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17443are
17444
17445@table @samp
17446@opindex fiji
17447@item fiji
17448Compile for GCN3 Fiji devices (gfx803).
17449
17450@item gfx900
17451Compile for GCN5 Vega 10 devices (gfx900).
17452
17453@item gfx906
17454Compile for GCN5 Vega 20 devices (gfx906).
17455
17456@end table
17457
17458@item -mstack-size=@var{bytes}
17459@opindex mstack-size
17460Specify how many @var{bytes} of stack space will be requested for each GPU
17461thread (wave-front).  Beware that there may be many threads and limited memory
17462available.  The size of the stack allocation may also have an impact on
17463run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
174641MB otherwise.
17465
17466@end table
17467
17468@node ARC Options
17469@subsection ARC Options
17470@cindex ARC options
17471
17472The following options control the architecture variant for which code
17473is being compiled:
17474
17475@c architecture variants
17476@table @gcctabopt
17477
17478@item -mbarrel-shifter
17479@opindex mbarrel-shifter
17480Generate instructions supported by barrel shifter.  This is the default
17481unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17482
17483@item -mjli-always
17484@opindex mjli-alawys
17485Force to call a function using jli_s instruction.  This option is
17486valid only for ARCv2 architecture.
17487
17488@item -mcpu=@var{cpu}
17489@opindex mcpu
17490Set architecture type, register usage, and instruction scheduling
17491parameters for @var{cpu}.  There are also shortcut alias options
17492available for backward compatibility and convenience.  Supported
17493values for @var{cpu} are
17494
17495@table @samp
17496@opindex mA6
17497@opindex mARC600
17498@item arc600
17499Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
17500
17501@item arc601
17502@opindex mARC601
17503Compile for ARC601.  Alias: @option{-mARC601}.
17504
17505@item arc700
17506@opindex mA7
17507@opindex mARC700
17508Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
17509This is the default when configured with @option{--with-cpu=arc700}@.
17510
17511@item arcem
17512Compile for ARC EM.
17513
17514@item archs
17515Compile for ARC HS.
17516
17517@item em
17518Compile for ARC EM CPU with no hardware extensions.
17519
17520@item em4
17521Compile for ARC EM4 CPU.
17522
17523@item em4_dmips
17524Compile for ARC EM4 DMIPS CPU.
17525
17526@item em4_fpus
17527Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17528extension.
17529
17530@item em4_fpuda
17531Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17532double assist instructions.
17533
17534@item hs
17535Compile for ARC HS CPU with no hardware extensions except the atomic
17536instructions.
17537
17538@item hs34
17539Compile for ARC HS34 CPU.
17540
17541@item hs38
17542Compile for ARC HS38 CPU.
17543
17544@item hs38_linux
17545Compile for ARC HS38 CPU with all hardware extensions on.
17546
17547@item arc600_norm
17548Compile for ARC 600 CPU with @code{norm} instructions enabled.
17549
17550@item arc600_mul32x16
17551Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17552instructions enabled.
17553
17554@item arc600_mul64
17555Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17556instructions enabled.
17557
17558@item arc601_norm
17559Compile for ARC 601 CPU with @code{norm} instructions enabled.
17560
17561@item arc601_mul32x16
17562Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17563instructions enabled.
17564
17565@item arc601_mul64
17566Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17567instructions enabled.
17568
17569@item nps400
17570Compile for ARC 700 on NPS400 chip.
17571
17572@item em_mini
17573Compile for ARC EM minimalist configuration featuring reduced register
17574set.
17575
17576@end table
17577
17578@item -mdpfp
17579@opindex mdpfp
17580@itemx -mdpfp-compact
17581@opindex mdpfp-compact
17582Generate double-precision FPX instructions, tuned for the compact
17583implementation.
17584
17585@item -mdpfp-fast
17586@opindex mdpfp-fast
17587Generate double-precision FPX instructions, tuned for the fast
17588implementation.
17589
17590@item -mno-dpfp-lrsr
17591@opindex mno-dpfp-lrsr
17592Disable @code{lr} and @code{sr} instructions from using FPX extension
17593aux registers.
17594
17595@item -mea
17596@opindex mea
17597Generate extended arithmetic instructions.  Currently only
17598@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17599supported.  Only valid for @option{-mcpu=ARC700}.
17600
17601@item -mno-mpy
17602@opindex mno-mpy
17603@opindex mmpy
17604Do not generate @code{mpy}-family instructions for ARC700.  This option is
17605deprecated.
17606
17607@item -mmul32x16
17608@opindex mmul32x16
17609Generate 32x16-bit multiply and multiply-accumulate instructions.
17610
17611@item -mmul64
17612@opindex mmul64
17613Generate @code{mul64} and @code{mulu64} instructions.
17614Only valid for @option{-mcpu=ARC600}.
17615
17616@item -mnorm
17617@opindex mnorm
17618Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
17619is in effect.
17620
17621@item -mspfp
17622@opindex mspfp
17623@itemx -mspfp-compact
17624@opindex mspfp-compact
17625Generate single-precision FPX instructions, tuned for the compact
17626implementation.
17627
17628@item -mspfp-fast
17629@opindex mspfp-fast
17630Generate single-precision FPX instructions, tuned for the fast
17631implementation.
17632
17633@item -msimd
17634@opindex msimd
17635Enable generation of ARC SIMD instructions via target-specific
17636builtins.  Only valid for @option{-mcpu=ARC700}.
17637
17638@item -msoft-float
17639@opindex msoft-float
17640This option ignored; it is provided for compatibility purposes only.
17641Software floating-point code is emitted by default, and this default
17642can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17643@option{-mspfp-fast} for single precision, and @option{-mdpfp},
17644@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17645
17646@item -mswap
17647@opindex mswap
17648Generate @code{swap} instructions.
17649
17650@item -matomic
17651@opindex matomic
17652This enables use of the locked load/store conditional extension to implement
17653atomic memory built-in functions.  Not available for ARC 6xx or ARC
17654EM cores.
17655
17656@item -mdiv-rem
17657@opindex mdiv-rem
17658Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17659
17660@item -mcode-density
17661@opindex mcode-density
17662Enable code density instructions for ARC EM.
17663This option is on by default for ARC HS.
17664
17665@item -mll64
17666@opindex mll64
17667Enable double load/store operations for ARC HS cores.
17668
17669@item -mtp-regno=@var{regno}
17670@opindex mtp-regno
17671Specify thread pointer register number.
17672
17673@item -mmpy-option=@var{multo}
17674@opindex mmpy-option
17675Compile ARCv2 code with a multiplier design option.  You can specify
17676the option using either a string or numeric value for @var{multo}.
17677@samp{wlh1} is the default value.  The recognized values are:
17678
17679@table @samp
17680@item 0
17681@itemx none
17682No multiplier available.
17683
17684@item 1
17685@itemx w
1768616x16 multiplier, fully pipelined.
17687The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17688
17689@item 2
17690@itemx wlh1
1769132x32 multiplier, fully
17692pipelined (1 stage).  The following instructions are additionally
17693enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17694
17695@item 3
17696@itemx wlh2
1769732x32 multiplier, fully pipelined
17698(2 stages).  The following instructions are additionally enabled: @code{mpy},
17699@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17700
17701@item 4
17702@itemx wlh3
17703Two 16x16 multipliers, blocking,
17704sequential.  The following instructions are additionally enabled: @code{mpy},
17705@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17706
17707@item 5
17708@itemx wlh4
17709One 16x16 multiplier, blocking,
17710sequential.  The following instructions are additionally enabled: @code{mpy},
17711@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17712
17713@item 6
17714@itemx wlh5
17715One 32x4 multiplier, blocking,
17716sequential.  The following instructions are additionally enabled: @code{mpy},
17717@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17718
17719@item 7
17720@itemx plus_dmpy
17721ARC HS SIMD support.
17722
17723@item 8
17724@itemx plus_macd
17725ARC HS SIMD support.
17726
17727@item 9
17728@itemx plus_qmacw
17729ARC HS SIMD support.
17730
17731@end table
17732
17733This option is only available for ARCv2 cores@.
17734
17735@item -mfpu=@var{fpu}
17736@opindex mfpu
17737Enables support for specific floating-point hardware extensions for ARCv2
17738cores.  Supported values for @var{fpu} are:
17739
17740@table @samp
17741
17742@item fpus
17743Enables support for single-precision floating-point hardware
17744extensions@.
17745
17746@item fpud
17747Enables support for double-precision floating-point hardware
17748extensions.  The single-precision floating-point extension is also
17749enabled.  Not available for ARC EM@.
17750
17751@item fpuda
17752Enables support for double-precision floating-point hardware
17753extensions using double-precision assist instructions.  The single-precision
17754floating-point extension is also enabled.  This option is
17755only available for ARC EM@.
17756
17757@item fpuda_div
17758Enables support for double-precision floating-point hardware
17759extensions using double-precision assist instructions.
17760The single-precision floating-point, square-root, and divide
17761extensions are also enabled.  This option is
17762only available for ARC EM@.
17763
17764@item fpuda_fma
17765Enables support for double-precision floating-point hardware
17766extensions using double-precision assist instructions.
17767The single-precision floating-point and fused multiply and add
17768hardware extensions are also enabled.  This option is
17769only available for ARC EM@.
17770
17771@item fpuda_all
17772Enables support for double-precision floating-point hardware
17773extensions using double-precision assist instructions.
17774All single-precision floating-point hardware extensions are also
17775enabled.  This option is only available for ARC EM@.
17776
17777@item fpus_div
17778Enables support for single-precision floating-point, square-root and divide
17779hardware extensions@.
17780
17781@item fpud_div
17782Enables support for double-precision floating-point, square-root and divide
17783hardware extensions.  This option
17784includes option @samp{fpus_div}. Not available for ARC EM@.
17785
17786@item fpus_fma
17787Enables support for single-precision floating-point and
17788fused multiply and add hardware extensions@.
17789
17790@item fpud_fma
17791Enables support for double-precision floating-point and
17792fused multiply and add hardware extensions.  This option
17793includes option @samp{fpus_fma}.  Not available for ARC EM@.
17794
17795@item fpus_all
17796Enables support for all single-precision floating-point hardware
17797extensions@.
17798
17799@item fpud_all
17800Enables support for all single- and double-precision floating-point
17801hardware extensions.  Not available for ARC EM@.
17802
17803@end table
17804
17805@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
17806@opindex mirq-ctrl-saved
17807Specifies general-purposes registers that the processor automatically
17808saves/restores on interrupt entry and exit.  @var{register-range} is
17809specified as two registers separated by a dash.  The register range
17810always starts with @code{r0}, the upper limit is @code{fp} register.
17811@var{blink} and @var{lp_count} are optional.  This option is only
17812valid for ARC EM and ARC HS cores.
17813
17814@item -mrgf-banked-regs=@var{number}
17815@opindex mrgf-banked-regs
17816Specifies the number of registers replicated in second register bank
17817on entry to fast interrupt.  Fast interrupts are interrupts with the
17818highest priority level P0.  These interrupts save only PC and STATUS32
17819registers to avoid memory transactions during interrupt entry and exit
17820sequences.  Use this option when you are using fast interrupts in an
17821ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
17822
17823@item -mlpc-width=@var{width}
17824@opindex mlpc-width
17825Specify the width of the @code{lp_count} register.  Valid values for
17826@var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
17827fixed to 32 bits.  If the width is less than 32, the compiler does not
17828attempt to transform loops in your program to use the zero-delay loop
17829mechanism unless it is known that the @code{lp_count} register can
17830hold the required loop-counter value.  Depending on the width
17831specified, the compiler and run-time library might continue to use the
17832loop mechanism for various needs.  This option defines macro
17833@code{__ARC_LPC_WIDTH__} with the value of @var{width}.
17834
17835@item -mrf16
17836@opindex mrf16
17837This option instructs the compiler to generate code for a 16-entry
17838register file.  This option defines the @code{__ARC_RF16__}
17839preprocessor macro.
17840
17841@item -mbranch-index
17842@opindex mbranch-index
17843Enable use of @code{bi} or @code{bih} instructions to implement jump
17844tables.
17845
17846@end table
17847
17848The following options are passed through to the assembler, and also
17849define preprocessor macro symbols.
17850
17851@c Flags used by the assembler, but for which we define preprocessor
17852@c macro symbols as well.
17853@table @gcctabopt
17854@item -mdsp-packa
17855@opindex mdsp-packa
17856Passed down to the assembler to enable the DSP Pack A extensions.
17857Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
17858deprecated.
17859
17860@item -mdvbf
17861@opindex mdvbf
17862Passed down to the assembler to enable the dual Viterbi butterfly
17863extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
17864option is deprecated.
17865
17866@c ARC700 4.10 extension instruction
17867@item -mlock
17868@opindex mlock
17869Passed down to the assembler to enable the locked load/store
17870conditional extension.  Also sets the preprocessor symbol
17871@code{__Xlock}.
17872
17873@item -mmac-d16
17874@opindex mmac-d16
17875Passed down to the assembler.  Also sets the preprocessor symbol
17876@code{__Xxmac_d16}.  This option is deprecated.
17877
17878@item -mmac-24
17879@opindex mmac-24
17880Passed down to the assembler.  Also sets the preprocessor symbol
17881@code{__Xxmac_24}.  This option is deprecated.
17882
17883@c ARC700 4.10 extension instruction
17884@item -mrtsc
17885@opindex mrtsc
17886Passed down to the assembler to enable the 64-bit time-stamp counter
17887extension instruction.  Also sets the preprocessor symbol
17888@code{__Xrtsc}.  This option is deprecated.
17889
17890@c ARC700 4.10 extension instruction
17891@item -mswape
17892@opindex mswape
17893Passed down to the assembler to enable the swap byte ordering
17894extension instruction.  Also sets the preprocessor symbol
17895@code{__Xswape}.
17896
17897@item -mtelephony
17898@opindex mtelephony
17899Passed down to the assembler to enable dual- and single-operand
17900instructions for telephony.  Also sets the preprocessor symbol
17901@code{__Xtelephony}.  This option is deprecated.
17902
17903@item -mxy
17904@opindex mxy
17905Passed down to the assembler to enable the XY memory extension.  Also
17906sets the preprocessor symbol @code{__Xxy}.
17907
17908@end table
17909
17910The following options control how the assembly code is annotated:
17911
17912@c Assembly annotation options
17913@table @gcctabopt
17914@item -misize
17915@opindex misize
17916Annotate assembler instructions with estimated addresses.
17917
17918@item -mannotate-align
17919@opindex mannotate-align
17920Explain what alignment considerations lead to the decision to make an
17921instruction short or long.
17922
17923@end table
17924
17925The following options are passed through to the linker:
17926
17927@c options passed through to the linker
17928@table @gcctabopt
17929@item -marclinux
17930@opindex marclinux
17931Passed through to the linker, to specify use of the @code{arclinux} emulation.
17932This option is enabled by default in tool chains built for
17933@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
17934when profiling is not requested.
17935
17936@item -marclinux_prof
17937@opindex marclinux_prof
17938Passed through to the linker, to specify use of the
17939@code{arclinux_prof} emulation.  This option is enabled by default in
17940tool chains built for @w{@code{arc-linux-uclibc}} and
17941@w{@code{arceb-linux-uclibc}} targets when profiling is requested.
17942
17943@end table
17944
17945The following options control the semantics of generated code:
17946
17947@c semantically relevant code generation options
17948@table @gcctabopt
17949@item -mlong-calls
17950@opindex mlong-calls
17951Generate calls as register indirect calls, thus providing access
17952to the full 32-bit address range.
17953
17954@item -mmedium-calls
17955@opindex mmedium-calls
17956Don't use less than 25-bit addressing range for calls, which is the
17957offset available for an unconditional branch-and-link
17958instruction.  Conditional execution of function calls is suppressed, to
17959allow use of the 25-bit range, rather than the 21-bit range with
17960conditional branch-and-link.  This is the default for tool chains built
17961for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17962
17963@item -G @var{num}
17964@opindex G
17965Put definitions of externally-visible data in a small data section if
17966that data is no bigger than @var{num} bytes.  The default value of
17967@var{num} is 4 for any ARC configuration, or 8 when we have double
17968load/store operations.
17969
17970@item -mno-sdata
17971@opindex mno-sdata
17972@opindex msdata
17973Do not generate sdata references.  This is the default for tool chains
17974built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17975targets.
17976
17977@item -mvolatile-cache
17978@opindex mvolatile-cache
17979Use ordinarily cached memory accesses for volatile references.  This is the
17980default.
17981
17982@item -mno-volatile-cache
17983@opindex mno-volatile-cache
17984@opindex mvolatile-cache
17985Enable cache bypass for volatile references.
17986
17987@end table
17988
17989The following options fine tune code generation:
17990@c code generation tuning options
17991@table @gcctabopt
17992@item -malign-call
17993@opindex malign-call
17994Do alignment optimizations for call instructions.
17995
17996@item -mauto-modify-reg
17997@opindex mauto-modify-reg
17998Enable the use of pre/post modify with register displacement.
17999
18000@item -mbbit-peephole
18001@opindex mbbit-peephole
18002Enable bbit peephole2.
18003
18004@item -mno-brcc
18005@opindex mno-brcc
18006This option disables a target-specific pass in @file{arc_reorg} to
18007generate compare-and-branch (@code{br@var{cc}}) instructions.
18008It has no effect on
18009generation of these instructions driven by the combiner pass.
18010
18011@item -mcase-vector-pcrel
18012@opindex mcase-vector-pcrel
18013Use PC-relative switch case tables to enable case table shortening.
18014This is the default for @option{-Os}.
18015
18016@item -mcompact-casesi
18017@opindex mcompact-casesi
18018Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
18019and only available for ARCv1 cores.  This option is deprecated.
18020
18021@item -mno-cond-exec
18022@opindex mno-cond-exec
18023Disable the ARCompact-specific pass to generate conditional
18024execution instructions.
18025
18026Due to delay slot scheduling and interactions between operand numbers,
18027literal sizes, instruction lengths, and the support for conditional execution,
18028the target-independent pass to generate conditional execution is often lacking,
18029so the ARC port has kept a special pass around that tries to find more
18030conditional execution generation opportunities after register allocation,
18031branch shortening, and delay slot scheduling have been done.  This pass
18032generally, but not always, improves performance and code size, at the cost of
18033extra compilation time, which is why there is an option to switch it off.
18034If you have a problem with call instructions exceeding their allowable
18035offset range because they are conditionalized, you should consider using
18036@option{-mmedium-calls} instead.
18037
18038@item -mearly-cbranchsi
18039@opindex mearly-cbranchsi
18040Enable pre-reload use of the @code{cbranchsi} pattern.
18041
18042@item -mexpand-adddi
18043@opindex mexpand-adddi
18044Expand @code{adddi3} and @code{subdi3} at RTL generation time into
18045@code{add.f}, @code{adc} etc.  This option is deprecated.
18046
18047@item -mindexed-loads
18048@opindex mindexed-loads
18049Enable the use of indexed loads.  This can be problematic because some
18050optimizers then assume that indexed stores exist, which is not
18051the case.
18052
18053@item -mlra
18054@opindex mlra
18055Enable Local Register Allocation.  This is still experimental for ARC,
18056so by default the compiler uses standard reload
18057(i.e.@: @option{-mno-lra}).
18058
18059@item -mlra-priority-none
18060@opindex mlra-priority-none
18061Don't indicate any priority for target registers.
18062
18063@item -mlra-priority-compact
18064@opindex mlra-priority-compact
18065Indicate target register priority for r0..r3 / r12..r15.
18066
18067@item -mlra-priority-noncompact
18068@opindex mlra-priority-noncompact
18069Reduce target register priority for r0..r3 / r12..r15.
18070
18071@item -mmillicode
18072@opindex mmillicode
18073When optimizing for size (using @option{-Os}), prologues and epilogues
18074that have to save or restore a large number of registers are often
18075shortened by using call to a special function in libgcc; this is
18076referred to as a @emph{millicode} call.  As these calls can pose
18077performance issues, and/or cause linking issues when linking in a
18078nonstandard way, this option is provided to turn on or off millicode
18079call generation.
18080
18081@item -mcode-density-frame
18082@opindex mcode-density-frame
18083This option enable the compiler to emit @code{enter} and @code{leave}
18084instructions.  These instructions are only valid for CPUs with
18085code-density feature.
18086
18087@item -mmixed-code
18088@opindex mmixed-code
18089Tweak register allocation to help 16-bit instruction generation.
18090This generally has the effect of decreasing the average instruction size
18091while increasing the instruction count.
18092
18093@item -mq-class
18094@opindex mq-class
18095Ths option is deprecated.  Enable @samp{q} instruction alternatives.
18096This is the default for @option{-Os}.
18097
18098@item -mRcq
18099@opindex mRcq
18100Enable @samp{Rcq} constraint handling.
18101Most short code generation depends on this.
18102This is the default.
18103
18104@item -mRcw
18105@opindex mRcw
18106Enable @samp{Rcw} constraint handling.
18107Most ccfsm condexec mostly depends on this.
18108This is the default.
18109
18110@item -msize-level=@var{level}
18111@opindex msize-level
18112Fine-tune size optimization with regards to instruction lengths and alignment.
18113The recognized values for @var{level} are:
18114@table @samp
18115@item 0
18116No size optimization.  This level is deprecated and treated like @samp{1}.
18117
18118@item 1
18119Short instructions are used opportunistically.
18120
18121@item 2
18122In addition, alignment of loops and of code after barriers are dropped.
18123
18124@item 3
18125In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18126
18127@end table
18128
18129This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
18130the behavior when this is not set is equivalent to level @samp{1}.
18131
18132@item -mtune=@var{cpu}
18133@opindex mtune
18134Set instruction scheduling parameters for @var{cpu}, overriding any implied
18135by @option{-mcpu=}.
18136
18137Supported values for @var{cpu} are
18138
18139@table @samp
18140@item ARC600
18141Tune for ARC600 CPU.
18142
18143@item ARC601
18144Tune for ARC601 CPU.
18145
18146@item ARC700
18147Tune for ARC700 CPU with standard multiplier block.
18148
18149@item ARC700-xmac
18150Tune for ARC700 CPU with XMAC block.
18151
18152@item ARC725D
18153Tune for ARC725D CPU.
18154
18155@item ARC750D
18156Tune for ARC750D CPU.
18157
18158@end table
18159
18160@item -mmultcost=@var{num}
18161@opindex mmultcost
18162Cost to assume for a multiply instruction, with @samp{4} being equal to a
18163normal instruction.
18164
18165@item -munalign-prob-threshold=@var{probability}
18166@opindex munalign-prob-threshold
18167Set probability threshold for unaligning branches.
18168When tuning for @samp{ARC700} and optimizing for speed, branches without
18169filled delay slot are preferably emitted unaligned and long, unless
18170profiling indicates that the probability for the branch to be taken
18171is below @var{probability}.  @xref{Cross-profiling}.
18172The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18173
18174@end table
18175
18176The following options are maintained for backward compatibility, but
18177are now deprecated and will be removed in a future release:
18178
18179@c Deprecated options
18180@table @gcctabopt
18181
18182@item -margonaut
18183@opindex margonaut
18184Obsolete FPX.
18185
18186@item -mbig-endian
18187@opindex mbig-endian
18188@itemx -EB
18189@opindex EB
18190Compile code for big-endian targets.  Use of these options is now
18191deprecated.  Big-endian code is supported by configuring GCC to build
18192@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18193for which big endian is the default.
18194
18195@item -mlittle-endian
18196@opindex mlittle-endian
18197@itemx -EL
18198@opindex EL
18199Compile code for little-endian targets.  Use of these options is now
18200deprecated.  Little-endian code is supported by configuring GCC to build
18201@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18202for which little endian is the default.
18203
18204@item -mbarrel_shifter
18205@opindex mbarrel_shifter
18206Replaced by @option{-mbarrel-shifter}.
18207
18208@item -mdpfp_compact
18209@opindex mdpfp_compact
18210Replaced by @option{-mdpfp-compact}.
18211
18212@item -mdpfp_fast
18213@opindex mdpfp_fast
18214Replaced by @option{-mdpfp-fast}.
18215
18216@item -mdsp_packa
18217@opindex mdsp_packa
18218Replaced by @option{-mdsp-packa}.
18219
18220@item -mEA
18221@opindex mEA
18222Replaced by @option{-mea}.
18223
18224@item -mmac_24
18225@opindex mmac_24
18226Replaced by @option{-mmac-24}.
18227
18228@item -mmac_d16
18229@opindex mmac_d16
18230Replaced by @option{-mmac-d16}.
18231
18232@item -mspfp_compact
18233@opindex mspfp_compact
18234Replaced by @option{-mspfp-compact}.
18235
18236@item -mspfp_fast
18237@opindex mspfp_fast
18238Replaced by @option{-mspfp-fast}.
18239
18240@item -mtune=@var{cpu}
18241@opindex mtune
18242Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18243@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18244@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18245
18246@item -multcost=@var{num}
18247@opindex multcost
18248Replaced by @option{-mmultcost}.
18249
18250@end table
18251
18252@node ARM Options
18253@subsection ARM Options
18254@cindex ARM options
18255
18256These @samp{-m} options are defined for the ARM port:
18257
18258@table @gcctabopt
18259@item -mabi=@var{name}
18260@opindex mabi
18261Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
18262@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18263
18264@item -mapcs-frame
18265@opindex mapcs-frame
18266Generate a stack frame that is compliant with the ARM Procedure Call
18267Standard for all functions, even if this is not strictly necessary for
18268correct execution of the code.  Specifying @option{-fomit-frame-pointer}
18269with this option causes the stack frames not to be generated for
18270leaf functions.  The default is @option{-mno-apcs-frame}.
18271This option is deprecated.
18272
18273@item -mapcs
18274@opindex mapcs
18275This is a synonym for @option{-mapcs-frame} and is deprecated.
18276
18277@ignore
18278@c not currently implemented
18279@item -mapcs-stack-check
18280@opindex mapcs-stack-check
18281Generate code to check the amount of stack space available upon entry to
18282every function (that actually uses some stack space).  If there is
18283insufficient space available then either the function
18284@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18285called, depending upon the amount of stack space required.  The runtime
18286system is required to provide these functions.  The default is
18287@option{-mno-apcs-stack-check}, since this produces smaller code.
18288
18289@c not currently implemented
18290@item -mapcs-reentrant
18291@opindex mapcs-reentrant
18292Generate reentrant, position-independent code.  The default is
18293@option{-mno-apcs-reentrant}.
18294@end ignore
18295
18296@item -mthumb-interwork
18297@opindex mthumb-interwork
18298Generate code that supports calling between the ARM and Thumb
18299instruction sets.  Without this option, on pre-v5 architectures, the
18300two instruction sets cannot be reliably used inside one program.  The
18301default is @option{-mno-thumb-interwork}, since slightly larger code
18302is generated when @option{-mthumb-interwork} is specified.  In AAPCS
18303configurations this option is meaningless.
18304
18305@item -mno-sched-prolog
18306@opindex mno-sched-prolog
18307@opindex msched-prolog
18308Prevent the reordering of instructions in the function prologue, or the
18309merging of those instruction with the instructions in the function's
18310body.  This means that all functions start with a recognizable set
18311of instructions (or in fact one of a choice from a small set of
18312different function prologues), and this information can be used to
18313locate the start of functions inside an executable piece of code.  The
18314default is @option{-msched-prolog}.
18315
18316@item -mfloat-abi=@var{name}
18317@opindex mfloat-abi
18318Specifies which floating-point ABI to use.  Permissible values
18319are: @samp{soft}, @samp{softfp} and @samp{hard}.
18320
18321Specifying @samp{soft} causes GCC to generate output containing
18322library calls for floating-point operations.
18323@samp{softfp} allows the generation of code using hardware floating-point
18324instructions, but still uses the soft-float calling conventions.
18325@samp{hard} allows generation of floating-point instructions
18326and uses FPU-specific calling conventions.
18327
18328The default depends on the specific target configuration.  Note that
18329the hard-float and soft-float ABIs are not link-compatible; you must
18330compile your entire program with the same ABI, and link with a
18331compatible set of libraries.
18332
18333@item -mgeneral-regs-only
18334@opindex mgeneral-regs-only
18335Generate code which uses only the general-purpose registers.  This will prevent
18336the compiler from using floating-point and Advanced SIMD registers but will not
18337impose any restrictions on the assembler.
18338
18339@item -mlittle-endian
18340@opindex mlittle-endian
18341Generate code for a processor running in little-endian mode.  This is
18342the default for all standard configurations.
18343
18344@item -mbig-endian
18345@opindex mbig-endian
18346Generate code for a processor running in big-endian mode; the default is
18347to compile code for a little-endian processor.
18348
18349@item -mbe8
18350@itemx -mbe32
18351@opindex mbe8
18352When linking a big-endian image select between BE8 and BE32 formats.
18353The option has no effect for little-endian images and is ignored.  The
18354default is dependent on the selected target architecture.  For ARMv6
18355and later architectures the default is BE8, for older architectures
18356the default is BE32.  BE32 format has been deprecated by ARM.
18357
18358@item -march=@var{name}@r{[}+extension@dots{}@r{]}
18359@opindex march
18360This specifies the name of the target ARM architecture.  GCC uses this
18361name to determine what kind of instructions it can emit when generating
18362assembly code.  This option can be used in conjunction with or instead
18363of the @option{-mcpu=} option.
18364
18365Permissible names are:
18366@samp{armv4t},
18367@samp{armv5t}, @samp{armv5te},
18368@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18369@samp{armv6z}, @samp{armv6zk},
18370@samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18371@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18372@samp{armv8.4-a},
18373@samp{armv8.5-a},
18374@samp{armv8.6-a},
18375@samp{armv7-r},
18376@samp{armv8-r},
18377@samp{armv6-m}, @samp{armv6s-m},
18378@samp{armv7-m}, @samp{armv7e-m},
18379@samp{armv8-m.base}, @samp{armv8-m.main},
18380@samp{armv8.1-m.main},
18381@samp{iwmmxt} and @samp{iwmmxt2}.
18382
18383Additionally, the following architectures, which lack support for the
18384Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18385
18386Many of the architectures support extensions.  These can be added by
18387appending @samp{+@var{extension}} to the architecture name.  Extension
18388options are processed in order and capabilities accumulate.  An extension
18389will also enable any necessary base extensions
18390upon which it depends.  For example, the @samp{+crypto} extension
18391will always enable the @samp{+simd} extension.  The exception to the
18392additive construction is for extensions that are prefixed with
18393@samp{+no@dots{}}: these extensions disable the specified option and
18394any other extensions that may depend on the presence of that
18395extension.
18396
18397For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18398writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18399entirely disabled by the @samp{+nofp} option that follows it.
18400
18401Most extension names are generically named, but have an effect that is
18402dependent upon the architecture to which it is applied.  For example,
18403the @samp{+simd} option can be applied to both @samp{armv7-a} and
18404@samp{armv8-a} architectures, but will enable the original ARMv7-A
18405Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18406variant for @samp{armv8-a}.
18407
18408The table below lists the supported extensions for each architecture.
18409Architectures not mentioned do not support any extensions.
18410
18411@table @samp
18412@item armv5te
18413@itemx armv6
18414@itemx armv6j
18415@itemx armv6k
18416@itemx armv6kz
18417@itemx armv6t2
18418@itemx armv6z
18419@itemx armv6zk
18420@table @samp
18421@item +fp
18422The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
18423used as an alias for this extension.
18424
18425@item +nofp
18426Disable the floating-point instructions.
18427@end table
18428
18429@item armv7
18430The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18431@table @samp
18432@item +fp
18433The VFPv3 floating-point instructions, with 16 double-precision
18434registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18435for this extension.  Note that floating-point is not supported by the
18436base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18437ARMv7-R architectures.
18438
18439@item +nofp
18440Disable the floating-point instructions.
18441@end table
18442
18443@item armv7-a
18444@table @samp
18445@item +mp
18446The multiprocessing extension.
18447
18448@item +sec
18449The security extension.
18450
18451@item +fp
18452The VFPv3 floating-point instructions, with 16 double-precision
18453registers.  The extension @samp{+vfpv3-d16} can be used as an alias
18454for this extension.
18455
18456@item +simd
18457The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18458The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18459for this extension.
18460
18461@item +vfpv3
18462The VFPv3 floating-point instructions, with 32 double-precision
18463registers.
18464
18465@item +vfpv3-d16-fp16
18466The VFPv3 floating-point instructions, with 16 double-precision
18467registers and the half-precision floating-point conversion operations.
18468
18469@item +vfpv3-fp16
18470The VFPv3 floating-point instructions, with 32 double-precision
18471registers and the half-precision floating-point conversion operations.
18472
18473@item +vfpv4-d16
18474The VFPv4 floating-point instructions, with 16 double-precision
18475registers.
18476
18477@item +vfpv4
18478The VFPv4 floating-point instructions, with 32 double-precision
18479registers.
18480
18481@item +neon-fp16
18482The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18483the half-precision floating-point conversion operations.
18484
18485@item +neon-vfpv4
18486The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18487
18488@item +nosimd
18489Disable the Advanced SIMD instructions (does not disable floating point).
18490
18491@item +nofp
18492Disable the floating-point and Advanced SIMD instructions.
18493@end table
18494
18495@item armv7ve
18496The extended version of the ARMv7-A architecture with support for
18497virtualization.
18498@table @samp
18499@item +fp
18500The VFPv4 floating-point instructions, with 16 double-precision registers.
18501The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18502
18503@item +simd
18504The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
18505extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18506
18507@item +vfpv3-d16
18508The VFPv3 floating-point instructions, with 16 double-precision
18509registers.
18510
18511@item +vfpv3
18512The VFPv3 floating-point instructions, with 32 double-precision
18513registers.
18514
18515@item +vfpv3-d16-fp16
18516The VFPv3 floating-point instructions, with 16 double-precision
18517registers and the half-precision floating-point conversion operations.
18518
18519@item +vfpv3-fp16
18520The VFPv3 floating-point instructions, with 32 double-precision
18521registers and the half-precision floating-point conversion operations.
18522
18523@item +vfpv4-d16
18524The VFPv4 floating-point instructions, with 16 double-precision
18525registers.
18526
18527@item +vfpv4
18528The VFPv4 floating-point instructions, with 32 double-precision
18529registers.
18530
18531@item +neon
18532The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18533The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18534
18535@item +neon-fp16
18536The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18537the half-precision floating-point conversion operations.
18538
18539@item +nosimd
18540Disable the Advanced SIMD instructions (does not disable floating point).
18541
18542@item +nofp
18543Disable the floating-point and Advanced SIMD instructions.
18544@end table
18545
18546@item armv8-a
18547@table @samp
18548@item +crc
18549The Cyclic Redundancy Check (CRC) instructions.
18550@item +simd
18551The ARMv8-A Advanced SIMD and floating-point instructions.
18552@item +crypto
18553The cryptographic instructions.
18554@item +nocrypto
18555Disable the cryptographic instructions.
18556@item +nofp
18557Disable the floating-point, Advanced SIMD and cryptographic instructions.
18558@item +sb
18559Speculation Barrier Instruction.
18560@item +predres
18561Execution and Data Prediction Restriction Instructions.
18562@end table
18563
18564@item armv8.1-a
18565@table @samp
18566@item +simd
18567The ARMv8.1-A Advanced SIMD and floating-point instructions.
18568
18569@item +crypto
18570The cryptographic instructions.  This also enables the Advanced SIMD and
18571floating-point instructions.
18572
18573@item +nocrypto
18574Disable the cryptographic instructions.
18575
18576@item +nofp
18577Disable the floating-point, Advanced SIMD and cryptographic instructions.
18578
18579@item +sb
18580Speculation Barrier Instruction.
18581
18582@item +predres
18583Execution and Data Prediction Restriction Instructions.
18584@end table
18585
18586@item armv8.2-a
18587@itemx armv8.3-a
18588@table @samp
18589@item +fp16
18590The half-precision floating-point data processing instructions.
18591This also enables the Advanced SIMD and floating-point instructions.
18592
18593@item +fp16fml
18594The half-precision floating-point fmla extension.  This also enables
18595the half-precision floating-point extension and Advanced SIMD and
18596floating-point instructions.
18597
18598@item +simd
18599The ARMv8.1-A Advanced SIMD and floating-point instructions.
18600
18601@item +crypto
18602The cryptographic instructions.  This also enables the Advanced SIMD and
18603floating-point instructions.
18604
18605@item +dotprod
18606Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
18607
18608@item +nocrypto
18609Disable the cryptographic extension.
18610
18611@item +nofp
18612Disable the floating-point, Advanced SIMD and cryptographic instructions.
18613
18614@item +sb
18615Speculation Barrier Instruction.
18616
18617@item +predres
18618Execution and Data Prediction Restriction Instructions.
18619
18620@item +i8mm
186218-bit Integer Matrix Multiply instructions.
18622This also enables Advanced SIMD and floating-point instructions.
18623
18624@item +bf16
18625Brain half-precision floating-point instructions.
18626This also enables Advanced SIMD and floating-point instructions.
18627@end table
18628
18629@item armv8.4-a
18630@table @samp
18631@item +fp16
18632The half-precision floating-point data processing instructions.
18633This also enables the Advanced SIMD and floating-point instructions as well
18634as the Dot Product extension and the half-precision floating-point fmla
18635extension.
18636
18637@item +simd
18638The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18639Dot Product extension.
18640
18641@item +crypto
18642The cryptographic instructions.  This also enables the Advanced SIMD and
18643floating-point instructions as well as the Dot Product extension.
18644
18645@item +nocrypto
18646Disable the cryptographic extension.
18647
18648@item +nofp
18649Disable the floating-point, Advanced SIMD and cryptographic instructions.
18650
18651@item +sb
18652Speculation Barrier Instruction.
18653
18654@item +predres
18655Execution and Data Prediction Restriction Instructions.
18656
18657@item +i8mm
186588-bit Integer Matrix Multiply instructions.
18659This also enables Advanced SIMD and floating-point instructions.
18660
18661@item +bf16
18662Brain half-precision floating-point instructions.
18663This also enables Advanced SIMD and floating-point instructions.
18664@end table
18665
18666@item armv8.5-a
18667@table @samp
18668@item +fp16
18669The half-precision floating-point data processing instructions.
18670This also enables the Advanced SIMD and floating-point instructions as well
18671as the Dot Product extension and the half-precision floating-point fmla
18672extension.
18673
18674@item +simd
18675The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18676Dot Product extension.
18677
18678@item +crypto
18679The cryptographic instructions.  This also enables the Advanced SIMD and
18680floating-point instructions as well as the Dot Product extension.
18681
18682@item +nocrypto
18683Disable the cryptographic extension.
18684
18685@item +nofp
18686Disable the floating-point, Advanced SIMD and cryptographic instructions.
18687
18688@item +i8mm
186898-bit Integer Matrix Multiply instructions.
18690This also enables Advanced SIMD and floating-point instructions.
18691
18692@item +bf16
18693Brain half-precision floating-point instructions.
18694This also enables Advanced SIMD and floating-point instructions.
18695@end table
18696
18697@item armv8.6-a
18698@table @samp
18699@item +fp16
18700The half-precision floating-point data processing instructions.
18701This also enables the Advanced SIMD and floating-point instructions as well
18702as the Dot Product extension and the half-precision floating-point fmla
18703extension.
18704
18705@item +simd
18706The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18707Dot Product extension.
18708
18709@item +crypto
18710The cryptographic instructions.  This also enables the Advanced SIMD and
18711floating-point instructions as well as the Dot Product extension.
18712
18713@item +nocrypto
18714Disable the cryptographic extension.
18715
18716@item +nofp
18717Disable the floating-point, Advanced SIMD and cryptographic instructions.
18718
18719@item +i8mm
187208-bit Integer Matrix Multiply instructions.
18721This also enables Advanced SIMD and floating-point instructions.
18722
18723@item +bf16
18724Brain half-precision floating-point instructions.
18725This also enables Advanced SIMD and floating-point instructions.
18726@end table
18727
18728@item armv7-r
18729@table @samp
18730@item +fp.sp
18731The single-precision VFPv3 floating-point instructions.  The extension
18732@samp{+vfpv3xd} can be used as an alias for this extension.
18733
18734@item +fp
18735The VFPv3 floating-point instructions with 16 double-precision registers.
18736The extension +vfpv3-d16 can be used as an alias for this extension.
18737
18738@item +vfpv3xd-d16-fp16
18739The single-precision VFPv3 floating-point instructions with 16 double-precision
18740registers and the half-precision floating-point conversion operations.
18741
18742@item +vfpv3-d16-fp16
18743The VFPv3 floating-point instructions with 16 double-precision
18744registers and the half-precision floating-point conversion operations.
18745
18746@item +nofp
18747Disable the floating-point extension.
18748
18749@item +idiv
18750The ARM-state integer division instructions.
18751
18752@item +noidiv
18753Disable the ARM-state integer division extension.
18754@end table
18755
18756@item armv7e-m
18757@table @samp
18758@item +fp
18759The single-precision VFPv4 floating-point instructions.
18760
18761@item +fpv5
18762The single-precision FPv5 floating-point instructions.
18763
18764@item +fp.dp
18765The single- and double-precision FPv5 floating-point instructions.
18766
18767@item +nofp
18768Disable the floating-point extensions.
18769@end table
18770
18771@item  armv8.1-m.main
18772@table @samp
18773
18774@item +dsp
18775The DSP instructions.
18776
18777@item +mve
18778The M-Profile Vector Extension (MVE) integer instructions.
18779
18780@item +mve.fp
18781The M-Profile Vector Extension (MVE) integer and single precision
18782floating-point instructions.
18783
18784@item +fp
18785The single-precision floating-point instructions.
18786
18787@item +fp.dp
18788The single- and double-precision floating-point instructions.
18789
18790@item +nofp
18791Disable the floating-point extension.
18792
18793@item +cdecp0, +cdecp1, ... , +cdecp7
18794Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18795to the numbers given in the options in the range 0 to 7.
18796@end table
18797
18798@item  armv8-m.main
18799@table @samp
18800@item +dsp
18801The DSP instructions.
18802
18803@item +nodsp
18804Disable the DSP extension.
18805
18806@item +fp
18807The single-precision floating-point instructions.
18808
18809@item +fp.dp
18810The single- and double-precision floating-point instructions.
18811
18812@item +nofp
18813Disable the floating-point extension.
18814
18815@item +cdecp0, +cdecp1, ... , +cdecp7
18816Enable the Custom Datapath Extension (CDE) on selected coprocessors according
18817to the numbers given in the options in the range 0 to 7.
18818@end table
18819
18820@item armv8-r
18821@table @samp
18822@item +crc
18823The Cyclic Redundancy Check (CRC) instructions.
18824@item +fp.sp
18825The single-precision FPv5 floating-point instructions.
18826@item +simd
18827The ARMv8-A Advanced SIMD and floating-point instructions.
18828@item +crypto
18829The cryptographic instructions.
18830@item +nocrypto
18831Disable the cryptographic instructions.
18832@item +nofp
18833Disable the floating-point, Advanced SIMD and cryptographic instructions.
18834@end table
18835
18836@end table
18837
18838@option{-march=native} causes the compiler to auto-detect the architecture
18839of the build computer.  At present, this feature is only supported on
18840GNU/Linux, and not all architectures are recognized.  If the auto-detect
18841is unsuccessful the option has no effect.
18842
18843@item -mtune=@var{name}
18844@opindex mtune
18845This option specifies the name of the target ARM processor for
18846which GCC should tune the performance of the code.
18847For some ARM implementations better performance can be obtained by using
18848this option.
18849Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
18850@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
18851@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
18852@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
18853@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
18854@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
18855@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
18856@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
18857@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
18858@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
18859@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
18860@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18861@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18862@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18863@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
18864@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
18865@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
18866@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
18867@samp{cortex-m35p}, @samp{cortex-m55},
18868@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
18869@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
18870@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
18871@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
18872@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
18873
18874Additionally, this option can specify that GCC should tune the performance
18875of the code for a big.LITTLE system.  Permissible names are:
18876@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
18877@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18878@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
18879@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
18880
18881@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
18882performance for a blend of processors within architecture @var{arch}.
18883The aim is to generate code that run well on the current most popular
18884processors, balancing between optimizations that benefit some CPUs in the
18885range, and avoiding performance pitfalls of other CPUs.  The effects of
18886this option may change in future GCC versions as CPU models come and go.
18887
18888@option{-mtune} permits the same extension options as @option{-mcpu}, but
18889the extension options do not affect the tuning of the generated code.
18890
18891@option{-mtune=native} causes the compiler to auto-detect the CPU
18892of the build computer.  At present, this feature is only supported on
18893GNU/Linux, and not all architectures are recognized.  If the auto-detect is
18894unsuccessful the option has no effect.
18895
18896@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
18897@opindex mcpu
18898This specifies the name of the target ARM processor.  GCC uses this name
18899to derive the name of the target ARM architecture (as if specified
18900by @option{-march}) and the ARM processor type for which to tune for
18901performance (as if specified by @option{-mtune}).  Where this option
18902is used in conjunction with @option{-march} or @option{-mtune},
18903those options take precedence over the appropriate part of this option.
18904
18905Many of the supported CPUs implement optional architectural
18906extensions.  Where this is so the architectural extensions are
18907normally enabled by default.  If implementations that lack the
18908extension exist, then the extension syntax can be used to disable
18909those extensions that have been omitted.  For floating-point and
18910Advanced SIMD (Neon) instructions, the settings of the options
18911@option{-mfloat-abi} and @option{-mfpu} must also be considered:
18912floating-point and Advanced SIMD instructions will only be used if
18913@option{-mfloat-abi} is not set to @samp{soft}; and any setting of
18914@option{-mfpu} other than @samp{auto} will override the available
18915floating-point and SIMD extension instructions.
18916
18917For example, @samp{cortex-a9} can be found in three major
18918configurations: integer only, with just a floating-point unit or with
18919floating-point and Advanced SIMD.  The default is to enable all the
18920instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
18921be used to disable just the SIMD or both the SIMD and floating-point
18922instructions respectively.
18923
18924Permissible names for this option are the same as those for
18925@option{-mtune}.
18926
18927The following extension options are common to the listed CPUs:
18928
18929@table @samp
18930@item +nodsp
18931Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
18932
18933@item  +nofp
18934Disables the floating-point instructions on @samp{arm9e},
18935@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
18936@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
18937@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
18938@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
18939Disables the floating-point and SIMD instructions on
18940@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
18941@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
18942@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
18943@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
18944@samp{cortex-a53} and @samp{cortex-a55}.
18945
18946@item +nofp.dp
18947Disables the double-precision component of the floating-point instructions
18948on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
18949@samp{cortex-m7}.
18950
18951@item +nosimd
18952Disables the SIMD (but not floating-point) instructions on
18953@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
18954and @samp{cortex-a9}.
18955
18956@item +crypto
18957Enables the cryptographic instructions on @samp{cortex-a32},
18958@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
18959@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
18960@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18961@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
18962@samp{cortex-a75.cortex-a55}.
18963@end table
18964
18965Additionally the @samp{generic-armv7-a} pseudo target defaults to
18966VFPv3 with 16 double-precision registers.  It supports the following
18967extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
18968@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
18969@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
18970@samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
18971the extensions to @option{-march=armv7-a}.
18972
18973@option{-mcpu=generic-@var{arch}} is also permissible, and is
18974equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
18975See @option{-mtune} for more information.
18976
18977@option{-mcpu=native} causes the compiler to auto-detect the CPU
18978of the build computer.  At present, this feature is only supported on
18979GNU/Linux, and not all architectures are recognized.  If the auto-detect
18980is unsuccessful the option has no effect.
18981
18982@item -mfpu=@var{name}
18983@opindex mfpu
18984This specifies what floating-point hardware (or hardware emulation) is
18985available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
18986@samp{vfpv3},
18987@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
18988@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
18989@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
18990@samp{fpv5-d16}, @samp{fpv5-sp-d16},
18991@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
18992Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
18993is an alias for @samp{vfpv2}.
18994
18995The setting @samp{auto} is the default and is special.  It causes the
18996compiler to select the floating-point and Advanced SIMD instructions
18997based on the settings of @option{-mcpu} and @option{-march}.
18998
18999If the selected floating-point hardware includes the NEON extension
19000(e.g.@: @option{-mfpu=neon}), note that floating-point
19001operations are not generated by GCC's auto-vectorization pass unless
19002@option{-funsafe-math-optimizations} is also specified.  This is
19003because NEON hardware does not fully implement the IEEE 754 standard for
19004floating-point arithmetic (in particular denormal values are treated as
19005zero), so the use of NEON instructions may lead to a loss of precision.
19006
19007You 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}).
19008
19009@item -mfp16-format=@var{name}
19010@opindex mfp16-format
19011Specify the format of the @code{__fp16} half-precision floating-point type.
19012Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
19013the default is @samp{none}, in which case the @code{__fp16} type is not
19014defined.  @xref{Half-Precision}, for more information.
19015
19016@item -mstructure-size-boundary=@var{n}
19017@opindex mstructure-size-boundary
19018The sizes of all structures and unions are rounded up to a multiple
19019of the number of bits set by this option.  Permissible values are 8, 32
19020and 64.  The default value varies for different toolchains.  For the COFF
19021targeted toolchain the default value is 8.  A value of 64 is only allowed
19022if the underlying ABI supports it.
19023
19024Specifying a larger number can produce faster, more efficient code, but
19025can also increase the size of the program.  Different values are potentially
19026incompatible.  Code compiled with one value cannot necessarily expect to
19027work with code or libraries compiled with another value, if they exchange
19028information using structures or unions.
19029
19030This option is deprecated.
19031
19032@item -mabort-on-noreturn
19033@opindex mabort-on-noreturn
19034Generate a call to the function @code{abort} at the end of a
19035@code{noreturn} function.  It is executed if the function tries to
19036return.
19037
19038@item -mlong-calls
19039@itemx -mno-long-calls
19040@opindex mlong-calls
19041@opindex mno-long-calls
19042Tells the compiler to perform function calls by first loading the
19043address of the function into a register and then performing a subroutine
19044call on this register.  This switch is needed if the target function
19045lies outside of the 64-megabyte addressing range of the offset-based
19046version of subroutine call instruction.
19047
19048Even if this switch is enabled, not all function calls are turned
19049into long calls.  The heuristic is that static functions, functions
19050that have the @code{short_call} attribute, functions that are inside
19051the scope of a @code{#pragma no_long_calls} directive, and functions whose
19052definitions have already been compiled within the current compilation
19053unit are not turned into long calls.  The exceptions to this rule are
19054that weak function definitions, functions with the @code{long_call}
19055attribute or the @code{section} attribute, and functions that are within
19056the scope of a @code{#pragma long_calls} directive are always
19057turned into long calls.
19058
19059This feature is not enabled by default.  Specifying
19060@option{-mno-long-calls} restores the default behavior, as does
19061placing the function calls within the scope of a @code{#pragma
19062long_calls_off} directive.  Note these switches have no effect on how
19063the compiler generates code to handle function calls via function
19064pointers.
19065
19066@item -msingle-pic-base
19067@opindex msingle-pic-base
19068Treat the register used for PIC addressing as read-only, rather than
19069loading it in the prologue for each function.  The runtime system is
19070responsible for initializing this register with an appropriate value
19071before execution begins.
19072
19073@item -mpic-register=@var{reg}
19074@opindex mpic-register
19075Specify the register to be used for PIC addressing.
19076For standard PIC base case, the default is any suitable register
19077determined by compiler.  For single PIC base case, the default is
19078@samp{R9} if target is EABI based or stack-checking is enabled,
19079otherwise the default is @samp{R10}.
19080
19081@item -mpic-data-is-text-relative
19082@opindex mpic-data-is-text-relative
19083Assume that the displacement between the text and data segments is fixed
19084at static link time.  This permits using PC-relative addressing
19085operations to access data known to be in the data segment.  For
19086non-VxWorks RTP targets, this option is enabled by default.  When
19087disabled on such targets, it will enable @option{-msingle-pic-base} by
19088default.
19089
19090@item -mpoke-function-name
19091@opindex mpoke-function-name
19092Write the name of each function into the text section, directly
19093preceding the function prologue.  The generated code is similar to this:
19094
19095@smallexample
19096     t0
19097         .ascii "arm_poke_function_name", 0
19098         .align
19099     t1
19100         .word 0xff000000 + (t1 - t0)
19101     arm_poke_function_name
19102         mov     ip, sp
19103         stmfd   sp!, @{fp, ip, lr, pc@}
19104         sub     fp, ip, #4
19105@end smallexample
19106
19107When performing a stack backtrace, code can inspect the value of
19108@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
19109location @code{pc - 12} and the top 8 bits are set, then we know that
19110there is a function name embedded immediately preceding this location
19111and has length @code{((pc[-3]) & 0xff000000)}.
19112
19113@item -mthumb
19114@itemx -marm
19115@opindex marm
19116@opindex mthumb
19117
19118Select between generating code that executes in ARM and Thumb
19119states.  The default for most configurations is to generate code
19120that executes in ARM state, but the default can be changed by
19121configuring GCC with the @option{--with-mode=}@var{state}
19122configure option.
19123
19124You can also override the ARM and Thumb mode for each function
19125by using the @code{target("thumb")} and @code{target("arm")} function attributes
19126(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
19127
19128@item -mflip-thumb
19129@opindex mflip-thumb
19130Switch ARM/Thumb modes on alternating functions.
19131This option is provided for regression testing of mixed Thumb/ARM code
19132generation, and is not intended for ordinary use in compiling code.
19133
19134@item -mtpcs-frame
19135@opindex mtpcs-frame
19136Generate a stack frame that is compliant with the Thumb Procedure Call
19137Standard for all non-leaf functions.  (A leaf function is one that does
19138not call any other functions.)  The default is @option{-mno-tpcs-frame}.
19139
19140@item -mtpcs-leaf-frame
19141@opindex mtpcs-leaf-frame
19142Generate a stack frame that is compliant with the Thumb Procedure Call
19143Standard for all leaf functions.  (A leaf function is one that does
19144not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
19145
19146@item -mcallee-super-interworking
19147@opindex mcallee-super-interworking
19148Gives all externally visible functions in the file being compiled an ARM
19149instruction set header which switches to Thumb mode before executing the
19150rest of the function.  This allows these functions to be called from
19151non-interworking code.  This option is not valid in AAPCS configurations
19152because interworking is enabled by default.
19153
19154@item -mcaller-super-interworking
19155@opindex mcaller-super-interworking
19156Allows calls via function pointers (including virtual functions) to
19157execute correctly regardless of whether the target code has been
19158compiled for interworking or not.  There is a small overhead in the cost
19159of executing a function pointer if this option is enabled.  This option
19160is not valid in AAPCS configurations because interworking is enabled
19161by default.
19162
19163@item -mtp=@var{name}
19164@opindex mtp
19165Specify the access model for the thread local storage pointer.  The valid
19166models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19167@samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19168(supported in the arm6k architecture), and @samp{auto}, which uses the
19169best available method for the selected processor.  The default setting is
19170@samp{auto}.
19171
19172@item -mtls-dialect=@var{dialect}
19173@opindex mtls-dialect
19174Specify the dialect to use for accessing thread local storage.  Two
19175@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
19176@samp{gnu} dialect selects the original GNU scheme for supporting
19177local and global dynamic TLS models.  The @samp{gnu2} dialect
19178selects the GNU descriptor scheme, which provides better performance
19179for shared libraries.  The GNU descriptor scheme is compatible with
19180the original scheme, but does require new assembler, linker and
19181library support.  Initial and local exec TLS models are unaffected by
19182this option and always use the original scheme.
19183
19184@item -mword-relocations
19185@opindex mword-relocations
19186Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19187This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19188loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19189is specified. This option conflicts with @option{-mslow-flash-data}.
19190
19191@item -mfix-cortex-m3-ldrd
19192@opindex mfix-cortex-m3-ldrd
19193Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19194with overlapping destination and base registers are used.  This option avoids
19195generating these instructions.  This option is enabled by default when
19196@option{-mcpu=cortex-m3} is specified.
19197
19198@item -munaligned-access
19199@itemx -mno-unaligned-access
19200@opindex munaligned-access
19201@opindex mno-unaligned-access
19202Enables (or disables) reading and writing of 16- and 32- bit values
19203from addresses that are not 16- or 32- bit aligned.  By default
19204unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19205ARMv8-M Baseline architectures, and enabled for all other
19206architectures.  If unaligned access is not enabled then words in packed
19207data structures are accessed a byte at a time.
19208
19209The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19210generated object file to either true or false, depending upon the
19211setting of this option.  If unaligned access is enabled then the
19212preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19213defined.
19214
19215@item -mneon-for-64bits
19216@opindex mneon-for-64bits
19217This option is deprecated and has no effect.
19218
19219@item -mslow-flash-data
19220@opindex mslow-flash-data
19221Assume loading data from flash is slower than fetching instruction.
19222Therefore literal load is minimized for better performance.
19223This option is only supported when compiling for ARMv7 M-profile and
19224off by default. It conflicts with @option{-mword-relocations}.
19225
19226@item -masm-syntax-unified
19227@opindex masm-syntax-unified
19228Assume inline assembler is using unified asm syntax.  The default is
19229currently off which implies divided syntax.  This option has no impact
19230on Thumb2. However, this may change in future releases of GCC.
19231Divided syntax should be considered deprecated.
19232
19233@item -mrestrict-it
19234@opindex mrestrict-it
19235Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19236IT blocks can only contain a single 16-bit instruction from a select
19237set of instructions. This option is on by default for ARMv8-A Thumb mode.
19238
19239@item -mprint-tune-info
19240@opindex mprint-tune-info
19241Print CPU tuning information as comment in assembler file.  This is
19242an option used only for regression testing of the compiler and not
19243intended for ordinary use in compiling code.  This option is disabled
19244by default.
19245
19246@item -mverbose-cost-dump
19247@opindex mverbose-cost-dump
19248Enable verbose cost model dumping in the debug dump files.  This option is
19249provided for use in debugging the compiler.
19250
19251@item -mpure-code
19252@opindex mpure-code
19253Do not allow constant data to be placed in code sections.
19254Additionally, when compiling for ELF object format give all text sections the
19255ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
19256is only available when generating non-pic code for M-profile targets.
19257
19258@item -mcmse
19259@opindex mcmse
19260Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19261Development Tools Engineering Specification", which can be found on
19262@url{https://developer.arm.com/documentation/ecm0359818/latest/}.
19263
19264@item -mfix-cmse-cve-2021-35465
19265@opindex mfix-cmse-cve-2021-35465
19266Mitigate against a potential security issue with the @code{VLLDM} instruction
19267in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
19268enabled by default when the option @option{-mcpu=} is used with
19269@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}.  The option
19270@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
19271
19272@item -mfdpic
19273@itemx -mno-fdpic
19274@opindex mfdpic
19275@opindex mno-fdpic
19276Select the FDPIC ABI, which uses 64-bit function descriptors to
19277represent pointers to functions.  When the compiler is configured for
19278@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19279and implies @option{-fPIE} if none of the PIC/PIE-related options is
19280provided.  On other targets, it only enables the FDPIC-specific code
19281generation features, and the user should explicitly provide the
19282PIC/PIE-related options as needed.
19283
19284Note that static linking is not supported because it would still
19285involve the dynamic linker when the program self-relocates.  If such
19286behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19287
19288The opposite @option{-mno-fdpic} option is useful (and required) to
19289build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19290toolchain as the one used to build the userland programs.
19291
19292@end table
19293
19294@node AVR Options
19295@subsection AVR Options
19296@cindex AVR Options
19297
19298These options are defined for AVR implementations:
19299
19300@table @gcctabopt
19301@item -mmcu=@var{mcu}
19302@opindex mmcu
19303Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19304
19305The default for this option is@tie{}@samp{avr2}.
19306
19307GCC supports the following AVR devices and ISAs:
19308
19309@include avr-mmcu.texi
19310
19311@item -mabsdata
19312@opindex mabsdata
19313
19314Assume that all data in static storage can be accessed by LDS / STS
19315instructions.  This option has only an effect on reduced Tiny devices like
19316ATtiny40.  See also the @code{absdata}
19317@ref{AVR Variable Attributes,variable attribute}.
19318
19319@item -maccumulate-args
19320@opindex maccumulate-args
19321Accumulate outgoing function arguments and acquire/release the needed
19322stack space for outgoing function arguments once in function
19323prologue/epilogue.  Without this option, outgoing arguments are pushed
19324before calling a function and popped afterwards.
19325
19326Popping the arguments after the function call can be expensive on
19327AVR so that accumulating the stack space might lead to smaller
19328executables because arguments need not be removed from the
19329stack after such a function call.
19330
19331This option can lead to reduced code size for functions that perform
19332several calls to functions that get their arguments on the stack like
19333calls to printf-like functions.
19334
19335@item -mbranch-cost=@var{cost}
19336@opindex mbranch-cost
19337Set the branch costs for conditional branch instructions to
19338@var{cost}.  Reasonable values for @var{cost} are small, non-negative
19339integers. The default branch cost is 0.
19340
19341@item -mcall-prologues
19342@opindex mcall-prologues
19343Functions prologues/epilogues are expanded as calls to appropriate
19344subroutines.  Code size is smaller.
19345
19346@item -mdouble=@var{bits}
19347@itemx -mlong-double=@var{bits}
19348@opindex mdouble
19349@opindex mlong-double
19350Set the size (in bits) of the @code{double} or @code{long double} type,
19351respectively.  Possible values for @var{bits} are 32 and 64.
19352Whether or not a specific value for @var{bits} is allowed depends on
19353the @code{--with-double=} and @code{--with-long-double=}
19354@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19355and the same applies for the default values of the options.
19356
19357@item -mgas-isr-prologues
19358@opindex mgas-isr-prologues
19359Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19360instruction supported by GNU Binutils.
19361If this option is on, the feature can still be disabled for individual
19362ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19363function attribute.  This feature is activated per default
19364if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19365and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19366
19367@item -mint8
19368@opindex mint8
19369Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
19370@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19371and @code{long long} is 4 bytes.  Please note that this option does not
19372conform to the C standards, but it results in smaller code
19373size.
19374
19375@item -mmain-is-OS_task
19376@opindex mmain-is-OS_task
19377Do not save registers in @code{main}.  The effect is the same like
19378attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19379to @code{main}. It is activated per default if optimization is on.
19380
19381@item -mn-flash=@var{num}
19382@opindex mn-flash
19383Assume that the flash memory has a size of
19384@var{num} times 64@tie{}KiB.
19385
19386@item -mno-interrupts
19387@opindex mno-interrupts
19388Generated code is not compatible with hardware interrupts.
19389Code size is smaller.
19390
19391@item -mrelax
19392@opindex mrelax
19393Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19394@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19395Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19396the assembler's command line and the @option{--relax} option to the
19397linker's command line.
19398
19399Jump relaxing is performed by the linker because jump offsets are not
19400known before code is located. Therefore, the assembler code generated by the
19401compiler is the same, but the instructions in the executable may
19402differ from instructions in the assembler code.
19403
19404Relaxing must be turned on if linker stubs are needed, see the
19405section on @code{EIND} and linker stubs below.
19406
19407@item -mrmw
19408@opindex mrmw
19409Assume that the device supports the Read-Modify-Write
19410instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19411
19412@item -mshort-calls
19413@opindex mshort-calls
19414
19415Assume that @code{RJMP} and @code{RCALL} can target the whole
19416program memory.
19417
19418This option is used internally for multilib selection.  It is
19419not an optimization option, and you don't need to set it by hand.
19420
19421@item -msp8
19422@opindex msp8
19423Treat the stack pointer register as an 8-bit register,
19424i.e.@: assume the high byte of the stack pointer is zero.
19425In general, you don't need to set this option by hand.
19426
19427This option is used internally by the compiler to select and
19428build multilibs for architectures @code{avr2} and @code{avr25}.
19429These architectures mix devices with and without @code{SPH}.
19430For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19431the compiler driver adds or removes this option from the compiler
19432proper's command line, because the compiler then knows if the device
19433or architecture has an 8-bit stack pointer and thus no @code{SPH}
19434register or not.
19435
19436@item -mstrict-X
19437@opindex mstrict-X
19438Use address register @code{X} in a way proposed by the hardware.  This means
19439that @code{X} is only used in indirect, post-increment or
19440pre-decrement addressing.
19441
19442Without this option, the @code{X} register may be used in the same way
19443as @code{Y} or @code{Z} which then is emulated by additional
19444instructions.
19445For example, loading a value with @code{X+const} addressing with a
19446small non-negative @code{const < 64} to a register @var{Rn} is
19447performed as
19448
19449@example
19450adiw r26, const   ; X += const
19451ld   @var{Rn}, X        ; @var{Rn} = *X
19452sbiw r26, const   ; X -= const
19453@end example
19454
19455@item -mtiny-stack
19456@opindex mtiny-stack
19457Only change the lower 8@tie{}bits of the stack pointer.
19458
19459@item -mfract-convert-truncate
19460@opindex mfract-convert-truncate
19461Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19462
19463@item -nodevicelib
19464@opindex nodevicelib
19465Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19466
19467@item -nodevicespecs
19468@opindex nodevicespecs
19469Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19470command line.  The user takes responsibility for supplying the sub-processes
19471like compiler proper, assembler and linker with appropriate command line
19472options.  This means that the user has to supply her private device specs
19473file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
19474more need for option @option{-mmcu=@var{mcu}}.
19475
19476This option can also serve as a replacement for the older way of
19477specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19478which contains a folder named @code{device-specs} which contains a specs file named
19479@code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19480
19481@item -Waddr-space-convert
19482@opindex Waddr-space-convert
19483@opindex Wno-addr-space-convert
19484Warn about conversions between address spaces in the case where the
19485resulting address space is not contained in the incoming address space.
19486
19487@item -Wmisspelled-isr
19488@opindex Wmisspelled-isr
19489@opindex Wno-misspelled-isr
19490Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19491Enabled by default.
19492@end table
19493
19494@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19495@cindex @code{EIND}
19496Pointers in the implementation are 16@tie{}bits wide.
19497The address of a function or label is represented as word address so
19498that indirect jumps and calls can target any code address in the
19499range of 64@tie{}Ki words.
19500
19501In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19502bytes of program memory space, there is a special function register called
19503@code{EIND} that serves as most significant part of the target address
19504when @code{EICALL} or @code{EIJMP} instructions are used.
19505
19506Indirect jumps and calls on these devices are handled as follows by
19507the compiler and are subject to some limitations:
19508
19509@itemize @bullet
19510
19511@item
19512The compiler never sets @code{EIND}.
19513
19514@item
19515The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19516instructions or might read @code{EIND} directly in order to emulate an
19517indirect call/jump by means of a @code{RET} instruction.
19518
19519@item
19520The compiler assumes that @code{EIND} never changes during the startup
19521code or during the application. In particular, @code{EIND} is not
19522saved/restored in function or interrupt service routine
19523prologue/epilogue.
19524
19525@item
19526For indirect calls to functions and computed goto, the linker
19527generates @emph{stubs}. Stubs are jump pads sometimes also called
19528@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19529The stub contains a direct jump to the desired address.
19530
19531@item
19532Linker relaxation must be turned on so that the linker generates
19533the stubs correctly in all situations. See the compiler option
19534@option{-mrelax} and the linker option @option{--relax}.
19535There are corner cases where the linker is supposed to generate stubs
19536but aborts without relaxation and without a helpful error message.
19537
19538@item
19539The default linker script is arranged for code with @code{EIND = 0}.
19540If code is supposed to work for a setup with @code{EIND != 0}, a custom
19541linker script has to be used in order to place the sections whose
19542name start with @code{.trampolines} into the segment where @code{EIND}
19543points to.
19544
19545@item
19546The startup code from libgcc never sets @code{EIND}.
19547Notice that startup code is a blend of code from libgcc and AVR-LibC.
19548For the impact of AVR-LibC on @code{EIND}, see the
19549@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19550
19551@item
19552It is legitimate for user-specific startup code to set up @code{EIND}
19553early, for example by means of initialization code located in
19554section @code{.init3}. Such code runs prior to general startup code
19555that initializes RAM and calls constructors, but after the bit
19556of startup code from AVR-LibC that sets @code{EIND} to the segment
19557where the vector table is located.
19558@example
19559#include <avr/io.h>
19560
19561static void
19562__attribute__((section(".init3"),naked,used,no_instrument_function))
19563init3_set_eind (void)
19564@{
19565  __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19566                  "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19567@}
19568@end example
19569
19570@noindent
19571The @code{__trampolines_start} symbol is defined in the linker script.
19572
19573@item
19574Stubs are generated automatically by the linker if
19575the following two conditions are met:
19576@itemize @minus
19577
19578@item The address of a label is taken by means of the @code{gs} modifier
19579(short for @emph{generate stubs}) like so:
19580@example
19581LDI r24, lo8(gs(@var{func}))
19582LDI r25, hi8(gs(@var{func}))
19583@end example
19584@item The final location of that label is in a code segment
19585@emph{outside} the segment where the stubs are located.
19586@end itemize
19587
19588@item
19589The compiler emits such @code{gs} modifiers for code labels in the
19590following situations:
19591@itemize @minus
19592@item Taking address of a function or code label.
19593@item Computed goto.
19594@item If prologue-save function is used, see @option{-mcall-prologues}
19595command-line option.
19596@item Switch/case dispatch tables. If you do not want such dispatch
19597tables you can specify the @option{-fno-jump-tables} command-line option.
19598@item C and C++ constructors/destructors called during startup/shutdown.
19599@item If the tools hit a @code{gs()} modifier explained above.
19600@end itemize
19601
19602@item
19603Jumping to non-symbolic addresses like so is @emph{not} supported:
19604
19605@example
19606int main (void)
19607@{
19608    /* Call function at word address 0x2 */
19609    return ((int(*)(void)) 0x2)();
19610@}
19611@end example
19612
19613Instead, a stub has to be set up, i.e.@: the function has to be called
19614through a symbol (@code{func_4} in the example):
19615
19616@example
19617int main (void)
19618@{
19619    extern int func_4 (void);
19620
19621    /* Call function at byte address 0x4 */
19622    return func_4();
19623@}
19624@end example
19625
19626and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19627Alternatively, @code{func_4} can be defined in the linker script.
19628@end itemize
19629
19630@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19631@cindex @code{RAMPD}
19632@cindex @code{RAMPX}
19633@cindex @code{RAMPY}
19634@cindex @code{RAMPZ}
19635Some AVR devices support memories larger than the 64@tie{}KiB range
19636that can be accessed with 16-bit pointers.  To access memory locations
19637outside this 64@tie{}KiB range, the content of a @code{RAMP}
19638register is used as high part of the address:
19639The @code{X}, @code{Y}, @code{Z} address register is concatenated
19640with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19641register, respectively, to get a wide address. Similarly,
19642@code{RAMPD} is used together with direct addressing.
19643
19644@itemize
19645@item
19646The startup code initializes the @code{RAMP} special function
19647registers with zero.
19648
19649@item
19650If a @ref{AVR Named Address Spaces,named address space} other than
19651generic or @code{__flash} is used, then @code{RAMPZ} is set
19652as needed before the operation.
19653
19654@item
19655If the device supports RAM larger than 64@tie{}KiB and the compiler
19656needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19657is reset to zero after the operation.
19658
19659@item
19660If the device comes with a specific @code{RAMP} register, the ISR
19661prologue/epilogue saves/restores that SFR and initializes it with
19662zero in case the ISR code might (implicitly) use it.
19663
19664@item
19665RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19666If you use inline assembler to read from locations outside the
1966716-bit address range and change one of the @code{RAMP} registers,
19668you must reset it to zero after the access.
19669
19670@end itemize
19671
19672@subsubsection AVR Built-in Macros
19673
19674GCC defines several built-in macros so that the user code can test
19675for the presence or absence of features.  Almost any of the following
19676built-in macros are deduced from device capabilities and thus
19677triggered by the @option{-mmcu=} command-line option.
19678
19679For even more AVR-specific built-in macros see
19680@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19681
19682@table @code
19683
19684@item __AVR_ARCH__
19685Build-in macro that resolves to a decimal number that identifies the
19686architecture and depends on the @option{-mmcu=@var{mcu}} option.
19687Possible values are:
19688
19689@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19690@code{4}, @code{5}, @code{51}, @code{6}
19691
19692for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19693@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19694
19695respectively and
19696
19697@code{100},
19698@code{102}, @code{103}, @code{104},
19699@code{105}, @code{106}, @code{107}
19700
19701for @var{mcu}=@code{avrtiny},
19702@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19703@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19704If @var{mcu} specifies a device, this built-in macro is set
19705accordingly. For example, with @option{-mmcu=atmega8} the macro is
19706defined to @code{4}.
19707
19708@item __AVR_@var{Device}__
19709Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19710the device's name. For example, @option{-mmcu=atmega8} defines the
19711built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19712@code{__AVR_ATtiny261A__}, etc.
19713
19714The built-in macros' names follow
19715the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19716the device name as from the AVR user manual. The difference between
19717@var{Device} in the built-in macro and @var{device} in
19718@option{-mmcu=@var{device}} is that the latter is always lowercase.
19719
19720If @var{device} is not a device but only a core architecture like
19721@samp{avr51}, this macro is not defined.
19722
19723@item __AVR_DEVICE_NAME__
19724Setting @option{-mmcu=@var{device}} defines this built-in macro to
19725the device's name. For example, with @option{-mmcu=atmega8} the macro
19726is defined to @code{atmega8}.
19727
19728If @var{device} is not a device but only a core architecture like
19729@samp{avr51}, this macro is not defined.
19730
19731@item __AVR_XMEGA__
19732The device / architecture belongs to the XMEGA family of devices.
19733
19734@item __AVR_HAVE_ELPM__
19735The device has the @code{ELPM} instruction.
19736
19737@item __AVR_HAVE_ELPMX__
19738The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19739R@var{n},Z+} instructions.
19740
19741@item __AVR_HAVE_MOVW__
19742The device has the @code{MOVW} instruction to perform 16-bit
19743register-register moves.
19744
19745@item __AVR_HAVE_LPMX__
19746The device has the @code{LPM R@var{n},Z} and
19747@code{LPM R@var{n},Z+} instructions.
19748
19749@item __AVR_HAVE_MUL__
19750The device has a hardware multiplier.
19751
19752@item __AVR_HAVE_JMP_CALL__
19753The device has the @code{JMP} and @code{CALL} instructions.
19754This is the case for devices with more than 8@tie{}KiB of program
19755memory.
19756
19757@item __AVR_HAVE_EIJMP_EICALL__
19758@itemx __AVR_3_BYTE_PC__
19759The device has the @code{EIJMP} and @code{EICALL} instructions.
19760This is the case for devices with more than 128@tie{}KiB of program memory.
19761This also means that the program counter
19762(PC) is 3@tie{}bytes wide.
19763
19764@item __AVR_2_BYTE_PC__
19765The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19766with up to 128@tie{}KiB of program memory.
19767
19768@item __AVR_HAVE_8BIT_SP__
19769@itemx __AVR_HAVE_16BIT_SP__
19770The stack pointer (SP) register is treated as 8-bit respectively
1977116-bit register by the compiler.
19772The definition of these macros is affected by @option{-mtiny-stack}.
19773
19774@item __AVR_HAVE_SPH__
19775@itemx __AVR_SP8__
19776The device has the SPH (high part of stack pointer) special function
19777register or has an 8-bit stack pointer, respectively.
19778The definition of these macros is affected by @option{-mmcu=} and
19779in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
19780by @option{-msp8}.
19781
19782@item __AVR_HAVE_RAMPD__
19783@itemx __AVR_HAVE_RAMPX__
19784@itemx __AVR_HAVE_RAMPY__
19785@itemx __AVR_HAVE_RAMPZ__
19786The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
19787@code{RAMPZ} special function register, respectively.
19788
19789@item __NO_INTERRUPTS__
19790This macro reflects the @option{-mno-interrupts} command-line option.
19791
19792@item __AVR_ERRATA_SKIP__
19793@itemx __AVR_ERRATA_SKIP_JMP_CALL__
19794Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19795instructions because of a hardware erratum.  Skip instructions are
19796@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
19797The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
19798set.
19799
19800@item __AVR_ISA_RMW__
19801The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
19802
19803@item __AVR_SFR_OFFSET__=@var{offset}
19804Instructions that can address I/O special function registers directly
19805like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
19806address as if addressed by an instruction to access RAM like @code{LD}
19807or @code{STS}. This offset depends on the device architecture and has
19808to be subtracted from the RAM address in order to get the
19809respective I/O@tie{}address.
19810
19811@item __AVR_SHORT_CALLS__
19812The @option{-mshort-calls} command line option is set.
19813
19814@item __AVR_PM_BASE_ADDRESS__=@var{addr}
19815Some devices support reading from flash memory by means of @code{LD*}
19816instructions.  The flash memory is seen in the data address space
19817at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
19818is not defined, this feature is not available.  If defined,
19819the address space is linear and there is no need to put
19820@code{.rodata} into RAM.  This is handled by the default linker
19821description file, and is currently available for
19822@code{avrtiny} and @code{avrxmega3}.  Even more convenient,
19823there is no need to use address spaces like @code{__flash} or
19824features like attribute @code{progmem} and @code{pgm_read_*}.
19825
19826@item __WITH_AVRLIBC__
19827The compiler is configured to be used together with AVR-Libc.
19828See the @option{--with-avrlibc} configure option.
19829
19830@item __HAVE_DOUBLE_MULTILIB__
19831Defined if @option{-mdouble=} acts as a multilib option.
19832
19833@item __HAVE_DOUBLE32__
19834@itemx __HAVE_DOUBLE64__
19835Defined if the compiler supports 32-bit double resp. 64-bit double.
19836The actual layout is specified by option @option{-mdouble=}.
19837
19838@item __DEFAULT_DOUBLE__
19839The size in bits of @code{double} if @option{-mdouble=} is not set.
19840To test the layout of @code{double} in a program, use the built-in
19841macro @code{__SIZEOF_DOUBLE__}.
19842
19843@item __HAVE_LONG_DOUBLE32__
19844@itemx __HAVE_LONG_DOUBLE64__
19845@itemx __HAVE_LONG_DOUBLE_MULTILIB__
19846@itemx __DEFAULT_LONG_DOUBLE__
19847Same as above, but for @code{long double} instead of @code{double}.
19848
19849@item __WITH_DOUBLE_COMPARISON__
19850Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
19851@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
19852and is defined to @code{2} or @code{3}.
19853
19854@item __WITH_LIBF7_LIBGCC__
19855@itemx __WITH_LIBF7_MATH__
19856@itemx __WITH_LIBF7_MATH_SYMBOLS__
19857Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
19858@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
19859
19860@end table
19861
19862@node Blackfin Options
19863@subsection Blackfin Options
19864@cindex Blackfin Options
19865
19866@table @gcctabopt
19867@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
19868@opindex mcpu=
19869Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
19870can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
19871@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
19872@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
19873@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
19874@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
19875@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
19876@samp{bf561}, @samp{bf592}.
19877
19878The optional @var{sirevision} specifies the silicon revision of the target
19879Blackfin processor.  Any workarounds available for the targeted silicon revision
19880are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
19881If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
19882are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
19883hexadecimal digits representing the major and minor numbers in the silicon
19884revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
19885is not defined.  If @var{sirevision} is @samp{any}, the
19886@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
19887If this optional @var{sirevision} is not used, GCC assumes the latest known
19888silicon revision of the targeted Blackfin processor.
19889
19890GCC defines a preprocessor macro for the specified @var{cpu}.
19891For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
19892provided by libgloss to be linked in if @option{-msim} is not given.
19893
19894Without this option, @samp{bf532} is used as the processor by default.
19895
19896Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
19897only the preprocessor macro is defined.
19898
19899@item -msim
19900@opindex msim
19901Specifies that the program will be run on the simulator.  This causes
19902the simulator BSP provided by libgloss to be linked in.  This option
19903has effect only for @samp{bfin-elf} toolchain.
19904Certain other options, such as @option{-mid-shared-library} and
19905@option{-mfdpic}, imply @option{-msim}.
19906
19907@item -momit-leaf-frame-pointer
19908@opindex momit-leaf-frame-pointer
19909Don't keep the frame pointer in a register for leaf functions.  This
19910avoids the instructions to save, set up and restore frame pointers and
19911makes an extra register available in leaf functions.
19912
19913@item -mspecld-anomaly
19914@opindex mspecld-anomaly
19915When enabled, the compiler ensures that the generated code does not
19916contain speculative loads after jump instructions. If this option is used,
19917@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
19918
19919@item -mno-specld-anomaly
19920@opindex mno-specld-anomaly
19921@opindex mspecld-anomaly
19922Don't generate extra code to prevent speculative loads from occurring.
19923
19924@item -mcsync-anomaly
19925@opindex mcsync-anomaly
19926When enabled, the compiler ensures that the generated code does not
19927contain CSYNC or SSYNC instructions too soon after conditional branches.
19928If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
19929
19930@item -mno-csync-anomaly
19931@opindex mno-csync-anomaly
19932@opindex mcsync-anomaly
19933Don't generate extra code to prevent CSYNC or SSYNC instructions from
19934occurring too soon after a conditional branch.
19935
19936@item -mlow64k
19937@opindex mlow64k
19938When enabled, the compiler is free to take advantage of the knowledge that
19939the entire program fits into the low 64k of memory.
19940
19941@item -mno-low64k
19942@opindex mno-low64k
19943Assume that the program is arbitrarily large.  This is the default.
19944
19945@item -mstack-check-l1
19946@opindex mstack-check-l1
19947Do stack checking using information placed into L1 scratchpad memory by the
19948uClinux kernel.
19949
19950@item -mid-shared-library
19951@opindex mid-shared-library
19952Generate code that supports shared libraries via the library ID method.
19953This allows for execute in place and shared libraries in an environment
19954without virtual memory management.  This option implies @option{-fPIC}.
19955With a @samp{bfin-elf} target, this option implies @option{-msim}.
19956
19957@item -mno-id-shared-library
19958@opindex mno-id-shared-library
19959@opindex mid-shared-library
19960Generate code that doesn't assume ID-based shared libraries are being used.
19961This is the default.
19962
19963@item -mleaf-id-shared-library
19964@opindex mleaf-id-shared-library
19965Generate code that supports shared libraries via the library ID method,
19966but assumes that this library or executable won't link against any other
19967ID shared libraries.  That allows the compiler to use faster code for jumps
19968and calls.
19969
19970@item -mno-leaf-id-shared-library
19971@opindex mno-leaf-id-shared-library
19972@opindex mleaf-id-shared-library
19973Do not assume that the code being compiled won't link against any ID shared
19974libraries.  Slower code is generated for jump and call insns.
19975
19976@item -mshared-library-id=n
19977@opindex mshared-library-id
19978Specifies the identification number of the ID-based shared library being
19979compiled.  Specifying a value of 0 generates more compact code; specifying
19980other values forces the allocation of that number to the current
19981library but is no more space- or time-efficient than omitting this option.
19982
19983@item -msep-data
19984@opindex msep-data
19985Generate code that allows the data segment to be located in a different
19986area of memory from the text segment.  This allows for execute in place in
19987an environment without virtual memory management by eliminating relocations
19988against the text section.
19989
19990@item -mno-sep-data
19991@opindex mno-sep-data
19992@opindex msep-data
19993Generate code that assumes that the data segment follows the text segment.
19994This is the default.
19995
19996@item -mlong-calls
19997@itemx -mno-long-calls
19998@opindex mlong-calls
19999@opindex mno-long-calls
20000Tells the compiler to perform function calls by first loading the
20001address of the function into a register and then performing a subroutine
20002call on this register.  This switch is needed if the target function
20003lies outside of the 24-bit addressing range of the offset-based
20004version of subroutine call instruction.
20005
20006This feature is not enabled by default.  Specifying
20007@option{-mno-long-calls} restores the default behavior.  Note these
20008switches have no effect on how the compiler generates code to handle
20009function calls via function pointers.
20010
20011@item -mfast-fp
20012@opindex mfast-fp
20013Link with the fast floating-point library. This library relaxes some of
20014the IEEE floating-point standard's rules for checking inputs against
20015Not-a-Number (NAN), in the interest of performance.
20016
20017@item -minline-plt
20018@opindex minline-plt
20019Enable inlining of PLT entries in function calls to functions that are
20020not known to bind locally.  It has no effect without @option{-mfdpic}.
20021
20022@item -mmulticore
20023@opindex mmulticore
20024Build a standalone application for multicore Blackfin processors.
20025This option causes proper start files and link scripts supporting
20026multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
20027It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
20028
20029This option can be used with @option{-mcorea} or @option{-mcoreb}, which
20030selects the one-application-per-core programming model.  Without
20031@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
20032programming model is used. In this model, the main function of Core B
20033should be named as @code{coreb_main}.
20034
20035If this option is not used, the single-core application programming
20036model is used.
20037
20038@item -mcorea
20039@opindex mcorea
20040Build a standalone application for Core A of BF561 when using
20041the one-application-per-core programming model. Proper start files
20042and link scripts are used to support Core A, and the macro
20043@code{__BFIN_COREA} is defined.
20044This option can only be used in conjunction with @option{-mmulticore}.
20045
20046@item -mcoreb
20047@opindex mcoreb
20048Build a standalone application for Core B of BF561 when using
20049the one-application-per-core programming model. Proper start files
20050and link scripts are used to support Core B, and the macro
20051@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
20052should be used instead of @code{main}.
20053This option can only be used in conjunction with @option{-mmulticore}.
20054
20055@item -msdram
20056@opindex msdram
20057Build a standalone application for SDRAM. Proper start files and
20058link scripts are used to put the application into SDRAM, and the macro
20059@code{__BFIN_SDRAM} is defined.
20060The loader should initialize SDRAM before loading the application.
20061
20062@item -micplb
20063@opindex micplb
20064Assume that ICPLBs are enabled at run time.  This has an effect on certain
20065anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
20066are enabled; for standalone applications the default is off.
20067@end table
20068
20069@node C6X Options
20070@subsection C6X Options
20071@cindex C6X Options
20072
20073@table @gcctabopt
20074@item -march=@var{name}
20075@opindex march
20076This specifies the name of the target architecture.  GCC uses this
20077name to determine what kind of instructions it can emit when generating
20078assembly code.  Permissible names are: @samp{c62x},
20079@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
20080
20081@item -mbig-endian
20082@opindex mbig-endian
20083Generate code for a big-endian target.
20084
20085@item -mlittle-endian
20086@opindex mlittle-endian
20087Generate code for a little-endian target.  This is the default.
20088
20089@item -msim
20090@opindex msim
20091Choose startup files and linker script suitable for the simulator.
20092
20093@item -msdata=default
20094@opindex msdata=default
20095Put small global and static data in the @code{.neardata} section,
20096which is pointed to by register @code{B14}.  Put small uninitialized
20097global and static data in the @code{.bss} section, which is adjacent
20098to the @code{.neardata} section.  Put small read-only data into the
20099@code{.rodata} section.  The corresponding sections used for large
20100pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
20101
20102@item -msdata=all
20103@opindex msdata=all
20104Put all data, not just small objects, into the sections reserved for
20105small data, and use addressing relative to the @code{B14} register to
20106access them.
20107
20108@item -msdata=none
20109@opindex msdata=none
20110Make no use of the sections reserved for small data, and use absolute
20111addresses to access all data.  Put all initialized global and static
20112data in the @code{.fardata} section, and all uninitialized data in the
20113@code{.far} section.  Put all constant data into the @code{.const}
20114section.
20115@end table
20116
20117@node CRIS Options
20118@subsection CRIS Options
20119@cindex CRIS Options
20120
20121These options are defined specifically for the CRIS ports.
20122
20123@table @gcctabopt
20124@item -march=@var{architecture-type}
20125@itemx -mcpu=@var{architecture-type}
20126@opindex march
20127@opindex mcpu
20128Generate code for the specified architecture.  The choices for
20129@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
20130respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
20131Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
20132@samp{v10}.
20133
20134@item -mtune=@var{architecture-type}
20135@opindex mtune
20136Tune to @var{architecture-type} everything applicable about the generated
20137code, except for the ABI and the set of available instructions.  The
20138choices for @var{architecture-type} are the same as for
20139@option{-march=@var{architecture-type}}.
20140
20141@item -mmax-stack-frame=@var{n}
20142@opindex mmax-stack-frame
20143Warn when the stack frame of a function exceeds @var{n} bytes.
20144
20145@item -metrax4
20146@itemx -metrax100
20147@opindex metrax4
20148@opindex metrax100
20149The options @option{-metrax4} and @option{-metrax100} are synonyms for
20150@option{-march=v3} and @option{-march=v8} respectively.
20151
20152@item -mmul-bug-workaround
20153@itemx -mno-mul-bug-workaround
20154@opindex mmul-bug-workaround
20155@opindex mno-mul-bug-workaround
20156Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20157models where it applies.  This option is active by default.
20158
20159@item -mpdebug
20160@opindex mpdebug
20161Enable CRIS-specific verbose debug-related information in the assembly
20162code.  This option also has the effect of turning off the @samp{#NO_APP}
20163formatted-code indicator to the assembler at the beginning of the
20164assembly file.
20165
20166@item -mcc-init
20167@opindex mcc-init
20168Do not use condition-code results from previous instruction; always emit
20169compare and test instructions before use of condition codes.
20170
20171@item -mno-side-effects
20172@opindex mno-side-effects
20173@opindex mside-effects
20174Do not emit instructions with side effects in addressing modes other than
20175post-increment.
20176
20177@item -mstack-align
20178@itemx -mno-stack-align
20179@itemx -mdata-align
20180@itemx -mno-data-align
20181@itemx -mconst-align
20182@itemx -mno-const-align
20183@opindex mstack-align
20184@opindex mno-stack-align
20185@opindex mdata-align
20186@opindex mno-data-align
20187@opindex mconst-align
20188@opindex mno-const-align
20189These options (@samp{no-} options) arrange (eliminate arrangements) for the
20190stack frame, individual data and constants to be aligned for the maximum
20191single data access size for the chosen CPU model.  The default is to
20192arrange for 32-bit alignment.  ABI details such as structure layout are
20193not affected by these options.
20194
20195@item -m32-bit
20196@itemx -m16-bit
20197@itemx -m8-bit
20198@opindex m32-bit
20199@opindex m16-bit
20200@opindex m8-bit
20201Similar to the stack- data- and const-align options above, these options
20202arrange for stack frame, writable data and constants to all be 32-bit,
2020316-bit or 8-bit aligned.  The default is 32-bit alignment.
20204
20205@item -mno-prologue-epilogue
20206@itemx -mprologue-epilogue
20207@opindex mno-prologue-epilogue
20208@opindex mprologue-epilogue
20209With @option{-mno-prologue-epilogue}, the normal function prologue and
20210epilogue which set up the stack frame are omitted and no return
20211instructions or return sequences are generated in the code.  Use this
20212option only together with visual inspection of the compiled code: no
20213warnings or errors are generated when call-saved registers must be saved,
20214or storage for local variables needs to be allocated.
20215
20216@item -mno-gotplt
20217@itemx -mgotplt
20218@opindex mno-gotplt
20219@opindex mgotplt
20220With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20221instruction sequences that load addresses for functions from the PLT part
20222of the GOT rather than (traditional on other architectures) calls to the
20223PLT@.  The default is @option{-mgotplt}.
20224
20225@item -melf
20226@opindex melf
20227Legacy no-op option only recognized with the cris-axis-elf and
20228cris-axis-linux-gnu targets.
20229
20230@item -mlinux
20231@opindex mlinux
20232Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20233
20234@item -sim
20235@opindex sim
20236This option, recognized for the cris-axis-elf, arranges
20237to link with input-output functions from a simulator library.  Code,
20238initialized data and zero-initialized data are allocated consecutively.
20239
20240@item -sim2
20241@opindex sim2
20242Like @option{-sim}, but pass linker options to locate initialized data at
202430x40000000 and zero-initialized data at 0x80000000.
20244@end table
20245
20246@node CR16 Options
20247@subsection CR16 Options
20248@cindex CR16 Options
20249
20250These options are defined specifically for the CR16 ports.
20251
20252@table @gcctabopt
20253
20254@item -mmac
20255@opindex mmac
20256Enable the use of multiply-accumulate instructions. Disabled by default.
20257
20258@item -mcr16cplus
20259@itemx -mcr16c
20260@opindex mcr16cplus
20261@opindex mcr16c
20262Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20263is default.
20264
20265@item -msim
20266@opindex msim
20267Links the library libsim.a which is in compatible with simulator. Applicable
20268to ELF compiler only.
20269
20270@item -mint32
20271@opindex mint32
20272Choose integer type as 32-bit wide.
20273
20274@item -mbit-ops
20275@opindex mbit-ops
20276Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20277
20278@item -mdata-model=@var{model}
20279@opindex mdata-model
20280Choose a data model. The choices for @var{model} are @samp{near},
20281@samp{far} or @samp{medium}. @samp{medium} is default.
20282However, @samp{far} is not valid with @option{-mcr16c}, as the
20283CR16C architecture does not support the far data model.
20284@end table
20285
20286@node C-SKY Options
20287@subsection C-SKY Options
20288@cindex C-SKY Options
20289
20290GCC supports these options when compiling for C-SKY V2 processors.
20291
20292@table @gcctabopt
20293
20294@item -march=@var{arch}
20295@opindex march=
20296Specify the C-SKY target architecture.  Valid values for @var{arch} are:
20297@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20298The default is @samp{ck810}.
20299
20300@item -mcpu=@var{cpu}
20301@opindex mcpu=
20302Specify the C-SKY target processor.  Valid values for @var{cpu} are:
20303@samp{ck801}, @samp{ck801t},
20304@samp{ck802}, @samp{ck802t}, @samp{ck802j},
20305@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20306@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20307@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20308@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20309@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20310@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20311@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20312@samp{ck803eftr1}, @samp{ck803efhtr1},
20313@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20314@samp{ck803sef}, @samp{ck803seft},
20315@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20316@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20317@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20318@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20319
20320@item -mbig-endian
20321@opindex mbig-endian
20322@itemx -EB
20323@opindex EB
20324@itemx -mlittle-endian
20325@opindex mlittle-endian
20326@itemx -EL
20327@opindex EL
20328
20329Select big- or little-endian code.  The default is little-endian.
20330
20331@item -mhard-float
20332@opindex mhard-float
20333@itemx -msoft-float
20334@opindex msoft-float
20335
20336Select hardware or software floating-point implementations.
20337The default is soft float.
20338
20339@item -mdouble-float
20340@itemx -mno-double-float
20341@opindex mdouble-float
20342When @option{-mhard-float} is in effect, enable generation of
20343double-precision float instructions.  This is the default except
20344when compiling for CK803.
20345
20346@item -mfdivdu
20347@itemx -mno-fdivdu
20348@opindex mfdivdu
20349When @option{-mhard-float} is in effect, enable generation of
20350@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20351This is the default except when compiling for CK803.
20352
20353@item -mfpu=@var{fpu}
20354@opindex mfpu=
20355Select the floating-point processor.  This option can only be used with
20356@option{-mhard-float}.
20357Values for @var{fpu} are
20358@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20359@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20360@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20361
20362@item -melrw
20363@itemx -mno-elrw
20364@opindex melrw
20365Enable the extended @code{lrw} instruction.  This option defaults to on
20366for CK801 and off otherwise.
20367
20368@item -mistack
20369@itemx -mno-istack
20370@opindex mistack
20371Enable interrupt stack instructions; the default is off.
20372
20373The @option{-mistack} option is required to handle the
20374@code{interrupt} and @code{isr} function attributes
20375(@pxref{C-SKY Function Attributes}).
20376
20377@item -mmp
20378@opindex mmp
20379Enable multiprocessor instructions; the default is off.
20380
20381@item -mcp
20382@opindex mcp
20383Enable coprocessor instructions; the default is off.
20384
20385@item -mcache
20386@opindex mcache
20387Enable coprocessor instructions; the default is off.
20388
20389@item -msecurity
20390@opindex msecurity
20391Enable C-SKY security instructions; the default is off.
20392
20393@item -mtrust
20394@opindex mtrust
20395Enable C-SKY trust instructions; the default is off.
20396
20397@item -mdsp
20398@opindex mdsp
20399@itemx -medsp
20400@opindex medsp
20401@itemx -mvdsp
20402@opindex mvdsp
20403Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20404All of these options default to off.
20405
20406@item -mdiv
20407@itemx -mno-div
20408@opindex mdiv
20409Generate divide instructions.  Default is off.
20410
20411@item -msmart
20412@itemx -mno-smart
20413@opindex msmart
20414Generate code for Smart Mode, using only registers numbered 0-7 to allow
20415use of 16-bit instructions.  This option is ignored for CK801 where this
20416is the required behavior, and it defaults to on for CK802.
20417For other targets, the default is off.
20418
20419@item -mhigh-registers
20420@itemx -mno-high-registers
20421@opindex mhigh-registers
20422Generate code using the high registers numbered 16-31.  This option
20423is not supported on CK801, CK802, or CK803, and is enabled by default
20424for other processors.
20425
20426@item -manchor
20427@itemx -mno-anchor
20428@opindex manchor
20429Generate code using global anchor symbol addresses.
20430
20431@item -mpushpop
20432@itemx -mno-pushpop
20433@opindex mpushpop
20434Generate code using @code{push} and @code{pop} instructions.  This option
20435defaults to on.
20436
20437@item -mmultiple-stld
20438@itemx -mstm
20439@itemx -mno-multiple-stld
20440@itemx -mno-stm
20441@opindex mmultiple-stld
20442Generate code using @code{stm} and @code{ldm} instructions.  This option
20443isn't supported on CK801 but is enabled by default on other processors.
20444
20445@item -mconstpool
20446@itemx -mno-constpool
20447@opindex mconstpool
20448Create constant pools in the compiler instead of deferring it to the
20449assembler.  This option is the default and required for correct code
20450generation on CK801 and CK802, and is optional on other processors.
20451
20452@item -mstack-size
20453@item -mno-stack-size
20454@opindex mstack-size
20455Emit @code{.stack_size} directives for each function in the assembly
20456output.  This option defaults to off.
20457
20458@item -mccrt
20459@itemx -mno-ccrt
20460@opindex mccrt
20461Generate code for the C-SKY compiler runtime instead of libgcc.  This
20462option defaults to off.
20463
20464@item -mbranch-cost=@var{n}
20465@opindex mbranch-cost=
20466Set the branch costs to roughly @code{n} instructions.  The default is 1.
20467
20468@item -msched-prolog
20469@itemx -mno-sched-prolog
20470@opindex msched-prolog
20471Permit scheduling of function prologue and epilogue sequences.  Using
20472this option can result in code that is not compliant with the C-SKY V2 ABI
20473prologue requirements and that cannot be debugged or backtraced.
20474It is disabled by default.
20475
20476@end table
20477
20478@node Darwin Options
20479@subsection Darwin Options
20480@cindex Darwin options
20481
20482These options are defined for all architectures running the Darwin operating
20483system.
20484
20485FSF GCC on Darwin does not create ``fat'' object files; it creates
20486an object file for the single architecture that GCC was built to
20487target.  Apple's GCC on Darwin does create ``fat'' files if multiple
20488@option{-arch} options are used; it does so by running the compiler or
20489linker multiple times and joining the results together with
20490@file{lipo}.
20491
20492The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20493@samp{i686}) is determined by the flags that specify the ISA
20494that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
20495@option{-force_cpusubtype_ALL} option can be used to override this.
20496
20497The Darwin tools vary in their behavior when presented with an ISA
20498mismatch.  The assembler, @file{as}, only permits instructions to
20499be used that are valid for the subtype of the file it is generating,
20500so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20501The linker for shared libraries, @file{/usr/bin/libtool}, fails
20502and prints an error if asked to create a shared library with a less
20503restrictive subtype than its input files (for instance, trying to put
20504a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
20505for executables, @command{ld}, quietly gives the executable the most
20506restrictive subtype of any of its input files.
20507
20508@table @gcctabopt
20509@item -F@var{dir}
20510@opindex F
20511Add the framework directory @var{dir} to the head of the list of
20512directories to be searched for header files.  These directories are
20513interleaved with those specified by @option{-I} options and are
20514scanned in a left-to-right order.
20515
20516A framework directory is a directory with frameworks in it.  A
20517framework is a directory with a @file{Headers} and/or
20518@file{PrivateHeaders} directory contained directly in it that ends
20519in @file{.framework}.  The name of a framework is the name of this
20520directory excluding the @file{.framework}.  Headers associated with
20521the framework are found in one of those two directories, with
20522@file{Headers} being searched first.  A subframework is a framework
20523directory that is in a framework's @file{Frameworks} directory.
20524Includes of subframework headers can only appear in a header of a
20525framework that contains the subframework, or in a sibling subframework
20526header.  Two subframeworks are siblings if they occur in the same
20527framework.  A subframework should not have the same name as a
20528framework; a warning is issued if this is violated.  Currently a
20529subframework cannot have subframeworks; in the future, the mechanism
20530may be extended to support this.  The standard frameworks can be found
20531in @file{/System/Library/Frameworks} and
20532@file{/Library/Frameworks}.  An example include looks like
20533@code{#include <Framework/header.h>}, where @file{Framework} denotes
20534the name of the framework and @file{header.h} is found in the
20535@file{PrivateHeaders} or @file{Headers} directory.
20536
20537@item -iframework@var{dir}
20538@opindex iframework
20539Like @option{-F} except the directory is a treated as a system
20540directory.  The main difference between this @option{-iframework} and
20541@option{-F} is that with @option{-iframework} the compiler does not
20542warn about constructs contained within header files found via
20543@var{dir}.  This option is valid only for the C family of languages.
20544
20545@item -gused
20546@opindex gused
20547Emit debugging information for symbols that are used.  For stabs
20548debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20549This is by default ON@.
20550
20551@item -gfull
20552@opindex gfull
20553Emit debugging information for all symbols and types.
20554
20555@item -mmacosx-version-min=@var{version}
20556The earliest version of MacOS X that this executable will run on
20557is @var{version}.  Typical values of @var{version} include @code{10.1},
20558@code{10.2}, and @code{10.3.9}.
20559
20560If the compiler was built to use the system's headers by default,
20561then the default for this option is the system version on which the
20562compiler is running, otherwise the default is to make choices that
20563are compatible with as many systems and code bases as possible.
20564
20565@item -mkernel
20566@opindex mkernel
20567Enable kernel development mode.  The @option{-mkernel} option sets
20568@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20569@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20570@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20571applicable.  This mode also sets @option{-mno-altivec},
20572@option{-msoft-float}, @option{-fno-builtin} and
20573@option{-mlong-branch} for PowerPC targets.
20574
20575@item -mone-byte-bool
20576@opindex mone-byte-bool
20577Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20578By default @code{sizeof(bool)} is @code{4} when compiling for
20579Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20580option has no effect on x86.
20581
20582@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20583to generate code that is not binary compatible with code generated
20584without that switch.  Using this switch may require recompiling all
20585other modules in a program, including system libraries.  Use this
20586switch to conform to a non-default data model.
20587
20588@item -mfix-and-continue
20589@itemx -ffix-and-continue
20590@itemx -findirect-data
20591@opindex mfix-and-continue
20592@opindex ffix-and-continue
20593@opindex findirect-data
20594Generate code suitable for fast turnaround development, such as to
20595allow GDB to dynamically load @file{.o} files into already-running
20596programs.  @option{-findirect-data} and @option{-ffix-and-continue}
20597are provided for backwards compatibility.
20598
20599@item -all_load
20600@opindex all_load
20601Loads all members of static archive libraries.
20602See man ld(1) for more information.
20603
20604@item -arch_errors_fatal
20605@opindex arch_errors_fatal
20606Cause the errors having to do with files that have the wrong architecture
20607to be fatal.
20608
20609@item -bind_at_load
20610@opindex bind_at_load
20611Causes the output file to be marked such that the dynamic linker will
20612bind all undefined references when the file is loaded or launched.
20613
20614@item -bundle
20615@opindex bundle
20616Produce a Mach-o bundle format file.
20617See man ld(1) for more information.
20618
20619@item -bundle_loader @var{executable}
20620@opindex bundle_loader
20621This option specifies the @var{executable} that will load the build
20622output file being linked.  See man ld(1) for more information.
20623
20624@item -dynamiclib
20625@opindex dynamiclib
20626When passed this option, GCC produces a dynamic library instead of
20627an executable when linking, using the Darwin @file{libtool} command.
20628
20629@item -force_cpusubtype_ALL
20630@opindex force_cpusubtype_ALL
20631This causes GCC's output file to have the @samp{ALL} subtype, instead of
20632one controlled by the @option{-mcpu} or @option{-march} option.
20633
20634@item -allowable_client  @var{client_name}
20635@itemx -client_name
20636@itemx -compatibility_version
20637@itemx -current_version
20638@itemx -dead_strip
20639@itemx -dependency-file
20640@itemx -dylib_file
20641@itemx -dylinker_install_name
20642@itemx -dynamic
20643@itemx -exported_symbols_list
20644@itemx -filelist
20645@need 800
20646@itemx -flat_namespace
20647@itemx -force_flat_namespace
20648@itemx -headerpad_max_install_names
20649@itemx -image_base
20650@itemx -init
20651@itemx -install_name
20652@itemx -keep_private_externs
20653@itemx -multi_module
20654@itemx -multiply_defined
20655@itemx -multiply_defined_unused
20656@need 800
20657@itemx -noall_load
20658@itemx -no_dead_strip_inits_and_terms
20659@itemx -nofixprebinding
20660@itemx -nomultidefs
20661@itemx -noprebind
20662@itemx -noseglinkedit
20663@itemx -pagezero_size
20664@itemx -prebind
20665@itemx -prebind_all_twolevel_modules
20666@itemx -private_bundle
20667@need 800
20668@itemx -read_only_relocs
20669@itemx -sectalign
20670@itemx -sectobjectsymbols
20671@itemx -whyload
20672@itemx -seg1addr
20673@itemx -sectcreate
20674@itemx -sectobjectsymbols
20675@itemx -sectorder
20676@itemx -segaddr
20677@itemx -segs_read_only_addr
20678@need 800
20679@itemx -segs_read_write_addr
20680@itemx -seg_addr_table
20681@itemx -seg_addr_table_filename
20682@itemx -seglinkedit
20683@itemx -segprot
20684@itemx -segs_read_only_addr
20685@itemx -segs_read_write_addr
20686@itemx -single_module
20687@itemx -static
20688@itemx -sub_library
20689@need 800
20690@itemx -sub_umbrella
20691@itemx -twolevel_namespace
20692@itemx -umbrella
20693@itemx -undefined
20694@itemx -unexported_symbols_list
20695@itemx -weak_reference_mismatches
20696@itemx -whatsloaded
20697@opindex allowable_client
20698@opindex client_name
20699@opindex compatibility_version
20700@opindex current_version
20701@opindex dead_strip
20702@opindex dependency-file
20703@opindex dylib_file
20704@opindex dylinker_install_name
20705@opindex dynamic
20706@opindex exported_symbols_list
20707@opindex filelist
20708@opindex flat_namespace
20709@opindex force_flat_namespace
20710@opindex headerpad_max_install_names
20711@opindex image_base
20712@opindex init
20713@opindex install_name
20714@opindex keep_private_externs
20715@opindex multi_module
20716@opindex multiply_defined
20717@opindex multiply_defined_unused
20718@opindex noall_load
20719@opindex no_dead_strip_inits_and_terms
20720@opindex nofixprebinding
20721@opindex nomultidefs
20722@opindex noprebind
20723@opindex noseglinkedit
20724@opindex pagezero_size
20725@opindex prebind
20726@opindex prebind_all_twolevel_modules
20727@opindex private_bundle
20728@opindex read_only_relocs
20729@opindex sectalign
20730@opindex sectobjectsymbols
20731@opindex whyload
20732@opindex seg1addr
20733@opindex sectcreate
20734@opindex sectobjectsymbols
20735@opindex sectorder
20736@opindex segaddr
20737@opindex segs_read_only_addr
20738@opindex segs_read_write_addr
20739@opindex seg_addr_table
20740@opindex seg_addr_table_filename
20741@opindex seglinkedit
20742@opindex segprot
20743@opindex segs_read_only_addr
20744@opindex segs_read_write_addr
20745@opindex single_module
20746@opindex static
20747@opindex sub_library
20748@opindex sub_umbrella
20749@opindex twolevel_namespace
20750@opindex umbrella
20751@opindex undefined
20752@opindex unexported_symbols_list
20753@opindex weak_reference_mismatches
20754@opindex whatsloaded
20755These options are passed to the Darwin linker.  The Darwin linker man page
20756describes them in detail.
20757@end table
20758
20759@node DEC Alpha Options
20760@subsection DEC Alpha Options
20761
20762These @samp{-m} options are defined for the DEC Alpha implementations:
20763
20764@table @gcctabopt
20765@item -mno-soft-float
20766@itemx -msoft-float
20767@opindex mno-soft-float
20768@opindex msoft-float
20769Use (do not use) the hardware floating-point instructions for
20770floating-point operations.  When @option{-msoft-float} is specified,
20771functions in @file{libgcc.a} are used to perform floating-point
20772operations.  Unless they are replaced by routines that emulate the
20773floating-point operations, or compiled in such a way as to call such
20774emulations routines, these routines issue floating-point
20775operations.   If you are compiling for an Alpha without floating-point
20776operations, you must ensure that the library is built so as not to call
20777them.
20778
20779Note that Alpha implementations without floating-point operations are
20780required to have floating-point registers.
20781
20782@item -mfp-reg
20783@itemx -mno-fp-regs
20784@opindex mfp-reg
20785@opindex mno-fp-regs
20786Generate code that uses (does not use) the floating-point register set.
20787@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
20788register set is not used, floating-point operands are passed in integer
20789registers as if they were integers and floating-point results are passed
20790in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
20791so any function with a floating-point argument or return value called by code
20792compiled with @option{-mno-fp-regs} must also be compiled with that
20793option.
20794
20795A typical use of this option is building a kernel that does not use,
20796and hence need not save and restore, any floating-point registers.
20797
20798@item -mieee
20799@opindex mieee
20800The Alpha architecture implements floating-point hardware optimized for
20801maximum performance.  It is mostly compliant with the IEEE floating-point
20802standard.  However, for full compliance, software assistance is
20803required.  This option generates code fully IEEE-compliant code
20804@emph{except} that the @var{inexact-flag} is not maintained (see below).
20805If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
20806defined during compilation.  The resulting code is less efficient but is
20807able to correctly support denormalized numbers and exceptional IEEE
20808values such as not-a-number and plus/minus infinity.  Other Alpha
20809compilers call this option @option{-ieee_with_no_inexact}.
20810
20811@item -mieee-with-inexact
20812@opindex mieee-with-inexact
20813This is like @option{-mieee} except the generated code also maintains
20814the IEEE @var{inexact-flag}.  Turning on this option causes the
20815generated code to implement fully-compliant IEEE math.  In addition to
20816@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
20817macro.  On some Alpha implementations the resulting code may execute
20818significantly slower than the code generated by default.  Since there is
20819very little code that depends on the @var{inexact-flag}, you should
20820normally not specify this option.  Other Alpha compilers call this
20821option @option{-ieee_with_inexact}.
20822
20823@item -mfp-trap-mode=@var{trap-mode}
20824@opindex mfp-trap-mode
20825This option controls what floating-point related traps are enabled.
20826Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
20827The trap mode can be set to one of four values:
20828
20829@table @samp
20830@item n
20831This is the default (normal) setting.  The only traps that are enabled
20832are the ones that cannot be disabled in software (e.g., division by zero
20833trap).
20834
20835@item u
20836In addition to the traps enabled by @samp{n}, underflow traps are enabled
20837as well.
20838
20839@item su
20840Like @samp{u}, but the instructions are marked to be safe for software
20841completion (see Alpha architecture manual for details).
20842
20843@item sui
20844Like @samp{su}, but inexact traps are enabled as well.
20845@end table
20846
20847@item -mfp-rounding-mode=@var{rounding-mode}
20848@opindex mfp-rounding-mode
20849Selects the IEEE rounding mode.  Other Alpha compilers call this option
20850@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
20851of:
20852
20853@table @samp
20854@item n
20855Normal IEEE rounding mode.  Floating-point numbers are rounded towards
20856the nearest machine number or towards the even machine number in case
20857of a tie.
20858
20859@item m
20860Round towards minus infinity.
20861
20862@item c
20863Chopped rounding mode.  Floating-point numbers are rounded towards zero.
20864
20865@item d
20866Dynamic rounding mode.  A field in the floating-point control register
20867(@var{fpcr}, see Alpha architecture reference manual) controls the
20868rounding mode in effect.  The C library initializes this register for
20869rounding towards plus infinity.  Thus, unless your program modifies the
20870@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
20871@end table
20872
20873@item -mtrap-precision=@var{trap-precision}
20874@opindex mtrap-precision
20875In the Alpha architecture, floating-point traps are imprecise.  This
20876means without software assistance it is impossible to recover from a
20877floating trap and program execution normally needs to be terminated.
20878GCC can generate code that can assist operating system trap handlers
20879in determining the exact location that caused a floating-point trap.
20880Depending on the requirements of an application, different levels of
20881precisions can be selected:
20882
20883@table @samp
20884@item p
20885Program precision.  This option is the default and means a trap handler
20886can only identify which program caused a floating-point exception.
20887
20888@item f
20889Function precision.  The trap handler can determine the function that
20890caused a floating-point exception.
20891
20892@item i
20893Instruction precision.  The trap handler can determine the exact
20894instruction that caused a floating-point exception.
20895@end table
20896
20897Other Alpha compilers provide the equivalent options called
20898@option{-scope_safe} and @option{-resumption_safe}.
20899
20900@item -mieee-conformant
20901@opindex mieee-conformant
20902This option marks the generated code as IEEE conformant.  You must not
20903use this option unless you also specify @option{-mtrap-precision=i} and either
20904@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
20905is to emit the line @samp{.eflag 48} in the function prologue of the
20906generated assembly file.
20907
20908@item -mbuild-constants
20909@opindex mbuild-constants
20910Normally GCC examines a 32- or 64-bit integer constant to
20911see if it can construct it from smaller constants in two or three
20912instructions.  If it cannot, it outputs the constant as a literal and
20913generates code to load it from the data segment at run time.
20914
20915Use this option to require GCC to construct @emph{all} integer constants
20916using code, even if it takes more instructions (the maximum is six).
20917
20918You typically use this option to build a shared library dynamic
20919loader.  Itself a shared library, it must relocate itself in memory
20920before it can find the variables and constants in its own data segment.
20921
20922@item -mbwx
20923@itemx -mno-bwx
20924@itemx -mcix
20925@itemx -mno-cix
20926@itemx -mfix
20927@itemx -mno-fix
20928@itemx -mmax
20929@itemx -mno-max
20930@opindex mbwx
20931@opindex mno-bwx
20932@opindex mcix
20933@opindex mno-cix
20934@opindex mfix
20935@opindex mno-fix
20936@opindex mmax
20937@opindex mno-max
20938Indicate whether GCC should generate code to use the optional BWX,
20939CIX, FIX and MAX instruction sets.  The default is to use the instruction
20940sets supported by the CPU type specified via @option{-mcpu=} option or that
20941of the CPU on which GCC was built if none is specified.
20942
20943@item -mfloat-vax
20944@itemx -mfloat-ieee
20945@opindex mfloat-vax
20946@opindex mfloat-ieee
20947Generate code that uses (does not use) VAX F and G floating-point
20948arithmetic instead of IEEE single and double precision.
20949
20950@item -mexplicit-relocs
20951@itemx -mno-explicit-relocs
20952@opindex mexplicit-relocs
20953@opindex mno-explicit-relocs
20954Older Alpha assemblers provided no way to generate symbol relocations
20955except via assembler macros.  Use of these macros does not allow
20956optimal instruction scheduling.  GNU binutils as of version 2.12
20957supports a new syntax that allows the compiler to explicitly mark
20958which relocations should apply to which instructions.  This option
20959is mostly useful for debugging, as GCC detects the capabilities of
20960the assembler when it is built and sets the default accordingly.
20961
20962@item -msmall-data
20963@itemx -mlarge-data
20964@opindex msmall-data
20965@opindex mlarge-data
20966When @option{-mexplicit-relocs} is in effect, static data is
20967accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
20968is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
20969(the @code{.sdata} and @code{.sbss} sections) and are accessed via
2097016-bit relocations off of the @code{$gp} register.  This limits the
20971size of the small data area to 64KB, but allows the variables to be
20972directly accessed via a single instruction.
20973
20974The default is @option{-mlarge-data}.  With this option the data area
20975is limited to just below 2GB@.  Programs that require more than 2GB of
20976data must use @code{malloc} or @code{mmap} to allocate the data in the
20977heap instead of in the program's data segment.
20978
20979When generating code for shared libraries, @option{-fpic} implies
20980@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
20981
20982@item -msmall-text
20983@itemx -mlarge-text
20984@opindex msmall-text
20985@opindex mlarge-text
20986When @option{-msmall-text} is used, the compiler assumes that the
20987code of the entire program (or shared library) fits in 4MB, and is
20988thus reachable with a branch instruction.  When @option{-msmall-data}
20989is used, the compiler can assume that all local symbols share the
20990same @code{$gp} value, and thus reduce the number of instructions
20991required for a function call from 4 to 1.
20992
20993The default is @option{-mlarge-text}.
20994
20995@item -mcpu=@var{cpu_type}
20996@opindex mcpu
20997Set the instruction set and instruction scheduling parameters for
20998machine type @var{cpu_type}.  You can specify either the @samp{EV}
20999style name or the corresponding chip number.  GCC supports scheduling
21000parameters for the EV4, EV5 and EV6 family of processors and
21001chooses the default values for the instruction set from the processor
21002you specify.  If you do not specify a processor type, GCC defaults
21003to the processor on which the compiler was built.
21004
21005Supported values for @var{cpu_type} are
21006
21007@table @samp
21008@item ev4
21009@itemx ev45
21010@itemx 21064
21011Schedules as an EV4 and has no instruction set extensions.
21012
21013@item ev5
21014@itemx 21164
21015Schedules as an EV5 and has no instruction set extensions.
21016
21017@item ev56
21018@itemx 21164a
21019Schedules as an EV5 and supports the BWX extension.
21020
21021@item pca56
21022@itemx 21164pc
21023@itemx 21164PC
21024Schedules as an EV5 and supports the BWX and MAX extensions.
21025
21026@item ev6
21027@itemx 21264
21028Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
21029
21030@item ev67
21031@itemx 21264a
21032Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
21033@end table
21034
21035Native toolchains also support the value @samp{native},
21036which selects the best architecture option for the host processor.
21037@option{-mcpu=native} has no effect if GCC does not recognize
21038the processor.
21039
21040@item -mtune=@var{cpu_type}
21041@opindex mtune
21042Set only the instruction scheduling parameters for machine type
21043@var{cpu_type}.  The instruction set is not changed.
21044
21045Native toolchains also support the value @samp{native},
21046which selects the best architecture option for the host processor.
21047@option{-mtune=native} has no effect if GCC does not recognize
21048the processor.
21049
21050@item -mmemory-latency=@var{time}
21051@opindex mmemory-latency
21052Sets the latency the scheduler should assume for typical memory
21053references as seen by the application.  This number is highly
21054dependent on the memory access patterns used by the application
21055and the size of the external cache on the machine.
21056
21057Valid options for @var{time} are
21058
21059@table @samp
21060@item @var{number}
21061A decimal number representing clock cycles.
21062
21063@item L1
21064@itemx L2
21065@itemx L3
21066@itemx main
21067The compiler contains estimates of the number of clock cycles for
21068``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21069(also called Dcache, Scache, and Bcache), as well as to main memory.
21070Note that L3 is only valid for EV5.
21071
21072@end table
21073@end table
21074
21075@node eBPF Options
21076@subsection eBPF Options
21077@cindex eBPF Options
21078
21079@table @gcctabopt
21080@item -mframe-limit=@var{bytes}
21081This specifies the hard limit for frame sizes, in bytes.  Currently,
21082the value that can be specified should be less than or equal to
21083@samp{32767}.  Defaults to whatever limit is imposed by the version of
21084the Linux kernel targeted.
21085
21086@item -mkernel=@var{version}
21087@opindex mkernel
21088This specifies the minimum version of the kernel that will run the
21089compiled program.  GCC uses this version to determine which
21090instructions to use, what kernel helpers to allow, etc.  Currently,
21091@var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
21092@samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
21093@samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
21094@samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
21095@samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
21096@samp{5.2}, @samp{latest} and @samp{native}.
21097
21098@item -mbig-endian
21099@opindex mbig-endian
21100Generate code for a big-endian target.
21101
21102@item -mlittle-endian
21103@opindex mlittle-endian
21104Generate code for a little-endian target.  This is the default.
21105
21106@item -mxbpf
21107Generate code for an expanded version of BPF, which relaxes some of
21108the restrictions imposed by the BPF architecture:
21109@itemize @minus
21110@item Save and restore callee-saved registers at function entry and
21111exit, respectively.
21112@end itemize
21113@end table
21114
21115@node FR30 Options
21116@subsection FR30 Options
21117@cindex FR30 Options
21118
21119These options are defined specifically for the FR30 port.
21120
21121@table @gcctabopt
21122
21123@item -msmall-model
21124@opindex msmall-model
21125Use the small address space model.  This can produce smaller code, but
21126it does assume that all symbolic values and addresses fit into a
2112720-bit range.
21128
21129@item -mno-lsim
21130@opindex mno-lsim
21131Assume that runtime support has been provided and so there is no need
21132to include the simulator library (@file{libsim.a}) on the linker
21133command line.
21134
21135@end table
21136
21137@node FT32 Options
21138@subsection FT32 Options
21139@cindex FT32 Options
21140
21141These options are defined specifically for the FT32 port.
21142
21143@table @gcctabopt
21144
21145@item -msim
21146@opindex msim
21147Specifies that the program will be run on the simulator.  This causes
21148an alternate runtime startup and library to be linked.
21149You must not use this option when generating programs that will run on
21150real hardware; you must provide your own runtime library for whatever
21151I/O functions are needed.
21152
21153@item -mlra
21154@opindex mlra
21155Enable Local Register Allocation.  This is still experimental for FT32,
21156so by default the compiler uses standard reload.
21157
21158@item -mnodiv
21159@opindex mnodiv
21160Do not use div and mod instructions.
21161
21162@item -mft32b
21163@opindex mft32b
21164Enable use of the extended instructions of the FT32B processor.
21165
21166@item -mcompress
21167@opindex mcompress
21168Compress all code using the Ft32B code compression scheme.
21169
21170@item -mnopm
21171@opindex  mnopm
21172Do not generate code that reads program memory.
21173
21174@end table
21175
21176@node FRV Options
21177@subsection FRV Options
21178@cindex FRV Options
21179
21180@table @gcctabopt
21181@item -mgpr-32
21182@opindex mgpr-32
21183
21184Only use the first 32 general-purpose registers.
21185
21186@item -mgpr-64
21187@opindex mgpr-64
21188
21189Use all 64 general-purpose registers.
21190
21191@item -mfpr-32
21192@opindex mfpr-32
21193
21194Use only the first 32 floating-point registers.
21195
21196@item -mfpr-64
21197@opindex mfpr-64
21198
21199Use all 64 floating-point registers.
21200
21201@item -mhard-float
21202@opindex mhard-float
21203
21204Use hardware instructions for floating-point operations.
21205
21206@item -msoft-float
21207@opindex msoft-float
21208
21209Use library routines for floating-point operations.
21210
21211@item -malloc-cc
21212@opindex malloc-cc
21213
21214Dynamically allocate condition code registers.
21215
21216@item -mfixed-cc
21217@opindex mfixed-cc
21218
21219Do not try to dynamically allocate condition code registers, only
21220use @code{icc0} and @code{fcc0}.
21221
21222@item -mdword
21223@opindex mdword
21224
21225Change ABI to use double word insns.
21226
21227@item -mno-dword
21228@opindex mno-dword
21229@opindex mdword
21230
21231Do not use double word instructions.
21232
21233@item -mdouble
21234@opindex mdouble
21235
21236Use floating-point double instructions.
21237
21238@item -mno-double
21239@opindex mno-double
21240
21241Do not use floating-point double instructions.
21242
21243@item -mmedia
21244@opindex mmedia
21245
21246Use media instructions.
21247
21248@item -mno-media
21249@opindex mno-media
21250
21251Do not use media instructions.
21252
21253@item -mmuladd
21254@opindex mmuladd
21255
21256Use multiply and add/subtract instructions.
21257
21258@item -mno-muladd
21259@opindex mno-muladd
21260
21261Do not use multiply and add/subtract instructions.
21262
21263@item -mfdpic
21264@opindex mfdpic
21265
21266Select the FDPIC ABI, which uses function descriptors to represent
21267pointers to functions.  Without any PIC/PIE-related options, it
21268implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
21269assumes GOT entries and small data are within a 12-bit range from the
21270GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21271are computed with 32 bits.
21272With a @samp{bfin-elf} target, this option implies @option{-msim}.
21273
21274@item -minline-plt
21275@opindex minline-plt
21276
21277Enable inlining of PLT entries in function calls to functions that are
21278not known to bind locally.  It has no effect without @option{-mfdpic}.
21279It's enabled by default if optimizing for speed and compiling for
21280shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21281optimization option such as @option{-O3} or above is present in the
21282command line.
21283
21284@item -mTLS
21285@opindex mTLS
21286
21287Assume a large TLS segment when generating thread-local code.
21288
21289@item -mtls
21290@opindex mtls
21291
21292Do not assume a large TLS segment when generating thread-local code.
21293
21294@item -mgprel-ro
21295@opindex mgprel-ro
21296
21297Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21298that is known to be in read-only sections.  It's enabled by default,
21299except for @option{-fpic} or @option{-fpie}: even though it may help
21300make the global offset table smaller, it trades 1 instruction for 4.
21301With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21302one of which may be shared by multiple symbols, and it avoids the need
21303for a GOT entry for the referenced symbol, so it's more likely to be a
21304win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
21305
21306@item -multilib-library-pic
21307@opindex multilib-library-pic
21308
21309Link with the (library, not FD) pic libraries.  It's implied by
21310@option{-mlibrary-pic}, as well as by @option{-fPIC} and
21311@option{-fpic} without @option{-mfdpic}.  You should never have to use
21312it explicitly.
21313
21314@item -mlinked-fp
21315@opindex mlinked-fp
21316
21317Follow the EABI requirement of always creating a frame pointer whenever
21318a stack frame is allocated.  This option is enabled by default and can
21319be disabled with @option{-mno-linked-fp}.
21320
21321@item -mlong-calls
21322@opindex mlong-calls
21323
21324Use indirect addressing to call functions outside the current
21325compilation unit.  This allows the functions to be placed anywhere
21326within the 32-bit address space.
21327
21328@item -malign-labels
21329@opindex malign-labels
21330
21331Try to align labels to an 8-byte boundary by inserting NOPs into the
21332previous packet.  This option only has an effect when VLIW packing
21333is enabled.  It doesn't create new packets; it merely adds NOPs to
21334existing ones.
21335
21336@item -mlibrary-pic
21337@opindex mlibrary-pic
21338
21339Generate position-independent EABI code.
21340
21341@item -macc-4
21342@opindex macc-4
21343
21344Use only the first four media accumulator registers.
21345
21346@item -macc-8
21347@opindex macc-8
21348
21349Use all eight media accumulator registers.
21350
21351@item -mpack
21352@opindex mpack
21353
21354Pack VLIW instructions.
21355
21356@item -mno-pack
21357@opindex mno-pack
21358
21359Do not pack VLIW instructions.
21360
21361@item -mno-eflags
21362@opindex mno-eflags
21363
21364Do not mark ABI switches in e_flags.
21365
21366@item -mcond-move
21367@opindex mcond-move
21368
21369Enable the use of conditional-move instructions (default).
21370
21371This switch is mainly for debugging the compiler and will likely be removed
21372in a future version.
21373
21374@item -mno-cond-move
21375@opindex mno-cond-move
21376
21377Disable the use of conditional-move instructions.
21378
21379This switch is mainly for debugging the compiler and will likely be removed
21380in a future version.
21381
21382@item -mscc
21383@opindex mscc
21384
21385Enable the use of conditional set instructions (default).
21386
21387This switch is mainly for debugging the compiler and will likely be removed
21388in a future version.
21389
21390@item -mno-scc
21391@opindex mno-scc
21392
21393Disable the use of conditional set instructions.
21394
21395This switch is mainly for debugging the compiler and will likely be removed
21396in a future version.
21397
21398@item -mcond-exec
21399@opindex mcond-exec
21400
21401Enable the use of conditional execution (default).
21402
21403This switch is mainly for debugging the compiler and will likely be removed
21404in a future version.
21405
21406@item -mno-cond-exec
21407@opindex mno-cond-exec
21408
21409Disable the use of conditional execution.
21410
21411This switch is mainly for debugging the compiler and will likely be removed
21412in a future version.
21413
21414@item -mvliw-branch
21415@opindex mvliw-branch
21416
21417Run a pass to pack branches into VLIW instructions (default).
21418
21419This switch is mainly for debugging the compiler and will likely be removed
21420in a future version.
21421
21422@item -mno-vliw-branch
21423@opindex mno-vliw-branch
21424
21425Do not run a pass to pack branches into VLIW instructions.
21426
21427This switch is mainly for debugging the compiler and will likely be removed
21428in a future version.
21429
21430@item -mmulti-cond-exec
21431@opindex mmulti-cond-exec
21432
21433Enable optimization of @code{&&} and @code{||} in conditional execution
21434(default).
21435
21436This switch is mainly for debugging the compiler and will likely be removed
21437in a future version.
21438
21439@item -mno-multi-cond-exec
21440@opindex mno-multi-cond-exec
21441
21442Disable optimization of @code{&&} and @code{||} in conditional execution.
21443
21444This switch is mainly for debugging the compiler and will likely be removed
21445in a future version.
21446
21447@item -mnested-cond-exec
21448@opindex mnested-cond-exec
21449
21450Enable nested conditional execution optimizations (default).
21451
21452This switch is mainly for debugging the compiler and will likely be removed
21453in a future version.
21454
21455@item -mno-nested-cond-exec
21456@opindex mno-nested-cond-exec
21457
21458Disable nested conditional execution optimizations.
21459
21460This switch is mainly for debugging the compiler and will likely be removed
21461in a future version.
21462
21463@item -moptimize-membar
21464@opindex moptimize-membar
21465
21466This switch removes redundant @code{membar} instructions from the
21467compiler-generated code.  It is enabled by default.
21468
21469@item -mno-optimize-membar
21470@opindex mno-optimize-membar
21471@opindex moptimize-membar
21472
21473This switch disables the automatic removal of redundant @code{membar}
21474instructions from the generated code.
21475
21476@item -mtomcat-stats
21477@opindex mtomcat-stats
21478
21479Cause gas to print out tomcat statistics.
21480
21481@item -mcpu=@var{cpu}
21482@opindex mcpu
21483
21484Select the processor type for which to generate code.  Possible values are
21485@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21486@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21487
21488@end table
21489
21490@node GNU/Linux Options
21491@subsection GNU/Linux Options
21492
21493These @samp{-m} options are defined for GNU/Linux targets:
21494
21495@table @gcctabopt
21496@item -mglibc
21497@opindex mglibc
21498Use the GNU C library.  This is the default except
21499on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21500@samp{*-*-linux-*android*} targets.
21501
21502@item -muclibc
21503@opindex muclibc
21504Use uClibc C library.  This is the default on
21505@samp{*-*-linux-*uclibc*} targets.
21506
21507@item -mmusl
21508@opindex mmusl
21509Use the musl C library.  This is the default on
21510@samp{*-*-linux-*musl*} targets.
21511
21512@item -mbionic
21513@opindex mbionic
21514Use Bionic C library.  This is the default on
21515@samp{*-*-linux-*android*} targets.
21516
21517@item -mandroid
21518@opindex mandroid
21519Compile code compatible with Android platform.  This is the default on
21520@samp{*-*-linux-*android*} targets.
21521
21522When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21523@option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
21524this option makes the GCC driver pass Android-specific options to the linker.
21525Finally, this option causes the preprocessor macro @code{__ANDROID__}
21526to be defined.
21527
21528@item -tno-android-cc
21529@opindex tno-android-cc
21530Disable compilation effects of @option{-mandroid}, i.e., do not enable
21531@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21532@option{-fno-rtti} by default.
21533
21534@item -tno-android-ld
21535@opindex tno-android-ld
21536Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21537linking options to the linker.
21538
21539@end table
21540
21541@node H8/300 Options
21542@subsection H8/300 Options
21543
21544These @samp{-m} options are defined for the H8/300 implementations:
21545
21546@table @gcctabopt
21547@item -mrelax
21548@opindex mrelax
21549Shorten some address references at link time, when possible; uses the
21550linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
21551ld, Using ld}, for a fuller description.
21552
21553@item -mh
21554@opindex mh
21555Generate code for the H8/300H@.
21556
21557@item -ms
21558@opindex ms
21559Generate code for the H8S@.
21560
21561@item -mn
21562@opindex mn
21563Generate code for the H8S and H8/300H in the normal mode.  This switch
21564must be used either with @option{-mh} or @option{-ms}.
21565
21566@item -ms2600
21567@opindex ms2600
21568Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
21569
21570@item -mexr
21571@opindex mexr
21572Extended registers are stored on stack before execution of function
21573with monitor attribute. Default option is @option{-mexr}.
21574This option is valid only for H8S targets.
21575
21576@item -mno-exr
21577@opindex mno-exr
21578@opindex mexr
21579Extended registers are not stored on stack before execution of function
21580with monitor attribute. Default option is @option{-mno-exr}.
21581This option is valid only for H8S targets.
21582
21583@item -mint32
21584@opindex mint32
21585Make @code{int} data 32 bits by default.
21586
21587@item -malign-300
21588@opindex malign-300
21589On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21590The default for the H8/300H and H8S is to align longs and floats on
215914-byte boundaries.
21592@option{-malign-300} causes them to be aligned on 2-byte boundaries.
21593This option has no effect on the H8/300.
21594@end table
21595
21596@node HPPA Options
21597@subsection HPPA Options
21598@cindex HPPA Options
21599
21600These @samp{-m} options are defined for the HPPA family of computers:
21601
21602@table @gcctabopt
21603@item -march=@var{architecture-type}
21604@opindex march
21605Generate code for the specified architecture.  The choices for
21606@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
216071.1, and @samp{2.0} for PA 2.0 processors.  Refer to
21608@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21609architecture option for your machine.  Code compiled for lower numbered
21610architectures runs on higher numbered architectures, but not the
21611other way around.
21612
21613@item -mpa-risc-1-0
21614@itemx -mpa-risc-1-1
21615@itemx -mpa-risc-2-0
21616@opindex mpa-risc-1-0
21617@opindex mpa-risc-1-1
21618@opindex mpa-risc-2-0
21619Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21620
21621@item -mcaller-copies
21622@opindex mcaller-copies
21623The caller copies function arguments passed by hidden reference.  This
21624option should be used with care as it is not compatible with the default
2162532-bit runtime.  However, only aggregates larger than eight bytes are
21626passed by hidden reference and the option provides better compatibility
21627with OpenMP.
21628
21629@item -mjump-in-delay
21630@opindex mjump-in-delay
21631This option is ignored and provided for compatibility purposes only.
21632
21633@item -mdisable-fpregs
21634@opindex mdisable-fpregs
21635Prevent floating-point registers from being used in any manner.  This is
21636necessary for compiling kernels that perform lazy context switching of
21637floating-point registers.  If you use this option and attempt to perform
21638floating-point operations, the compiler aborts.
21639
21640@item -mdisable-indexing
21641@opindex mdisable-indexing
21642Prevent the compiler from using indexing address modes.  This avoids some
21643rather obscure problems when compiling MIG generated code under MACH@.
21644
21645@item -mno-space-regs
21646@opindex mno-space-regs
21647@opindex mspace-regs
21648Generate code that assumes the target has no space registers.  This allows
21649GCC to generate faster indirect calls and use unscaled index address modes.
21650
21651Such code is suitable for level 0 PA systems and kernels.
21652
21653@item -mfast-indirect-calls
21654@opindex mfast-indirect-calls
21655Generate code that assumes calls never cross space boundaries.  This
21656allows GCC to emit code that performs faster indirect calls.
21657
21658This option does not work in the presence of shared libraries or nested
21659functions.
21660
21661@item -mfixed-range=@var{register-range}
21662@opindex mfixed-range
21663Generate code treating the given register range as fixed registers.
21664A fixed register is one that the register allocator cannot use.  This is
21665useful when compiling kernel code.  A register range is specified as
21666two registers separated by a dash.  Multiple register ranges can be
21667specified separated by a comma.
21668
21669@item -mlong-load-store
21670@opindex mlong-load-store
21671Generate 3-instruction load and store sequences as sometimes required by
21672the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
21673the HP compilers.
21674
21675@item -mportable-runtime
21676@opindex mportable-runtime
21677Use the portable calling conventions proposed by HP for ELF systems.
21678
21679@item -mgas
21680@opindex mgas
21681Enable the use of assembler directives only GAS understands.
21682
21683@item -mschedule=@var{cpu-type}
21684@opindex mschedule
21685Schedule code according to the constraints for the machine type
21686@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
21687@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
21688to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21689proper scheduling option for your machine.  The default scheduling is
21690@samp{8000}.
21691
21692@item -mlinker-opt
21693@opindex mlinker-opt
21694Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
21695debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
21696linkers in which they give bogus error messages when linking some programs.
21697
21698@item -msoft-float
21699@opindex msoft-float
21700Generate output containing library calls for floating point.
21701@strong{Warning:} the requisite libraries are not available for all HPPA
21702targets.  Normally the facilities of the machine's usual C compiler are
21703used, but this cannot be done directly in cross-compilation.  You must make
21704your own arrangements to provide suitable library functions for
21705cross-compilation.
21706
21707@option{-msoft-float} changes the calling convention in the output file;
21708therefore, it is only useful if you compile @emph{all} of a program with
21709this option.  In particular, you need to compile @file{libgcc.a}, the
21710library that comes with GCC, with @option{-msoft-float} in order for
21711this to work.
21712
21713@item -msio
21714@opindex msio
21715Generate the predefine, @code{_SIO}, for server IO@.  The default is
21716@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
21717@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
21718options are available under HP-UX and HI-UX@.
21719
21720@item -mgnu-ld
21721@opindex mgnu-ld
21722Use options specific to GNU @command{ld}.
21723This passes @option{-shared} to @command{ld} when
21724building a shared library.  It is the default when GCC is configured,
21725explicitly or implicitly, with the GNU linker.  This option does not
21726affect which @command{ld} is called; it only changes what parameters
21727are passed to that @command{ld}.
21728The @command{ld} that is called is determined by the
21729@option{--with-ld} configure option, GCC's program search path, and
21730finally by the user's @env{PATH}.  The linker used by GCC can be printed
21731using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
21732on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21733
21734@item -mhp-ld
21735@opindex mhp-ld
21736Use options specific to HP @command{ld}.
21737This passes @option{-b} to @command{ld} when building
21738a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21739links.  It is the default when GCC is configured, explicitly or
21740implicitly, with the HP linker.  This option does not affect
21741which @command{ld} is called; it only changes what parameters are passed to that
21742@command{ld}.
21743The @command{ld} that is called is determined by the @option{--with-ld}
21744configure option, GCC's program search path, and finally by the user's
21745@env{PATH}.  The linker used by GCC can be printed using @samp{which
21746`gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
21747HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21748
21749@item -mlong-calls
21750@opindex mno-long-calls
21751@opindex mlong-calls
21752Generate code that uses long call sequences.  This ensures that a call
21753is always able to reach linker generated stubs.  The default is to generate
21754long calls only when the distance from the call site to the beginning
21755of the function or translation unit, as the case may be, exceeds a
21756predefined limit set by the branch type being used.  The limits for
21757normal calls are 7,600,000 and 240,000 bytes, respectively for the
21758PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
21759240,000 bytes.
21760
21761Distances are measured from the beginning of functions when using the
21762@option{-ffunction-sections} option, or when using the @option{-mgas}
21763and @option{-mno-portable-runtime} options together under HP-UX with
21764the SOM linker.
21765
21766It is normally not desirable to use this option as it degrades
21767performance.  However, it may be useful in large applications,
21768particularly when partial linking is used to build the application.
21769
21770The types of long calls used depends on the capabilities of the
21771assembler and linker, and the type of code being generated.  The
21772impact on systems that support long absolute calls, and long pic
21773symbol-difference or pc-relative calls should be relatively small.
21774However, an indirect call is used on 32-bit ELF systems in pic code
21775and it is quite long.
21776
21777@item -munix=@var{unix-std}
21778@opindex march
21779Generate compiler predefines and select a startfile for the specified
21780UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
21781and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
21782is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
2178311.11 and later.  The default values are @samp{93} for HP-UX 10.00,
21784@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
21785and later.
21786
21787@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
21788@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
21789and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
21790@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
21791@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
21792@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
21793
21794It is @emph{important} to note that this option changes the interfaces
21795for various library routines.  It also affects the operational behavior
21796of the C library.  Thus, @emph{extreme} care is needed in using this
21797option.
21798
21799Library code that is intended to operate with more than one UNIX
21800standard must test, set and restore the variable @code{__xpg4_extended_mask}
21801as appropriate.  Most GNU software doesn't provide this capability.
21802
21803@item -nolibdld
21804@opindex nolibdld
21805Suppress the generation of link options to search libdld.sl when the
21806@option{-static} option is specified on HP-UX 10 and later.
21807
21808@item -static
21809@opindex static
21810The HP-UX implementation of setlocale in libc has a dependency on
21811libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
21812when the @option{-static} option is specified, special link options
21813are needed to resolve this dependency.
21814
21815On HP-UX 10 and later, the GCC driver adds the necessary options to
21816link with libdld.sl when the @option{-static} option is specified.
21817This causes the resulting binary to be dynamic.  On the 64-bit port,
21818the linkers generate dynamic binaries by default in any case.  The
21819@option{-nolibdld} option can be used to prevent the GCC driver from
21820adding these link options.
21821
21822@item -threads
21823@opindex threads
21824Add support for multithreading with the @dfn{dce thread} library
21825under HP-UX@.  This option sets flags for both the preprocessor and
21826linker.
21827@end table
21828
21829@node IA-64 Options
21830@subsection IA-64 Options
21831@cindex IA-64 Options
21832
21833These are the @samp{-m} options defined for the Intel IA-64 architecture.
21834
21835@table @gcctabopt
21836@item -mbig-endian
21837@opindex mbig-endian
21838Generate code for a big-endian target.  This is the default for HP-UX@.
21839
21840@item -mlittle-endian
21841@opindex mlittle-endian
21842Generate code for a little-endian target.  This is the default for AIX5
21843and GNU/Linux.
21844
21845@item -mgnu-as
21846@itemx -mno-gnu-as
21847@opindex mgnu-as
21848@opindex mno-gnu-as
21849Generate (or don't) code for the GNU assembler.  This is the default.
21850@c Also, this is the default if the configure option @option{--with-gnu-as}
21851@c is used.
21852
21853@item -mgnu-ld
21854@itemx -mno-gnu-ld
21855@opindex mgnu-ld
21856@opindex mno-gnu-ld
21857Generate (or don't) code for the GNU linker.  This is the default.
21858@c Also, this is the default if the configure option @option{--with-gnu-ld}
21859@c is used.
21860
21861@item -mno-pic
21862@opindex mno-pic
21863Generate code that does not use a global pointer register.  The result
21864is not position independent code, and violates the IA-64 ABI@.
21865
21866@item -mvolatile-asm-stop
21867@itemx -mno-volatile-asm-stop
21868@opindex mvolatile-asm-stop
21869@opindex mno-volatile-asm-stop
21870Generate (or don't) a stop bit immediately before and after volatile asm
21871statements.
21872
21873@item -mregister-names
21874@itemx -mno-register-names
21875@opindex mregister-names
21876@opindex mno-register-names
21877Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
21878the stacked registers.  This may make assembler output more readable.
21879
21880@item -mno-sdata
21881@itemx -msdata
21882@opindex mno-sdata
21883@opindex msdata
21884Disable (or enable) optimizations that use the small data section.  This may
21885be useful for working around optimizer bugs.
21886
21887@item -mconstant-gp
21888@opindex mconstant-gp
21889Generate code that uses a single constant global pointer value.  This is
21890useful when compiling kernel code.
21891
21892@item -mauto-pic
21893@opindex mauto-pic
21894Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
21895This is useful when compiling firmware code.
21896
21897@item -minline-float-divide-min-latency
21898@opindex minline-float-divide-min-latency
21899Generate code for inline divides of floating-point values
21900using the minimum latency algorithm.
21901
21902@item -minline-float-divide-max-throughput
21903@opindex minline-float-divide-max-throughput
21904Generate code for inline divides of floating-point values
21905using the maximum throughput algorithm.
21906
21907@item -mno-inline-float-divide
21908@opindex mno-inline-float-divide
21909Do not generate inline code for divides of floating-point values.
21910
21911@item -minline-int-divide-min-latency
21912@opindex minline-int-divide-min-latency
21913Generate code for inline divides of integer values
21914using the minimum latency algorithm.
21915
21916@item -minline-int-divide-max-throughput
21917@opindex minline-int-divide-max-throughput
21918Generate code for inline divides of integer values
21919using the maximum throughput algorithm.
21920
21921@item -mno-inline-int-divide
21922@opindex mno-inline-int-divide
21923@opindex minline-int-divide
21924Do not generate inline code for divides of integer values.
21925
21926@item -minline-sqrt-min-latency
21927@opindex minline-sqrt-min-latency
21928Generate code for inline square roots
21929using the minimum latency algorithm.
21930
21931@item -minline-sqrt-max-throughput
21932@opindex minline-sqrt-max-throughput
21933Generate code for inline square roots
21934using the maximum throughput algorithm.
21935
21936@item -mno-inline-sqrt
21937@opindex mno-inline-sqrt
21938Do not generate inline code for @code{sqrt}.
21939
21940@item -mfused-madd
21941@itemx -mno-fused-madd
21942@opindex mfused-madd
21943@opindex mno-fused-madd
21944Do (don't) generate code that uses the fused multiply/add or multiply/subtract
21945instructions.  The default is to use these instructions.
21946
21947@item -mno-dwarf2-asm
21948@itemx -mdwarf2-asm
21949@opindex mno-dwarf2-asm
21950@opindex mdwarf2-asm
21951Don't (or do) generate assembler code for the DWARF line number debugging
21952info.  This may be useful when not using the GNU assembler.
21953
21954@item -mearly-stop-bits
21955@itemx -mno-early-stop-bits
21956@opindex mearly-stop-bits
21957@opindex mno-early-stop-bits
21958Allow stop bits to be placed earlier than immediately preceding the
21959instruction that triggered the stop bit.  This can improve instruction
21960scheduling, but does not always do so.
21961
21962@item -mfixed-range=@var{register-range}
21963@opindex mfixed-range
21964Generate code treating the given register range as fixed registers.
21965A fixed register is one that the register allocator cannot use.  This is
21966useful when compiling kernel code.  A register range is specified as
21967two registers separated by a dash.  Multiple register ranges can be
21968specified separated by a comma.
21969
21970@item -mtls-size=@var{tls-size}
21971@opindex mtls-size
21972Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
2197364.
21974
21975@item -mtune=@var{cpu-type}
21976@opindex mtune
21977Tune the instruction scheduling for a particular CPU, Valid values are
21978@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
21979and @samp{mckinley}.
21980
21981@item -milp32
21982@itemx -mlp64
21983@opindex milp32
21984@opindex mlp64
21985Generate code for a 32-bit or 64-bit environment.
21986The 32-bit environment sets int, long and pointer to 32 bits.
21987The 64-bit environment sets int to 32 bits and long and pointer
21988to 64 bits.  These are HP-UX specific flags.
21989
21990@item -mno-sched-br-data-spec
21991@itemx -msched-br-data-spec
21992@opindex mno-sched-br-data-spec
21993@opindex msched-br-data-spec
21994(Dis/En)able data speculative scheduling before reload.
21995This results in generation of @code{ld.a} instructions and
21996the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21997The default setting is disabled.
21998
21999@item -msched-ar-data-spec
22000@itemx -mno-sched-ar-data-spec
22001@opindex msched-ar-data-spec
22002@opindex mno-sched-ar-data-spec
22003(En/Dis)able data speculative scheduling after reload.
22004This results in generation of @code{ld.a} instructions and
22005the corresponding check instructions (@code{ld.c} / @code{chk.a}).
22006The default setting is enabled.
22007
22008@item -mno-sched-control-spec
22009@itemx -msched-control-spec
22010@opindex mno-sched-control-spec
22011@opindex msched-control-spec
22012(Dis/En)able control speculative scheduling.  This feature is
22013available only during region scheduling (i.e.@: before reload).
22014This results in generation of the @code{ld.s} instructions and
22015the corresponding check instructions @code{chk.s}.
22016The default setting is disabled.
22017
22018@item -msched-br-in-data-spec
22019@itemx -mno-sched-br-in-data-spec
22020@opindex msched-br-in-data-spec
22021@opindex mno-sched-br-in-data-spec
22022(En/Dis)able speculative scheduling of the instructions that
22023are dependent on the data speculative loads before reload.
22024This is effective only with @option{-msched-br-data-spec} enabled.
22025The default setting is enabled.
22026
22027@item -msched-ar-in-data-spec
22028@itemx -mno-sched-ar-in-data-spec
22029@opindex msched-ar-in-data-spec
22030@opindex mno-sched-ar-in-data-spec
22031(En/Dis)able speculative scheduling of the instructions that
22032are dependent on the data speculative loads after reload.
22033This is effective only with @option{-msched-ar-data-spec} enabled.
22034The default setting is enabled.
22035
22036@item -msched-in-control-spec
22037@itemx -mno-sched-in-control-spec
22038@opindex msched-in-control-spec
22039@opindex mno-sched-in-control-spec
22040(En/Dis)able speculative scheduling of the instructions that
22041are dependent on the control speculative loads.
22042This is effective only with @option{-msched-control-spec} enabled.
22043The default setting is enabled.
22044
22045@item -mno-sched-prefer-non-data-spec-insns
22046@itemx -msched-prefer-non-data-spec-insns
22047@opindex mno-sched-prefer-non-data-spec-insns
22048@opindex msched-prefer-non-data-spec-insns
22049If enabled, data-speculative instructions are chosen for schedule
22050only if there are no other choices at the moment.  This makes
22051the use of the data speculation much more conservative.
22052The default setting is disabled.
22053
22054@item -mno-sched-prefer-non-control-spec-insns
22055@itemx -msched-prefer-non-control-spec-insns
22056@opindex mno-sched-prefer-non-control-spec-insns
22057@opindex msched-prefer-non-control-spec-insns
22058If enabled, control-speculative instructions are chosen for schedule
22059only if there are no other choices at the moment.  This makes
22060the use of the control speculation much more conservative.
22061The default setting is disabled.
22062
22063@item -mno-sched-count-spec-in-critical-path
22064@itemx -msched-count-spec-in-critical-path
22065@opindex mno-sched-count-spec-in-critical-path
22066@opindex msched-count-spec-in-critical-path
22067If enabled, speculative dependencies are considered during
22068computation of the instructions priorities.  This makes the use of the
22069speculation a bit more conservative.
22070The default setting is disabled.
22071
22072@item -msched-spec-ldc
22073@opindex msched-spec-ldc
22074Use a simple data speculation check.  This option is on by default.
22075
22076@item -msched-control-spec-ldc
22077@opindex msched-spec-ldc
22078Use a simple check for control speculation.  This option is on by default.
22079
22080@item -msched-stop-bits-after-every-cycle
22081@opindex msched-stop-bits-after-every-cycle
22082Place a stop bit after every cycle when scheduling.  This option is on
22083by default.
22084
22085@item -msched-fp-mem-deps-zero-cost
22086@opindex msched-fp-mem-deps-zero-cost
22087Assume that floating-point stores and loads are not likely to cause a conflict
22088when placed into the same instruction group.  This option is disabled by
22089default.
22090
22091@item -msel-sched-dont-check-control-spec
22092@opindex msel-sched-dont-check-control-spec
22093Generate checks for control speculation in selective scheduling.
22094This flag is disabled by default.
22095
22096@item -msched-max-memory-insns=@var{max-insns}
22097@opindex msched-max-memory-insns
22098Limit on the number of memory insns per instruction group, giving lower
22099priority to subsequent memory insns attempting to schedule in the same
22100instruction group. Frequently useful to prevent cache bank conflicts.
22101The default value is 1.
22102
22103@item -msched-max-memory-insns-hard-limit
22104@opindex msched-max-memory-insns-hard-limit
22105Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
22106disallowing more than that number in an instruction group.
22107Otherwise, the limit is ``soft'', meaning that non-memory operations
22108are preferred when the limit is reached, but memory operations may still
22109be scheduled.
22110
22111@end table
22112
22113@node LM32 Options
22114@subsection LM32 Options
22115@cindex LM32 options
22116
22117These @option{-m} options are defined for the LatticeMico32 architecture:
22118
22119@table @gcctabopt
22120@item -mbarrel-shift-enabled
22121@opindex mbarrel-shift-enabled
22122Enable barrel-shift instructions.
22123
22124@item -mdivide-enabled
22125@opindex mdivide-enabled
22126Enable divide and modulus instructions.
22127
22128@item -mmultiply-enabled
22129@opindex multiply-enabled
22130Enable multiply instructions.
22131
22132@item -msign-extend-enabled
22133@opindex msign-extend-enabled
22134Enable sign extend instructions.
22135
22136@item -muser-enabled
22137@opindex muser-enabled
22138Enable user-defined instructions.
22139
22140@end table
22141
22142@node M32C Options
22143@subsection M32C Options
22144@cindex M32C options
22145
22146@table @gcctabopt
22147@item -mcpu=@var{name}
22148@opindex mcpu=
22149Select the CPU for which code is generated.  @var{name} may be one of
22150@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22151/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22152the M32C/80 series.
22153
22154@item -msim
22155@opindex msim
22156Specifies that the program will be run on the simulator.  This causes
22157an alternate runtime library to be linked in which supports, for
22158example, file I/O@.  You must not use this option when generating
22159programs that will run on real hardware; you must provide your own
22160runtime library for whatever I/O functions are needed.
22161
22162@item -memregs=@var{number}
22163@opindex memregs=
22164Specifies the number of memory-based pseudo-registers GCC uses
22165during code generation.  These pseudo-registers are used like real
22166registers, so there is a tradeoff between GCC's ability to fit the
22167code into available registers, and the performance penalty of using
22168memory instead of registers.  Note that all modules in a program must
22169be compiled with the same value for this option.  Because of that, you
22170must not use this option with GCC's default runtime libraries.
22171
22172@end table
22173
22174@node M32R/D Options
22175@subsection M32R/D Options
22176@cindex M32R/D options
22177
22178These @option{-m} options are defined for Renesas M32R/D architectures:
22179
22180@table @gcctabopt
22181@item -m32r2
22182@opindex m32r2
22183Generate code for the M32R/2@.
22184
22185@item -m32rx
22186@opindex m32rx
22187Generate code for the M32R/X@.
22188
22189@item -m32r
22190@opindex m32r
22191Generate code for the M32R@.  This is the default.
22192
22193@item -mmodel=small
22194@opindex mmodel=small
22195Assume all objects live in the lower 16MB of memory (so that their addresses
22196can be loaded with the @code{ld24} instruction), and assume all subroutines
22197are reachable with the @code{bl} instruction.
22198This is the default.
22199
22200The addressability of a particular object can be set with the
22201@code{model} attribute.
22202
22203@item -mmodel=medium
22204@opindex mmodel=medium
22205Assume objects may be anywhere in the 32-bit address space (the compiler
22206generates @code{seth/add3} instructions to load their addresses), and
22207assume all subroutines are reachable with the @code{bl} instruction.
22208
22209@item -mmodel=large
22210@opindex mmodel=large
22211Assume objects may be anywhere in the 32-bit address space (the compiler
22212generates @code{seth/add3} instructions to load their addresses), and
22213assume subroutines may not be reachable with the @code{bl} instruction
22214(the compiler generates the much slower @code{seth/add3/jl}
22215instruction sequence).
22216
22217@item -msdata=none
22218@opindex msdata=none
22219Disable use of the small data area.  Variables are put into
22220one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22221@code{section} attribute has been specified).
22222This is the default.
22223
22224The small data area consists of sections @code{.sdata} and @code{.sbss}.
22225Objects may be explicitly put in the small data area with the
22226@code{section} attribute using one of these sections.
22227
22228@item -msdata=sdata
22229@opindex msdata=sdata
22230Put small global and static data in the small data area, but do not
22231generate special code to reference them.
22232
22233@item -msdata=use
22234@opindex msdata=use
22235Put small global and static data in the small data area, and generate
22236special instructions to reference them.
22237
22238@item -G @var{num}
22239@opindex G
22240@cindex smaller data references
22241Put global and static objects less than or equal to @var{num} bytes
22242into the small data or BSS sections instead of the normal data or BSS
22243sections.  The default value of @var{num} is 8.
22244The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22245for this option to have any effect.
22246
22247All modules should be compiled with the same @option{-G @var{num}} value.
22248Compiling with different values of @var{num} may or may not work; if it
22249doesn't the linker gives an error message---incorrect code is not
22250generated.
22251
22252@item -mdebug
22253@opindex mdebug
22254Makes the M32R-specific code in the compiler display some statistics
22255that might help in debugging programs.
22256
22257@item -malign-loops
22258@opindex malign-loops
22259Align all loops to a 32-byte boundary.
22260
22261@item -mno-align-loops
22262@opindex mno-align-loops
22263Do not enforce a 32-byte alignment for loops.  This is the default.
22264
22265@item -missue-rate=@var{number}
22266@opindex missue-rate=@var{number}
22267Issue @var{number} instructions per cycle.  @var{number} can only be 1
22268or 2.
22269
22270@item -mbranch-cost=@var{number}
22271@opindex mbranch-cost=@var{number}
22272@var{number} can only be 1 or 2.  If it is 1 then branches are
22273preferred over conditional code, if it is 2, then the opposite applies.
22274
22275@item -mflush-trap=@var{number}
22276@opindex mflush-trap=@var{number}
22277Specifies the trap number to use to flush the cache.  The default is
2227812.  Valid numbers are between 0 and 15 inclusive.
22279
22280@item -mno-flush-trap
22281@opindex mno-flush-trap
22282Specifies that the cache cannot be flushed by using a trap.
22283
22284@item -mflush-func=@var{name}
22285@opindex mflush-func=@var{name}
22286Specifies the name of the operating system function to call to flush
22287the cache.  The default is @samp{_flush_cache}, but a function call
22288is only used if a trap is not available.
22289
22290@item -mno-flush-func
22291@opindex mno-flush-func
22292Indicates that there is no OS function for flushing the cache.
22293
22294@end table
22295
22296@node M680x0 Options
22297@subsection M680x0 Options
22298@cindex M680x0 options
22299
22300These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22301The default settings depend on which architecture was selected when
22302the compiler was configured; the defaults for the most common choices
22303are given below.
22304
22305@table @gcctabopt
22306@item -march=@var{arch}
22307@opindex march
22308Generate code for a specific M680x0 or ColdFire instruction set
22309architecture.  Permissible values of @var{arch} for M680x0
22310architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22311@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
22312architectures are selected according to Freescale's ISA classification
22313and the permissible values are: @samp{isaa}, @samp{isaaplus},
22314@samp{isab} and @samp{isac}.
22315
22316GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22317code for a ColdFire target.  The @var{arch} in this macro is one of the
22318@option{-march} arguments given above.
22319
22320When used together, @option{-march} and @option{-mtune} select code
22321that runs on a family of similar processors but that is optimized
22322for a particular microarchitecture.
22323
22324@item -mcpu=@var{cpu}
22325@opindex mcpu
22326Generate code for a specific M680x0 or ColdFire processor.
22327The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22328@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22329and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
22330below, which also classifies the CPUs into families:
22331
22332@multitable @columnfractions 0.20 0.80
22333@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22334@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}
22335@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22336@item @samp{5206e} @tab @samp{5206e}
22337@item @samp{5208} @tab @samp{5207} @samp{5208}
22338@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22339@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22340@item @samp{5216} @tab @samp{5214} @samp{5216}
22341@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22342@item @samp{5225} @tab @samp{5224} @samp{5225}
22343@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22344@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22345@item @samp{5249} @tab @samp{5249}
22346@item @samp{5250} @tab @samp{5250}
22347@item @samp{5271} @tab @samp{5270} @samp{5271}
22348@item @samp{5272} @tab @samp{5272}
22349@item @samp{5275} @tab @samp{5274} @samp{5275}
22350@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22351@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22352@item @samp{5307} @tab @samp{5307}
22353@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22354@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22355@item @samp{5407} @tab @samp{5407}
22356@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}
22357@end multitable
22358
22359@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22360@var{arch} is compatible with @var{cpu}.  Other combinations of
22361@option{-mcpu} and @option{-march} are rejected.
22362
22363GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22364@var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
22365where the value of @var{family} is given by the table above.
22366
22367@item -mtune=@var{tune}
22368@opindex mtune
22369Tune the code for a particular microarchitecture within the
22370constraints set by @option{-march} and @option{-mcpu}.
22371The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22372@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22373and @samp{cpu32}.  The ColdFire microarchitectures
22374are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22375
22376You can also use @option{-mtune=68020-40} for code that needs
22377to run relatively well on 68020, 68030 and 68040 targets.
22378@option{-mtune=68020-60} is similar but includes 68060 targets
22379as well.  These two options select the same tuning decisions as
22380@option{-m68020-40} and @option{-m68020-60} respectively.
22381
22382GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22383when tuning for 680x0 architecture @var{arch}.  It also defines
22384@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22385option is used.  If GCC is tuning for a range of architectures,
22386as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22387it defines the macros for every architecture in the range.
22388
22389GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22390ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22391of the arguments given above.
22392
22393@item -m68000
22394@itemx -mc68000
22395@opindex m68000
22396@opindex mc68000
22397Generate output for a 68000.  This is the default
22398when the compiler is configured for 68000-based systems.
22399It is equivalent to @option{-march=68000}.
22400
22401Use this option for microcontrollers with a 68000 or EC000 core,
22402including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22403
22404@item -m68010
22405@opindex m68010
22406Generate output for a 68010.  This is the default
22407when the compiler is configured for 68010-based systems.
22408It is equivalent to @option{-march=68010}.
22409
22410@item -m68020
22411@itemx -mc68020
22412@opindex m68020
22413@opindex mc68020
22414Generate output for a 68020.  This is the default
22415when the compiler is configured for 68020-based systems.
22416It is equivalent to @option{-march=68020}.
22417
22418@item -m68030
22419@opindex m68030
22420Generate output for a 68030.  This is the default when the compiler is
22421configured for 68030-based systems.  It is equivalent to
22422@option{-march=68030}.
22423
22424@item -m68040
22425@opindex m68040
22426Generate output for a 68040.  This is the default when the compiler is
22427configured for 68040-based systems.  It is equivalent to
22428@option{-march=68040}.
22429
22430This option inhibits the use of 68881/68882 instructions that have to be
22431emulated by software on the 68040.  Use this option if your 68040 does not
22432have code to emulate those instructions.
22433
22434@item -m68060
22435@opindex m68060
22436Generate output for a 68060.  This is the default when the compiler is
22437configured for 68060-based systems.  It is equivalent to
22438@option{-march=68060}.
22439
22440This option inhibits the use of 68020 and 68881/68882 instructions that
22441have to be emulated by software on the 68060.  Use this option if your 68060
22442does not have code to emulate those instructions.
22443
22444@item -mcpu32
22445@opindex mcpu32
22446Generate output for a CPU32.  This is the default
22447when the compiler is configured for CPU32-based systems.
22448It is equivalent to @option{-march=cpu32}.
22449
22450Use this option for microcontrollers with a
22451CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
2245268336, 68340, 68341, 68349 and 68360.
22453
22454@item -m5200
22455@opindex m5200
22456Generate output for a 520X ColdFire CPU@.  This is the default
22457when the compiler is configured for 520X-based systems.
22458It is equivalent to @option{-mcpu=5206}, and is now deprecated
22459in favor of that option.
22460
22461Use this option for microcontroller with a 5200 core, including
22462the MCF5202, MCF5203, MCF5204 and MCF5206.
22463
22464@item -m5206e
22465@opindex m5206e
22466Generate output for a 5206e ColdFire CPU@.  The option is now
22467deprecated in favor of the equivalent @option{-mcpu=5206e}.
22468
22469@item -m528x
22470@opindex m528x
22471Generate output for a member of the ColdFire 528X family.
22472The option is now deprecated in favor of the equivalent
22473@option{-mcpu=528x}.
22474
22475@item -m5307
22476@opindex m5307
22477Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
22478in favor of the equivalent @option{-mcpu=5307}.
22479
22480@item -m5407
22481@opindex m5407
22482Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
22483in favor of the equivalent @option{-mcpu=5407}.
22484
22485@item -mcfv4e
22486@opindex mcfv4e
22487Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22488This includes use of hardware floating-point instructions.
22489The option is equivalent to @option{-mcpu=547x}, and is now
22490deprecated in favor of that option.
22491
22492@item -m68020-40
22493@opindex m68020-40
22494Generate output for a 68040, without using any of the new instructions.
22495This results in code that can run relatively efficiently on either a
2249668020/68881 or a 68030 or a 68040.  The generated code does use the
2249768881 instructions that are emulated on the 68040.
22498
22499The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22500
22501@item -m68020-60
22502@opindex m68020-60
22503Generate output for a 68060, without using any of the new instructions.
22504This results in code that can run relatively efficiently on either a
2250568020/68881 or a 68030 or a 68040.  The generated code does use the
2250668881 instructions that are emulated on the 68060.
22507
22508The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22509
22510@item -mhard-float
22511@itemx -m68881
22512@opindex mhard-float
22513@opindex m68881
22514Generate floating-point instructions.  This is the default for 68020
22515and above, and for ColdFire devices that have an FPU@.  It defines the
22516macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22517on ColdFire targets.
22518
22519@item -msoft-float
22520@opindex msoft-float
22521Do not generate floating-point instructions; use library calls instead.
22522This is the default for 68000, 68010, and 68832 targets.  It is also
22523the default for ColdFire devices that have no FPU.
22524
22525@item -mdiv
22526@itemx -mno-div
22527@opindex mdiv
22528@opindex mno-div
22529Generate (do not generate) ColdFire hardware divide and remainder
22530instructions.  If @option{-march} is used without @option{-mcpu},
22531the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22532architectures.  Otherwise, the default is taken from the target CPU
22533(either the default CPU, or the one specified by @option{-mcpu}).  For
22534example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22535@option{-mcpu=5206e}.
22536
22537GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22538
22539@item -mshort
22540@opindex mshort
22541Consider type @code{int} to be 16 bits wide, like @code{short int}.
22542Additionally, parameters passed on the stack are also aligned to a
2254316-bit boundary even on targets whose API mandates promotion to 32-bit.
22544
22545@item -mno-short
22546@opindex mno-short
22547Do not consider type @code{int} to be 16 bits wide.  This is the default.
22548
22549@item -mnobitfield
22550@itemx -mno-bitfield
22551@opindex mnobitfield
22552@opindex mno-bitfield
22553Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
22554and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22555
22556@item -mbitfield
22557@opindex mbitfield
22558Do use the bit-field instructions.  The @option{-m68020} option implies
22559@option{-mbitfield}.  This is the default if you use a configuration
22560designed for a 68020.
22561
22562@item -mrtd
22563@opindex mrtd
22564Use a different function-calling convention, in which functions
22565that take a fixed number of arguments return with the @code{rtd}
22566instruction, which pops their arguments while returning.  This
22567saves one instruction in the caller since there is no need to pop
22568the arguments there.
22569
22570This calling convention is incompatible with the one normally
22571used on Unix, so you cannot use it if you need to call libraries
22572compiled with the Unix compiler.
22573
22574Also, you must provide function prototypes for all functions that
22575take variable numbers of arguments (including @code{printf});
22576otherwise incorrect code is generated for calls to those
22577functions.
22578
22579In addition, seriously incorrect code results if you call a
22580function with too many arguments.  (Normally, extra arguments are
22581harmlessly ignored.)
22582
22583The @code{rtd} instruction is supported by the 68010, 68020, 68030,
2258468040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22585
22586The default is @option{-mno-rtd}.
22587
22588@item -malign-int
22589@itemx -mno-align-int
22590@opindex malign-int
22591@opindex mno-align-int
22592Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22593@code{float}, @code{double}, and @code{long double} variables on a 32-bit
22594boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22595Aligning variables on 32-bit boundaries produces code that runs somewhat
22596faster on processors with 32-bit busses at the expense of more memory.
22597
22598@strong{Warning:} if you use the @option{-malign-int} switch, GCC
22599aligns structures containing the above types differently than
22600most published application binary interface specifications for the m68k.
22601
22602@opindex mpcrel
22603Use the pc-relative addressing mode of the 68000 directly, instead of
22604using a global offset table.  At present, this option implies @option{-fpic},
22605allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
22606not presently supported with @option{-mpcrel}, though this could be supported for
2260768020 and higher processors.
22608
22609@item -mno-strict-align
22610@itemx -mstrict-align
22611@opindex mno-strict-align
22612@opindex mstrict-align
22613Do not (do) assume that unaligned memory references are handled by
22614the system.
22615
22616@item -msep-data
22617Generate code that allows the data segment to be located in a different
22618area of memory from the text segment.  This allows for execute-in-place in
22619an environment without virtual memory management.  This option implies
22620@option{-fPIC}.
22621
22622@item -mno-sep-data
22623Generate code that assumes that the data segment follows the text segment.
22624This is the default.
22625
22626@item -mid-shared-library
22627Generate code that supports shared libraries via the library ID method.
22628This allows for execute-in-place and shared libraries in an environment
22629without virtual memory management.  This option implies @option{-fPIC}.
22630
22631@item -mno-id-shared-library
22632Generate code that doesn't assume ID-based shared libraries are being used.
22633This is the default.
22634
22635@item -mshared-library-id=n
22636Specifies the identification number of the ID-based shared library being
22637compiled.  Specifying a value of 0 generates more compact code; specifying
22638other values forces the allocation of that number to the current
22639library, but is no more space- or time-efficient than omitting this option.
22640
22641@item -mxgot
22642@itemx -mno-xgot
22643@opindex mxgot
22644@opindex mno-xgot
22645When generating position-independent code for ColdFire, generate code
22646that works if the GOT has more than 8192 entries.  This code is
22647larger and slower than code generated without this option.  On M680x0
22648processors, this option is not needed; @option{-fPIC} suffices.
22649
22650GCC normally uses a single instruction to load values from the GOT@.
22651While this is relatively efficient, it only works if the GOT
22652is smaller than about 64k.  Anything larger causes the linker
22653to report an error such as:
22654
22655@cindex relocation truncated to fit (ColdFire)
22656@smallexample
22657relocation truncated to fit: R_68K_GOT16O foobar
22658@end smallexample
22659
22660If this happens, you should recompile your code with @option{-mxgot}.
22661It should then work with very large GOTs.  However, code generated with
22662@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22663the value of a global symbol.
22664
22665Note that some linkers, including newer versions of the GNU linker,
22666can create multiple GOTs and sort GOT entries.  If you have such a linker,
22667you should only need to use @option{-mxgot} when compiling a single
22668object file that accesses more than 8192 GOT entries.  Very few do.
22669
22670These options have no effect unless GCC is generating
22671position-independent code.
22672
22673@item -mlong-jump-table-offsets
22674@opindex mlong-jump-table-offsets
22675Use 32-bit offsets in @code{switch} tables.  The default is to use
2267616-bit offsets.
22677
22678@end table
22679
22680@node MCore Options
22681@subsection MCore Options
22682@cindex MCore options
22683
22684These are the @samp{-m} options defined for the Motorola M*Core
22685processors.
22686
22687@table @gcctabopt
22688
22689@item -mhardlit
22690@itemx -mno-hardlit
22691@opindex mhardlit
22692@opindex mno-hardlit
22693Inline constants into the code stream if it can be done in two
22694instructions or less.
22695
22696@item -mdiv
22697@itemx -mno-div
22698@opindex mdiv
22699@opindex mno-div
22700Use the divide instruction.  (Enabled by default).
22701
22702@item -mrelax-immediate
22703@itemx -mno-relax-immediate
22704@opindex mrelax-immediate
22705@opindex mno-relax-immediate
22706Allow arbitrary-sized immediates in bit operations.
22707
22708@item -mwide-bitfields
22709@itemx -mno-wide-bitfields
22710@opindex mwide-bitfields
22711@opindex mno-wide-bitfields
22712Always treat bit-fields as @code{int}-sized.
22713
22714@item -m4byte-functions
22715@itemx -mno-4byte-functions
22716@opindex m4byte-functions
22717@opindex mno-4byte-functions
22718Force all functions to be aligned to a 4-byte boundary.
22719
22720@item -mcallgraph-data
22721@itemx -mno-callgraph-data
22722@opindex mcallgraph-data
22723@opindex mno-callgraph-data
22724Emit callgraph information.
22725
22726@item -mslow-bytes
22727@itemx -mno-slow-bytes
22728@opindex mslow-bytes
22729@opindex mno-slow-bytes
22730Prefer word access when reading byte quantities.
22731
22732@item -mlittle-endian
22733@itemx -mbig-endian
22734@opindex mlittle-endian
22735@opindex mbig-endian
22736Generate code for a little-endian target.
22737
22738@item -m210
22739@itemx -m340
22740@opindex m210
22741@opindex m340
22742Generate code for the 210 processor.
22743
22744@item -mno-lsim
22745@opindex mno-lsim
22746Assume that runtime support has been provided and so omit the
22747simulator library (@file{libsim.a)} from the linker command line.
22748
22749@item -mstack-increment=@var{size}
22750@opindex mstack-increment
22751Set the maximum amount for a single stack increment operation.  Large
22752values can increase the speed of programs that contain functions
22753that need a large amount of stack space, but they can also trigger a
22754segmentation fault if the stack is extended too much.  The default
22755value is 0x1000.
22756
22757@end table
22758
22759@node MeP Options
22760@subsection MeP Options
22761@cindex MeP options
22762
22763@table @gcctabopt
22764
22765@item -mabsdiff
22766@opindex mabsdiff
22767Enables the @code{abs} instruction, which is the absolute difference
22768between two registers.
22769
22770@item -mall-opts
22771@opindex mall-opts
22772Enables all the optional instructions---average, multiply, divide, bit
22773operations, leading zero, absolute difference, min/max, clip, and
22774saturation.
22775
22776
22777@item -maverage
22778@opindex maverage
22779Enables the @code{ave} instruction, which computes the average of two
22780registers.
22781
22782@item -mbased=@var{n}
22783@opindex mbased=
22784Variables of size @var{n} bytes or smaller are placed in the
22785@code{.based} section by default.  Based variables use the @code{$tp}
22786register as a base register, and there is a 128-byte limit to the
22787@code{.based} section.
22788
22789@item -mbitops
22790@opindex mbitops
22791Enables the bit operation instructions---bit test (@code{btstm}), set
22792(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
22793test-and-set (@code{tas}).
22794
22795@item -mc=@var{name}
22796@opindex mc=
22797Selects which section constant data is placed in.  @var{name} may
22798be @samp{tiny}, @samp{near}, or @samp{far}.
22799
22800@item -mclip
22801@opindex mclip
22802Enables the @code{clip} instruction.  Note that @option{-mclip} is not
22803useful unless you also provide @option{-mminmax}.
22804
22805@item -mconfig=@var{name}
22806@opindex mconfig=
22807Selects one of the built-in core configurations.  Each MeP chip has
22808one or more modules in it; each module has a core CPU and a variety of
22809coprocessors, optional instructions, and peripherals.  The
22810@code{MeP-Integrator} tool, not part of GCC, provides these
22811configurations through this option; using this option is the same as
22812using all the corresponding command-line options.  The default
22813configuration is @samp{default}.
22814
22815@item -mcop
22816@opindex mcop
22817Enables the coprocessor instructions.  By default, this is a 32-bit
22818coprocessor.  Note that the coprocessor is normally enabled via the
22819@option{-mconfig=} option.
22820
22821@item -mcop32
22822@opindex mcop32
22823Enables the 32-bit coprocessor's instructions.
22824
22825@item -mcop64
22826@opindex mcop64
22827Enables the 64-bit coprocessor's instructions.
22828
22829@item -mivc2
22830@opindex mivc2
22831Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
22832
22833@item -mdc
22834@opindex mdc
22835Causes constant variables to be placed in the @code{.near} section.
22836
22837@item -mdiv
22838@opindex mdiv
22839Enables the @code{div} and @code{divu} instructions.
22840
22841@item -meb
22842@opindex meb
22843Generate big-endian code.
22844
22845@item -mel
22846@opindex mel
22847Generate little-endian code.
22848
22849@item -mio-volatile
22850@opindex mio-volatile
22851Tells the compiler that any variable marked with the @code{io}
22852attribute is to be considered volatile.
22853
22854@item -ml
22855@opindex ml
22856Causes variables to be assigned to the @code{.far} section by default.
22857
22858@item -mleadz
22859@opindex mleadz
22860Enables the @code{leadz} (leading zero) instruction.
22861
22862@item -mm
22863@opindex mm
22864Causes variables to be assigned to the @code{.near} section by default.
22865
22866@item -mminmax
22867@opindex mminmax
22868Enables the @code{min} and @code{max} instructions.
22869
22870@item -mmult
22871@opindex mmult
22872Enables the multiplication and multiply-accumulate instructions.
22873
22874@item -mno-opts
22875@opindex mno-opts
22876Disables all the optional instructions enabled by @option{-mall-opts}.
22877
22878@item -mrepeat
22879@opindex mrepeat
22880Enables the @code{repeat} and @code{erepeat} instructions, used for
22881low-overhead looping.
22882
22883@item -ms
22884@opindex ms
22885Causes all variables to default to the @code{.tiny} section.  Note
22886that there is a 65536-byte limit to this section.  Accesses to these
22887variables use the @code{%gp} base register.
22888
22889@item -msatur
22890@opindex msatur
22891Enables the saturation instructions.  Note that the compiler does not
22892currently generate these itself, but this option is included for
22893compatibility with other tools, like @code{as}.
22894
22895@item -msdram
22896@opindex msdram
22897Link the SDRAM-based runtime instead of the default ROM-based runtime.
22898
22899@item -msim
22900@opindex msim
22901Link the simulator run-time libraries.
22902
22903@item -msimnovec
22904@opindex msimnovec
22905Link the simulator runtime libraries, excluding built-in support
22906for reset and exception vectors and tables.
22907
22908@item -mtf
22909@opindex mtf
22910Causes all functions to default to the @code{.far} section.  Without
22911this option, functions default to the @code{.near} section.
22912
22913@item -mtiny=@var{n}
22914@opindex mtiny=
22915Variables that are @var{n} bytes or smaller are allocated to the
22916@code{.tiny} section.  These variables use the @code{$gp} base
22917register.  The default for this option is 4, but note that there's a
2291865536-byte limit to the @code{.tiny} section.
22919
22920@end table
22921
22922@node MicroBlaze Options
22923@subsection MicroBlaze Options
22924@cindex MicroBlaze Options
22925
22926@table @gcctabopt
22927
22928@item -msoft-float
22929@opindex msoft-float
22930Use software emulation for floating point (default).
22931
22932@item -mhard-float
22933@opindex mhard-float
22934Use hardware floating-point instructions.
22935
22936@item -mmemcpy
22937@opindex mmemcpy
22938Do not optimize block moves, use @code{memcpy}.
22939
22940@item -mno-clearbss
22941@opindex mno-clearbss
22942This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
22943
22944@item -mcpu=@var{cpu-type}
22945@opindex mcpu=
22946Use features of, and schedule code for, the given CPU.
22947Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
22948where @var{X} is a major version, @var{YY} is the minor version, and
22949@var{Z} is compatibility code.  Example values are @samp{v3.00.a},
22950@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
22951
22952@item -mxl-soft-mul
22953@opindex mxl-soft-mul
22954Use software multiply emulation (default).
22955
22956@item -mxl-soft-div
22957@opindex mxl-soft-div
22958Use software emulation for divides (default).
22959
22960@item -mxl-barrel-shift
22961@opindex mxl-barrel-shift
22962Use the hardware barrel shifter.
22963
22964@item -mxl-pattern-compare
22965@opindex mxl-pattern-compare
22966Use pattern compare instructions.
22967
22968@item -msmall-divides
22969@opindex msmall-divides
22970Use table lookup optimization for small signed integer divisions.
22971
22972@item -mxl-stack-check
22973@opindex mxl-stack-check
22974This option is deprecated.  Use @option{-fstack-check} instead.
22975
22976@item -mxl-gp-opt
22977@opindex mxl-gp-opt
22978Use GP-relative @code{.sdata}/@code{.sbss} sections.
22979
22980@item -mxl-multiply-high
22981@opindex mxl-multiply-high
22982Use multiply high instructions for high part of 32x32 multiply.
22983
22984@item -mxl-float-convert
22985@opindex mxl-float-convert
22986Use hardware floating-point conversion instructions.
22987
22988@item -mxl-float-sqrt
22989@opindex mxl-float-sqrt
22990Use hardware floating-point square root instruction.
22991
22992@item -mbig-endian
22993@opindex mbig-endian
22994Generate code for a big-endian target.
22995
22996@item -mlittle-endian
22997@opindex mlittle-endian
22998Generate code for a little-endian target.
22999
23000@item -mxl-reorder
23001@opindex mxl-reorder
23002Use reorder instructions (swap and byte reversed load/store).
23003
23004@item -mxl-mode-@var{app-model}
23005Select application model @var{app-model}.  Valid models are
23006@table @samp
23007@item executable
23008normal executable (default), uses startup code @file{crt0.o}.
23009
23010@item -mpic-data-is-text-relative
23011@opindex mpic-data-is-text-relative
23012Assume that the displacement between the text and data segments is fixed
23013at static link time.  This allows data to be referenced by offset from start of
23014text address instead of GOT since PC-relative addressing is not supported.
23015
23016@item xmdstub
23017for use with Xilinx Microprocessor Debugger (XMD) based
23018software intrusive debug agent called xmdstub. This uses startup file
23019@file{crt1.o} and sets the start address of the program to 0x800.
23020
23021@item bootstrap
23022for applications that are loaded using a bootloader.
23023This model uses startup file @file{crt2.o} which does not contain a processor
23024reset vector handler. This is suitable for transferring control on a
23025processor reset to the bootloader rather than the application.
23026
23027@item novectors
23028for applications that do not require any of the
23029MicroBlaze vectors. This option may be useful for applications running
23030within a monitoring application. This model uses @file{crt3.o} as a startup file.
23031@end table
23032
23033Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
23034@option{-mxl-mode-@var{app-model}}.
23035
23036@end table
23037
23038@node MIPS Options
23039@subsection MIPS Options
23040@cindex MIPS options
23041
23042@table @gcctabopt
23043
23044@item -EB
23045@opindex EB
23046Generate big-endian code.
23047
23048@item -EL
23049@opindex EL
23050Generate little-endian code.  This is the default for @samp{mips*el-*-*}
23051configurations.
23052
23053@item -march=@var{arch}
23054@opindex march
23055Generate code that runs on @var{arch}, which can be the name of a
23056generic MIPS ISA, or the name of a particular processor.
23057The ISA names are:
23058@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
23059@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
23060@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
23061@samp{mips64r5} and @samp{mips64r6}.
23062The processor names are:
23063@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
23064@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
23065@samp{5kc}, @samp{5kf},
23066@samp{20kc},
23067@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
23068@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
23069@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
23070@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
23071@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
23072@samp{i6400}, @samp{i6500},
23073@samp{interaptiv},
23074@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
23075@samp{gs464e}, @samp{gs264e},
23076@samp{m4k},
23077@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
23078@samp{m5100}, @samp{m5101},
23079@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
23080@samp{orion},
23081@samp{p5600}, @samp{p6600},
23082@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
23083@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
23084@samp{r6000}, @samp{r8000},
23085@samp{rm7000}, @samp{rm9000},
23086@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
23087@samp{sb1},
23088@samp{sr71000},
23089@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
23090@samp{vr5000}, @samp{vr5400}, @samp{vr5500},
23091@samp{xlr} and @samp{xlp}.
23092The special value @samp{from-abi} selects the
23093most compatible architecture for the selected ABI (that is,
23094@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
23095
23096The native Linux/GNU toolchain also supports the value @samp{native},
23097which selects the best architecture option for the host processor.
23098@option{-march=native} has no effect if GCC does not recognize
23099the processor.
23100
23101In processor names, a final @samp{000} can be abbreviated as @samp{k}
23102(for example, @option{-march=r2k}).  Prefixes are optional, and
23103@samp{vr} may be written @samp{r}.
23104
23105Names of the form @samp{@var{n}f2_1} refer to processors with
23106FPUs clocked at half the rate of the core, names of the form
23107@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
23108rate as the core, and names of the form @samp{@var{n}f3_2} refer to
23109processors with FPUs clocked a ratio of 3:2 with respect to the core.
23110For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
23111for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
23112accepted as synonyms for @samp{@var{n}f1_1}.
23113
23114GCC defines two macros based on the value of this option.  The first
23115is @code{_MIPS_ARCH}, which gives the name of target architecture, as
23116a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
23117where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
23118For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
23119to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
23120
23121Note that the @code{_MIPS_ARCH} macro uses the processor names given
23122above.  In other words, it has the full prefix and does not
23123abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
23124the macro names the resolved architecture (either @code{"mips1"} or
23125@code{"mips3"}).  It names the default architecture when no
23126@option{-march} option is given.
23127
23128@item -mtune=@var{arch}
23129@opindex mtune
23130Optimize for @var{arch}.  Among other things, this option controls
23131the way instructions are scheduled, and the perceived cost of arithmetic
23132operations.  The list of @var{arch} values is the same as for
23133@option{-march}.
23134
23135When this option is not used, GCC optimizes for the processor
23136specified by @option{-march}.  By using @option{-march} and
23137@option{-mtune} together, it is possible to generate code that
23138runs on a family of processors, but optimize the code for one
23139particular member of that family.
23140
23141@option{-mtune} defines the macros @code{_MIPS_TUNE} and
23142@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
23143@option{-march} ones described above.
23144
23145@item -mips1
23146@opindex mips1
23147Equivalent to @option{-march=mips1}.
23148
23149@item -mips2
23150@opindex mips2
23151Equivalent to @option{-march=mips2}.
23152
23153@item -mips3
23154@opindex mips3
23155Equivalent to @option{-march=mips3}.
23156
23157@item -mips4
23158@opindex mips4
23159Equivalent to @option{-march=mips4}.
23160
23161@item -mips32
23162@opindex mips32
23163Equivalent to @option{-march=mips32}.
23164
23165@item -mips32r3
23166@opindex mips32r3
23167Equivalent to @option{-march=mips32r3}.
23168
23169@item -mips32r5
23170@opindex mips32r5
23171Equivalent to @option{-march=mips32r5}.
23172
23173@item -mips32r6
23174@opindex mips32r6
23175Equivalent to @option{-march=mips32r6}.
23176
23177@item -mips64
23178@opindex mips64
23179Equivalent to @option{-march=mips64}.
23180
23181@item -mips64r2
23182@opindex mips64r2
23183Equivalent to @option{-march=mips64r2}.
23184
23185@item -mips64r3
23186@opindex mips64r3
23187Equivalent to @option{-march=mips64r3}.
23188
23189@item -mips64r5
23190@opindex mips64r5
23191Equivalent to @option{-march=mips64r5}.
23192
23193@item -mips64r6
23194@opindex mips64r6
23195Equivalent to @option{-march=mips64r6}.
23196
23197@item -mips16
23198@itemx -mno-mips16
23199@opindex mips16
23200@opindex mno-mips16
23201Generate (do not generate) MIPS16 code.  If GCC is targeting a
23202MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23203
23204MIPS16 code generation can also be controlled on a per-function basis
23205by means of @code{mips16} and @code{nomips16} attributes.
23206@xref{Function Attributes}, for more information.
23207
23208@item -mflip-mips16
23209@opindex mflip-mips16
23210Generate MIPS16 code on alternating functions.  This option is provided
23211for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23212not intended for ordinary use in compiling user code.
23213
23214@item -minterlink-compressed
23215@itemx -mno-interlink-compressed
23216@opindex minterlink-compressed
23217@opindex mno-interlink-compressed
23218Require (do not require) that code using the standard (uncompressed) MIPS ISA
23219be link-compatible with MIPS16 and microMIPS code, and vice versa.
23220
23221For example, code using the standard ISA encoding cannot jump directly
23222to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23223@option{-minterlink-compressed} therefore disables direct jumps unless GCC
23224knows that the target of the jump is not compressed.
23225
23226@item -minterlink-mips16
23227@itemx -mno-interlink-mips16
23228@opindex minterlink-mips16
23229@opindex mno-interlink-mips16
23230Aliases of @option{-minterlink-compressed} and
23231@option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
23232and are retained for backwards compatibility.
23233
23234@item -mabi=32
23235@itemx -mabi=o64
23236@itemx -mabi=n32
23237@itemx -mabi=64
23238@itemx -mabi=eabi
23239@opindex mabi=32
23240@opindex mabi=o64
23241@opindex mabi=n32
23242@opindex mabi=64
23243@opindex mabi=eabi
23244Generate code for the given ABI@.
23245
23246Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
23247generates 64-bit code when you select a 64-bit architecture, but you
23248can use @option{-mgp32} to get 32-bit code instead.
23249
23250For information about the O64 ABI, see
23251@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23252
23253GCC supports a variant of the o32 ABI in which floating-point registers
23254are 64 rather than 32 bits wide.  You can select this combination with
23255@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
23256and @code{mfhc1} instructions and is therefore only supported for
23257MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23258
23259The register assignments for arguments and return values remain the
23260same, but each scalar value is passed in a single 64-bit register
23261rather than a pair of 32-bit registers.  For example, scalar
23262floating-point values are returned in @samp{$f0} only, not a
23263@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
23264remains the same in that the even-numbered double-precision registers
23265are saved.
23266
23267Two additional variants of the o32 ABI are supported to enable
23268a transition from 32-bit to 64-bit registers.  These are FPXX
23269(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23270The FPXX extension mandates that all code must execute correctly
23271when run using 32-bit or 64-bit registers.  The code can be interlinked
23272with either FP32 or FP64, but not both.
23273The FP64A extension is similar to the FP64 extension but forbids the
23274use of odd-numbered single-precision registers.  This can be used
23275in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23276processors and allows both FP32 and FP64A code to interlink and
23277run in the same process without changing FPU modes.
23278
23279@item -mabicalls
23280@itemx -mno-abicalls
23281@opindex mabicalls
23282@opindex mno-abicalls
23283Generate (do not generate) code that is suitable for SVR4-style
23284dynamic objects.  @option{-mabicalls} is the default for SVR4-based
23285systems.
23286
23287@item -mshared
23288@itemx -mno-shared
23289Generate (do not generate) code that is fully position-independent,
23290and that can therefore be linked into shared libraries.  This option
23291only affects @option{-mabicalls}.
23292
23293All @option{-mabicalls} code has traditionally been position-independent,
23294regardless of options like @option{-fPIC} and @option{-fpic}.  However,
23295as an extension, the GNU toolchain allows executables to use absolute
23296accesses for locally-binding symbols.  It can also use shorter GP
23297initialization sequences and generate direct calls to locally-defined
23298functions.  This mode is selected by @option{-mno-shared}.
23299
23300@option{-mno-shared} depends on binutils 2.16 or higher and generates
23301objects that can only be linked by the GNU linker.  However, the option
23302does not affect the ABI of the final executable; it only affects the ABI
23303of relocatable objects.  Using @option{-mno-shared} generally makes
23304executables both smaller and quicker.
23305
23306@option{-mshared} is the default.
23307
23308@item -mplt
23309@itemx -mno-plt
23310@opindex mplt
23311@opindex mno-plt
23312Assume (do not assume) that the static and dynamic linkers
23313support PLTs and copy relocations.  This option only affects
23314@option{-mno-shared -mabicalls}.  For the n64 ABI, this option
23315has no effect without @option{-msym32}.
23316
23317You can make @option{-mplt} the default by configuring
23318GCC with @option{--with-mips-plt}.  The default is
23319@option{-mno-plt} otherwise.
23320
23321@item -mxgot
23322@itemx -mno-xgot
23323@opindex mxgot
23324@opindex mno-xgot
23325Lift (do not lift) the usual restrictions on the size of the global
23326offset table.
23327
23328GCC normally uses a single instruction to load values from the GOT@.
23329While this is relatively efficient, it only works if the GOT
23330is smaller than about 64k.  Anything larger causes the linker
23331to report an error such as:
23332
23333@cindex relocation truncated to fit (MIPS)
23334@smallexample
23335relocation truncated to fit: R_MIPS_GOT16 foobar
23336@end smallexample
23337
23338If this happens, you should recompile your code with @option{-mxgot}.
23339This works with very large GOTs, although the code is also
23340less efficient, since it takes three instructions to fetch the
23341value of a global symbol.
23342
23343Note that some linkers can create multiple GOTs.  If you have such a
23344linker, you should only need to use @option{-mxgot} when a single object
23345file accesses more than 64k's worth of GOT entries.  Very few do.
23346
23347These options have no effect unless GCC is generating position
23348independent code.
23349
23350@item -mgp32
23351@opindex mgp32
23352Assume that general-purpose registers are 32 bits wide.
23353
23354@item -mgp64
23355@opindex mgp64
23356Assume that general-purpose registers are 64 bits wide.
23357
23358@item -mfp32
23359@opindex mfp32
23360Assume that floating-point registers are 32 bits wide.
23361
23362@item -mfp64
23363@opindex mfp64
23364Assume that floating-point registers are 64 bits wide.
23365
23366@item -mfpxx
23367@opindex mfpxx
23368Do not assume the width of floating-point registers.
23369
23370@item -mhard-float
23371@opindex mhard-float
23372Use floating-point coprocessor instructions.
23373
23374@item -msoft-float
23375@opindex msoft-float
23376Do not use floating-point coprocessor instructions.  Implement
23377floating-point calculations using library calls instead.
23378
23379@item -mno-float
23380@opindex mno-float
23381Equivalent to @option{-msoft-float}, but additionally asserts that the
23382program being compiled does not perform any floating-point operations.
23383This option is presently supported only by some bare-metal MIPS
23384configurations, where it may select a special set of libraries
23385that lack all floating-point support (including, for example, the
23386floating-point @code{printf} formats).
23387If code compiled with @option{-mno-float} accidentally contains
23388floating-point operations, it is likely to suffer a link-time
23389or run-time failure.
23390
23391@item -msingle-float
23392@opindex msingle-float
23393Assume that the floating-point coprocessor only supports single-precision
23394operations.
23395
23396@item -mdouble-float
23397@opindex mdouble-float
23398Assume that the floating-point coprocessor supports double-precision
23399operations.  This is the default.
23400
23401@item -modd-spreg
23402@itemx -mno-odd-spreg
23403@opindex modd-spreg
23404@opindex mno-odd-spreg
23405Enable the use of odd-numbered single-precision floating-point registers
23406for the o32 ABI.  This is the default for processors that are known to
23407support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23408is set by default.
23409
23410@item -mabs=2008
23411@itemx -mabs=legacy
23412@opindex mabs=2008
23413@opindex mabs=legacy
23414These options control the treatment of the special not-a-number (NaN)
23415IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23416@code{neg.@i{fmt}} machine instructions.
23417
23418By default or when @option{-mabs=legacy} is used the legacy
23419treatment is selected.  In this case these instructions are considered
23420arithmetic and avoided where correct operation is required and the
23421input operand might be a NaN.  A longer sequence of instructions that
23422manipulate the sign bit of floating-point datum manually is used
23423instead unless the @option{-ffinite-math-only} option has also been
23424specified.
23425
23426The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
23427this case these instructions are considered non-arithmetic and therefore
23428operating correctly in all cases, including in particular where the
23429input operand is a NaN.  These instructions are therefore always used
23430for the respective operations.
23431
23432@item -mnan=2008
23433@itemx -mnan=legacy
23434@opindex mnan=2008
23435@opindex mnan=legacy
23436These options control the encoding of the special not-a-number (NaN)
23437IEEE 754 floating-point data.
23438
23439The @option{-mnan=legacy} option selects the legacy encoding.  In this
23440case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23441significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23442by the first bit of their trailing significand field being 1.
23443
23444The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
23445this case qNaNs are denoted by the first bit of their trailing
23446significand field being 1, whereas sNaNs are denoted by the first bit of
23447their trailing significand field being 0.
23448
23449The default is @option{-mnan=legacy} unless GCC has been configured with
23450@option{--with-nan=2008}.
23451
23452@item -mllsc
23453@itemx -mno-llsc
23454@opindex mllsc
23455@opindex mno-llsc
23456Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23457implement atomic memory built-in functions.  When neither option is
23458specified, GCC uses the instructions if the target architecture
23459supports them.
23460
23461@option{-mllsc} is useful if the runtime environment can emulate the
23462instructions and @option{-mno-llsc} can be useful when compiling for
23463nonstandard ISAs.  You can make either option the default by
23464configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23465respectively.  @option{--with-llsc} is the default for some
23466configurations; see the installation documentation for details.
23467
23468@item -mdsp
23469@itemx -mno-dsp
23470@opindex mdsp
23471@opindex mno-dsp
23472Use (do not use) revision 1 of the MIPS DSP ASE@.
23473@xref{MIPS DSP Built-in Functions}.  This option defines the
23474preprocessor macro @code{__mips_dsp}.  It also defines
23475@code{__mips_dsp_rev} to 1.
23476
23477@item -mdspr2
23478@itemx -mno-dspr2
23479@opindex mdspr2
23480@opindex mno-dspr2
23481Use (do not use) revision 2 of the MIPS DSP ASE@.
23482@xref{MIPS DSP Built-in Functions}.  This option defines the
23483preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23484It also defines @code{__mips_dsp_rev} to 2.
23485
23486@item -msmartmips
23487@itemx -mno-smartmips
23488@opindex msmartmips
23489@opindex mno-smartmips
23490Use (do not use) the MIPS SmartMIPS ASE.
23491
23492@item -mpaired-single
23493@itemx -mno-paired-single
23494@opindex mpaired-single
23495@opindex mno-paired-single
23496Use (do not use) paired-single floating-point instructions.
23497@xref{MIPS Paired-Single Support}.  This option requires
23498hardware floating-point support to be enabled.
23499
23500@item -mdmx
23501@itemx -mno-mdmx
23502@opindex mdmx
23503@opindex mno-mdmx
23504Use (do not use) MIPS Digital Media Extension instructions.
23505This option can only be used when generating 64-bit code and requires
23506hardware floating-point support to be enabled.
23507
23508@item -mips3d
23509@itemx -mno-mips3d
23510@opindex mips3d
23511@opindex mno-mips3d
23512Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
23513The option @option{-mips3d} implies @option{-mpaired-single}.
23514
23515@item -mmicromips
23516@itemx -mno-micromips
23517@opindex mmicromips
23518@opindex mno-mmicromips
23519Generate (do not generate) microMIPS code.
23520
23521MicroMIPS code generation can also be controlled on a per-function basis
23522by means of @code{micromips} and @code{nomicromips} attributes.
23523@xref{Function Attributes}, for more information.
23524
23525@item -mmt
23526@itemx -mno-mt
23527@opindex mmt
23528@opindex mno-mt
23529Use (do not use) MT Multithreading instructions.
23530
23531@item -mmcu
23532@itemx -mno-mcu
23533@opindex mmcu
23534@opindex mno-mcu
23535Use (do not use) the MIPS MCU ASE instructions.
23536
23537@item -meva
23538@itemx -mno-eva
23539@opindex meva
23540@opindex mno-eva
23541Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23542
23543@item -mvirt
23544@itemx -mno-virt
23545@opindex mvirt
23546@opindex mno-virt
23547Use (do not use) the MIPS Virtualization (VZ) instructions.
23548
23549@item -mxpa
23550@itemx -mno-xpa
23551@opindex mxpa
23552@opindex mno-xpa
23553Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23554
23555@item -mcrc
23556@itemx -mno-crc
23557@opindex mcrc
23558@opindex mno-crc
23559Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23560
23561@item -mginv
23562@itemx -mno-ginv
23563@opindex mginv
23564@opindex mno-ginv
23565Use (do not use) the MIPS Global INValidate (GINV) instructions.
23566
23567@item -mloongson-mmi
23568@itemx -mno-loongson-mmi
23569@opindex mloongson-mmi
23570@opindex mno-loongson-mmi
23571Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23572
23573@item -mloongson-ext
23574@itemx -mno-loongson-ext
23575@opindex mloongson-ext
23576@opindex mno-loongson-ext
23577Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23578
23579@item -mloongson-ext2
23580@itemx -mno-loongson-ext2
23581@opindex mloongson-ext2
23582@opindex mno-loongson-ext2
23583Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23584
23585@item -mlong64
23586@opindex mlong64
23587Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
23588an explanation of the default and the way that the pointer size is
23589determined.
23590
23591@item -mlong32
23592@opindex mlong32
23593Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23594
23595The default size of @code{int}s, @code{long}s and pointers depends on
23596the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
23597uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
2359832-bit @code{long}s.  Pointers are the same size as @code{long}s,
23599or the same size as integer registers, whichever is smaller.
23600
23601@item -msym32
23602@itemx -mno-sym32
23603@opindex msym32
23604@opindex mno-sym32
23605Assume (do not assume) that all symbols have 32-bit values, regardless
23606of the selected ABI@.  This option is useful in combination with
23607@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23608to generate shorter and faster references to symbolic addresses.
23609
23610@item -G @var{num}
23611@opindex G
23612Put definitions of externally-visible data in a small data section
23613if that data is no bigger than @var{num} bytes.  GCC can then generate
23614more efficient accesses to the data; see @option{-mgpopt} for details.
23615
23616The default @option{-G} option depends on the configuration.
23617
23618@item -mlocal-sdata
23619@itemx -mno-local-sdata
23620@opindex mlocal-sdata
23621@opindex mno-local-sdata
23622Extend (do not extend) the @option{-G} behavior to local data too,
23623such as to static variables in C@.  @option{-mlocal-sdata} is the
23624default for all configurations.
23625
23626If the linker complains that an application is using too much small data,
23627you might want to try rebuilding the less performance-critical parts with
23628@option{-mno-local-sdata}.  You might also want to build large
23629libraries with @option{-mno-local-sdata}, so that the libraries leave
23630more room for the main program.
23631
23632@item -mextern-sdata
23633@itemx -mno-extern-sdata
23634@opindex mextern-sdata
23635@opindex mno-extern-sdata
23636Assume (do not assume) that externally-defined data is in
23637a small data section if the size of that data is within the @option{-G} limit.
23638@option{-mextern-sdata} is the default for all configurations.
23639
23640If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23641@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23642that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23643is placed in a small data section.  If @var{Var} is defined by another
23644module, you must either compile that module with a high-enough
23645@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23646definition.  If @var{Var} is common, you must link the application
23647with a high-enough @option{-G} setting.
23648
23649The easiest way of satisfying these restrictions is to compile
23650and link every module with the same @option{-G} option.  However,
23651you may wish to build a library that supports several different
23652small data limits.  You can do this by compiling the library with
23653the highest supported @option{-G} setting and additionally using
23654@option{-mno-extern-sdata} to stop the library from making assumptions
23655about externally-defined data.
23656
23657@item -mgpopt
23658@itemx -mno-gpopt
23659@opindex mgpopt
23660@opindex mno-gpopt
23661Use (do not use) GP-relative accesses for symbols that are known to be
23662in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23663@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
23664configurations.
23665
23666@option{-mno-gpopt} is useful for cases where the @code{$gp} register
23667might not hold the value of @code{_gp}.  For example, if the code is
23668part of a library that might be used in a boot monitor, programs that
23669call boot monitor routines pass an unknown value in @code{$gp}.
23670(In such situations, the boot monitor itself is usually compiled
23671with @option{-G0}.)
23672
23673@option{-mno-gpopt} implies @option{-mno-local-sdata} and
23674@option{-mno-extern-sdata}.
23675
23676@item -membedded-data
23677@itemx -mno-embedded-data
23678@opindex membedded-data
23679@opindex mno-embedded-data
23680Allocate variables to the read-only data section first if possible, then
23681next in the small data section if possible, otherwise in data.  This gives
23682slightly slower code than the default, but reduces the amount of RAM required
23683when executing, and thus may be preferred for some embedded systems.
23684
23685@item -muninit-const-in-rodata
23686@itemx -mno-uninit-const-in-rodata
23687@opindex muninit-const-in-rodata
23688@opindex mno-uninit-const-in-rodata
23689Put uninitialized @code{const} variables in the read-only data section.
23690This option is only meaningful in conjunction with @option{-membedded-data}.
23691
23692@item -mcode-readable=@var{setting}
23693@opindex mcode-readable
23694Specify whether GCC may generate code that reads from executable sections.
23695There are three possible settings:
23696
23697@table @gcctabopt
23698@item -mcode-readable=yes
23699Instructions may freely access executable sections.  This is the
23700default setting.
23701
23702@item -mcode-readable=pcrel
23703MIPS16 PC-relative load instructions can access executable sections,
23704but other instructions must not do so.  This option is useful on 4KSc
23705and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23706It is also useful on processors that can be configured to have a dual
23707instruction/data SRAM interface and that, like the M4K, automatically
23708redirect PC-relative loads to the instruction RAM.
23709
23710@item -mcode-readable=no
23711Instructions must not access executable sections.  This option can be
23712useful on targets that are configured to have a dual instruction/data
23713SRAM interface but that (unlike the M4K) do not automatically redirect
23714PC-relative loads to the instruction RAM.
23715@end table
23716
23717@item -msplit-addresses
23718@itemx -mno-split-addresses
23719@opindex msplit-addresses
23720@opindex mno-split-addresses
23721Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23722relocation operators.  This option has been superseded by
23723@option{-mexplicit-relocs} but is retained for backwards compatibility.
23724
23725@item -mexplicit-relocs
23726@itemx -mno-explicit-relocs
23727@opindex mexplicit-relocs
23728@opindex mno-explicit-relocs
23729Use (do not use) assembler relocation operators when dealing with symbolic
23730addresses.  The alternative, selected by @option{-mno-explicit-relocs},
23731is to use assembler macros instead.
23732
23733@option{-mexplicit-relocs} is the default if GCC was configured
23734to use an assembler that supports relocation operators.
23735
23736@item -mcheck-zero-division
23737@itemx -mno-check-zero-division
23738@opindex mcheck-zero-division
23739@opindex mno-check-zero-division
23740Trap (do not trap) on integer division by zero.
23741
23742The default is @option{-mcheck-zero-division}.
23743
23744@item -mdivide-traps
23745@itemx -mdivide-breaks
23746@opindex mdivide-traps
23747@opindex mdivide-breaks
23748MIPS systems check for division by zero by generating either a
23749conditional trap or a break instruction.  Using traps results in
23750smaller code, but is only supported on MIPS II and later.  Also, some
23751versions of the Linux kernel have a bug that prevents trap from
23752generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
23753allow conditional traps on architectures that support them and
23754@option{-mdivide-breaks} to force the use of breaks.
23755
23756The default is usually @option{-mdivide-traps}, but this can be
23757overridden at configure time using @option{--with-divide=breaks}.
23758Divide-by-zero checks can be completely disabled using
23759@option{-mno-check-zero-division}.
23760
23761@item -mload-store-pairs
23762@itemx -mno-load-store-pairs
23763@opindex mload-store-pairs
23764@opindex mno-load-store-pairs
23765Enable (disable) an optimization that pairs consecutive load or store
23766instructions to enable load/store bonding.  This option is enabled by
23767default but only takes effect when the selected architecture is known
23768to support bonding.
23769
23770@item -mmemcpy
23771@itemx -mno-memcpy
23772@opindex mmemcpy
23773@opindex mno-memcpy
23774Force (do not force) the use of @code{memcpy} for non-trivial block
23775moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
23776most constant-sized copies.
23777
23778@item -mlong-calls
23779@itemx -mno-long-calls
23780@opindex mlong-calls
23781@opindex mno-long-calls
23782Disable (do not disable) use of the @code{jal} instruction.  Calling
23783functions using @code{jal} is more efficient but requires the caller
23784and callee to be in the same 256 megabyte segment.
23785
23786This option has no effect on abicalls code.  The default is
23787@option{-mno-long-calls}.
23788
23789@item -mmad
23790@itemx -mno-mad
23791@opindex mmad
23792@opindex mno-mad
23793Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
23794instructions, as provided by the R4650 ISA@.
23795
23796@item -mimadd
23797@itemx -mno-imadd
23798@opindex mimadd
23799@opindex mno-imadd
23800Enable (disable) use of the @code{madd} and @code{msub} integer
23801instructions.  The default is @option{-mimadd} on architectures
23802that support @code{madd} and @code{msub} except for the 74k
23803architecture where it was found to generate slower code.
23804
23805@item -mfused-madd
23806@itemx -mno-fused-madd
23807@opindex mfused-madd
23808@opindex mno-fused-madd
23809Enable (disable) use of the floating-point multiply-accumulate
23810instructions, when they are available.  The default is
23811@option{-mfused-madd}.
23812
23813On the R8000 CPU when multiply-accumulate instructions are used,
23814the intermediate product is calculated to infinite precision
23815and is not subject to the FCSR Flush to Zero bit.  This may be
23816undesirable in some circumstances.  On other processors the result
23817is numerically identical to the equivalent computation using
23818separate multiply, add, subtract and negate instructions.
23819
23820@item -nocpp
23821@opindex nocpp
23822Tell the MIPS assembler to not run its preprocessor over user
23823assembler files (with a @samp{.s} suffix) when assembling them.
23824
23825@item -mfix-24k
23826@itemx -mno-fix-24k
23827@opindex mfix-24k
23828@opindex mno-fix-24k
23829Work around the 24K E48 (lost data on stores during refill) errata.
23830The workarounds are implemented by the assembler rather than by GCC@.
23831
23832@item -mfix-r4000
23833@itemx -mno-fix-r4000
23834@opindex mfix-r4000
23835@opindex mno-fix-r4000
23836Work around certain R4000 CPU errata:
23837@itemize @minus
23838@item
23839A double-word or a variable shift may give an incorrect result if executed
23840immediately after starting an integer division.
23841@item
23842A double-word or a variable shift may give an incorrect result if executed
23843while an integer multiplication is in progress.
23844@item
23845An integer division may give an incorrect result if started in a delay slot
23846of a taken branch or a jump.
23847@end itemize
23848
23849@item -mfix-r4400
23850@itemx -mno-fix-r4400
23851@opindex mfix-r4400
23852@opindex mno-fix-r4400
23853Work around certain R4400 CPU errata:
23854@itemize @minus
23855@item
23856A double-word or a variable shift may give an incorrect result if executed
23857immediately after starting an integer division.
23858@end itemize
23859
23860@item -mfix-r10000
23861@itemx -mno-fix-r10000
23862@opindex mfix-r10000
23863@opindex mno-fix-r10000
23864Work around certain R10000 errata:
23865@itemize @minus
23866@item
23867@code{ll}/@code{sc} sequences may not behave atomically on revisions
23868prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
23869@end itemize
23870
23871This option can only be used if the target architecture supports
23872branch-likely instructions.  @option{-mfix-r10000} is the default when
23873@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
23874otherwise.
23875
23876@item -mfix-r5900
23877@itemx -mno-fix-r5900
23878@opindex mfix-r5900
23879Do not attempt to schedule the preceding instruction into the delay slot
23880of a branch instruction placed at the end of a short loop of six
23881instructions or fewer and always schedule a @code{nop} instruction there
23882instead.  The short loop bug under certain conditions causes loops to
23883execute only once or twice, due to a hardware bug in the R5900 chip.  The
23884workaround is implemented by the assembler rather than by GCC@.
23885
23886@item -mfix-rm7000
23887@itemx -mno-fix-rm7000
23888@opindex mfix-rm7000
23889Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
23890workarounds are implemented by the assembler rather than by GCC@.
23891
23892@item -mfix-vr4120
23893@itemx -mno-fix-vr4120
23894@opindex mfix-vr4120
23895Work around certain VR4120 errata:
23896@itemize @minus
23897@item
23898@code{dmultu} does not always produce the correct result.
23899@item
23900@code{div} and @code{ddiv} do not always produce the correct result if one
23901of the operands is negative.
23902@end itemize
23903The workarounds for the division errata rely on special functions in
23904@file{libgcc.a}.  At present, these functions are only provided by
23905the @code{mips64vr*-elf} configurations.
23906
23907Other VR4120 errata require a NOP to be inserted between certain pairs of
23908instructions.  These errata are handled by the assembler, not by GCC itself.
23909
23910@item -mfix-vr4130
23911@opindex mfix-vr4130
23912Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
23913workarounds are implemented by the assembler rather than by GCC,
23914although GCC avoids using @code{mflo} and @code{mfhi} if the
23915VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
23916instructions are available instead.
23917
23918@item -mfix-sb1
23919@itemx -mno-fix-sb1
23920@opindex mfix-sb1
23921Work around certain SB-1 CPU core errata.
23922(This flag currently works around the SB-1 revision 2
23923``F1'' and ``F2'' floating-point errata.)
23924
23925@item -mr10k-cache-barrier=@var{setting}
23926@opindex mr10k-cache-barrier
23927Specify whether GCC should insert cache barriers to avoid the
23928side effects of speculation on R10K processors.
23929
23930In common with many processors, the R10K tries to predict the outcome
23931of a conditional branch and speculatively executes instructions from
23932the ``taken'' branch.  It later aborts these instructions if the
23933predicted outcome is wrong.  However, on the R10K, even aborted
23934instructions can have side effects.
23935
23936This problem only affects kernel stores and, depending on the system,
23937kernel loads.  As an example, a speculatively-executed store may load
23938the target memory into cache and mark the cache line as dirty, even if
23939the store itself is later aborted.  If a DMA operation writes to the
23940same area of memory before the ``dirty'' line is flushed, the cached
23941data overwrites the DMA-ed data.  See the R10K processor manual
23942for a full description, including other potential problems.
23943
23944One workaround is to insert cache barrier instructions before every memory
23945access that might be speculatively executed and that might have side
23946effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
23947controls GCC's implementation of this workaround.  It assumes that
23948aborted accesses to any byte in the following regions does not have
23949side effects:
23950
23951@enumerate
23952@item
23953the memory occupied by the current function's stack frame;
23954
23955@item
23956the memory occupied by an incoming stack argument;
23957
23958@item
23959the memory occupied by an object with a link-time-constant address.
23960@end enumerate
23961
23962It is the kernel's responsibility to ensure that speculative
23963accesses to these regions are indeed safe.
23964
23965If the input program contains a function declaration such as:
23966
23967@smallexample
23968void foo (void);
23969@end smallexample
23970
23971then the implementation of @code{foo} must allow @code{j foo} and
23972@code{jal foo} to be executed speculatively.  GCC honors this
23973restriction for functions it compiles itself.  It expects non-GCC
23974functions (such as hand-written assembly code) to do the same.
23975
23976The option has three forms:
23977
23978@table @gcctabopt
23979@item -mr10k-cache-barrier=load-store
23980Insert a cache barrier before a load or store that might be
23981speculatively executed and that might have side effects even
23982if aborted.
23983
23984@item -mr10k-cache-barrier=store
23985Insert a cache barrier before a store that might be speculatively
23986executed and that might have side effects even if aborted.
23987
23988@item -mr10k-cache-barrier=none
23989Disable the insertion of cache barriers.  This is the default setting.
23990@end table
23991
23992@item -mflush-func=@var{func}
23993@itemx -mno-flush-func
23994@opindex mflush-func
23995Specifies the function to call to flush the I and D caches, or to not
23996call any such function.  If called, the function must take the same
23997arguments as the common @code{_flush_func}, that is, the address of the
23998memory range for which the cache is being flushed, the size of the
23999memory range, and the number 3 (to flush both caches).  The default
24000depends on the target GCC was configured for, but commonly is either
24001@code{_flush_func} or @code{__cpu_flush}.
24002
24003@item mbranch-cost=@var{num}
24004@opindex mbranch-cost
24005Set the cost of branches to roughly @var{num} ``simple'' instructions.
24006This cost is only a heuristic and is not guaranteed to produce
24007consistent results across releases.  A zero cost redundantly selects
24008the default, which is based on the @option{-mtune} setting.
24009
24010@item -mbranch-likely
24011@itemx -mno-branch-likely
24012@opindex mbranch-likely
24013@opindex mno-branch-likely
24014Enable or disable use of Branch Likely instructions, regardless of the
24015default for the selected architecture.  By default, Branch Likely
24016instructions may be generated if they are supported by the selected
24017architecture.  An exception is for the MIPS32 and MIPS64 architectures
24018and processors that implement those architectures; for those, Branch
24019Likely instructions are not be generated by default because the MIPS32
24020and MIPS64 architectures specifically deprecate their use.
24021
24022@item -mcompact-branches=never
24023@itemx -mcompact-branches=optimal
24024@itemx -mcompact-branches=always
24025@opindex mcompact-branches=never
24026@opindex mcompact-branches=optimal
24027@opindex mcompact-branches=always
24028These options control which form of branches will be generated.  The
24029default is @option{-mcompact-branches=optimal}.
24030
24031The @option{-mcompact-branches=never} option ensures that compact branch
24032instructions will never be generated.
24033
24034The @option{-mcompact-branches=always} option ensures that a compact
24035branch instruction will be generated if available.  If a compact branch
24036instruction is not available, a delay slot form of the branch will be
24037used instead.
24038
24039This option is supported from MIPS Release 6 onwards.
24040
24041The @option{-mcompact-branches=optimal} option will cause a delay slot
24042branch to be used if one is available in the current ISA and the delay
24043slot is successfully filled.  If the delay slot is not filled, a compact
24044branch will be chosen if one is available.
24045
24046@item -mfp-exceptions
24047@itemx -mno-fp-exceptions
24048@opindex mfp-exceptions
24049Specifies whether FP exceptions are enabled.  This affects how
24050FP instructions are scheduled for some processors.
24051The default is that FP exceptions are
24052enabled.
24053
24054For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
2405564-bit code, then we can use both FP pipes.  Otherwise, we can only use one
24056FP pipe.
24057
24058@item -mvr4130-align
24059@itemx -mno-vr4130-align
24060@opindex mvr4130-align
24061The VR4130 pipeline is two-way superscalar, but can only issue two
24062instructions together if the first one is 8-byte aligned.  When this
24063option is enabled, GCC aligns pairs of instructions that it
24064thinks should execute in parallel.
24065
24066This option only has an effect when optimizing for the VR4130.
24067It normally makes code faster, but at the expense of making it bigger.
24068It is enabled by default at optimization level @option{-O3}.
24069
24070@item -msynci
24071@itemx -mno-synci
24072@opindex msynci
24073Enable (disable) generation of @code{synci} instructions on
24074architectures that support it.  The @code{synci} instructions (if
24075enabled) are generated when @code{__builtin___clear_cache} is
24076compiled.
24077
24078This option defaults to @option{-mno-synci}, but the default can be
24079overridden by configuring GCC with @option{--with-synci}.
24080
24081When compiling code for single processor systems, it is generally safe
24082to use @code{synci}.  However, on many multi-core (SMP) systems, it
24083does not invalidate the instruction caches on all cores and may lead
24084to undefined behavior.
24085
24086@item -mrelax-pic-calls
24087@itemx -mno-relax-pic-calls
24088@opindex mrelax-pic-calls
24089Try to turn PIC calls that are normally dispatched via register
24090@code{$25} into direct calls.  This is only possible if the linker can
24091resolve the destination at link time and if the destination is within
24092range for a direct call.
24093
24094@option{-mrelax-pic-calls} is the default if GCC was configured to use
24095an assembler and a linker that support the @code{.reloc} assembly
24096directive and @option{-mexplicit-relocs} is in effect.  With
24097@option{-mno-explicit-relocs}, this optimization can be performed by the
24098assembler and the linker alone without help from the compiler.
24099
24100@item -mmcount-ra-address
24101@itemx -mno-mcount-ra-address
24102@opindex mmcount-ra-address
24103@opindex mno-mcount-ra-address
24104Emit (do not emit) code that allows @code{_mcount} to modify the
24105calling function's return address.  When enabled, this option extends
24106the usual @code{_mcount} interface with a new @var{ra-address}
24107parameter, which has type @code{intptr_t *} and is passed in register
24108@code{$12}.  @code{_mcount} can then modify the return address by
24109doing both of the following:
24110@itemize
24111@item
24112Returning the new address in register @code{$31}.
24113@item
24114Storing the new address in @code{*@var{ra-address}},
24115if @var{ra-address} is nonnull.
24116@end itemize
24117
24118The default is @option{-mno-mcount-ra-address}.
24119
24120@item -mframe-header-opt
24121@itemx -mno-frame-header-opt
24122@opindex mframe-header-opt
24123Enable (disable) frame header optimization in the o32 ABI.  When using the
24124o32 ABI, calling functions will allocate 16 bytes on the stack for the called
24125function to write out register arguments.  When enabled, this optimization
24126will suppress the allocation of the frame header if it can be determined that
24127it is unused.
24128
24129This optimization is off by default at all optimization levels.
24130
24131@item -mlxc1-sxc1
24132@itemx -mno-lxc1-sxc1
24133@opindex mlxc1-sxc1
24134When applicable, enable (disable) the generation of @code{lwxc1},
24135@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
24136
24137@item -mmadd4
24138@itemx -mno-madd4
24139@opindex mmadd4
24140When applicable, enable (disable) the generation of 4-operand @code{madd.s},
24141@code{madd.d} and related instructions.  Enabled by default.
24142
24143@end table
24144
24145@node MMIX Options
24146@subsection MMIX Options
24147@cindex MMIX Options
24148
24149These options are defined for the MMIX:
24150
24151@table @gcctabopt
24152@item -mlibfuncs
24153@itemx -mno-libfuncs
24154@opindex mlibfuncs
24155@opindex mno-libfuncs
24156Specify that intrinsic library functions are being compiled, passing all
24157values in registers, no matter the size.
24158
24159@item -mepsilon
24160@itemx -mno-epsilon
24161@opindex mepsilon
24162@opindex mno-epsilon
24163Generate floating-point comparison instructions that compare with respect
24164to the @code{rE} epsilon register.
24165
24166@item -mabi=mmixware
24167@itemx -mabi=gnu
24168@opindex mabi=mmixware
24169@opindex mabi=gnu
24170Generate code that passes function parameters and return values that (in
24171the called function) are seen as registers @code{$0} and up, as opposed to
24172the GNU ABI which uses global registers @code{$231} and up.
24173
24174@item -mzero-extend
24175@itemx -mno-zero-extend
24176@opindex mzero-extend
24177@opindex mno-zero-extend
24178When reading data from memory in sizes shorter than 64 bits, use (do not
24179use) zero-extending load instructions by default, rather than
24180sign-extending ones.
24181
24182@item -mknuthdiv
24183@itemx -mno-knuthdiv
24184@opindex mknuthdiv
24185@opindex mno-knuthdiv
24186Make the result of a division yielding a remainder have the same sign as
24187the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
24188remainder follows the sign of the dividend.  Both methods are
24189arithmetically valid, the latter being almost exclusively used.
24190
24191@item -mtoplevel-symbols
24192@itemx -mno-toplevel-symbols
24193@opindex mtoplevel-symbols
24194@opindex mno-toplevel-symbols
24195Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24196code can be used with the @code{PREFIX} assembly directive.
24197
24198@item -melf
24199@opindex melf
24200Generate an executable in the ELF format, rather than the default
24201@samp{mmo} format used by the @command{mmix} simulator.
24202
24203@item -mbranch-predict
24204@itemx -mno-branch-predict
24205@opindex mbranch-predict
24206@opindex mno-branch-predict
24207Use (do not use) the probable-branch instructions, when static branch
24208prediction indicates a probable branch.
24209
24210@item -mbase-addresses
24211@itemx -mno-base-addresses
24212@opindex mbase-addresses
24213@opindex mno-base-addresses
24214Generate (do not generate) code that uses @emph{base addresses}.  Using a
24215base address automatically generates a request (handled by the assembler
24216and the linker) for a constant to be set up in a global register.  The
24217register is used for one or more base address requests within the range 0
24218to 255 from the value held in the register.  The generally leads to short
24219and fast code, but the number of different data items that can be
24220addressed is limited.  This means that a program that uses lots of static
24221data may require @option{-mno-base-addresses}.
24222
24223@item -msingle-exit
24224@itemx -mno-single-exit
24225@opindex msingle-exit
24226@opindex mno-single-exit
24227Force (do not force) generated code to have a single exit point in each
24228function.
24229@end table
24230
24231@node MN10300 Options
24232@subsection MN10300 Options
24233@cindex MN10300 options
24234
24235These @option{-m} options are defined for Matsushita MN10300 architectures:
24236
24237@table @gcctabopt
24238@item -mmult-bug
24239@opindex mmult-bug
24240Generate code to avoid bugs in the multiply instructions for the MN10300
24241processors.  This is the default.
24242
24243@item -mno-mult-bug
24244@opindex mno-mult-bug
24245Do not generate code to avoid bugs in the multiply instructions for the
24246MN10300 processors.
24247
24248@item -mam33
24249@opindex mam33
24250Generate code using features specific to the AM33 processor.
24251
24252@item -mno-am33
24253@opindex mno-am33
24254Do not generate code using features specific to the AM33 processor.  This
24255is the default.
24256
24257@item -mam33-2
24258@opindex mam33-2
24259Generate code using features specific to the AM33/2.0 processor.
24260
24261@item -mam34
24262@opindex mam34
24263Generate code using features specific to the AM34 processor.
24264
24265@item -mtune=@var{cpu-type}
24266@opindex mtune
24267Use the timing characteristics of the indicated CPU type when
24268scheduling instructions.  This does not change the targeted processor
24269type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
24270@samp{am33-2} or @samp{am34}.
24271
24272@item -mreturn-pointer-on-d0
24273@opindex mreturn-pointer-on-d0
24274When generating a function that returns a pointer, return the pointer
24275in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
24276only in @code{a0}, and attempts to call such functions without a prototype
24277result in errors.  Note that this option is on by default; use
24278@option{-mno-return-pointer-on-d0} to disable it.
24279
24280@item -mno-crt0
24281@opindex mno-crt0
24282Do not link in the C run-time initialization object file.
24283
24284@item -mrelax
24285@opindex mrelax
24286Indicate to the linker that it should perform a relaxation optimization pass
24287to shorten branches, calls and absolute memory addresses.  This option only
24288has an effect when used on the command line for the final link step.
24289
24290This option makes symbolic debugging impossible.
24291
24292@item -mliw
24293@opindex mliw
24294Allow the compiler to generate @emph{Long Instruction Word}
24295instructions if the target is the @samp{AM33} or later.  This is the
24296default.  This option defines the preprocessor macro @code{__LIW__}.
24297
24298@item -mno-liw
24299@opindex mno-liw
24300Do not allow the compiler to generate @emph{Long Instruction Word}
24301instructions.  This option defines the preprocessor macro
24302@code{__NO_LIW__}.
24303
24304@item -msetlb
24305@opindex msetlb
24306Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24307instructions if the target is the @samp{AM33} or later.  This is the
24308default.  This option defines the preprocessor macro @code{__SETLB__}.
24309
24310@item -mno-setlb
24311@opindex mno-setlb
24312Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24313instructions.  This option defines the preprocessor macro
24314@code{__NO_SETLB__}.
24315
24316@end table
24317
24318@node Moxie Options
24319@subsection Moxie Options
24320@cindex Moxie Options
24321
24322@table @gcctabopt
24323
24324@item -meb
24325@opindex meb
24326Generate big-endian code.  This is the default for @samp{moxie-*-*}
24327configurations.
24328
24329@item -mel
24330@opindex mel
24331Generate little-endian code.
24332
24333@item -mmul.x
24334@opindex mmul.x
24335Generate mul.x and umul.x instructions.  This is the default for
24336@samp{moxiebox-*-*} configurations.
24337
24338@item -mno-crt0
24339@opindex mno-crt0
24340Do not link in the C run-time initialization object file.
24341
24342@end table
24343
24344@node MSP430 Options
24345@subsection MSP430 Options
24346@cindex MSP430 Options
24347
24348These options are defined for the MSP430:
24349
24350@table @gcctabopt
24351
24352@item -masm-hex
24353@opindex masm-hex
24354Force assembly output to always use hex constants.  Normally such
24355constants are signed decimals, but this option is available for
24356testsuite and/or aesthetic purposes.
24357
24358@item -mmcu=
24359@opindex mmcu=
24360Select the MCU to target.  This is used to create a C preprocessor
24361symbol based upon the MCU name, converted to upper case and pre- and
24362post-fixed with @samp{__}.  This in turn is used by the
24363@file{msp430.h} header file to select an MCU-specific supplementary
24364header file.
24365
24366The option also sets the ISA to use.  If the MCU name is one that is
24367known to only support the 430 ISA then that is selected, otherwise the
24368430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
24369used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
24370name selects the 430X ISA.
24371
24372In addition an MCU-specific linker script is added to the linker
24373command line.  The script's name is the name of the MCU with
24374@file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24375command line defines the C preprocessor symbol @code{__XXX__} and
24376cause the linker to search for a script called @file{xxx.ld}.
24377
24378The ISA and hardware multiply supported for the different MCUs is hard-coded
24379into GCC.  However, an external @samp{devices.csv} file can be used to
24380extend device support beyond those that have been hard-coded.
24381
24382GCC searches for the @samp{devices.csv} file using the following methods in the
24383given precedence order, where the first method takes precendence over the
24384second which takes precedence over the third.
24385
24386@table @asis
24387@item Include path specified with @code{-I} and @code{-L}
24388@samp{devices.csv} will be searched for in each of the directories specified by
24389include paths and linker library search paths.
24390@item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24391Define the value of the global environment variable
24392@samp{MSP430_GCC_INCLUDE_DIR}
24393to the full path to the directory containing devices.csv, and GCC will search
24394this directory for devices.csv.  If devices.csv is found, this directory will
24395also be registered as an include path, and linker library path.  Header files
24396and linker scripts in this directory can therefore be used without manually
24397specifying @code{-I} and @code{-L} on the command line.
24398@item The @samp{msp430-elf@{,bare@}/include/devices} directory
24399Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24400toolchain root directory.  This directory does not exist in a default
24401installation, but if the user has created it and copied @samp{devices.csv}
24402there, then the MCU data will be read.  As above, this directory will
24403also be registered as an include path, and linker library path.
24404
24405@end table
24406If none of the above search methods find @samp{devices.csv}, then the
24407hard-coded MCU data is used.
24408
24409
24410@item -mwarn-mcu
24411@itemx -mno-warn-mcu
24412@opindex mwarn-mcu
24413@opindex mno-warn-mcu
24414This option enables or disables warnings about conflicts between the
24415MCU name specified by the @option{-mmcu} option and the ISA set by the
24416@option{-mcpu} option and/or the hardware multiply support set by the
24417@option{-mhwmult} option.  It also toggles warnings about unrecognized
24418MCU names.  This option is on by default.
24419
24420@item -mcpu=
24421@opindex mcpu=
24422Specifies the ISA to use.  Accepted values are @samp{msp430},
24423@samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
24424@option{-mmcu=} option should be used to select the ISA.
24425
24426@item -msim
24427@opindex msim
24428Link to the simulator runtime libraries and linker script.  Overrides
24429any scripts that would be selected by the @option{-mmcu=} option.
24430
24431@item -mlarge
24432@opindex mlarge
24433Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24434
24435@item -msmall
24436@opindex msmall
24437Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24438
24439@item -mrelax
24440@opindex mrelax
24441This option is passed to the assembler and linker, and allows the
24442linker to perform certain optimizations that cannot be done until
24443the final link.
24444
24445@item mhwmult=
24446@opindex mhwmult=
24447Describes the type of hardware multiply supported by the target.
24448Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24449for the original 16-bit-only multiply supported by early MCUs.
24450@samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24451@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24452A value of @samp{auto} can also be given.  This tells GCC to deduce
24453the hardware multiply support based upon the MCU name provided by the
24454@option{-mmcu} option.  If no @option{-mmcu} option is specified or if
24455the MCU name is not recognized then no hardware multiply support is
24456assumed.  @code{auto} is the default setting.
24457
24458Hardware multiplies are normally performed by calling a library
24459routine.  This saves space in the generated code.  When compiling at
24460@option{-O3} or higher however the hardware multiplier is invoked
24461inline.  This makes for bigger, but faster code.
24462
24463The hardware multiply routines disable interrupts whilst running and
24464restore the previous interrupt state when they finish.  This makes
24465them safe to use inside interrupt handlers as well as in normal code.
24466
24467@item -minrt
24468@opindex minrt
24469Enable the use of a minimum runtime environment - no static
24470initializers or constructors.  This is intended for memory-constrained
24471devices.  The compiler includes special symbols in some objects
24472that tell the linker and runtime which code fragments are required.
24473
24474@item -mtiny-printf
24475@opindex mtiny-printf
24476Enable reduced code size @code{printf} and @code{puts} library functions.
24477The @samp{tiny} implementations of these functions are not reentrant, so
24478must be used with caution in multi-threaded applications.
24479
24480Support for streams has been removed and the string to be printed will
24481always be sent to stdout via the @code{write} syscall.  The string is not
24482buffered before it is sent to write.
24483
24484This option requires Newlib Nano IO, so GCC must be configured with
24485@samp{--enable-newlib-nano-formatted-io}.
24486
24487@item -mcode-region=
24488@itemx -mdata-region=
24489@opindex mcode-region
24490@opindex mdata-region
24491These options tell the compiler where to place functions and data that
24492do not have one of the @code{lower}, @code{upper}, @code{either} or
24493@code{section} attributes.  Possible values are @code{lower},
24494@code{upper}, @code{either} or @code{any}.  The first three behave
24495like the corresponding attribute.  The fourth possible value -
24496@code{any} - is the default.  It leaves placement entirely up to the
24497linker script and how it assigns the standard sections
24498(@code{.text}, @code{.data}, etc) to the memory regions.
24499
24500@item -msilicon-errata=
24501@opindex msilicon-errata
24502This option passes on a request to assembler to enable the fixes for
24503the named silicon errata.
24504
24505@item -msilicon-errata-warn=
24506@opindex msilicon-errata-warn
24507This option passes on a request to the assembler to enable warning
24508messages when a silicon errata might need to be applied.
24509
24510@item -mwarn-devices-csv
24511@itemx -mno-warn-devices-csv
24512@opindex mwarn-devices-csv
24513@opindex mno-warn-devices-csv
24514Warn if @samp{devices.csv} is not found or there are problem parsing it
24515(default: on).
24516
24517@end table
24518
24519@node NDS32 Options
24520@subsection NDS32 Options
24521@cindex NDS32 Options
24522
24523These options are defined for NDS32 implementations:
24524
24525@table @gcctabopt
24526
24527@item -mbig-endian
24528@opindex mbig-endian
24529Generate code in big-endian mode.
24530
24531@item -mlittle-endian
24532@opindex mlittle-endian
24533Generate code in little-endian mode.
24534
24535@item -mreduced-regs
24536@opindex mreduced-regs
24537Use reduced-set registers for register allocation.
24538
24539@item -mfull-regs
24540@opindex mfull-regs
24541Use full-set registers for register allocation.
24542
24543@item -mcmov
24544@opindex mcmov
24545Generate conditional move instructions.
24546
24547@item -mno-cmov
24548@opindex mno-cmov
24549Do not generate conditional move instructions.
24550
24551@item -mext-perf
24552@opindex mext-perf
24553Generate performance extension instructions.
24554
24555@item -mno-ext-perf
24556@opindex mno-ext-perf
24557Do not generate performance extension instructions.
24558
24559@item -mext-perf2
24560@opindex mext-perf2
24561Generate performance extension 2 instructions.
24562
24563@item -mno-ext-perf2
24564@opindex mno-ext-perf2
24565Do not generate performance extension 2 instructions.
24566
24567@item -mext-string
24568@opindex mext-string
24569Generate string extension instructions.
24570
24571@item -mno-ext-string
24572@opindex mno-ext-string
24573Do not generate string extension instructions.
24574
24575@item -mv3push
24576@opindex mv3push
24577Generate v3 push25/pop25 instructions.
24578
24579@item -mno-v3push
24580@opindex mno-v3push
24581Do not generate v3 push25/pop25 instructions.
24582
24583@item -m16-bit
24584@opindex m16-bit
24585Generate 16-bit instructions.
24586
24587@item -mno-16-bit
24588@opindex mno-16-bit
24589Do not generate 16-bit instructions.
24590
24591@item -misr-vector-size=@var{num}
24592@opindex misr-vector-size
24593Specify the size of each interrupt vector, which must be 4 or 16.
24594
24595@item -mcache-block-size=@var{num}
24596@opindex mcache-block-size
24597Specify the size of each cache block,
24598which must be a power of 2 between 4 and 512.
24599
24600@item -march=@var{arch}
24601@opindex march
24602Specify the name of the target architecture.
24603
24604@item -mcmodel=@var{code-model}
24605@opindex mcmodel
24606Set the code model to one of
24607@table @asis
24608@item @samp{small}
24609All the data and read-only data segments must be within 512KB addressing space.
24610The text segment must be within 16MB addressing space.
24611@item @samp{medium}
24612The data segment must be within 512KB while the read-only data segment can be
24613within 4GB addressing space.  The text segment should be still within 16MB
24614addressing space.
24615@item @samp{large}
24616All the text and data segments can be within 4GB addressing space.
24617@end table
24618
24619@item -mctor-dtor
24620@opindex mctor-dtor
24621Enable constructor/destructor feature.
24622
24623@item -mrelax
24624@opindex mrelax
24625Guide linker to relax instructions.
24626
24627@end table
24628
24629@node Nios II Options
24630@subsection Nios II Options
24631@cindex Nios II options
24632@cindex Altera Nios II options
24633
24634These are the options defined for the Altera Nios II processor.
24635
24636@table @gcctabopt
24637
24638@item -G @var{num}
24639@opindex G
24640@cindex smaller data references
24641Put global and static objects less than or equal to @var{num} bytes
24642into the small data or BSS sections instead of the normal data or BSS
24643sections.  The default value of @var{num} is 8.
24644
24645@item -mgpopt=@var{option}
24646@itemx -mgpopt
24647@itemx -mno-gpopt
24648@opindex mgpopt
24649@opindex mno-gpopt
24650Generate (do not generate) GP-relative accesses.  The following
24651@var{option} names are recognized:
24652
24653@table @samp
24654
24655@item none
24656Do not generate GP-relative accesses.
24657
24658@item local
24659Generate GP-relative accesses for small data objects that are not
24660external, weak, or uninitialized common symbols.
24661Also use GP-relative addressing for objects that
24662have been explicitly placed in a small data section via a @code{section}
24663attribute.
24664
24665@item global
24666As for @samp{local}, but also generate GP-relative accesses for
24667small data objects that are external, weak, or common.  If you use this option,
24668you must ensure that all parts of your program (including libraries) are
24669compiled with the same @option{-G} setting.
24670
24671@item data
24672Generate GP-relative accesses for all data objects in the program.  If you
24673use this option, the entire data and BSS segments
24674of your program must fit in 64K of memory and you must use an appropriate
24675linker script to allocate them within the addressable range of the
24676global pointer.
24677
24678@item all
24679Generate GP-relative addresses for function pointers as well as data
24680pointers.  If you use this option, the entire text, data, and BSS segments
24681of your program must fit in 64K of memory and you must use an appropriate
24682linker script to allocate them within the addressable range of the
24683global pointer.
24684
24685@end table
24686
24687@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24688@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24689
24690The default is @option{-mgpopt} except when @option{-fpic} or
24691@option{-fPIC} is specified to generate position-independent code.
24692Note that the Nios II ABI does not permit GP-relative accesses from
24693shared libraries.
24694
24695You may need to specify @option{-mno-gpopt} explicitly when building
24696programs that include large amounts of small data, including large
24697GOT data sections.  In this case, the 16-bit offset for GP-relative
24698addressing may not be large enough to allow access to the entire
24699small data section.
24700
24701@item -mgprel-sec=@var{regexp}
24702@opindex mgprel-sec
24703This option specifies additional section names that can be accessed via
24704GP-relative addressing.  It is most useful in conjunction with
24705@code{section} attributes on variable declarations
24706(@pxref{Common Variable Attributes}) and a custom linker script.
24707The @var{regexp} is a POSIX Extended Regular Expression.
24708
24709This option does not affect the behavior of the @option{-G} option, and
24710the specified sections are in addition to the standard @code{.sdata}
24711and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24712
24713@item -mr0rel-sec=@var{regexp}
24714@opindex mr0rel-sec
24715This option specifies names of sections that can be accessed via a
2471616-bit offset from @code{r0}; that is, in the low 32K or high 32K
24717of the 32-bit address space.  It is most useful in conjunction with
24718@code{section} attributes on variable declarations
24719(@pxref{Common Variable Attributes}) and a custom linker script.
24720The @var{regexp} is a POSIX Extended Regular Expression.
24721
24722In contrast to the use of GP-relative addressing for small data,
24723zero-based addressing is never generated by default and there are no
24724conventional section names used in standard linker scripts for sections
24725in the low or high areas of memory.
24726
24727@item -mel
24728@itemx -meb
24729@opindex mel
24730@opindex meb
24731Generate little-endian (default) or big-endian (experimental) code,
24732respectively.
24733
24734@item -march=@var{arch}
24735@opindex march
24736This specifies the name of the target Nios II architecture.  GCC uses this
24737name to determine what kind of instructions it can emit when generating
24738assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
24739
24740The preprocessor macro @code{__nios2_arch__} is available to programs,
24741with value 1 or 2, indicating the targeted ISA level.
24742
24743@item -mbypass-cache
24744@itemx -mno-bypass-cache
24745@opindex mno-bypass-cache
24746@opindex mbypass-cache
24747Force all load and store instructions to always bypass cache by
24748using I/O variants of the instructions. The default is not to
24749bypass the cache.
24750
24751@item -mno-cache-volatile
24752@itemx -mcache-volatile
24753@opindex mcache-volatile
24754@opindex mno-cache-volatile
24755Volatile memory access bypass the cache using the I/O variants of
24756the load and store instructions. The default is not to bypass the cache.
24757
24758@item -mno-fast-sw-div
24759@itemx -mfast-sw-div
24760@opindex mno-fast-sw-div
24761@opindex mfast-sw-div
24762Do not use table-based fast divide for small numbers. The default
24763is to use the fast divide at @option{-O3} and above.
24764
24765@item -mno-hw-mul
24766@itemx -mhw-mul
24767@itemx -mno-hw-mulx
24768@itemx -mhw-mulx
24769@itemx -mno-hw-div
24770@itemx -mhw-div
24771@opindex mno-hw-mul
24772@opindex mhw-mul
24773@opindex mno-hw-mulx
24774@opindex mhw-mulx
24775@opindex mno-hw-div
24776@opindex mhw-div
24777Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
24778instructions by the compiler. The default is to emit @code{mul}
24779and not emit @code{div} and @code{mulx}.
24780
24781@item -mbmx
24782@itemx -mno-bmx
24783@itemx -mcdx
24784@itemx -mno-cdx
24785Enable or disable generation of Nios II R2 BMX (bit manipulation) and
24786CDX (code density) instructions.  Enabling these instructions also
24787requires @option{-march=r2}.  Since these instructions are optional
24788extensions to the R2 architecture, the default is not to emit them.
24789
24790@item -mcustom-@var{insn}=@var{N}
24791@itemx -mno-custom-@var{insn}
24792@opindex mcustom-@var{insn}
24793@opindex mno-custom-@var{insn}
24794Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
24795custom instruction with encoding @var{N} when generating code that uses
24796@var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
24797instruction 253 for single-precision floating-point add operations instead
24798of the default behavior of using a library call.
24799
24800The following values of @var{insn} are supported.  Except as otherwise
24801noted, floating-point operations are expected to be implemented with
24802normal IEEE 754 semantics and correspond directly to the C operators or the
24803equivalent GCC built-in functions (@pxref{Other Builtins}).
24804
24805Single-precision floating point:
24806@table @asis
24807
24808@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
24809Binary arithmetic operations.
24810
24811@item @samp{fnegs}
24812Unary negation.
24813
24814@item @samp{fabss}
24815Unary absolute value.
24816
24817@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
24818Comparison operations.
24819
24820@item @samp{fmins}, @samp{fmaxs}
24821Floating-point minimum and maximum.  These instructions are only
24822generated if @option{-ffinite-math-only} is specified.
24823
24824@item @samp{fsqrts}
24825Unary square root operation.
24826
24827@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
24828Floating-point trigonometric and exponential functions.  These instructions
24829are only generated if @option{-funsafe-math-optimizations} is also specified.
24830
24831@end table
24832
24833Double-precision floating point:
24834@table @asis
24835
24836@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
24837Binary arithmetic operations.
24838
24839@item @samp{fnegd}
24840Unary negation.
24841
24842@item @samp{fabsd}
24843Unary absolute value.
24844
24845@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
24846Comparison operations.
24847
24848@item @samp{fmind}, @samp{fmaxd}
24849Double-precision minimum and maximum.  These instructions are only
24850generated if @option{-ffinite-math-only} is specified.
24851
24852@item @samp{fsqrtd}
24853Unary square root operation.
24854
24855@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
24856Double-precision trigonometric and exponential functions.  These instructions
24857are only generated if @option{-funsafe-math-optimizations} is also specified.
24858
24859@end table
24860
24861Conversions:
24862@table @asis
24863@item @samp{fextsd}
24864Conversion from single precision to double precision.
24865
24866@item @samp{ftruncds}
24867Conversion from double precision to single precision.
24868
24869@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
24870Conversion from floating point to signed or unsigned integer types, with
24871truncation towards zero.
24872
24873@item @samp{round}
24874Conversion from single-precision floating point to signed integer,
24875rounding to the nearest integer and ties away from zero.
24876This corresponds to the @code{__builtin_lroundf} function when
24877@option{-fno-math-errno} is used.
24878
24879@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
24880Conversion from signed or unsigned integer types to floating-point types.
24881
24882@end table
24883
24884In addition, all of the following transfer instructions for internal
24885registers X and Y must be provided to use any of the double-precision
24886floating-point instructions.  Custom instructions taking two
24887double-precision source operands expect the first operand in the
2488864-bit register X.  The other operand (or only operand of a unary
24889operation) is given to the custom arithmetic instruction with the
24890least significant half in source register @var{src1} and the most
24891significant half in @var{src2}.  A custom instruction that returns a
24892double-precision result returns the most significant 32 bits in the
24893destination register and the other half in 32-bit register Y.
24894GCC automatically generates the necessary code sequences to write
24895register X and/or read register Y when double-precision floating-point
24896instructions are used.
24897
24898@table @asis
24899
24900@item @samp{fwrx}
24901Write @var{src1} into the least significant half of X and @var{src2} into
24902the most significant half of X.
24903
24904@item @samp{fwry}
24905Write @var{src1} into Y.
24906
24907@item @samp{frdxhi}, @samp{frdxlo}
24908Read the most or least (respectively) significant half of X and store it in
24909@var{dest}.
24910
24911@item @samp{frdy}
24912Read the value of Y and store it into @var{dest}.
24913@end table
24914
24915Note that you can gain more local control over generation of Nios II custom
24916instructions by using the @code{target("custom-@var{insn}=@var{N}")}
24917and @code{target("no-custom-@var{insn}")} function attributes
24918(@pxref{Function Attributes})
24919or pragmas (@pxref{Function Specific Option Pragmas}).
24920
24921@item -mcustom-fpu-cfg=@var{name}
24922@opindex mcustom-fpu-cfg
24923
24924This option enables a predefined, named set of custom instruction encodings
24925(see @option{-mcustom-@var{insn}} above).
24926Currently, the following sets are defined:
24927
24928@option{-mcustom-fpu-cfg=60-1} is equivalent to:
24929@gccoptlist{-mcustom-fmuls=252 @gol
24930-mcustom-fadds=253 @gol
24931-mcustom-fsubs=254 @gol
24932-fsingle-precision-constant}
24933
24934@option{-mcustom-fpu-cfg=60-2} is equivalent to:
24935@gccoptlist{-mcustom-fmuls=252 @gol
24936-mcustom-fadds=253 @gol
24937-mcustom-fsubs=254 @gol
24938-mcustom-fdivs=255 @gol
24939-fsingle-precision-constant}
24940
24941@option{-mcustom-fpu-cfg=72-3} is equivalent to:
24942@gccoptlist{-mcustom-floatus=243 @gol
24943-mcustom-fixsi=244 @gol
24944-mcustom-floatis=245 @gol
24945-mcustom-fcmpgts=246 @gol
24946-mcustom-fcmples=249 @gol
24947-mcustom-fcmpeqs=250 @gol
24948-mcustom-fcmpnes=251 @gol
24949-mcustom-fmuls=252 @gol
24950-mcustom-fadds=253 @gol
24951-mcustom-fsubs=254 @gol
24952-mcustom-fdivs=255 @gol
24953-fsingle-precision-constant}
24954
24955Custom instruction assignments given by individual
24956@option{-mcustom-@var{insn}=} options override those given by
24957@option{-mcustom-fpu-cfg=}, regardless of the
24958order of the options on the command line.
24959
24960Note that you can gain more local control over selection of a FPU
24961configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
24962function attribute (@pxref{Function Attributes})
24963or pragma (@pxref{Function Specific Option Pragmas}).
24964
24965@end table
24966
24967These additional @samp{-m} options are available for the Altera Nios II
24968ELF (bare-metal) target:
24969
24970@table @gcctabopt
24971
24972@item -mhal
24973@opindex mhal
24974Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
24975startup and termination code, and is typically used in conjunction with
24976@option{-msys-crt0=} to specify the location of the alternate startup code
24977provided by the HAL BSP.
24978
24979@item -msmallc
24980@opindex msmallc
24981Link with a limited version of the C library, @option{-lsmallc}, rather than
24982Newlib.
24983
24984@item -msys-crt0=@var{startfile}
24985@opindex msys-crt0
24986@var{startfile} is the file name of the startfile (crt0) to use
24987when linking.  This option is only useful in conjunction with @option{-mhal}.
24988
24989@item -msys-lib=@var{systemlib}
24990@opindex msys-lib
24991@var{systemlib} is the library name of the library that provides
24992low-level system calls required by the C library,
24993e.g.@: @code{read} and @code{write}.
24994This option is typically used to link with a library provided by a HAL BSP.
24995
24996@end table
24997
24998@node Nvidia PTX Options
24999@subsection Nvidia PTX Options
25000@cindex Nvidia PTX options
25001@cindex nvptx options
25002
25003These options are defined for Nvidia PTX:
25004
25005@table @gcctabopt
25006
25007@item -m32
25008@itemx -m64
25009@opindex m32
25010@opindex m64
25011Generate code for 32-bit or 64-bit ABI.
25012
25013@item -misa=@var{ISA-string}
25014@opindex march
25015Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
25016strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
25017@samp{sm_35}.  The default ISA is sm_30.
25018
25019@item -mmainkernel
25020@opindex mmainkernel
25021Link in code for a __main kernel.  This is for stand-alone instead of
25022offloading execution.
25023
25024@item -moptimize
25025@opindex moptimize
25026Apply partitioned execution optimizations.  This is the default when any
25027level of optimization is selected.
25028
25029@item -msoft-stack
25030@opindex msoft-stack
25031Generate code that does not use @code{.local} memory
25032directly for stack storage. Instead, a per-warp stack pointer is
25033maintained explicitly. This enables variable-length stack allocation (with
25034variable-length arrays or @code{alloca}), and when global memory is used for
25035underlying storage, makes it possible to access automatic variables from other
25036threads, or with atomic instructions. This code generation variant is used
25037for OpenMP offloading, but the option is exposed on its own for the purpose
25038of testing the compiler; to generate code suitable for linking into programs
25039using OpenMP offloading, use option @option{-mgomp}.
25040
25041@item -muniform-simt
25042@opindex muniform-simt
25043Switch to code generation variant that allows to execute all threads in each
25044warp, while maintaining memory state and side effects as if only one thread
25045in each warp was active outside of OpenMP SIMD regions.  All atomic operations
25046and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
25047current lane index equals the master lane index), and the register being
25048assigned is copied via a shuffle instruction from the master lane.  Outside of
25049SIMD regions lane 0 is the master; inside, each thread sees itself as the
25050master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
25051all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
25052regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
25053with current lane index to compute the master lane index.
25054
25055@item -mgomp
25056@opindex mgomp
25057Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
25058@option{-muniform-simt} options, and selects corresponding multilib variant.
25059
25060@end table
25061
25062@node OpenRISC Options
25063@subsection OpenRISC Options
25064@cindex OpenRISC Options
25065
25066These options are defined for OpenRISC:
25067
25068@table @gcctabopt
25069
25070@item -mboard=@var{name}
25071@opindex mboard
25072Configure a board specific runtime.  This will be passed to the linker for
25073newlib board library linking.  The default is @code{or1ksim}.
25074
25075@item -mnewlib
25076@opindex mnewlib
25077This option is ignored; it is for compatibility purposes only.  This used to
25078select linker and preprocessor options for use with newlib.
25079
25080@item -msoft-div
25081@itemx -mhard-div
25082@opindex msoft-div
25083@opindex mhard-div
25084Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
25085This default is hardware divide.
25086
25087@item -msoft-mul
25088@itemx -mhard-mul
25089@opindex msoft-mul
25090@opindex mhard-mul
25091Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
25092This default is hardware multiply.
25093
25094@item -msoft-float
25095@itemx -mhard-float
25096@opindex msoft-float
25097@opindex mhard-float
25098Select software or hardware for floating point operations.
25099The default is software.
25100
25101@item -mdouble-float
25102@opindex mdouble-float
25103When @option{-mhard-float} is selected, enables generation of double-precision
25104floating point instructions.  By default functions from @file{libgcc} are used
25105to perform double-precision floating point operations.
25106
25107@item -munordered-float
25108@opindex munordered-float
25109When @option{-mhard-float} is selected, enables generation of unordered
25110floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
25111functions from @file{libgcc} are used to perform unordered floating point
25112compare and set flag operations.
25113
25114@item -mcmov
25115@opindex mcmov
25116Enable generation of conditional move (@code{l.cmov}) instructions.  By
25117default the equivalent will be generated using set and branch.
25118
25119@item -mror
25120@opindex mror
25121Enable generation of rotate right (@code{l.ror}) instructions.  By default
25122functions from @file{libgcc} are used to perform rotate right operations.
25123
25124@item -mrori
25125@opindex mrori
25126Enable generation of rotate right with immediate (@code{l.rori}) instructions.
25127By default functions from @file{libgcc} are used to perform rotate right with
25128immediate operations.
25129
25130@item -msext
25131@opindex msext
25132Enable generation of sign extension (@code{l.ext*}) instructions.  By default
25133memory loads are used to perform sign extension.
25134
25135@item -msfimm
25136@opindex msfimm
25137Enable generation of compare and set flag with immediate (@code{l.sf*i})
25138instructions.  By default extra instructions will be generated to store the
25139immediate to a register first.
25140
25141@item -mshftimm
25142@opindex mshftimm
25143Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
25144@code{l.slli}) instructions.  By default extra instructions will be generated
25145to store the immediate to a register first.
25146
25147
25148@end table
25149
25150@node PDP-11 Options
25151@subsection PDP-11 Options
25152@cindex PDP-11 Options
25153
25154These options are defined for the PDP-11:
25155
25156@table @gcctabopt
25157@item -mfpu
25158@opindex mfpu
25159Use hardware FPP floating point.  This is the default.  (FIS floating
25160point on the PDP-11/40 is not supported.)  Implies -m45.
25161
25162@item -msoft-float
25163@opindex msoft-float
25164Do not use hardware floating point.
25165
25166@item -mac0
25167@opindex mac0
25168Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25169
25170@item -mno-ac0
25171@opindex mno-ac0
25172Return floating-point results in memory.  This is the default.
25173
25174@item -m40
25175@opindex m40
25176Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
25177
25178@item -m45
25179@opindex m45
25180Generate code for a PDP-11/45.  This is the default.
25181
25182@item -m10
25183@opindex m10
25184Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
25185
25186@item -mint16
25187@itemx -mno-int32
25188@opindex mint16
25189@opindex mno-int32
25190Use 16-bit @code{int}.  This is the default.
25191
25192@item -mint32
25193@itemx -mno-int16
25194@opindex mint32
25195@opindex mno-int16
25196Use 32-bit @code{int}.
25197
25198@item -msplit
25199@opindex msplit
25200Target has split instruction and data space.  Implies -m45.
25201
25202@item -munix-asm
25203@opindex munix-asm
25204Use Unix assembler syntax.
25205
25206@item -mdec-asm
25207@opindex mdec-asm
25208Use DEC assembler syntax.
25209
25210@item -mgnu-asm
25211@opindex mgnu-asm
25212Use GNU assembler syntax.  This is the default.
25213
25214@item -mlra
25215@opindex mlra
25216Use the new LRA register allocator.  By default, the old ``reload''
25217allocator is used.
25218@end table
25219
25220@node picoChip Options
25221@subsection picoChip Options
25222@cindex picoChip options
25223
25224These @samp{-m} options are defined for picoChip implementations:
25225
25226@table @gcctabopt
25227
25228@item -mae=@var{ae_type}
25229@opindex mcpu
25230Set the instruction set, register set, and instruction scheduling
25231parameters for array element type @var{ae_type}.  Supported values
25232for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25233
25234@option{-mae=ANY} selects a completely generic AE type.  Code
25235generated with this option runs on any of the other AE types.  The
25236code is not as efficient as it would be if compiled for a specific
25237AE type, and some types of operation (e.g., multiplication) do not
25238work properly on all types of AE.
25239
25240@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
25241for compiled code, and is the default.
25242
25243@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
25244option may suffer from poor performance of byte (char) manipulation,
25245since the DSP AE does not provide hardware support for byte load/stores.
25246
25247@item -msymbol-as-address
25248Enable the compiler to directly use a symbol name as an address in a
25249load/store instruction, without first loading it into a
25250register.  Typically, the use of this option generates larger
25251programs, which run faster than when the option isn't used.  However, the
25252results vary from program to program, so it is left as a user option,
25253rather than being permanently enabled.
25254
25255@item -mno-inefficient-warnings
25256Disables warnings about the generation of inefficient code.  These
25257warnings can be generated, for example, when compiling code that
25258performs byte-level memory operations on the MAC AE type.  The MAC AE has
25259no hardware support for byte-level memory operations, so all byte
25260load/stores must be synthesized from word load/store operations.  This is
25261inefficient and a warning is generated to indicate
25262that you should rewrite the code to avoid byte operations, or to target
25263an AE type that has the necessary hardware support.  This option disables
25264these warnings.
25265
25266@end table
25267
25268@node PowerPC Options
25269@subsection PowerPC Options
25270@cindex PowerPC options
25271
25272These are listed under @xref{RS/6000 and PowerPC Options}.
25273
25274@node PRU Options
25275@subsection PRU Options
25276@cindex PRU Options
25277
25278These command-line options are defined for PRU target:
25279
25280@table @gcctabopt
25281@item -minrt
25282@opindex minrt
25283Link with a minimum runtime environment, with no support for static
25284initializers and constructors.  Using this option can significantly reduce
25285the size of the final ELF binary.  Beware that the compiler could still
25286generate code with static initializers and constructors.  It is up to the
25287programmer to ensure that the source program will not use those features.
25288
25289@item -mmcu=@var{mcu}
25290@opindex mmcu
25291Specify the PRU MCU variant to use.  Check Newlib for the exact list of
25292supported MCUs.
25293
25294@item -mno-relax
25295@opindex mno-relax
25296Make GCC pass the @option{--no-relax} command-line option to the linker
25297instead of the @option{--relax} option.
25298
25299@item -mloop
25300@opindex mloop
25301Allow (or do not allow) GCC to use the LOOP instruction.
25302
25303@item -mabi=@var{variant}
25304@opindex mabi
25305Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
25306unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25307more naturally with certain GCC assumptions.  These are the differences:
25308
25309@table @samp
25310@item Function Pointer Size
25311TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25312supports only 32-bit data and code pointers.
25313
25314@item Optional Return Value Pointer
25315Function return values larger than 64 bits are passed by using a hidden
25316pointer as the first argument of the function.  TI ABI, though, mandates that
25317the pointer can be NULL in case the caller is not using the returned value.
25318GNU always passes and expects a valid return value pointer.
25319
25320@end table
25321
25322The current @option{-mabi=ti} implementation simply raises a compile error
25323when any of the above code constructs is detected.  As a consequence
25324the standard C library cannot be built and it is omitted when linking with
25325@option{-mabi=ti}.
25326
25327Relaxation is a GNU feature and for safety reasons is disabled when using
25328@option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
25329instructions, so the GNU linker cannot adjust them when shortening adjacent
25330LDI32 pseudo instructions.
25331
25332@end table
25333
25334@node RISC-V Options
25335@subsection RISC-V Options
25336@cindex RISC-V Options
25337
25338These command-line options are defined for RISC-V targets:
25339
25340@table @gcctabopt
25341@item -mbranch-cost=@var{n}
25342@opindex mbranch-cost
25343Set the cost of branches to roughly @var{n} instructions.
25344
25345@item -mplt
25346@itemx -mno-plt
25347@opindex plt
25348When generating PIC code, do or don't allow the use of PLTs. Ignored for
25349non-PIC.  The default is @option{-mplt}.
25350
25351@item -mabi=@var{ABI-string}
25352@opindex mabi
25353Specify integer and floating-point calling convention.  @var{ABI-string}
25354contains two parts: the size of integer types and the registers used for
25355floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
25356@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
2535732-bit), and that floating-point values up to 64 bits wide are passed in F
25358registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25359allows the compiler to generate code that uses the F and D extensions but only
25360allows floating-point values up to 32 bits long to be passed in registers; or
25361@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25362passed in registers.
25363
25364The default for this argument is system dependent, users who want a specific
25365calling convention should specify one explicitly.  The valid calling
25366conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25367@samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
25368implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25369invalid because the ABI requires 64-bit values be passed in F registers, but F
25370registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
25371only be used with the @samp{rv32e} architecture.  This ABI is not well
25372specified at present, and is subject to change.
25373
25374@item -mfdiv
25375@itemx -mno-fdiv
25376@opindex mfdiv
25377Do or don't use hardware floating-point divide and square root instructions.
25378This requires the F or D extensions for floating-point registers.  The default
25379is to use them if the specified architecture has these instructions.
25380
25381@item -mdiv
25382@itemx -mno-div
25383@opindex mdiv
25384Do or don't use hardware instructions for integer division.  This requires the
25385M extension.  The default is to use them if the specified architecture has
25386these instructions.
25387
25388@item -march=@var{ISA-string}
25389@opindex march
25390Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
25391lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25392@samp{rv32imaf}.
25393
25394@item -mtune=@var{processor-string}
25395@opindex mtune
25396Optimize the output for the given processor, specified by microarchitecture
25397name.  Permissible values for this option are: @samp{rocket},
25398@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25399and @samp{size}.
25400
25401When @option{-mtune=} is not specified, the default is @samp{rocket}.
25402
25403The @samp{size} choice is not intended for use by end-users.  This is used
25404when @option{-Os} is specified.  It overrides the instruction cost info
25405provided by @option{-mtune=}, but does not override the pipeline info.  This
25406helps reduce code size while still giving good performance.
25407
25408@item -mpreferred-stack-boundary=@var{num}
25409@opindex mpreferred-stack-boundary
25410Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25411byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
25412the default is 4 (16 bytes or 128-bits).
25413
25414@strong{Warning:} If you use this switch, then you must build all modules with
25415the same value, including any libraries.  This includes the system libraries
25416and startup modules.
25417
25418@item -msmall-data-limit=@var{n}
25419@opindex msmall-data-limit
25420Put global and static data smaller than @var{n} bytes into a special section
25421(on some targets).
25422
25423@item -msave-restore
25424@itemx -mno-save-restore
25425@opindex msave-restore
25426Do or don't use smaller but slower prologue and epilogue code that uses
25427library function calls.  The default is to use fast inline prologues and
25428epilogues.
25429
25430@item -mstrict-align
25431@itemx -mno-strict-align
25432@opindex mstrict-align
25433Do not or do generate unaligned memory accesses.  The default is set depending
25434on whether the processor we are optimizing for supports fast unaligned access
25435or not.
25436
25437@item -mcmodel=medlow
25438@opindex mcmodel=medlow
25439Generate code for the medium-low code model. The program and its statically
25440defined symbols must lie within a single 2 GiB address range and must lie
25441between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25442statically or dynamically linked. This is the default code model.
25443
25444@item -mcmodel=medany
25445@opindex mcmodel=medany
25446Generate code for the medium-any code model. The program and its statically
25447defined symbols must be within any single 2 GiB address range. Programs can be
25448statically or dynamically linked.
25449
25450@item -mexplicit-relocs
25451@itemx -mno-exlicit-relocs
25452Use or do not use assembler relocation operators when dealing with symbolic
25453addresses.  The alternative is to use assembler macros instead, which may
25454limit optimization.
25455
25456@item -mrelax
25457@itemx -mno-relax
25458Take advantage of linker relaxations to reduce the number of instructions
25459required to materialize symbol addresses. The default is to take advantage of
25460linker relaxations.
25461
25462@item -memit-attribute
25463@itemx -mno-emit-attribute
25464Emit (do not emit) RISC-V attribute to record extra information into ELF
25465objects.  This feature requires at least binutils 2.32.
25466
25467@item -malign-data=@var{type}
25468@opindex malign-data
25469Control how GCC aligns variables and constants of array, structure, or union
25470types.  Supported values for @var{type} are @samp{xlen} which uses x register
25471width as the alignment value, and @samp{natural} which uses natural alignment.
25472@samp{xlen} is the default.
25473@end table
25474
25475@node RL78 Options
25476@subsection RL78 Options
25477@cindex RL78 Options
25478
25479@table @gcctabopt
25480
25481@item -msim
25482@opindex msim
25483Links in additional target libraries to support operation within a
25484simulator.
25485
25486@item -mmul=none
25487@itemx -mmul=g10
25488@itemx -mmul=g13
25489@itemx -mmul=g14
25490@itemx -mmul=rl78
25491@opindex mmul
25492Specifies the type of hardware multiplication and division support to
25493be used.  The simplest is @code{none}, which uses software for both
25494multiplication and division.  This is the default.  The @code{g13}
25495value is for the hardware multiply/divide peripheral found on the
25496RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
25497the multiplication and division instructions supported by the RL78/G14
25498(S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
25499the value @code{mg10} is an alias for @code{none}.
25500
25501In addition a C preprocessor macro is defined, based upon the setting
25502of this option.  Possible values are: @code{__RL78_MUL_NONE__},
25503@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25504
25505@item -mcpu=g10
25506@itemx -mcpu=g13
25507@itemx -mcpu=g14
25508@itemx -mcpu=rl78
25509@opindex mcpu
25510Specifies the RL78 core to target.  The default is the G14 core, also
25511known as an S3 core or just RL78.  The G13 or S2 core does not have
25512multiply or divide instructions, instead it uses a hardware peripheral
25513for these operations.  The G10 or S1 core does not have register
25514banks, so it uses a different calling convention.
25515
25516If this option is set it also selects the type of hardware multiply
25517support to use, unless this is overridden by an explicit
25518@option{-mmul=none} option on the command line.  Thus specifying
25519@option{-mcpu=g13} enables the use of the G13 hardware multiply
25520peripheral and specifying @option{-mcpu=g10} disables the use of
25521hardware multiplications altogether.
25522
25523Note, although the RL78/G14 core is the default target, specifying
25524@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25525change the behavior of the toolchain since it also enables G14
25526hardware multiply support.  If these options are not specified on the
25527command line then software multiplication routines will be used even
25528though the code targets the RL78 core.  This is for backwards
25529compatibility with older toolchains which did not have hardware
25530multiply and divide support.
25531
25532In addition a C preprocessor macro is defined, based upon the setting
25533of this option.  Possible values are: @code{__RL78_G10__},
25534@code{__RL78_G13__} or @code{__RL78_G14__}.
25535
25536@item -mg10
25537@itemx -mg13
25538@itemx -mg14
25539@itemx -mrl78
25540@opindex mg10
25541@opindex mg13
25542@opindex mg14
25543@opindex mrl78
25544These are aliases for the corresponding @option{-mcpu=} option.  They
25545are provided for backwards compatibility.
25546
25547@item -mallregs
25548@opindex mallregs
25549Allow the compiler to use all of the available registers.  By default
25550registers @code{r24..r31} are reserved for use in interrupt handlers.
25551With this option enabled these registers can be used in ordinary
25552functions as well.
25553
25554@item -m64bit-doubles
25555@itemx -m32bit-doubles
25556@opindex m64bit-doubles
25557@opindex m32bit-doubles
25558Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25559or 32 bits (@option{-m32bit-doubles}) in size.  The default is
25560@option{-m32bit-doubles}.
25561
25562@item -msave-mduc-in-interrupts
25563@itemx -mno-save-mduc-in-interrupts
25564@opindex msave-mduc-in-interrupts
25565@opindex mno-save-mduc-in-interrupts
25566Specifies that interrupt handler functions should preserve the
25567MDUC registers.  This is only necessary if normal code might use
25568the MDUC registers, for example because it performs multiplication
25569and division operations.  The default is to ignore the MDUC registers
25570as this makes the interrupt handlers faster.  The target option -mg13
25571needs to be passed for this to work as this feature is only available
25572on the G13 target (S2 core).  The MDUC registers will only be saved
25573if the interrupt handler performs a multiplication or division
25574operation or it calls another function.
25575
25576@end table
25577
25578@node RS/6000 and PowerPC Options
25579@subsection IBM RS/6000 and PowerPC Options
25580@cindex RS/6000 and PowerPC Options
25581@cindex IBM RS/6000 and PowerPC Options
25582
25583These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25584@table @gcctabopt
25585@item -mpowerpc-gpopt
25586@itemx -mno-powerpc-gpopt
25587@itemx -mpowerpc-gfxopt
25588@itemx -mno-powerpc-gfxopt
25589@need 800
25590@itemx -mpowerpc64
25591@itemx -mno-powerpc64
25592@itemx -mmfcrf
25593@itemx -mno-mfcrf
25594@itemx -mpopcntb
25595@itemx -mno-popcntb
25596@itemx -mpopcntd
25597@itemx -mno-popcntd
25598@itemx -mfprnd
25599@itemx -mno-fprnd
25600@need 800
25601@itemx -mcmpb
25602@itemx -mno-cmpb
25603@itemx -mhard-dfp
25604@itemx -mno-hard-dfp
25605@opindex mpowerpc-gpopt
25606@opindex mno-powerpc-gpopt
25607@opindex mpowerpc-gfxopt
25608@opindex mno-powerpc-gfxopt
25609@opindex mpowerpc64
25610@opindex mno-powerpc64
25611@opindex mmfcrf
25612@opindex mno-mfcrf
25613@opindex mpopcntb
25614@opindex mno-popcntb
25615@opindex mpopcntd
25616@opindex mno-popcntd
25617@opindex mfprnd
25618@opindex mno-fprnd
25619@opindex mcmpb
25620@opindex mno-cmpb
25621@opindex mhard-dfp
25622@opindex mno-hard-dfp
25623You use these options to specify which instructions are available on the
25624processor you are using.  The default value of these options is
25625determined when configuring GCC@.  Specifying the
25626@option{-mcpu=@var{cpu_type}} overrides the specification of these
25627options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
25628rather than the options listed above.
25629
25630Specifying @option{-mpowerpc-gpopt} allows
25631GCC to use the optional PowerPC architecture instructions in the
25632General Purpose group, including floating-point square root.  Specifying
25633@option{-mpowerpc-gfxopt} allows GCC to
25634use the optional PowerPC architecture instructions in the Graphics
25635group, including floating-point select.
25636
25637The @option{-mmfcrf} option allows GCC to generate the move from
25638condition register field instruction implemented on the POWER4
25639processor and other processors that support the PowerPC V2.01
25640architecture.
25641The @option{-mpopcntb} option allows GCC to generate the popcount and
25642double-precision FP reciprocal estimate instruction implemented on the
25643POWER5 processor and other processors that support the PowerPC V2.02
25644architecture.
25645The @option{-mpopcntd} option allows GCC to generate the popcount
25646instruction implemented on the POWER7 processor and other processors
25647that support the PowerPC V2.06 architecture.
25648The @option{-mfprnd} option allows GCC to generate the FP round to
25649integer instructions implemented on the POWER5+ processor and other
25650processors that support the PowerPC V2.03 architecture.
25651The @option{-mcmpb} option allows GCC to generate the compare bytes
25652instruction implemented on the POWER6 processor and other processors
25653that support the PowerPC V2.05 architecture.
25654The @option{-mhard-dfp} option allows GCC to generate the decimal
25655floating-point instructions implemented on some POWER processors.
25656
25657The @option{-mpowerpc64} option allows GCC to generate the additional
2565864-bit instructions that are found in the full PowerPC64 architecture
25659and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
25660@option{-mno-powerpc64}.
25661
25662@item -mcpu=@var{cpu_type}
25663@opindex mcpu
25664Set architecture type, register usage, and
25665instruction scheduling parameters for machine type @var{cpu_type}.
25666Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25667@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25668@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25669@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25670@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25671@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25672@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25673@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25674@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25675@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25676@samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
25677@samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25678
25679@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25680@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25681endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25682architecture machine types, with an appropriate, generic processor
25683model assumed for scheduling purposes.
25684
25685Specifying @samp{native} as cpu type detects and selects the
25686architecture option that corresponds to the host processor of the
25687system performing the compilation.
25688@option{-mcpu=native} has no effect if GCC does not recognize the
25689processor.
25690
25691The other options specify a specific processor.  Code generated under
25692those options runs best on that processor, and may not run at all on
25693others.
25694
25695The @option{-mcpu} options automatically enable or disable the
25696following options:
25697
25698@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
25699-mpopcntb  -mpopcntd  -mpowerpc64 @gol
25700-mpowerpc-gpopt  -mpowerpc-gfxopt @gol
25701-mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
25702-mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
25703-mquad-memory  -mquad-memory-atomic  -mfloat128 @gol
25704-mfloat128-hardware -mprefixed -mpcrel -mmma}
25705
25706The particular options set for any particular CPU varies between
25707compiler versions, depending on what setting seems to produce optimal
25708code for that CPU; it doesn't necessarily reflect the actual hardware's
25709capabilities.  If you wish to set an individual option to a particular
25710value, you may specify it after the @option{-mcpu} option, like
25711@option{-mcpu=970 -mno-altivec}.
25712
25713On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25714not enabled or disabled by the @option{-mcpu} option at present because
25715AIX does not have full support for these options.  You may still
25716enable or disable them individually if you're sure it'll work in your
25717environment.
25718
25719@item -mtune=@var{cpu_type}
25720@opindex mtune
25721Set the instruction scheduling parameters for machine type
25722@var{cpu_type}, but do not set the architecture type or register usage,
25723as @option{-mcpu=@var{cpu_type}} does.  The same
25724values for @var{cpu_type} are used for @option{-mtune} as for
25725@option{-mcpu}.  If both are specified, the code generated uses the
25726architecture and registers set by @option{-mcpu}, but the
25727scheduling parameters set by @option{-mtune}.
25728
25729@item -mcmodel=small
25730@opindex mcmodel=small
25731Generate PowerPC64 code for the small model: The TOC is limited to
2573264k.
25733
25734@item -mcmodel=medium
25735@opindex mcmodel=medium
25736Generate PowerPC64 code for the medium model: The TOC and other static
25737data may be up to a total of 4G in size.  This is the default for 64-bit
25738Linux.
25739
25740@item -mcmodel=large
25741@opindex mcmodel=large
25742Generate PowerPC64 code for the large model: The TOC may be up to 4G
25743in size.  Other data and code is only limited by the 64-bit address
25744space.
25745
25746@item -maltivec
25747@itemx -mno-altivec
25748@opindex maltivec
25749@opindex mno-altivec
25750Generate code that uses (does not use) AltiVec instructions, and also
25751enable the use of built-in functions that allow more direct access to
25752the AltiVec instruction set.  You may also need to set
25753@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25754enhancements.
25755
25756When @option{-maltivec} is used, the element order for AltiVec intrinsics
25757such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
25758match array element order corresponding to the endianness of the
25759target.  That is, element zero identifies the leftmost element in a
25760vector register when targeting a big-endian platform, and identifies
25761the rightmost element in a vector register when targeting a
25762little-endian platform.
25763
25764@item -mvrsave
25765@itemx -mno-vrsave
25766@opindex mvrsave
25767@opindex mno-vrsave
25768Generate VRSAVE instructions when generating AltiVec code.
25769
25770@item -msecure-plt
25771@opindex msecure-plt
25772Generate code that allows @command{ld} and @command{ld.so}
25773to build executables and shared
25774libraries with non-executable @code{.plt} and @code{.got} sections.
25775This is a PowerPC
2577632-bit SYSV ABI option.
25777
25778@item -mbss-plt
25779@opindex mbss-plt
25780Generate code that uses a BSS @code{.plt} section that @command{ld.so}
25781fills in, and
25782requires @code{.plt} and @code{.got}
25783sections that are both writable and executable.
25784This is a PowerPC 32-bit SYSV ABI option.
25785
25786@item -misel
25787@itemx -mno-isel
25788@opindex misel
25789@opindex mno-isel
25790This switch enables or disables the generation of ISEL instructions.
25791
25792@item -mvsx
25793@itemx -mno-vsx
25794@opindex mvsx
25795@opindex mno-vsx
25796Generate code that uses (does not use) vector/scalar (VSX)
25797instructions, and also enable the use of built-in functions that allow
25798more direct access to the VSX instruction set.
25799
25800@item -mcrypto
25801@itemx -mno-crypto
25802@opindex mcrypto
25803@opindex mno-crypto
25804Enable the use (disable) of the built-in functions that allow direct
25805access to the cryptographic instructions that were added in version
258062.07 of the PowerPC ISA.
25807
25808@item -mhtm
25809@itemx -mno-htm
25810@opindex mhtm
25811@opindex mno-htm
25812Enable (disable) the use of the built-in functions that allow direct
25813access to the Hardware Transactional Memory (HTM) instructions that
25814were added in version 2.07 of the PowerPC ISA.
25815
25816@item -mpower8-fusion
25817@itemx -mno-power8-fusion
25818@opindex mpower8-fusion
25819@opindex mno-power8-fusion
25820Generate code that keeps (does not keeps) some integer operations
25821adjacent so that the instructions can be fused together on power8 and
25822later processors.
25823
25824@item -mpower8-vector
25825@itemx -mno-power8-vector
25826@opindex mpower8-vector
25827@opindex mno-power8-vector
25828Generate code that uses (does not use) the vector and scalar
25829instructions that were added in version 2.07 of the PowerPC ISA.  Also
25830enable the use of built-in functions that allow more direct access to
25831the vector instructions.
25832
25833@item -mquad-memory
25834@itemx -mno-quad-memory
25835@opindex mquad-memory
25836@opindex mno-quad-memory
25837Generate code that uses (does not use) the non-atomic quad word memory
25838instructions.  The @option{-mquad-memory} option requires use of
2583964-bit mode.
25840
25841@item -mquad-memory-atomic
25842@itemx -mno-quad-memory-atomic
25843@opindex mquad-memory-atomic
25844@opindex mno-quad-memory-atomic
25845Generate code that uses (does not use) the atomic quad word memory
25846instructions.  The @option{-mquad-memory-atomic} option requires use of
2584764-bit mode.
25848
25849@item -mfloat128
25850@itemx -mno-float128
25851@opindex mfloat128
25852@opindex mno-float128
25853Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
25854and use either software emulation for IEEE 128-bit floating point or
25855hardware instructions.
25856
25857The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
25858128-bit floating point support.  The IEEE 128-bit floating point is only
25859supported on Linux.
25860
25861The default for @option{-mfloat128} is enabled on PowerPC Linux
25862systems using the VSX instruction set, and disabled on other systems.
25863
25864If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
25865@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
25866point support will also enable the generation of ISA 3.0 IEEE 128-bit
25867floating point instructions.  Otherwise, if you do not specify to
25868generate ISA 3.0 instructions or you are targeting a 32-bit big endian
25869system, IEEE 128-bit floating point will be done with software
25870emulation.
25871
25872@item -mfloat128-hardware
25873@itemx -mno-float128-hardware
25874@opindex mfloat128-hardware
25875@opindex mno-float128-hardware
25876Enable/disable using ISA 3.0 hardware instructions to support the
25877@var{__float128} data type.
25878
25879The default for @option{-mfloat128-hardware} is enabled on PowerPC
25880Linux systems using the ISA 3.0 instruction set, and disabled on other
25881systems.
25882
25883@item -m32
25884@itemx -m64
25885@opindex m32
25886@opindex m64
25887Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25888targets (including GNU/Linux).  The 32-bit environment sets int, long
25889and pointer to 32 bits and generates code that runs on any PowerPC
25890variant.  The 64-bit environment sets int to 32 bits and long and
25891pointer to 64 bits, and generates code for PowerPC64, as for
25892@option{-mpowerpc64}.
25893
25894@item -mfull-toc
25895@itemx -mno-fp-in-toc
25896@itemx -mno-sum-in-toc
25897@itemx -mminimal-toc
25898@opindex mfull-toc
25899@opindex mno-fp-in-toc
25900@opindex mno-sum-in-toc
25901@opindex mminimal-toc
25902Modify generation of the TOC (Table Of Contents), which is created for
25903every executable file.  The @option{-mfull-toc} option is selected by
25904default.  In that case, GCC allocates at least one TOC entry for
25905each unique non-automatic variable reference in your program.  GCC
25906also places floating-point constants in the TOC@.  However, only
2590716,384 entries are available in the TOC@.
25908
25909If you receive a linker error message that saying you have overflowed
25910the available TOC space, you can reduce the amount of TOC space used
25911with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
25912@option{-mno-fp-in-toc} prevents GCC from putting floating-point
25913constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
25914generate code to calculate the sum of an address and a constant at
25915run time instead of putting that sum into the TOC@.  You may specify one
25916or both of these options.  Each causes GCC to produce very slightly
25917slower and larger code at the expense of conserving TOC space.
25918
25919If you still run out of space in the TOC even when you specify both of
25920these options, specify @option{-mminimal-toc} instead.  This option causes
25921GCC to make only one TOC entry for every file.  When you specify this
25922option, GCC produces code that is slower and larger but which
25923uses extremely little TOC space.  You may wish to use this option
25924only on files that contain less frequently-executed code.
25925
25926@item -maix64
25927@itemx -maix32
25928@opindex maix64
25929@opindex maix32
25930Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
25931@code{long} type, and the infrastructure needed to support them.
25932Specifying @option{-maix64} implies @option{-mpowerpc64},
25933while @option{-maix32} disables the 64-bit ABI and
25934implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
25935
25936@item -mxl-compat
25937@itemx -mno-xl-compat
25938@opindex mxl-compat
25939@opindex mno-xl-compat
25940Produce code that conforms more closely to IBM XL compiler semantics
25941when using AIX-compatible ABI@.  Pass floating-point arguments to
25942prototyped functions beyond the register save area (RSA) on the stack
25943in addition to argument FPRs.  Do not assume that most significant
25944double in 128-bit long double value is properly rounded when comparing
25945values and converting to double.  Use XL symbol names for long double
25946support routines.
25947
25948The AIX calling convention was extended but not initially documented to
25949handle an obscure K&R C case of calling a function that takes the
25950address of its arguments with fewer arguments than declared.  IBM XL
25951compilers access floating-point arguments that do not fit in the
25952RSA from the stack when a subroutine is compiled without
25953optimization.  Because always storing floating-point arguments on the
25954stack is inefficient and rarely needed, this option is not enabled by
25955default and only is necessary when calling subroutines compiled by IBM
25956XL compilers without optimization.
25957
25958@item -mpe
25959@opindex mpe
25960Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
25961application written to use message passing with special startup code to
25962enable the application to run.  The system must have PE installed in the
25963standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
25964must be overridden with the @option{-specs=} option to specify the
25965appropriate directory location.  The Parallel Environment does not
25966support threads, so the @option{-mpe} option and the @option{-pthread}
25967option are incompatible.
25968
25969@item -malign-natural
25970@itemx -malign-power
25971@opindex malign-natural
25972@opindex malign-power
25973On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25974@option{-malign-natural} overrides the ABI-defined alignment of larger
25975types, such as floating-point doubles, on their natural size-based boundary.
25976The option @option{-malign-power} instructs GCC to follow the ABI-specified
25977alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
25978
25979On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
25980is not supported.
25981
25982@item -msoft-float
25983@itemx -mhard-float
25984@opindex msoft-float
25985@opindex mhard-float
25986Generate code that does not use (uses) the floating-point register set.
25987Software floating-point emulation is provided if you use the
25988@option{-msoft-float} option, and pass the option to GCC when linking.
25989
25990@item -mmultiple
25991@itemx -mno-multiple
25992@opindex mmultiple
25993@opindex mno-multiple
25994Generate code that uses (does not use) the load multiple word
25995instructions and the store multiple word instructions.  These
25996instructions are generated by default on POWER systems, and not
25997generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
25998PowerPC systems, since those instructions do not work when the
25999processor is in little-endian mode.  The exceptions are PPC740 and
26000PPC750 which permit these instructions in little-endian mode.
26001
26002@item -mupdate
26003@itemx -mno-update
26004@opindex mupdate
26005@opindex mno-update
26006Generate code that uses (does not use) the load or store instructions
26007that update the base register to the address of the calculated memory
26008location.  These instructions are generated by default.  If you use
26009@option{-mno-update}, there is a small window between the time that the
26010stack pointer is updated and the address of the previous frame is
26011stored, which means code that walks the stack frame across interrupts or
26012signals may get corrupted data.
26013
26014@item -mavoid-indexed-addresses
26015@itemx -mno-avoid-indexed-addresses
26016@opindex mavoid-indexed-addresses
26017@opindex mno-avoid-indexed-addresses
26018Generate code that tries to avoid (not avoid) the use of indexed load
26019or store instructions. These instructions can incur a performance
26020penalty on Power6 processors in certain situations, such as when
26021stepping through large arrays that cross a 16M boundary.  This option
26022is enabled by default when targeting Power6 and disabled otherwise.
26023
26024@item -mfused-madd
26025@itemx -mno-fused-madd
26026@opindex mfused-madd
26027@opindex mno-fused-madd
26028Generate code that uses (does not use) the floating-point multiply and
26029accumulate instructions.  These instructions are generated by default
26030if hardware floating point is used.  The machine-dependent
26031@option{-mfused-madd} option is now mapped to the machine-independent
26032@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26033mapped to @option{-ffp-contract=off}.
26034
26035@item -mmulhw
26036@itemx -mno-mulhw
26037@opindex mmulhw
26038@opindex mno-mulhw
26039Generate code that uses (does not use) the half-word multiply and
26040multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
26041These instructions are generated by default when targeting those
26042processors.
26043
26044@item -mdlmzb
26045@itemx -mno-dlmzb
26046@opindex mdlmzb
26047@opindex mno-dlmzb
26048Generate code that uses (does not use) the string-search @samp{dlmzb}
26049instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
26050generated by default when targeting those processors.
26051
26052@item -mno-bit-align
26053@itemx -mbit-align
26054@opindex mno-bit-align
26055@opindex mbit-align
26056On System V.4 and embedded PowerPC systems do not (do) force structures
26057and unions that contain bit-fields to be aligned to the base type of the
26058bit-field.
26059
26060For example, by default a structure containing nothing but 8
26061@code{unsigned} bit-fields of length 1 is aligned to a 4-byte
26062boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
26063the structure is aligned to a 1-byte boundary and is 1 byte in
26064size.
26065
26066@item -mno-strict-align
26067@itemx -mstrict-align
26068@opindex mno-strict-align
26069@opindex mstrict-align
26070On System V.4 and embedded PowerPC systems do not (do) assume that
26071unaligned memory references are handled by the system.
26072
26073@item -mrelocatable
26074@itemx -mno-relocatable
26075@opindex mrelocatable
26076@opindex mno-relocatable
26077Generate code that allows (does not allow) a static executable to be
26078relocated to a different address at run time.  A simple embedded
26079PowerPC system loader should relocate the entire contents of
26080@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
26081a table of 32-bit addresses generated by this option.  For this to
26082work, all objects linked together must be compiled with
26083@option{-mrelocatable} or @option{-mrelocatable-lib}.
26084@option{-mrelocatable} code aligns the stack to an 8-byte boundary.
26085
26086@item -mrelocatable-lib
26087@itemx -mno-relocatable-lib
26088@opindex mrelocatable-lib
26089@opindex mno-relocatable-lib
26090Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
26091@code{.fixup} section to allow static executables to be relocated at
26092run time, but @option{-mrelocatable-lib} does not use the smaller stack
26093alignment of @option{-mrelocatable}.  Objects compiled with
26094@option{-mrelocatable-lib} may be linked with objects compiled with
26095any combination of the @option{-mrelocatable} options.
26096
26097@item -mno-toc
26098@itemx -mtoc
26099@opindex mno-toc
26100@opindex mtoc
26101On System V.4 and embedded PowerPC systems do not (do) assume that
26102register 2 contains a pointer to a global area pointing to the addresses
26103used in the program.
26104
26105@item -mlittle
26106@itemx -mlittle-endian
26107@opindex mlittle
26108@opindex mlittle-endian
26109On System V.4 and embedded PowerPC systems compile code for the
26110processor in little-endian mode.  The @option{-mlittle-endian} option is
26111the same as @option{-mlittle}.
26112
26113@item -mbig
26114@itemx -mbig-endian
26115@opindex mbig
26116@opindex mbig-endian
26117On System V.4 and embedded PowerPC systems compile code for the
26118processor in big-endian mode.  The @option{-mbig-endian} option is
26119the same as @option{-mbig}.
26120
26121@item -mdynamic-no-pic
26122@opindex mdynamic-no-pic
26123On Darwin and Mac OS X systems, compile code so that it is not
26124relocatable, but that its external references are relocatable.  The
26125resulting code is suitable for applications, but not shared
26126libraries.
26127
26128@item -msingle-pic-base
26129@opindex msingle-pic-base
26130Treat the register used for PIC addressing as read-only, rather than
26131loading it in the prologue for each function.  The runtime system is
26132responsible for initializing this register with an appropriate value
26133before execution begins.
26134
26135@item -mprioritize-restricted-insns=@var{priority}
26136@opindex mprioritize-restricted-insns
26137This option controls the priority that is assigned to
26138dispatch-slot restricted instructions during the second scheduling
26139pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
26140or @samp{2} to assign no, highest, or second-highest (respectively)
26141priority to dispatch-slot restricted
26142instructions.
26143
26144@item -msched-costly-dep=@var{dependence_type}
26145@opindex msched-costly-dep
26146This option controls which dependences are considered costly
26147by the target during instruction scheduling.  The argument
26148@var{dependence_type} takes one of the following values:
26149
26150@table @asis
26151@item @samp{no}
26152No dependence is costly.
26153
26154@item @samp{all}
26155All dependences are costly.
26156
26157@item @samp{true_store_to_load}
26158A true dependence from store to load is costly.
26159
26160@item @samp{store_to_load}
26161Any dependence from store to load is costly.
26162
26163@item @var{number}
26164Any dependence for which the latency is greater than or equal to
26165@var{number} is costly.
26166@end table
26167
26168@item -minsert-sched-nops=@var{scheme}
26169@opindex minsert-sched-nops
26170This option controls which NOP insertion scheme is used during
26171the second scheduling pass.  The argument @var{scheme} takes one of the
26172following values:
26173
26174@table @asis
26175@item @samp{no}
26176Don't insert NOPs.
26177
26178@item @samp{pad}
26179Pad with NOPs any dispatch group that has vacant issue slots,
26180according to the scheduler's grouping.
26181
26182@item @samp{regroup_exact}
26183Insert NOPs to force costly dependent insns into
26184separate groups.  Insert exactly as many NOPs as needed to force an insn
26185to a new group, according to the estimated processor grouping.
26186
26187@item @var{number}
26188Insert NOPs to force costly dependent insns into
26189separate groups.  Insert @var{number} NOPs to force an insn to a new group.
26190@end table
26191
26192@item -mcall-sysv
26193@opindex mcall-sysv
26194On System V.4 and embedded PowerPC systems compile code using calling
26195conventions that adhere to the March 1995 draft of the System V
26196Application Binary Interface, PowerPC processor supplement.  This is the
26197default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26198
26199@item -mcall-sysv-eabi
26200@itemx -mcall-eabi
26201@opindex mcall-sysv-eabi
26202@opindex mcall-eabi
26203Specify both @option{-mcall-sysv} and @option{-meabi} options.
26204
26205@item -mcall-sysv-noeabi
26206@opindex mcall-sysv-noeabi
26207Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26208
26209@item -mcall-aixdesc
26210@opindex m
26211On System V.4 and embedded PowerPC systems compile code for the AIX
26212operating system.
26213
26214@item -mcall-linux
26215@opindex mcall-linux
26216On System V.4 and embedded PowerPC systems compile code for the
26217Linux-based GNU system.
26218
26219@item -mcall-freebsd
26220@opindex mcall-freebsd
26221On System V.4 and embedded PowerPC systems compile code for the
26222FreeBSD operating system.
26223
26224@item -mcall-netbsd
26225@opindex mcall-netbsd
26226On System V.4 and embedded PowerPC systems compile code for the
26227NetBSD operating system.
26228
26229@item -mcall-openbsd
26230@opindex mcall-netbsd
26231On System V.4 and embedded PowerPC systems compile code for the
26232OpenBSD operating system.
26233
26234@item -mtraceback=@var{traceback_type}
26235@opindex mtraceback
26236Select the type of traceback table. Valid values for @var{traceback_type}
26237are @samp{full}, @samp{part}, and @samp{no}.
26238
26239@item -maix-struct-return
26240@opindex maix-struct-return
26241Return all structures in memory (as specified by the AIX ABI)@.
26242
26243@item -msvr4-struct-return
26244@opindex msvr4-struct-return
26245Return structures smaller than 8 bytes in registers (as specified by the
26246SVR4 ABI)@.
26247
26248@item -mabi=@var{abi-type}
26249@opindex mabi
26250Extend the current ABI with a particular extension, or remove such extension.
26251Valid values are: @samp{altivec}, @samp{no-altivec},
26252@samp{ibmlongdouble}, @samp{ieeelongdouble},
26253@samp{elfv1}, @samp{elfv2},
26254and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
26255
26256@item -mabi=ibmlongdouble
26257@opindex mabi=ibmlongdouble
26258Change the current ABI to use IBM extended-precision long double.
26259This is not likely to work if your system defaults to using IEEE
26260extended-precision long double.  If you change the long double type
26261from IEEE extended-precision, the compiler will issue a warning unless
26262you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26263to be enabled.
26264
26265@item -mabi=ieeelongdouble
26266@opindex mabi=ieeelongdouble
26267Change the current ABI to use IEEE extended-precision long double.
26268This is not likely to work if your system defaults to using IBM
26269extended-precision long double.  If you change the long double type
26270from IBM extended-precision, the compiler will issue a warning unless
26271you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
26272to be enabled.
26273
26274@item -mabi=elfv1
26275@opindex mabi=elfv1
26276Change the current ABI to use the ELFv1 ABI.
26277This is the default ABI for big-endian PowerPC 64-bit Linux.
26278Overriding the default ABI requires special system support and is
26279likely to fail in spectacular ways.
26280
26281@item -mabi=elfv2
26282@opindex mabi=elfv2
26283Change the current ABI to use the ELFv2 ABI.
26284This is the default ABI for little-endian PowerPC 64-bit Linux.
26285Overriding the default ABI requires special system support and is
26286likely to fail in spectacular ways.
26287
26288@item -mgnu-attribute
26289@itemx -mno-gnu-attribute
26290@opindex mgnu-attribute
26291@opindex mno-gnu-attribute
26292Emit .gnu_attribute assembly directives to set tag/value pairs in a
26293.gnu.attributes section that specify ABI variations in function
26294parameters or return values.
26295
26296@item -mprototype
26297@itemx -mno-prototype
26298@opindex mprototype
26299@opindex mno-prototype
26300On System V.4 and embedded PowerPC systems assume that all calls to
26301variable argument functions are properly prototyped.  Otherwise, the
26302compiler must insert an instruction before every non-prototyped call to
26303set or clear bit 6 of the condition code register (@code{CR}) to
26304indicate whether floating-point values are passed in the floating-point
26305registers in case the function takes variable arguments.  With
26306@option{-mprototype}, only calls to prototyped variable argument functions
26307set or clear the bit.
26308
26309@item -msim
26310@opindex msim
26311On embedded PowerPC systems, assume that the startup module is called
26312@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26313@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
26314configurations.
26315
26316@item -mmvme
26317@opindex mmvme
26318On embedded PowerPC systems, assume that the startup module is called
26319@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26320@file{libc.a}.
26321
26322@item -mads
26323@opindex mads
26324On embedded PowerPC systems, assume that the startup module is called
26325@file{crt0.o} and the standard C libraries are @file{libads.a} and
26326@file{libc.a}.
26327
26328@item -myellowknife
26329@opindex myellowknife
26330On embedded PowerPC systems, assume that the startup module is called
26331@file{crt0.o} and the standard C libraries are @file{libyk.a} and
26332@file{libc.a}.
26333
26334@item -mvxworks
26335@opindex mvxworks
26336On System V.4 and embedded PowerPC systems, specify that you are
26337compiling for a VxWorks system.
26338
26339@item -memb
26340@opindex memb
26341On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26342header to indicate that @samp{eabi} extended relocations are used.
26343
26344@item -meabi
26345@itemx -mno-eabi
26346@opindex meabi
26347@opindex mno-eabi
26348On System V.4 and embedded PowerPC systems do (do not) adhere to the
26349Embedded Applications Binary Interface (EABI), which is a set of
26350modifications to the System V.4 specifications.  Selecting @option{-meabi}
26351means that the stack is aligned to an 8-byte boundary, a function
26352@code{__eabi} is called from @code{main} to set up the EABI
26353environment, and the @option{-msdata} option can use both @code{r2} and
26354@code{r13} to point to two separate small data areas.  Selecting
26355@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26356no EABI initialization function is called from @code{main}, and the
26357@option{-msdata} option only uses @code{r13} to point to a single
26358small data area.  The @option{-meabi} option is on by default if you
26359configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26360
26361@item -msdata=eabi
26362@opindex msdata=eabi
26363On System V.4 and embedded PowerPC systems, put small initialized
26364@code{const} global and static data in the @code{.sdata2} section, which
26365is pointed to by register @code{r2}.  Put small initialized
26366non-@code{const} global and static data in the @code{.sdata} section,
26367which is pointed to by register @code{r13}.  Put small uninitialized
26368global and static data in the @code{.sbss} section, which is adjacent to
26369the @code{.sdata} section.  The @option{-msdata=eabi} option is
26370incompatible with the @option{-mrelocatable} option.  The
26371@option{-msdata=eabi} option also sets the @option{-memb} option.
26372
26373@item -msdata=sysv
26374@opindex msdata=sysv
26375On System V.4 and embedded PowerPC systems, put small global and static
26376data in the @code{.sdata} section, which is pointed to by register
26377@code{r13}.  Put small uninitialized global and static data in the
26378@code{.sbss} section, which is adjacent to the @code{.sdata} section.
26379The @option{-msdata=sysv} option is incompatible with the
26380@option{-mrelocatable} option.
26381
26382@item -msdata=default
26383@itemx -msdata
26384@opindex msdata=default
26385@opindex msdata
26386On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26387compile code the same as @option{-msdata=eabi}, otherwise compile code the
26388same as @option{-msdata=sysv}.
26389
26390@item -msdata=data
26391@opindex msdata=data
26392On System V.4 and embedded PowerPC systems, put small global
26393data in the @code{.sdata} section.  Put small uninitialized global
26394data in the @code{.sbss} section.  Do not use register @code{r13}
26395to address small data however.  This is the default behavior unless
26396other @option{-msdata} options are used.
26397
26398@item -msdata=none
26399@itemx -mno-sdata
26400@opindex msdata=none
26401@opindex mno-sdata
26402On embedded PowerPC systems, put all initialized global and static data
26403in the @code{.data} section, and all uninitialized data in the
26404@code{.bss} section.
26405
26406@item -mreadonly-in-sdata
26407@opindex mreadonly-in-sdata
26408@opindex mno-readonly-in-sdata
26409Put read-only objects in the @code{.sdata} section as well.  This is the
26410default.
26411
26412@item -mblock-move-inline-limit=@var{num}
26413@opindex mblock-move-inline-limit
26414Inline all block moves (such as calls to @code{memcpy} or structure
26415copies) less than or equal to @var{num} bytes.  The minimum value for
26416@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26417targets.  The default value is target-specific.
26418
26419@item -mblock-compare-inline-limit=@var{num}
26420@opindex mblock-compare-inline-limit
26421Generate non-looping inline code for all block compares (such as calls
26422to @code{memcmp} or structure compares) less than or equal to @var{num}
26423bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26424block compare is disabled. The default value is target-specific.
26425
26426@item -mblock-compare-inline-loop-limit=@var{num}
26427@opindex mblock-compare-inline-loop-limit
26428Generate an inline expansion using loop code for all block compares that
26429are less than or equal to @var{num} bytes, but greater than the limit
26430for non-loop inline block compare expansion. If the block length is not
26431constant, at most @var{num} bytes will be compared before @code{memcmp}
26432is called to compare the remainder of the block. The default value is
26433target-specific.
26434
26435@item -mstring-compare-inline-limit=@var{num}
26436@opindex mstring-compare-inline-limit
26437Compare at most @var{num} string bytes with inline code.
26438If the difference or end of string is not found at the
26439end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26440take care of the rest of the comparison. The default is 64 bytes.
26441
26442@item -G @var{num}
26443@opindex G
26444@cindex smaller data references (PowerPC)
26445@cindex .sdata/.sdata2 references (PowerPC)
26446On embedded PowerPC systems, put global and static items less than or
26447equal to @var{num} bytes into the small data or BSS sections instead of
26448the normal data or BSS section.  By default, @var{num} is 8.  The
26449@option{-G @var{num}} switch is also passed to the linker.
26450All modules should be compiled with the same @option{-G @var{num}} value.
26451
26452@item -mregnames
26453@itemx -mno-regnames
26454@opindex mregnames
26455@opindex mno-regnames
26456On System V.4 and embedded PowerPC systems do (do not) emit register
26457names in the assembly language output using symbolic forms.
26458
26459@item -mlongcall
26460@itemx -mno-longcall
26461@opindex mlongcall
26462@opindex mno-longcall
26463By default assume that all calls are far away so that a longer and more
26464expensive calling sequence is required.  This is required for calls
26465farther than 32 megabytes (33,554,432 bytes) from the current location.
26466A short call is generated if the compiler knows
26467the call cannot be that far away.  This setting can be overridden by
26468the @code{shortcall} function attribute, or by @code{#pragma
26469longcall(0)}.
26470
26471Some linkers are capable of detecting out-of-range calls and generating
26472glue code on the fly.  On these systems, long calls are unnecessary and
26473generate slower code.  As of this writing, the AIX linker can do this,
26474as can the GNU linker for PowerPC/64.  It is planned to add this feature
26475to the GNU linker for 32-bit PowerPC systems as well.
26476
26477On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26478GCC can generate long calls using an inline PLT call sequence (see
26479@option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
26480ELFv1 (big-endian) do not support inline PLT calls.
26481
26482On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26483callee, L42}, plus a @dfn{branch island} (glue code).  The two target
26484addresses represent the callee and the branch island.  The
26485Darwin/PPC linker prefers the first address and generates a @code{bl
26486callee} if the PPC @code{bl} instruction reaches the callee directly;
26487otherwise, the linker generates @code{bl L42} to call the branch
26488island.  The branch island is appended to the body of the
26489calling function; it computes the full 32-bit address of the callee
26490and jumps to it.
26491
26492On Mach-O (Darwin) systems, this option directs the compiler emit to
26493the glue for every direct call, and the Darwin linker decides whether
26494to use or discard it.
26495
26496In the future, GCC may ignore all longcall specifications
26497when the linker is known to generate glue.
26498
26499@item -mpltseq
26500@itemx -mno-pltseq
26501@opindex mpltseq
26502@opindex mno-pltseq
26503Implement (do not implement) -fno-plt and long calls using an inline
26504PLT call sequence that supports lazy linking and long calls to
26505functions in dlopen'd shared libraries.  Inline PLT calls are only
26506supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26507linkers, and are enabled by default if the support is detected when
26508configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26509configured with @option{--enable-secureplt}.  @option{-mpltseq} code
26510and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26511linked together.
26512
26513@item -mtls-markers
26514@itemx -mno-tls-markers
26515@opindex mtls-markers
26516@opindex mno-tls-markers
26517Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26518specifying the function argument.  The relocation allows the linker to
26519reliably associate function call with argument setup instructions for
26520TLS optimization, which in turn allows GCC to better schedule the
26521sequence.
26522
26523@item -mrecip
26524@itemx -mno-recip
26525@opindex mrecip
26526This option enables use of the reciprocal estimate and
26527reciprocal square root estimate instructions with additional
26528Newton-Raphson steps to increase precision instead of doing a divide or
26529square root and divide for floating-point arguments.  You should use
26530the @option{-ffast-math} option when using @option{-mrecip} (or at
26531least @option{-funsafe-math-optimizations},
26532@option{-ffinite-math-only}, @option{-freciprocal-math} and
26533@option{-fno-trapping-math}).  Note that while the throughput of the
26534sequence is generally higher than the throughput of the non-reciprocal
26535instruction, the precision of the sequence can be decreased by up to 2
26536ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26537roots.
26538
26539@item -mrecip=@var{opt}
26540@opindex mrecip=opt
26541This option controls which reciprocal estimate instructions
26542may be used.  @var{opt} is a comma-separated list of options, which may
26543be preceded by a @code{!} to invert the option:
26544
26545@table @samp
26546
26547@item all
26548Enable all estimate instructions.
26549
26550@item default
26551Enable the default instructions, equivalent to @option{-mrecip}.
26552
26553@item none
26554Disable all estimate instructions, equivalent to @option{-mno-recip}.
26555
26556@item div
26557Enable the reciprocal approximation instructions for both
26558single and double precision.
26559
26560@item divf
26561Enable the single-precision reciprocal approximation instructions.
26562
26563@item divd
26564Enable the double-precision reciprocal approximation instructions.
26565
26566@item rsqrt
26567Enable the reciprocal square root approximation instructions for both
26568single and double precision.
26569
26570@item rsqrtf
26571Enable the single-precision reciprocal square root approximation instructions.
26572
26573@item rsqrtd
26574Enable the double-precision reciprocal square root approximation instructions.
26575
26576@end table
26577
26578So, for example, @option{-mrecip=all,!rsqrtd} enables
26579all of the reciprocal estimate instructions, except for the
26580@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26581which handle the double-precision reciprocal square root calculations.
26582
26583@item -mrecip-precision
26584@itemx -mno-recip-precision
26585@opindex mrecip-precision
26586Assume (do not assume) that the reciprocal estimate instructions
26587provide higher-precision estimates than is mandated by the PowerPC
26588ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26589@option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26590The double-precision square root estimate instructions are not generated by
26591default on low-precision machines, since they do not provide an
26592estimate that converges after three steps.
26593
26594@item -mveclibabi=@var{type}
26595@opindex mveclibabi
26596Specifies the ABI type to use for vectorizing intrinsics using an
26597external library.  The only type supported at present is @samp{mass},
26598which specifies to use IBM's Mathematical Acceleration Subsystem
26599(MASS) libraries for vectorizing intrinsics using external libraries.
26600GCC currently emits calls to @code{acosd2}, @code{acosf4},
26601@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26602@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26603@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26604@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26605@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26606@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26607@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26608@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26609@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26610@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26611@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26612@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26613@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26614for power7.  Both @option{-ftree-vectorize} and
26615@option{-funsafe-math-optimizations} must also be enabled.  The MASS
26616libraries must be specified at link time.
26617
26618@item -mfriz
26619@itemx -mno-friz
26620@opindex mfriz
26621Generate (do not generate) the @code{friz} instruction when the
26622@option{-funsafe-math-optimizations} option is used to optimize
26623rounding of floating-point values to 64-bit integer and back to floating
26624point.  The @code{friz} instruction does not return the same value if
26625the floating-point number is too large to fit in an integer.
26626
26627@item -mpointers-to-nested-functions
26628@itemx -mno-pointers-to-nested-functions
26629@opindex mpointers-to-nested-functions
26630Generate (do not generate) code to load up the static chain register
26631(@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26632systems where a function pointer points to a 3-word descriptor giving
26633the function address, TOC value to be loaded in register @code{r2}, and
26634static chain value to be loaded in register @code{r11}.  The
26635@option{-mpointers-to-nested-functions} is on by default.  You cannot
26636call through pointers to nested functions or pointers
26637to functions compiled in other languages that use the static chain if
26638you use @option{-mno-pointers-to-nested-functions}.
26639
26640@item -msave-toc-indirect
26641@itemx -mno-save-toc-indirect
26642@opindex msave-toc-indirect
26643Generate (do not generate) code to save the TOC value in the reserved
26644stack location in the function prologue if the function calls through
26645a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
26646saved in the prologue, it is saved just before the call through the
26647pointer.  The @option{-mno-save-toc-indirect} option is the default.
26648
26649@item -mcompat-align-parm
26650@itemx -mno-compat-align-parm
26651@opindex mcompat-align-parm
26652Generate (do not generate) code to pass structure parameters with a
26653maximum alignment of 64 bits, for compatibility with older versions
26654of GCC.
26655
26656Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26657structure parameter on a 128-bit boundary when that structure contained
26658a member requiring 128-bit alignment.  This is corrected in more
26659recent versions of GCC.  This option may be used to generate code
26660that is compatible with functions compiled with older versions of
26661GCC.
26662
26663The @option{-mno-compat-align-parm} option is the default.
26664
26665@item -mstack-protector-guard=@var{guard}
26666@itemx -mstack-protector-guard-reg=@var{reg}
26667@itemx -mstack-protector-guard-offset=@var{offset}
26668@itemx -mstack-protector-guard-symbol=@var{symbol}
26669@opindex mstack-protector-guard
26670@opindex mstack-protector-guard-reg
26671@opindex mstack-protector-guard-offset
26672@opindex mstack-protector-guard-symbol
26673Generate stack protection code using canary at @var{guard}.  Supported
26674locations are @samp{global} for global canary or @samp{tls} for per-thread
26675canary in the TLS block (the default with GNU libc version 2.4 or later).
26676
26677With the latter choice the options
26678@option{-mstack-protector-guard-reg=@var{reg}} and
26679@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26680which register to use as base register for reading the canary, and from what
26681offset from that base register. The default for those is as specified in the
26682relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26683the offset with a symbol reference to a canary in the TLS block.
26684
26685@item -mpcrel
26686@itemx -mno-pcrel
26687@opindex mpcrel
26688@opindex mno-pcrel
26689Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
26690option requires that the medium code model (@option{-mcmodel=medium})
26691and prefixed addressing (@option{-mprefixed}) options are enabled.
26692
26693@item -mprefixed
26694@itemx -mno-prefixed
26695@opindex mprefixed
26696@opindex mno-prefixed
26697Generate (do not generate) addressing modes using prefixed load and
26698store instructions.  The @option{-mprefixed} option requires that
26699the option @option{-mcpu=power10} (or later) is enabled.
26700
26701@item -mmma
26702@itemx -mno-mma
26703@opindex mmma
26704@opindex mno-mma
26705Generate (do not generate) the MMA instructions.  The @option{-mma}
26706option requires that the option @option{-mcpu=power10} (or later)
26707is enabled.
26708@end table
26709
26710@node RX Options
26711@subsection RX Options
26712@cindex RX Options
26713
26714These command-line options are defined for RX targets:
26715
26716@table @gcctabopt
26717@item -m64bit-doubles
26718@itemx -m32bit-doubles
26719@opindex m64bit-doubles
26720@opindex m32bit-doubles
26721Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26722or 32 bits (@option{-m32bit-doubles}) in size.  The default is
26723@option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
26724works on 32-bit values, which is why the default is
26725@option{-m32bit-doubles}.
26726
26727@item -fpu
26728@itemx -nofpu
26729@opindex fpu
26730@opindex nofpu
26731Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26732floating-point hardware.  The default is enabled for the RX600
26733series and disabled for the RX200 series.
26734
26735Floating-point instructions are only generated for 32-bit floating-point
26736values, however, so the FPU hardware is not used for doubles if the
26737@option{-m64bit-doubles} option is used.
26738
26739@emph{Note} If the @option{-fpu} option is enabled then
26740@option{-funsafe-math-optimizations} is also enabled automatically.
26741This is because the RX FPU instructions are themselves unsafe.
26742
26743@item -mcpu=@var{name}
26744@opindex mcpu
26745Selects the type of RX CPU to be targeted.  Currently three types are
26746supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26747the specific @samp{RX610} CPU.  The default is @samp{RX600}.
26748
26749The only difference between @samp{RX600} and @samp{RX610} is that the
26750@samp{RX610} does not support the @code{MVTIPL} instruction.
26751
26752The @samp{RX200} series does not have a hardware floating-point unit
26753and so @option{-nofpu} is enabled by default when this type is
26754selected.
26755
26756@item -mbig-endian-data
26757@itemx -mlittle-endian-data
26758@opindex mbig-endian-data
26759@opindex mlittle-endian-data
26760Store data (but not code) in the big-endian format.  The default is
26761@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26762format.
26763
26764@item -msmall-data-limit=@var{N}
26765@opindex msmall-data-limit
26766Specifies the maximum size in bytes of global and static variables
26767which can be placed into the small data area.  Using the small data
26768area can lead to smaller and faster code, but the size of area is
26769limited and it is up to the programmer to ensure that the area does
26770not overflow.  Also when the small data area is used one of the RX's
26771registers (usually @code{r13}) is reserved for use pointing to this
26772area, so it is no longer available for use by the compiler.  This
26773could result in slower and/or larger code if variables are pushed onto
26774the stack instead of being held in this register.
26775
26776Note, common variables (variables that have not been initialized) and
26777constants are not placed into the small data area as they are assigned
26778to other sections in the output executable.
26779
26780The default value is zero, which disables this feature.  Note, this
26781feature is not enabled by default with higher optimization levels
26782(@option{-O2} etc) because of the potentially detrimental effects of
26783reserving a register.  It is up to the programmer to experiment and
26784discover whether this feature is of benefit to their program.  See the
26785description of the @option{-mpid} option for a description of how the
26786actual register to hold the small data area pointer is chosen.
26787
26788@item -msim
26789@itemx -mno-sim
26790@opindex msim
26791@opindex mno-sim
26792Use the simulator runtime.  The default is to use the libgloss
26793board-specific runtime.
26794
26795@item -mas100-syntax
26796@itemx -mno-as100-syntax
26797@opindex mas100-syntax
26798@opindex mno-as100-syntax
26799When generating assembler output use a syntax that is compatible with
26800Renesas's AS100 assembler.  This syntax can also be handled by the GAS
26801assembler, but it has some restrictions so it is not generated by default.
26802
26803@item -mmax-constant-size=@var{N}
26804@opindex mmax-constant-size
26805Specifies the maximum size, in bytes, of a constant that can be used as
26806an operand in a RX instruction.  Although the RX instruction set does
26807allow constants of up to 4 bytes in length to be used in instructions,
26808a longer value equates to a longer instruction.  Thus in some
26809circumstances it can be beneficial to restrict the size of constants
26810that are used in instructions.  Constants that are too big are instead
26811placed into a constant pool and referenced via register indirection.
26812
26813The value @var{N} can be between 0 and 4.  A value of 0 (the default)
26814or 4 means that constants of any size are allowed.
26815
26816@item -mrelax
26817@opindex mrelax
26818Enable linker relaxation.  Linker relaxation is a process whereby the
26819linker attempts to reduce the size of a program by finding shorter
26820versions of various instructions.  Disabled by default.
26821
26822@item -mint-register=@var{N}
26823@opindex mint-register
26824Specify the number of registers to reserve for fast interrupt handler
26825functions.  The value @var{N} can be between 0 and 4.  A value of 1
26826means that register @code{r13} is reserved for the exclusive use
26827of fast interrupt handlers.  A value of 2 reserves @code{r13} and
26828@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
26829@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
26830A value of 0, the default, does not reserve any registers.
26831
26832@item -msave-acc-in-interrupts
26833@opindex msave-acc-in-interrupts
26834Specifies that interrupt handler functions should preserve the
26835accumulator register.  This is only necessary if normal code might use
26836the accumulator register, for example because it performs 64-bit
26837multiplications.  The default is to ignore the accumulator as this
26838makes the interrupt handlers faster.
26839
26840@item -mpid
26841@itemx -mno-pid
26842@opindex mpid
26843@opindex mno-pid
26844Enables the generation of position independent data.  When enabled any
26845access to constant data is done via an offset from a base address
26846held in a register.  This allows the location of constant data to be
26847determined at run time without requiring the executable to be
26848relocated, which is a benefit to embedded applications with tight
26849memory constraints.  Data that can be modified is not affected by this
26850option.
26851
26852Note, using this feature reserves a register, usually @code{r13}, for
26853the constant data base address.  This can result in slower and/or
26854larger code, especially in complicated functions.
26855
26856The actual register chosen to hold the constant data base address
26857depends upon whether the @option{-msmall-data-limit} and/or the
26858@option{-mint-register} command-line options are enabled.  Starting
26859with register @code{r13} and proceeding downwards, registers are
26860allocated first to satisfy the requirements of @option{-mint-register},
26861then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
26862is possible for the small data area register to be @code{r8} if both
26863@option{-mint-register=4} and @option{-mpid} are specified on the
26864command line.
26865
26866By default this feature is not enabled.  The default can be restored
26867via the @option{-mno-pid} command-line option.
26868
26869@item -mno-warn-multiple-fast-interrupts
26870@itemx -mwarn-multiple-fast-interrupts
26871@opindex mno-warn-multiple-fast-interrupts
26872@opindex mwarn-multiple-fast-interrupts
26873Prevents GCC from issuing a warning message if it finds more than one
26874fast interrupt handler when it is compiling a file.  The default is to
26875issue a warning for each extra fast interrupt handler found, as the RX
26876only supports one such interrupt.
26877
26878@item -mallow-string-insns
26879@itemx -mno-allow-string-insns
26880@opindex mallow-string-insns
26881@opindex mno-allow-string-insns
26882Enables or disables the use of the string manipulation instructions
26883@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
26884@code{SWHILE} and also the @code{RMPA} instruction.  These
26885instructions may prefetch data, which is not safe to do if accessing
26886an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
26887for more information).
26888
26889The default is to allow these instructions, but it is not possible for
26890GCC to reliably detect all circumstances where a string instruction
26891might be used to access an I/O register, so their use cannot be
26892disabled automatically.  Instead it is reliant upon the programmer to
26893use the @option{-mno-allow-string-insns} option if their program
26894accesses I/O space.
26895
26896When the instructions are enabled GCC defines the C preprocessor
26897symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
26898symbol @code{__RX_DISALLOW_STRING_INSNS__}.
26899
26900@item -mjsr
26901@itemx -mno-jsr
26902@opindex mjsr
26903@opindex mno-jsr
26904Use only (or not only) @code{JSR} instructions to access functions.
26905This option can be used when code size exceeds the range of @code{BSR}
26906instructions.  Note that @option{-mno-jsr} does not mean to not use
26907@code{JSR} but instead means that any type of branch may be used.
26908@end table
26909
26910@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
26911has special significance to the RX port when used with the
26912@code{interrupt} function attribute.  This attribute indicates a
26913function intended to process fast interrupts.  GCC ensures
26914that it only uses the registers @code{r10}, @code{r11}, @code{r12}
26915and/or @code{r13} and only provided that the normal use of the
26916corresponding registers have been restricted via the
26917@option{-ffixed-@var{reg}} or @option{-mint-register} command-line
26918options.
26919
26920@node S/390 and zSeries Options
26921@subsection S/390 and zSeries Options
26922@cindex S/390 and zSeries Options
26923
26924These are the @samp{-m} options defined for the S/390 and zSeries architecture.
26925
26926@table @gcctabopt
26927@item -mhard-float
26928@itemx -msoft-float
26929@opindex mhard-float
26930@opindex msoft-float
26931Use (do not use) the hardware floating-point instructions and registers
26932for floating-point operations.  When @option{-msoft-float} is specified,
26933functions in @file{libgcc.a} are used to perform floating-point
26934operations.  When @option{-mhard-float} is specified, the compiler
26935generates IEEE floating-point instructions.  This is the default.
26936
26937@item -mhard-dfp
26938@itemx -mno-hard-dfp
26939@opindex mhard-dfp
26940@opindex mno-hard-dfp
26941Use (do not use) the hardware decimal-floating-point instructions for
26942decimal-floating-point operations.  When @option{-mno-hard-dfp} is
26943specified, functions in @file{libgcc.a} are used to perform
26944decimal-floating-point operations.  When @option{-mhard-dfp} is
26945specified, the compiler generates decimal-floating-point hardware
26946instructions.  This is the default for @option{-march=z9-ec} or higher.
26947
26948@item -mlong-double-64
26949@itemx -mlong-double-128
26950@opindex mlong-double-64
26951@opindex mlong-double-128
26952These switches control the size of @code{long double} type. A size
26953of 64 bits makes the @code{long double} type equivalent to the @code{double}
26954type. This is the default.
26955
26956@item -mbackchain
26957@itemx -mno-backchain
26958@opindex mbackchain
26959@opindex mno-backchain
26960Store (do not store) the address of the caller's frame as backchain pointer
26961into the callee's stack frame.
26962A backchain may be needed to allow debugging using tools that do not understand
26963DWARF call frame information.
26964When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
26965at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
26966the backchain is placed into the topmost word of the 96/160 byte register
26967save area.
26968
26969In general, code compiled with @option{-mbackchain} is call-compatible with
26970code compiled with @option{-mmo-backchain}; however, use of the backchain
26971for debugging purposes usually requires that the whole binary is built with
26972@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
26973@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
26974to build a linux kernel use @option{-msoft-float}.
26975
26976The default is to not maintain the backchain.
26977
26978@item -mpacked-stack
26979@itemx -mno-packed-stack
26980@opindex mpacked-stack
26981@opindex mno-packed-stack
26982Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
26983specified, the compiler uses the all fields of the 96/160 byte register save
26984area only for their default purpose; unused fields still take up stack space.
26985When @option{-mpacked-stack} is specified, register save slots are densely
26986packed at the top of the register save area; unused space is reused for other
26987purposes, allowing for more efficient use of the available stack space.
26988However, when @option{-mbackchain} is also in effect, the topmost word of
26989the save area is always used to store the backchain, and the return address
26990register is always saved two words below the backchain.
26991
26992As long as the stack frame backchain is not used, code generated with
26993@option{-mpacked-stack} is call-compatible with code generated with
26994@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
26995S/390 or zSeries generated code that uses the stack frame backchain at run
26996time, not just for debugging purposes.  Such code is not call-compatible
26997with code compiled with @option{-mpacked-stack}.  Also, note that the
26998combination of @option{-mbackchain},
26999@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
27000to build a linux kernel use @option{-msoft-float}.
27001
27002The default is to not use the packed stack layout.
27003
27004@item -msmall-exec
27005@itemx -mno-small-exec
27006@opindex msmall-exec
27007@opindex mno-small-exec
27008Generate (or do not generate) code using the @code{bras} instruction
27009to do subroutine calls.
27010This only works reliably if the total executable size does not
27011exceed 64k.  The default is to use the @code{basr} instruction instead,
27012which does not have this limitation.
27013
27014@item -m64
27015@itemx -m31
27016@opindex m64
27017@opindex m31
27018When @option{-m31} is specified, generate code compliant to the
27019GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
27020code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
27021particular to generate 64-bit instructions.  For the @samp{s390}
27022targets, the default is @option{-m31}, while the @samp{s390x}
27023targets default to @option{-m64}.
27024
27025@item -mzarch
27026@itemx -mesa
27027@opindex mzarch
27028@opindex mesa
27029When @option{-mzarch} is specified, generate code using the
27030instructions available on z/Architecture.
27031When @option{-mesa} is specified, generate code using the
27032instructions available on ESA/390.  Note that @option{-mesa} is
27033not possible with @option{-m64}.
27034When generating code compliant to the GNU/Linux for S/390 ABI,
27035the default is @option{-mesa}.  When generating code compliant
27036to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
27037
27038@item -mhtm
27039@itemx -mno-htm
27040@opindex mhtm
27041@opindex mno-htm
27042The @option{-mhtm} option enables a set of builtins making use of
27043instructions available with the transactional execution facility
27044introduced with the IBM zEnterprise EC12 machine generation
27045@ref{S/390 System z Built-in Functions}.
27046@option{-mhtm} is enabled by default when using @option{-march=zEC12}.
27047
27048@item -mvx
27049@itemx -mno-vx
27050@opindex mvx
27051@opindex mno-vx
27052When @option{-mvx} is specified, generate code using the instructions
27053available with the vector extension facility introduced with the IBM
27054z13 machine generation.
27055This option changes the ABI for some vector type values with regard to
27056alignment and calling conventions.  In case vector type values are
27057being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
27058command will be added to mark the resulting binary with the ABI used.
27059@option{-mvx} is enabled by default when using @option{-march=z13}.
27060
27061@item -mzvector
27062@itemx -mno-zvector
27063@opindex mzvector
27064@opindex mno-zvector
27065The @option{-mzvector} option enables vector language extensions and
27066builtins using instructions available with the vector extension
27067facility introduced with the IBM z13 machine generation.
27068This option adds support for @samp{vector} to be used as a keyword to
27069define vector type variables and arguments.  @samp{vector} is only
27070available when GNU extensions are enabled.  It will not be expanded
27071when requesting strict standard compliance e.g.@: with @option{-std=c99}.
27072In addition to the GCC low-level builtins @option{-mzvector} enables
27073a set of builtins added for compatibility with AltiVec-style
27074implementations like Power and Cell.  In order to make use of these
27075builtins the header file @file{vecintrin.h} needs to be included.
27076@option{-mzvector} is disabled by default.
27077
27078@item -mmvcle
27079@itemx -mno-mvcle
27080@opindex mmvcle
27081@opindex mno-mvcle
27082Generate (or do not generate) code using the @code{mvcle} instruction
27083to perform block moves.  When @option{-mno-mvcle} is specified,
27084use a @code{mvc} loop instead.  This is the default unless optimizing for
27085size.
27086
27087@item -mdebug
27088@itemx -mno-debug
27089@opindex mdebug
27090@opindex mno-debug
27091Print (or do not print) additional debug information when compiling.
27092The default is to not print debug information.
27093
27094@item -march=@var{cpu-type}
27095@opindex march
27096Generate code that runs on @var{cpu-type}, which is the name of a
27097system representing a certain processor type.  Possible values for
27098@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
27099@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
27100@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
27101@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
27102
27103The default is @option{-march=z900}.
27104
27105Specifying @samp{native} as cpu type can be used to select the best
27106architecture option for the host processor.
27107@option{-march=native} has no effect if GCC does not recognize the
27108processor.
27109
27110@item -mtune=@var{cpu-type}
27111@opindex mtune
27112Tune to @var{cpu-type} everything applicable about the generated code,
27113except for the ABI and the set of available instructions.
27114The list of @var{cpu-type} values is the same as for @option{-march}.
27115The default is the value used for @option{-march}.
27116
27117@item -mtpf-trace
27118@itemx -mno-tpf-trace
27119@opindex mtpf-trace
27120@opindex mno-tpf-trace
27121Generate code that adds (does not add) in TPF OS specific branches to trace
27122routines in the operating system.  This option is off by default, even
27123when compiling for the TPF OS@.
27124
27125@item -mtpf-trace-skip
27126@itemx -mno-tpf-trace-skip
27127@opindex mtpf-trace-skip
27128@opindex mno-tpf-trace-skip
27129Generate code that changes (does not change) the default branch
27130targets enabled by @option{-mtpf-trace} to point to specialized trace
27131routines providing the ability of selectively skipping function trace
27132entries for the TPF OS.  This option is off by default, even when
27133compiling for the TPF OS and specifying @option{-mtpf-trace}.
27134
27135@item -mfused-madd
27136@itemx -mno-fused-madd
27137@opindex mfused-madd
27138@opindex mno-fused-madd
27139Generate code that uses (does not use) the floating-point multiply and
27140accumulate instructions.  These instructions are generated by default if
27141hardware floating point is used.
27142
27143@item -mwarn-framesize=@var{framesize}
27144@opindex mwarn-framesize
27145Emit a warning if the current function exceeds the given frame size.  Because
27146this is a compile-time check it doesn't need to be a real problem when the program
27147runs.  It is intended to identify functions that most probably cause
27148a stack overflow.  It is useful to be used in an environment with limited stack
27149size e.g.@: the linux kernel.
27150
27151@item -mwarn-dynamicstack
27152@opindex mwarn-dynamicstack
27153Emit a warning if the function calls @code{alloca} or uses dynamically-sized
27154arrays.  This is generally a bad idea with a limited stack size.
27155
27156@item -mstack-guard=@var{stack-guard}
27157@itemx -mstack-size=@var{stack-size}
27158@opindex mstack-guard
27159@opindex mstack-size
27160If these options are provided the S/390 back end emits additional instructions in
27161the function prologue that trigger a trap if the stack size is @var{stack-guard}
27162bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27163If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27164the frame size of the compiled function is chosen.
27165These options are intended to be used to help debugging stack overflow problems.
27166The additionally emitted code causes only little overhead and hence can also be
27167used in production-like systems without greater performance degradation.  The given
27168values have to be exact powers of 2 and @var{stack-size} has to be greater than
27169@var{stack-guard} without exceeding 64k.
27170In order to be efficient the extra code makes the assumption that the stack starts
27171at an address aligned to the value given by @var{stack-size}.
27172The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27173
27174@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27175@opindex mhotpatch
27176If the hotpatch option is enabled, a ``hot-patching'' function
27177prologue is generated for all functions in the compilation unit.
27178The funtion label is prepended with the given number of two-byte
27179NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
27180the label, 2 * @var{post-halfwords} bytes are appended, using the
27181largest NOP like instructions the architecture allows (maximum
271821000000).
27183
27184If both arguments are zero, hotpatching is disabled.
27185
27186This option can be overridden for individual functions with the
27187@code{hotpatch} attribute.
27188@end table
27189
27190@node Score Options
27191@subsection Score Options
27192@cindex Score Options
27193
27194These options are defined for Score implementations:
27195
27196@table @gcctabopt
27197@item -meb
27198@opindex meb
27199Compile code for big-endian mode.  This is the default.
27200
27201@item -mel
27202@opindex mel
27203Compile code for little-endian mode.
27204
27205@item -mnhwloop
27206@opindex mnhwloop
27207Disable generation of @code{bcnz} instructions.
27208
27209@item -muls
27210@opindex muls
27211Enable generation of unaligned load and store instructions.
27212
27213@item -mmac
27214@opindex mmac
27215Enable the use of multiply-accumulate instructions. Disabled by default.
27216
27217@item -mscore5
27218@opindex mscore5
27219Specify the SCORE5 as the target architecture.
27220
27221@item -mscore5u
27222@opindex mscore5u
27223Specify the SCORE5U of the target architecture.
27224
27225@item -mscore7
27226@opindex mscore7
27227Specify the SCORE7 as the target architecture. This is the default.
27228
27229@item -mscore7d
27230@opindex mscore7d
27231Specify the SCORE7D as the target architecture.
27232@end table
27233
27234@node SH Options
27235@subsection SH Options
27236
27237These @samp{-m} options are defined for the SH implementations:
27238
27239@table @gcctabopt
27240@item -m1
27241@opindex m1
27242Generate code for the SH1.
27243
27244@item -m2
27245@opindex m2
27246Generate code for the SH2.
27247
27248@item -m2e
27249Generate code for the SH2e.
27250
27251@item -m2a-nofpu
27252@opindex m2a-nofpu
27253Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27254that the floating-point unit is not used.
27255
27256@item -m2a-single-only
27257@opindex m2a-single-only
27258Generate code for the SH2a-FPU, in such a way that no double-precision
27259floating-point operations are used.
27260
27261@item -m2a-single
27262@opindex m2a-single
27263Generate code for the SH2a-FPU assuming the floating-point unit is in
27264single-precision mode by default.
27265
27266@item -m2a
27267@opindex m2a
27268Generate code for the SH2a-FPU assuming the floating-point unit is in
27269double-precision mode by default.
27270
27271@item -m3
27272@opindex m3
27273Generate code for the SH3.
27274
27275@item -m3e
27276@opindex m3e
27277Generate code for the SH3e.
27278
27279@item -m4-nofpu
27280@opindex m4-nofpu
27281Generate code for the SH4 without a floating-point unit.
27282
27283@item -m4-single-only
27284@opindex m4-single-only
27285Generate code for the SH4 with a floating-point unit that only
27286supports single-precision arithmetic.
27287
27288@item -m4-single
27289@opindex m4-single
27290Generate code for the SH4 assuming the floating-point unit is in
27291single-precision mode by default.
27292
27293@item -m4
27294@opindex m4
27295Generate code for the SH4.
27296
27297@item -m4-100
27298@opindex m4-100
27299Generate code for SH4-100.
27300
27301@item -m4-100-nofpu
27302@opindex m4-100-nofpu
27303Generate code for SH4-100 in such a way that the
27304floating-point unit is not used.
27305
27306@item -m4-100-single
27307@opindex m4-100-single
27308Generate code for SH4-100 assuming the floating-point unit is in
27309single-precision mode by default.
27310
27311@item -m4-100-single-only
27312@opindex m4-100-single-only
27313Generate code for SH4-100 in such a way that no double-precision
27314floating-point operations are used.
27315
27316@item -m4-200
27317@opindex m4-200
27318Generate code for SH4-200.
27319
27320@item -m4-200-nofpu
27321@opindex m4-200-nofpu
27322Generate code for SH4-200 without in such a way that the
27323floating-point unit is not used.
27324
27325@item -m4-200-single
27326@opindex m4-200-single
27327Generate code for SH4-200 assuming the floating-point unit is in
27328single-precision mode by default.
27329
27330@item -m4-200-single-only
27331@opindex m4-200-single-only
27332Generate code for SH4-200 in such a way that no double-precision
27333floating-point operations are used.
27334
27335@item -m4-300
27336@opindex m4-300
27337Generate code for SH4-300.
27338
27339@item -m4-300-nofpu
27340@opindex m4-300-nofpu
27341Generate code for SH4-300 without in such a way that the
27342floating-point unit is not used.
27343
27344@item -m4-300-single
27345@opindex m4-300-single
27346Generate code for SH4-300 in such a way that no double-precision
27347floating-point operations are used.
27348
27349@item -m4-300-single-only
27350@opindex m4-300-single-only
27351Generate code for SH4-300 in such a way that no double-precision
27352floating-point operations are used.
27353
27354@item -m4-340
27355@opindex m4-340
27356Generate code for SH4-340 (no MMU, no FPU).
27357
27358@item -m4-500
27359@opindex m4-500
27360Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
27361assembler.
27362
27363@item -m4a-nofpu
27364@opindex m4a-nofpu
27365Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27366floating-point unit is not used.
27367
27368@item -m4a-single-only
27369@opindex m4a-single-only
27370Generate code for the SH4a, in such a way that no double-precision
27371floating-point operations are used.
27372
27373@item -m4a-single
27374@opindex m4a-single
27375Generate code for the SH4a assuming the floating-point unit is in
27376single-precision mode by default.
27377
27378@item -m4a
27379@opindex m4a
27380Generate code for the SH4a.
27381
27382@item -m4al
27383@opindex m4al
27384Same as @option{-m4a-nofpu}, except that it implicitly passes
27385@option{-dsp} to the assembler.  GCC doesn't generate any DSP
27386instructions at the moment.
27387
27388@item -mb
27389@opindex mb
27390Compile code for the processor in big-endian mode.
27391
27392@item -ml
27393@opindex ml
27394Compile code for the processor in little-endian mode.
27395
27396@item -mdalign
27397@opindex mdalign
27398Align doubles at 64-bit boundaries.  Note that this changes the calling
27399conventions, and thus some functions from the standard C library do
27400not work unless you recompile it first with @option{-mdalign}.
27401
27402@item -mrelax
27403@opindex mrelax
27404Shorten some address references at link time, when possible; uses the
27405linker option @option{-relax}.
27406
27407@item -mbigtable
27408@opindex mbigtable
27409Use 32-bit offsets in @code{switch} tables.  The default is to use
2741016-bit offsets.
27411
27412@item -mbitops
27413@opindex mbitops
27414Enable the use of bit manipulation instructions on SH2A.
27415
27416@item -mfmovd
27417@opindex mfmovd
27418Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
27419alignment constraints.
27420
27421@item -mrenesas
27422@opindex mrenesas
27423Comply with the calling conventions defined by Renesas.
27424
27425@item -mno-renesas
27426@opindex mno-renesas
27427Comply with the calling conventions defined for GCC before the Renesas
27428conventions were available.  This option is the default for all
27429targets of the SH toolchain.
27430
27431@item -mnomacsave
27432@opindex mnomacsave
27433Mark the @code{MAC} register as call-clobbered, even if
27434@option{-mrenesas} is given.
27435
27436@item -mieee
27437@itemx -mno-ieee
27438@opindex mieee
27439@opindex mno-ieee
27440Control the IEEE compliance of floating-point comparisons, which affects the
27441handling of cases where the result of a comparison is unordered.  By default
27442@option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
27443enabled @option{-mno-ieee} is implicitly set, which results in faster
27444floating-point greater-equal and less-equal comparisons.  The implicit settings
27445can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27446
27447@item -minline-ic_invalidate
27448@opindex minline-ic_invalidate
27449Inline code to invalidate instruction cache entries after setting up
27450nested function trampolines.
27451This option has no effect if @option{-musermode} is in effect and the selected
27452code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27453instruction.
27454If the selected code generation option does not allow the use of the @code{icbi}
27455instruction, and @option{-musermode} is not in effect, the inlined code
27456manipulates the instruction cache address array directly with an associative
27457write.  This not only requires privileged mode at run time, but it also
27458fails if the cache line had been mapped via the TLB and has become unmapped.
27459
27460@item -misize
27461@opindex misize
27462Dump instruction size and location in the assembly code.
27463
27464@item -mpadstruct
27465@opindex mpadstruct
27466This option is deprecated.  It pads structures to multiple of 4 bytes,
27467which is incompatible with the SH ABI@.
27468
27469@item -matomic-model=@var{model}
27470@opindex matomic-model=@var{model}
27471Sets the model of atomic operations and additional parameters as a comma
27472separated list.  For details on the atomic built-in functions see
27473@ref{__atomic Builtins}.  The following models and parameters are supported:
27474
27475@table @samp
27476
27477@item none
27478Disable compiler generated atomic sequences and emit library calls for atomic
27479operations.  This is the default if the target is not @code{sh*-*-linux*}.
27480
27481@item soft-gusa
27482Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27483built-in functions.  The generated atomic sequences require additional support
27484from the interrupt/exception handling code of the system and are only suitable
27485for SH3* and SH4* single-core systems.  This option is enabled by default when
27486the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
27487this option also partially utilizes the hardware atomic instructions
27488@code{movli.l} and @code{movco.l} to create more efficient code, unless
27489@samp{strict} is specified.
27490
27491@item soft-tcb
27492Generate software atomic sequences that use a variable in the thread control
27493block.  This is a variation of the gUSA sequences which can also be used on
27494SH1* and SH2* targets.  The generated atomic sequences require additional
27495support from the interrupt/exception handling code of the system and are only
27496suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
27497parameter has to be specified as well.
27498
27499@item soft-imask
27500Generate software atomic sequences that temporarily disable interrupts by
27501setting @code{SR.IMASK = 1111}.  This model works only when the program runs
27502in privileged mode and is only suitable for single-core systems.  Additional
27503support from the interrupt/exception handling code of the system is not
27504required.  This model is enabled by default when the target is
27505@code{sh*-*-linux*} and SH1* or SH2*.
27506
27507@item hard-llcs
27508Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27509instructions only.  This is only available on SH4A and is suitable for
27510multi-core systems.  Since the hardware instructions support only 32 bit atomic
27511variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27512Code compiled with this option is also compatible with other software
27513atomic model interrupt/exception handling systems if executed on an SH4A
27514system.  Additional support from the interrupt/exception handling code of the
27515system is not required for this model.
27516
27517@item gbr-offset=
27518This parameter specifies the offset in bytes of the variable in the thread
27519control block structure that should be used by the generated atomic sequences
27520when the @samp{soft-tcb} model has been selected.  For other models this
27521parameter is ignored.  The specified value must be an integer multiple of four
27522and in the range 0-1020.
27523
27524@item strict
27525This parameter prevents mixed usage of multiple atomic models, even if they
27526are compatible, and makes the compiler generate atomic sequences of the
27527specified model only.
27528
27529@end table
27530
27531@item -mtas
27532@opindex mtas
27533Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27534Notice that depending on the particular hardware and software configuration
27535this can degrade overall performance due to the operand cache line flushes
27536that are implied by the @code{tas.b} instruction.  On multi-core SH4A
27537processors the @code{tas.b} instruction must be used with caution since it
27538can result in data corruption for certain cache configurations.
27539
27540@item -mprefergot
27541@opindex mprefergot
27542When generating position-independent code, emit function calls using
27543the Global Offset Table instead of the Procedure Linkage Table.
27544
27545@item -musermode
27546@itemx -mno-usermode
27547@opindex musermode
27548@opindex mno-usermode
27549Don't allow (allow) the compiler generating privileged mode code.  Specifying
27550@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27551inlined code would not work in user mode.  @option{-musermode} is the default
27552when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
27553@option{-musermode} has no effect, since there is no user mode.
27554
27555@item -multcost=@var{number}
27556@opindex multcost=@var{number}
27557Set the cost to assume for a multiply insn.
27558
27559@item -mdiv=@var{strategy}
27560@opindex mdiv=@var{strategy}
27561Set the division strategy to be used for integer division operations.
27562@var{strategy} can be one of:
27563
27564@table @samp
27565
27566@item call-div1
27567Calls a library function that uses the single-step division instruction
27568@code{div1} to perform the operation.  Division by zero calculates an
27569unspecified result and does not trap.  This is the default except for SH4,
27570SH2A and SHcompact.
27571
27572@item call-fp
27573Calls a library function that performs the operation in double precision
27574floating point.  Division by zero causes a floating-point exception.  This is
27575the default for SHcompact with FPU.  Specifying this for targets that do not
27576have a double precision FPU defaults to @code{call-div1}.
27577
27578@item call-table
27579Calls a library function that uses a lookup table for small divisors and
27580the @code{div1} instruction with case distinction for larger divisors.  Division
27581by zero calculates an unspecified result and does not trap.  This is the default
27582for SH4.  Specifying this for targets that do not have dynamic shift
27583instructions defaults to @code{call-div1}.
27584
27585@end table
27586
27587When a division strategy has not been specified the default strategy is
27588selected based on the current target.  For SH2A the default strategy is to
27589use the @code{divs} and @code{divu} instructions instead of library function
27590calls.
27591
27592@item -maccumulate-outgoing-args
27593@opindex maccumulate-outgoing-args
27594Reserve space once for outgoing arguments in the function prologue rather
27595than around each call.  Generally beneficial for performance and size.  Also
27596needed for unwinding to avoid changing the stack frame around conditional code.
27597
27598@item -mdivsi3_libfunc=@var{name}
27599@opindex mdivsi3_libfunc=@var{name}
27600Set the name of the library function used for 32-bit signed division to
27601@var{name}.
27602This only affects the name used in the @samp{call} division strategies, and
27603the compiler still expects the same sets of input/output/clobbered registers as
27604if this option were not present.
27605
27606@item -mfixed-range=@var{register-range}
27607@opindex mfixed-range
27608Generate code treating the given register range as fixed registers.
27609A fixed register is one that the register allocator cannot use.  This is
27610useful when compiling kernel code.  A register range is specified as
27611two registers separated by a dash.  Multiple register ranges can be
27612specified separated by a comma.
27613
27614@item -mbranch-cost=@var{num}
27615@opindex mbranch-cost=@var{num}
27616Assume @var{num} to be the cost for a branch instruction.  Higher numbers
27617make the compiler try to generate more branch-free code if possible.
27618If not specified the value is selected depending on the processor type that
27619is being compiled for.
27620
27621@item -mzdcbranch
27622@itemx -mno-zdcbranch
27623@opindex mzdcbranch
27624@opindex mno-zdcbranch
27625Assume (do not assume) that zero displacement conditional branch instructions
27626@code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
27627compiler prefers zero displacement branch code sequences.  This is
27628enabled by default when generating code for SH4 and SH4A.  It can be explicitly
27629disabled by specifying @option{-mno-zdcbranch}.
27630
27631@item -mcbranch-force-delay-slot
27632@opindex mcbranch-force-delay-slot
27633Force the usage of delay slots for conditional branches, which stuffs the delay
27634slot with a @code{nop} if a suitable instruction cannot be found.  By default
27635this option is disabled.  It can be enabled to work around hardware bugs as
27636found in the original SH7055.
27637
27638@item -mfused-madd
27639@itemx -mno-fused-madd
27640@opindex mfused-madd
27641@opindex mno-fused-madd
27642Generate code that uses (does not use) the floating-point multiply and
27643accumulate instructions.  These instructions are generated by default
27644if hardware floating point is used.  The machine-dependent
27645@option{-mfused-madd} option is now mapped to the machine-independent
27646@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27647mapped to @option{-ffp-contract=off}.
27648
27649@item -mfsca
27650@itemx -mno-fsca
27651@opindex mfsca
27652@opindex mno-fsca
27653Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27654and cosine approximations.  The option @option{-mfsca} must be used in
27655combination with @option{-funsafe-math-optimizations}.  It is enabled by default
27656when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
27657approximations even if @option{-funsafe-math-optimizations} is in effect.
27658
27659@item -mfsrra
27660@itemx -mno-fsrra
27661@opindex mfsrra
27662@opindex mno-fsrra
27663Allow or disallow the compiler to emit the @code{fsrra} instruction for
27664reciprocal square root approximations.  The option @option{-mfsrra} must be used
27665in combination with @option{-funsafe-math-optimizations} and
27666@option{-ffinite-math-only}.  It is enabled by default when generating code for
27667SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
27668even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27669in effect.
27670
27671@item -mpretend-cmove
27672@opindex mpretend-cmove
27673Prefer zero-displacement conditional branches for conditional move instruction
27674patterns.  This can result in faster code on the SH4 processor.
27675
27676@item -mfdpic
27677@opindex fdpic
27678Generate code using the FDPIC ABI.
27679
27680@end table
27681
27682@node Solaris 2 Options
27683@subsection Solaris 2 Options
27684@cindex Solaris 2 options
27685
27686These @samp{-m} options are supported on Solaris 2:
27687
27688@table @gcctabopt
27689@item -mclear-hwcap
27690@opindex mclear-hwcap
27691@option{-mclear-hwcap} tells the compiler to remove the hardware
27692capabilities generated by the Solaris assembler.  This is only necessary
27693when object files use ISA extensions not supported by the current
27694machine, but check at runtime whether or not to use them.
27695
27696@item -mimpure-text
27697@opindex mimpure-text
27698@option{-mimpure-text}, used in addition to @option{-shared}, tells
27699the compiler to not pass @option{-z text} to the linker when linking a
27700shared object.  Using this option, you can link position-dependent
27701code into a shared object.
27702
27703@option{-mimpure-text} suppresses the ``relocations remain against
27704allocatable but non-writable sections'' linker error message.
27705However, the necessary relocations trigger copy-on-write, and the
27706shared object is not actually shared across processes.  Instead of
27707using @option{-mimpure-text}, you should compile all source code with
27708@option{-fpic} or @option{-fPIC}.
27709
27710@end table
27711
27712These switches are supported in addition to the above on Solaris 2:
27713
27714@table @gcctabopt
27715@item -pthreads
27716@opindex pthreads
27717This is a synonym for @option{-pthread}.
27718@end table
27719
27720@node SPARC Options
27721@subsection SPARC Options
27722@cindex SPARC options
27723
27724These @samp{-m} options are supported on the SPARC:
27725
27726@table @gcctabopt
27727@item -mno-app-regs
27728@itemx -mapp-regs
27729@opindex mno-app-regs
27730@opindex mapp-regs
27731Specify @option{-mapp-regs} to generate output using the global registers
277322 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
27733global register 1, each global register 2 through 4 is then treated as an
27734allocable register that is clobbered by function calls.  This is the default.
27735
27736To be fully SVR4 ABI-compliant at the cost of some performance loss,
27737specify @option{-mno-app-regs}.  You should compile libraries and system
27738software with this option.
27739
27740@item -mflat
27741@itemx -mno-flat
27742@opindex mflat
27743@opindex mno-flat
27744With @option{-mflat}, the compiler does not generate save/restore instructions
27745and uses a ``flat'' or single register window model.  This model is compatible
27746with the regular register window model.  The local registers and the input
27747registers (0--5) are still treated as ``call-saved'' registers and are
27748saved on the stack as needed.
27749
27750With @option{-mno-flat} (the default), the compiler generates save/restore
27751instructions (except for leaf functions).  This is the normal operating mode.
27752
27753@item -mfpu
27754@itemx -mhard-float
27755@opindex mfpu
27756@opindex mhard-float
27757Generate output containing floating-point instructions.  This is the
27758default.
27759
27760@item -mno-fpu
27761@itemx -msoft-float
27762@opindex mno-fpu
27763@opindex msoft-float
27764Generate output containing library calls for floating point.
27765@strong{Warning:} the requisite libraries are not available for all SPARC
27766targets.  Normally the facilities of the machine's usual C compiler are
27767used, but this cannot be done directly in cross-compilation.  You must make
27768your own arrangements to provide suitable library functions for
27769cross-compilation.  The embedded targets @samp{sparc-*-aout} and
27770@samp{sparclite-*-*} do provide software floating-point support.
27771
27772@option{-msoft-float} changes the calling convention in the output file;
27773therefore, it is only useful if you compile @emph{all} of a program with
27774this option.  In particular, you need to compile @file{libgcc.a}, the
27775library that comes with GCC, with @option{-msoft-float} in order for
27776this to work.
27777
27778@item -mhard-quad-float
27779@opindex mhard-quad-float
27780Generate output containing quad-word (long double) floating-point
27781instructions.
27782
27783@item -msoft-quad-float
27784@opindex msoft-quad-float
27785Generate output containing library calls for quad-word (long double)
27786floating-point instructions.  The functions called are those specified
27787in the SPARC ABI@.  This is the default.
27788
27789As of this writing, there are no SPARC implementations that have hardware
27790support for the quad-word floating-point instructions.  They all invoke
27791a trap handler for one of these instructions, and then the trap handler
27792emulates the effect of the instruction.  Because of the trap handler overhead,
27793this is much slower than calling the ABI library routines.  Thus the
27794@option{-msoft-quad-float} option is the default.
27795
27796@item -mno-unaligned-doubles
27797@itemx -munaligned-doubles
27798@opindex mno-unaligned-doubles
27799@opindex munaligned-doubles
27800Assume that doubles have 8-byte alignment.  This is the default.
27801
27802With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
27803alignment only if they are contained in another type, or if they have an
27804absolute address.  Otherwise, it assumes they have 4-byte alignment.
27805Specifying this option avoids some rare compatibility problems with code
27806generated by other compilers.  It is not the default because it results
27807in a performance loss, especially for floating-point code.
27808
27809@item -muser-mode
27810@itemx -mno-user-mode
27811@opindex muser-mode
27812@opindex mno-user-mode
27813Do not generate code that can only run in supervisor mode.  This is relevant
27814only for the @code{casa} instruction emitted for the LEON3 processor.  This
27815is the default.
27816
27817@item -mfaster-structs
27818@itemx -mno-faster-structs
27819@opindex mfaster-structs
27820@opindex mno-faster-structs
27821With @option{-mfaster-structs}, the compiler assumes that structures
27822should have 8-byte alignment.  This enables the use of pairs of
27823@code{ldd} and @code{std} instructions for copies in structure
27824assignment, in place of twice as many @code{ld} and @code{st} pairs.
27825However, the use of this changed alignment directly violates the SPARC
27826ABI@.  Thus, it's intended only for use on targets where the developer
27827acknowledges that their resulting code is not directly in line with
27828the rules of the ABI@.
27829
27830@item -mstd-struct-return
27831@itemx -mno-std-struct-return
27832@opindex mstd-struct-return
27833@opindex mno-std-struct-return
27834With @option{-mstd-struct-return}, the compiler generates checking code
27835in functions returning structures or unions to detect size mismatches
27836between the two sides of function calls, as per the 32-bit ABI@.
27837
27838The default is @option{-mno-std-struct-return}.  This option has no effect
27839in 64-bit mode.
27840
27841@item -mlra
27842@itemx -mno-lra
27843@opindex mlra
27844@opindex mno-lra
27845Enable Local Register Allocation.  This is the default for SPARC since GCC 7
27846so @option{-mno-lra} needs to be passed to get old Reload.
27847
27848@item -mcpu=@var{cpu_type}
27849@opindex mcpu
27850Set the instruction set, register set, and instruction scheduling parameters
27851for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
27852@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
27853@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
27854@samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
27855@samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
27856@samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
27857@samp{m8}.
27858
27859Native Solaris and GNU/Linux toolchains also support the value @samp{native},
27860which selects the best architecture option for the host processor.
27861@option{-mcpu=native} has no effect if GCC does not recognize
27862the processor.
27863
27864Default instruction scheduling parameters are used for values that select
27865an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
27866@samp{sparclite}, @samp{sparclet}, @samp{v9}.
27867
27868Here is a list of each supported architecture and their supported
27869implementations.
27870
27871@table @asis
27872@item v7
27873cypress, leon3v7
27874
27875@item v8
27876supersparc, hypersparc, leon, leon3, leon5
27877
27878@item sparclite
27879f930, f934, sparclite86x
27880
27881@item sparclet
27882tsc701
27883
27884@item v9
27885ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27886niagara7, m8
27887@end table
27888
27889By default (unless configured otherwise), GCC generates code for the V7
27890variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
27891additionally optimizes it for the Cypress CY7C602 chip, as used in the
27892SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
27893SPARCStation 1, 2, IPX etc.
27894
27895With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
27896architecture.  The only difference from V7 code is that the compiler emits
27897the integer multiply and integer divide instructions which exist in SPARC-V8
27898but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
27899optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
279002000 series.
27901
27902With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
27903the SPARC architecture.  This adds the integer multiply, integer divide step
27904and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
27905With @option{-mcpu=f930}, the compiler additionally optimizes it for the
27906Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
27907@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
27908MB86934 chip, which is the more recent SPARClite with FPU@.
27909
27910With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
27911the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
27912integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
27913but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
27914optimizes it for the TEMIC SPARClet chip.
27915
27916With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
27917architecture.  This adds 64-bit integer and floating-point move instructions,
279183 additional floating-point condition code registers and conditional move
27919instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
27920optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
27921@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
27922Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
27923@option{-mcpu=niagara}, the compiler additionally optimizes it for
27924Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
27925additionally optimizes it for Sun UltraSPARC T2 chips. With
27926@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
27927UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
27928additionally optimizes it for Sun UltraSPARC T4 chips.  With
27929@option{-mcpu=niagara7}, the compiler additionally optimizes it for
27930Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
27931additionally optimizes it for Oracle M8 chips.
27932
27933@item -mtune=@var{cpu_type}
27934@opindex mtune
27935Set the instruction scheduling parameters for machine type
27936@var{cpu_type}, but do not set the instruction set or register set that the
27937option @option{-mcpu=@var{cpu_type}} does.
27938
27939The same values for @option{-mcpu=@var{cpu_type}} can be used for
27940@option{-mtune=@var{cpu_type}}, but the only useful values are those
27941that select a particular CPU implementation.  Those are
27942@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
27943@samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
27944@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
27945@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
27946@samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
27947and GNU/Linux toolchains, @samp{native} can also be used.
27948
27949@item -mv8plus
27950@itemx -mno-v8plus
27951@opindex mv8plus
27952@opindex mno-v8plus
27953With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
27954difference from the V8 ABI is that the global and out registers are
27955considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
27956mode for all SPARC-V9 processors.
27957
27958@item -mvis
27959@itemx -mno-vis
27960@opindex mvis
27961@opindex mno-vis
27962With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
27963Visual Instruction Set extensions.  The default is @option{-mno-vis}.
27964
27965@item -mvis2
27966@itemx -mno-vis2
27967@opindex mvis2
27968@opindex mno-vis2
27969With @option{-mvis2}, GCC generates code that takes advantage of
27970version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
27971default is @option{-mvis2} when targeting a cpu that supports such
27972instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
27973also sets @option{-mvis}.
27974
27975@item -mvis3
27976@itemx -mno-vis3
27977@opindex mvis3
27978@opindex mno-vis3
27979With @option{-mvis3}, GCC generates code that takes advantage of
27980version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
27981default is @option{-mvis3} when targeting a cpu that supports such
27982instructions, such as niagara-3 and later.  Setting @option{-mvis3}
27983also sets @option{-mvis2} and @option{-mvis}.
27984
27985@item -mvis4
27986@itemx -mno-vis4
27987@opindex mvis4
27988@opindex mno-vis4
27989With @option{-mvis4}, GCC generates code that takes advantage of
27990version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
27991default is @option{-mvis4} when targeting a cpu that supports such
27992instructions, such as niagara-7 and later.  Setting @option{-mvis4}
27993also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
27994
27995@item -mvis4b
27996@itemx -mno-vis4b
27997@opindex mvis4b
27998@opindex mno-vis4b
27999With @option{-mvis4b}, GCC generates code that takes advantage of
28000version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
28001the additional VIS instructions introduced in the Oracle SPARC
28002Architecture 2017.  The default is @option{-mvis4b} when targeting a
28003cpu that supports such instructions, such as m8 and later.  Setting
28004@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
28005@option{-mvis2} and @option{-mvis}.
28006
28007@item -mcbcond
28008@itemx -mno-cbcond
28009@opindex mcbcond
28010@opindex mno-cbcond
28011With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
28012Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
28013when targeting a CPU that supports such instructions, such as Niagara-4 and
28014later.
28015
28016@item -mfmaf
28017@itemx -mno-fmaf
28018@opindex mfmaf
28019@opindex mno-fmaf
28020With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
28021Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
28022when targeting a CPU that supports such instructions, such as Niagara-3 and
28023later.
28024
28025@item -mfsmuld
28026@itemx -mno-fsmuld
28027@opindex mfsmuld
28028@opindex mno-fsmuld
28029With @option{-mfsmuld}, GCC generates code that takes advantage of the
28030Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
28031@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
28032or V9 with FPU except @option{-mcpu=leon}.
28033
28034@item -mpopc
28035@itemx -mno-popc
28036@opindex mpopc
28037@opindex mno-popc
28038With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
28039Population Count instruction.  The default is @option{-mpopc}
28040when targeting a CPU that supports such an instruction, such as Niagara-2 and
28041later.
28042
28043@item -msubxc
28044@itemx -mno-subxc
28045@opindex msubxc
28046@opindex mno-subxc
28047With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
28048Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
28049when targeting a CPU that supports such an instruction, such as Niagara-7 and
28050later.
28051
28052@item -mfix-at697f
28053@opindex mfix-at697f
28054Enable the documented workaround for the single erratum of the Atmel AT697F
28055processor (which corresponds to erratum #13 of the AT697E processor).
28056
28057@item -mfix-ut699
28058@opindex mfix-ut699
28059Enable the documented workarounds for the floating-point errata and the data
28060cache nullify errata of the UT699 processor.
28061
28062@item -mfix-ut700
28063@opindex mfix-ut700
28064Enable the documented workaround for the back-to-back store errata of
28065the UT699E/UT700 processor.
28066
28067@item -mfix-gr712rc
28068@opindex mfix-gr712rc
28069Enable the documented workaround for the back-to-back store errata of
28070the GR712RC processor.
28071@end table
28072
28073These @samp{-m} options are supported in addition to the above
28074on SPARC-V9 processors in 64-bit environments:
28075
28076@table @gcctabopt
28077@item -m32
28078@itemx -m64
28079@opindex m32
28080@opindex m64
28081Generate code for a 32-bit or 64-bit environment.
28082The 32-bit environment sets int, long and pointer to 32 bits.
28083The 64-bit environment sets int to 32 bits and long and pointer
28084to 64 bits.
28085
28086@item -mcmodel=@var{which}
28087@opindex mcmodel
28088Set the code model to one of
28089
28090@table @samp
28091@item medlow
28092The Medium/Low code model: 64-bit addresses, programs
28093must be linked in the low 32 bits of memory.  Programs can be statically
28094or dynamically linked.
28095
28096@item medmid
28097The Medium/Middle code model: 64-bit addresses, programs
28098must be linked in the low 44 bits of memory, the text and data segments must
28099be less than 2GB in size and the data segment must be located within 2GB of
28100the text segment.
28101
28102@item medany
28103The Medium/Anywhere code model: 64-bit addresses, programs
28104may be linked anywhere in memory, the text and data segments must be less
28105than 2GB in size and the data segment must be located within 2GB of the
28106text segment.
28107
28108@item embmedany
28109The Medium/Anywhere code model for embedded systems:
2811064-bit addresses, the text and data segments must be less than 2GB in
28111size, both starting anywhere in memory (determined at link time).  The
28112global register %g4 points to the base of the data segment.  Programs
28113are statically linked and PIC is not supported.
28114@end table
28115
28116@item -mmemory-model=@var{mem-model}
28117@opindex mmemory-model
28118Set the memory model in force on the processor to one of
28119
28120@table @samp
28121@item default
28122The default memory model for the processor and operating system.
28123
28124@item rmo
28125Relaxed Memory Order
28126
28127@item pso
28128Partial Store Order
28129
28130@item tso
28131Total Store Order
28132
28133@item sc
28134Sequential Consistency
28135@end table
28136
28137These memory models are formally defined in Appendix D of the SPARC-V9
28138architecture manual, as set in the processor's @code{PSTATE.MM} field.
28139
28140@item -mstack-bias
28141@itemx -mno-stack-bias
28142@opindex mstack-bias
28143@opindex mno-stack-bias
28144With @option{-mstack-bias}, GCC assumes that the stack pointer, and
28145frame pointer if present, are offset by @minus{}2047 which must be added back
28146when making stack frame references.  This is the default in 64-bit mode.
28147Otherwise, assume no such offset is present.
28148@end table
28149
28150@node System V Options
28151@subsection Options for System V
28152
28153These additional options are available on System V Release 4 for
28154compatibility with other compilers on those systems:
28155
28156@table @gcctabopt
28157@item -G
28158@opindex G
28159Create a shared object.
28160It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28161
28162@item -Qy
28163@opindex Qy
28164Identify the versions of each tool used by the compiler, in a
28165@code{.ident} assembler directive in the output.
28166
28167@item -Qn
28168@opindex Qn
28169Refrain from adding @code{.ident} directives to the output file (this is
28170the default).
28171
28172@item -YP,@var{dirs}
28173@opindex YP
28174Search the directories @var{dirs}, and no others, for libraries
28175specified with @option{-l}.
28176
28177@item -Ym,@var{dir}
28178@opindex Ym
28179Look in the directory @var{dir} to find the M4 preprocessor.
28180The assembler uses this option.
28181@c This is supposed to go with a -Yd for predefined M4 macro files, but
28182@c the generic assembler that comes with Solaris takes just -Ym.
28183@end table
28184
28185@node TILE-Gx Options
28186@subsection TILE-Gx Options
28187@cindex TILE-Gx options
28188
28189These @samp{-m} options are supported on the TILE-Gx:
28190
28191@table @gcctabopt
28192@item -mcmodel=small
28193@opindex mcmodel=small
28194Generate code for the small model.  The distance for direct calls is
28195limited to 500M in either direction.  PC-relative addresses are 32
28196bits.  Absolute addresses support the full address range.
28197
28198@item -mcmodel=large
28199@opindex mcmodel=large
28200Generate code for the large model.  There is no limitation on call
28201distance, pc-relative addresses, or absolute addresses.
28202
28203@item -mcpu=@var{name}
28204@opindex mcpu
28205Selects the type of CPU to be targeted.  Currently the only supported
28206type is @samp{tilegx}.
28207
28208@item -m32
28209@itemx -m64
28210@opindex m32
28211@opindex m64
28212Generate code for a 32-bit or 64-bit environment.  The 32-bit
28213environment sets int, long, and pointer to 32 bits.  The 64-bit
28214environment sets int to 32 bits and long and pointer to 64 bits.
28215
28216@item -mbig-endian
28217@itemx -mlittle-endian
28218@opindex mbig-endian
28219@opindex mlittle-endian
28220Generate code in big/little endian mode, respectively.
28221@end table
28222
28223@node TILEPro Options
28224@subsection TILEPro Options
28225@cindex TILEPro options
28226
28227These @samp{-m} options are supported on the TILEPro:
28228
28229@table @gcctabopt
28230@item -mcpu=@var{name}
28231@opindex mcpu
28232Selects the type of CPU to be targeted.  Currently the only supported
28233type is @samp{tilepro}.
28234
28235@item -m32
28236@opindex m32
28237Generate code for a 32-bit environment, which sets int, long, and
28238pointer to 32 bits.  This is the only supported behavior so the flag
28239is essentially ignored.
28240@end table
28241
28242@node V850 Options
28243@subsection V850 Options
28244@cindex V850 Options
28245
28246These @samp{-m} options are defined for V850 implementations:
28247
28248@table @gcctabopt
28249@item -mlong-calls
28250@itemx -mno-long-calls
28251@opindex mlong-calls
28252@opindex mno-long-calls
28253Treat all calls as being far away (near).  If calls are assumed to be
28254far away, the compiler always loads the function's address into a
28255register, and calls indirect through the pointer.
28256
28257@item -mno-ep
28258@itemx -mep
28259@opindex mno-ep
28260@opindex mep
28261Do not optimize (do optimize) basic blocks that use the same index
28262pointer 4 or more times to copy pointer into the @code{ep} register, and
28263use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
28264option is on by default if you optimize.
28265
28266@item -mno-prolog-function
28267@itemx -mprolog-function
28268@opindex mno-prolog-function
28269@opindex mprolog-function
28270Do not use (do use) external functions to save and restore registers
28271at the prologue and epilogue of a function.  The external functions
28272are slower, but use less code space if more than one function saves
28273the same number of registers.  The @option{-mprolog-function} option
28274is on by default if you optimize.
28275
28276@item -mspace
28277@opindex mspace
28278Try to make the code as small as possible.  At present, this just turns
28279on the @option{-mep} and @option{-mprolog-function} options.
28280
28281@item -mtda=@var{n}
28282@opindex mtda
28283Put static or global variables whose size is @var{n} bytes or less into
28284the tiny data area that register @code{ep} points to.  The tiny data
28285area can hold up to 256 bytes in total (128 bytes for byte references).
28286
28287@item -msda=@var{n}
28288@opindex msda
28289Put static or global variables whose size is @var{n} bytes or less into
28290the small data area that register @code{gp} points to.  The small data
28291area can hold up to 64 kilobytes.
28292
28293@item -mzda=@var{n}
28294@opindex mzda
28295Put static or global variables whose size is @var{n} bytes or less into
28296the first 32 kilobytes of memory.
28297
28298@item -mv850
28299@opindex mv850
28300Specify that the target processor is the V850.
28301
28302@item -mv850e3v5
28303@opindex mv850e3v5
28304Specify that the target processor is the V850E3V5.  The preprocessor
28305constant @code{__v850e3v5__} is defined if this option is used.
28306
28307@item -mv850e2v4
28308@opindex mv850e2v4
28309Specify that the target processor is the V850E3V5.  This is an alias for
28310the @option{-mv850e3v5} option.
28311
28312@item -mv850e2v3
28313@opindex mv850e2v3
28314Specify that the target processor is the V850E2V3.  The preprocessor
28315constant @code{__v850e2v3__} is defined if this option is used.
28316
28317@item -mv850e2
28318@opindex mv850e2
28319Specify that the target processor is the V850E2.  The preprocessor
28320constant @code{__v850e2__} is defined if this option is used.
28321
28322@item -mv850e1
28323@opindex mv850e1
28324Specify that the target processor is the V850E1.  The preprocessor
28325constants @code{__v850e1__} and @code{__v850e__} are defined if
28326this option is used.
28327
28328@item -mv850es
28329@opindex mv850es
28330Specify that the target processor is the V850ES.  This is an alias for
28331the @option{-mv850e1} option.
28332
28333@item -mv850e
28334@opindex mv850e
28335Specify that the target processor is the V850E@.  The preprocessor
28336constant @code{__v850e__} is defined if this option is used.
28337
28338If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28339nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28340are defined then a default target processor is chosen and the
28341relevant @samp{__v850*__} preprocessor constant is defined.
28342
28343The preprocessor constants @code{__v850} and @code{__v851__} are always
28344defined, regardless of which processor variant is the target.
28345
28346@item -mdisable-callt
28347@itemx -mno-disable-callt
28348@opindex mdisable-callt
28349@opindex mno-disable-callt
28350This option suppresses generation of the @code{CALLT} instruction for the
28351v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28352architecture.
28353
28354This option is enabled by default when the RH850 ABI is
28355in use (see @option{-mrh850-abi}), and disabled by default when the
28356GCC ABI is in use.  If @code{CALLT} instructions are being generated
28357then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28358
28359@item -mrelax
28360@itemx -mno-relax
28361@opindex mrelax
28362@opindex mno-relax
28363Pass on (or do not pass on) the @option{-mrelax} command-line option
28364to the assembler.
28365
28366@item -mlong-jumps
28367@itemx -mno-long-jumps
28368@opindex mlong-jumps
28369@opindex mno-long-jumps
28370Disable (or re-enable) the generation of PC-relative jump instructions.
28371
28372@item -msoft-float
28373@itemx -mhard-float
28374@opindex msoft-float
28375@opindex mhard-float
28376Disable (or re-enable) the generation of hardware floating point
28377instructions.  This option is only significant when the target
28378architecture is @samp{V850E2V3} or higher.  If hardware floating point
28379instructions are being generated then the C preprocessor symbol
28380@code{__FPU_OK__} is defined, otherwise the symbol
28381@code{__NO_FPU__} is defined.
28382
28383@item -mloop
28384@opindex mloop
28385Enables the use of the e3v5 LOOP instruction.  The use of this
28386instruction is not enabled by default when the e3v5 architecture is
28387selected because its use is still experimental.
28388
28389@item -mrh850-abi
28390@itemx -mghs
28391@opindex mrh850-abi
28392@opindex mghs
28393Enables support for the RH850 version of the V850 ABI.  This is the
28394default.  With this version of the ABI the following rules apply:
28395
28396@itemize
28397@item
28398Integer sized structures and unions are returned via a memory pointer
28399rather than a register.
28400
28401@item
28402Large structures and unions (more than 8 bytes in size) are passed by
28403value.
28404
28405@item
28406Functions are aligned to 16-bit boundaries.
28407
28408@item
28409The @option{-m8byte-align} command-line option is supported.
28410
28411@item
28412The @option{-mdisable-callt} command-line option is enabled by
28413default.  The @option{-mno-disable-callt} command-line option is not
28414supported.
28415@end itemize
28416
28417When this version of the ABI is enabled the C preprocessor symbol
28418@code{__V850_RH850_ABI__} is defined.
28419
28420@item -mgcc-abi
28421@opindex mgcc-abi
28422Enables support for the old GCC version of the V850 ABI.  With this
28423version of the ABI the following rules apply:
28424
28425@itemize
28426@item
28427Integer sized structures and unions are returned in register @code{r10}.
28428
28429@item
28430Large structures and unions (more than 8 bytes in size) are passed by
28431reference.
28432
28433@item
28434Functions are aligned to 32-bit boundaries, unless optimizing for
28435size.
28436
28437@item
28438The @option{-m8byte-align} command-line option is not supported.
28439
28440@item
28441The @option{-mdisable-callt} command-line option is supported but not
28442enabled by default.
28443@end itemize
28444
28445When this version of the ABI is enabled the C preprocessor symbol
28446@code{__V850_GCC_ABI__} is defined.
28447
28448@item -m8byte-align
28449@itemx -mno-8byte-align
28450@opindex m8byte-align
28451@opindex mno-8byte-align
28452Enables support for @code{double} and @code{long long} types to be
28453aligned on 8-byte boundaries.  The default is to restrict the
28454alignment of all objects to at most 4-bytes.  When
28455@option{-m8byte-align} is in effect the C preprocessor symbol
28456@code{__V850_8BYTE_ALIGN__} is defined.
28457
28458@item -mbig-switch
28459@opindex mbig-switch
28460Generate code suitable for big switch tables.  Use this option only if
28461the assembler/linker complain about out of range branches within a switch
28462table.
28463
28464@item -mapp-regs
28465@opindex mapp-regs
28466This option causes r2 and r5 to be used in the code generated by
28467the compiler.  This setting is the default.
28468
28469@item -mno-app-regs
28470@opindex mno-app-regs
28471This option causes r2 and r5 to be treated as fixed registers.
28472
28473@end table
28474
28475@node VAX Options
28476@subsection VAX Options
28477@cindex VAX options
28478
28479These @samp{-m} options are defined for the VAX:
28480
28481@table @gcctabopt
28482@item -munix
28483@opindex munix
28484Do not output certain jump instructions (@code{aobleq} and so on)
28485that the Unix assembler for the VAX cannot handle across long
28486ranges.
28487
28488@item -mgnu
28489@opindex mgnu
28490Do output those jump instructions, on the assumption that the
28491GNU assembler is being used.
28492
28493@item -mg
28494@opindex mg
28495Output code for G-format floating-point numbers instead of D-format.
28496@end table
28497
28498@node Visium Options
28499@subsection Visium Options
28500@cindex Visium options
28501
28502@table @gcctabopt
28503
28504@item -mdebug
28505@opindex mdebug
28506A program which performs file I/O and is destined to run on an MCM target
28507should be linked with this option.  It causes the libraries libc.a and
28508libdebug.a to be linked.  The program should be run on the target under
28509the control of the GDB remote debugging stub.
28510
28511@item -msim
28512@opindex msim
28513A program which performs file I/O and is destined to run on the simulator
28514should be linked with option.  This causes libraries libc.a and libsim.a to
28515be linked.
28516
28517@item -mfpu
28518@itemx -mhard-float
28519@opindex mfpu
28520@opindex mhard-float
28521Generate code containing floating-point instructions.  This is the
28522default.
28523
28524@item -mno-fpu
28525@itemx -msoft-float
28526@opindex mno-fpu
28527@opindex msoft-float
28528Generate code containing library calls for floating-point.
28529
28530@option{-msoft-float} changes the calling convention in the output file;
28531therefore, it is only useful if you compile @emph{all} of a program with
28532this option.  In particular, you need to compile @file{libgcc.a}, the
28533library that comes with GCC, with @option{-msoft-float} in order for
28534this to work.
28535
28536@item -mcpu=@var{cpu_type}
28537@opindex mcpu
28538Set the instruction set, register set, and instruction scheduling parameters
28539for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
28540@samp{mcm}, @samp{gr5} and @samp{gr6}.
28541
28542@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28543
28544By default (unless configured otherwise), GCC generates code for the GR5
28545variant of the Visium architecture.
28546
28547With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28548architecture.  The only difference from GR5 code is that the compiler will
28549generate block move instructions.
28550
28551@item -mtune=@var{cpu_type}
28552@opindex mtune
28553Set the instruction scheduling parameters for machine type @var{cpu_type},
28554but do not set the instruction set or register set that the option
28555@option{-mcpu=@var{cpu_type}} would.
28556
28557@item -msv-mode
28558@opindex msv-mode
28559Generate code for the supervisor mode, where there are no restrictions on
28560the access to general registers.  This is the default.
28561
28562@item -muser-mode
28563@opindex muser-mode
28564Generate code for the user mode, where the access to some general registers
28565is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28566mode; on the GR6, only registers r29 to r31 are affected.
28567@end table
28568
28569@node VMS Options
28570@subsection VMS Options
28571
28572These @samp{-m} options are defined for the VMS implementations:
28573
28574@table @gcctabopt
28575@item -mvms-return-codes
28576@opindex mvms-return-codes
28577Return VMS condition codes from @code{main}. The default is to return POSIX-style
28578condition (e.g.@: error) codes.
28579
28580@item -mdebug-main=@var{prefix}
28581@opindex mdebug-main=@var{prefix}
28582Flag the first routine whose name starts with @var{prefix} as the main
28583routine for the debugger.
28584
28585@item -mmalloc64
28586@opindex mmalloc64
28587Default to 64-bit memory allocation routines.
28588
28589@item -mpointer-size=@var{size}
28590@opindex mpointer-size=@var{size}
28591Set the default size of pointers. Possible options for @var{size} are
28592@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28593for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28594The later option disables @code{pragma pointer_size}.
28595@end table
28596
28597@node VxWorks Options
28598@subsection VxWorks Options
28599@cindex VxWorks Options
28600
28601The options in this section are defined for all VxWorks targets.
28602Options specific to the target hardware are listed with the other
28603options for that target.
28604
28605@table @gcctabopt
28606@item -mrtp
28607@opindex mrtp
28608GCC can generate code for both VxWorks kernels and real time processes
28609(RTPs).  This option switches from the former to the latter.  It also
28610defines the preprocessor macro @code{__RTP__}.
28611
28612@item -non-static
28613@opindex non-static
28614Link an RTP executable against shared libraries rather than static
28615libraries.  The options @option{-static} and @option{-shared} can
28616also be used for RTPs (@pxref{Link Options}); @option{-static}
28617is the default.
28618
28619@item -Bstatic
28620@itemx -Bdynamic
28621@opindex Bstatic
28622@opindex Bdynamic
28623These options are passed down to the linker.  They are defined for
28624compatibility with Diab.
28625
28626@item -Xbind-lazy
28627@opindex Xbind-lazy
28628Enable lazy binding of function calls.  This option is equivalent to
28629@option{-Wl,-z,now} and is defined for compatibility with Diab.
28630
28631@item -Xbind-now
28632@opindex Xbind-now
28633Disable lazy binding of function calls.  This option is the default and
28634is defined for compatibility with Diab.
28635@end table
28636
28637@node x86 Options
28638@subsection x86 Options
28639@cindex x86 Options
28640
28641These @samp{-m} options are defined for the x86 family of computers.
28642
28643@table @gcctabopt
28644
28645@item -march=@var{cpu-type}
28646@opindex march
28647Generate instructions for the machine type @var{cpu-type}.  In contrast to
28648@option{-mtune=@var{cpu-type}}, which merely tunes the generated code
28649for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28650to generate code that may not run at all on processors other than the one
28651indicated.  Specifying @option{-march=@var{cpu-type}} implies
28652@option{-mtune=@var{cpu-type}}.
28653
28654The choices for @var{cpu-type} are:
28655
28656@table @samp
28657@item native
28658This selects the CPU to generate code for at compilation time by determining
28659the processor type of the compiling machine.  Using @option{-march=native}
28660enables all instruction subsets supported by the local machine (hence
28661the result might not run on different machines).  Using @option{-mtune=native}
28662produces code optimized for the local machine under the constraints
28663of the selected instruction set.
28664
28665@item x86-64
28666A generic CPU with 64-bit extensions.
28667
28668@item i386
28669Original Intel i386 CPU@.
28670
28671@item i486
28672Intel i486 CPU@.  (No scheduling is implemented for this chip.)
28673
28674@item i586
28675@itemx pentium
28676Intel Pentium CPU with no MMX support.
28677
28678@item lakemont
28679Intel Lakemont MCU, based on Intel Pentium CPU.
28680
28681@item pentium-mmx
28682Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28683
28684@item pentiumpro
28685Intel Pentium Pro CPU@.
28686
28687@item i686
28688When used with @option{-march}, the Pentium Pro
28689instruction set is used, so the code runs on all i686 family chips.
28690When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28691
28692@item pentium2
28693Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28694support.
28695
28696@item pentium3
28697@itemx pentium3m
28698Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28699set support.
28700
28701@item pentium-m
28702Intel Pentium M; low-power version of Intel Pentium III CPU
28703with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
28704
28705@item pentium4
28706@itemx pentium4m
28707Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28708
28709@item prescott
28710Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28711set support.
28712
28713@item nocona
28714Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28715SSE2 and SSE3 instruction set support.
28716
28717@item core2
28718Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28719instruction set support.
28720
28721@item nehalem
28722Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28723SSE4.1, SSE4.2 and POPCNT instruction set support.
28724
28725@item westmere
28726Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28727SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28728
28729@item sandybridge
28730Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28731SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28732
28733@item ivybridge
28734Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28735SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28736instruction set support.
28737
28738@item haswell
28739Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28740SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28741BMI, BMI2 and F16C instruction set support.
28742
28743@item broadwell
28744Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28745SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
28746F16C, RDSEED ADCX and PREFETCHW instruction set support.
28747
28748@item skylake
28749Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28750SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28751BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
28752instruction set support.
28753
28754@item bonnell
28755Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28756instruction set support.
28757
28758@item silvermont
28759Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28760SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
28761
28762@item goldmont
28763Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28764SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
28765XSAVEOPT and FSGSBASE instruction set support.
28766
28767@item goldmont-plus
28768Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28769SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
28770XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
28771
28772@item tremont
28773Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28774SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
28775XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
28776MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
28777
28778@item knl
28779Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28780SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28781BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
28782AVX512ER and AVX512CD instruction set support.
28783
28784@item knm
28785Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28786SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28787BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
28788AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
28789set support.
28790
28791@item skylake-avx512
28792Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28793SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28794BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28795CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
28796
28797@item cannonlake
28798Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28799SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28800RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28801XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28802AVX512IFMA, SHA and UMIP instruction set support.
28803
28804@item icelake-client
28805Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28806SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28807RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28808XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28809AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28810AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
28811
28812@item icelake-server
28813Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28814SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28815RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28816XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28817AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28818AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
28819set support.
28820
28821@item cascadelake
28822Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28823SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28824BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28825AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
28826
28827@item cooperlake
28828Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28829SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28830BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28831AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
28832set support.
28833
28834@item tigerlake
28835Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28836SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28837BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28838AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
28839RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
28840VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
28841instruction set support.
28842
28843@item k6
28844AMD K6 CPU with MMX instruction set support.
28845
28846@item k6-2
28847@itemx k6-3
28848Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
28849
28850@item athlon
28851@itemx athlon-tbird
28852AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
28853support.
28854
28855@item athlon-4
28856@itemx athlon-xp
28857@itemx athlon-mp
28858Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
28859instruction set support.
28860
28861@item k8
28862@itemx opteron
28863@itemx athlon64
28864@itemx athlon-fx
28865Processors based on the AMD K8 core with x86-64 instruction set support,
28866including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
28867(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
28868instruction set extensions.)
28869
28870@item k8-sse3
28871@itemx opteron-sse3
28872@itemx athlon64-sse3
28873Improved versions of AMD K8 cores with SSE3 instruction set support.
28874
28875@item amdfam10
28876@itemx barcelona
28877CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
28878supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
28879instruction set extensions.)
28880
28881@item bdver1
28882CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
28883supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28884SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28885
28886@item bdver2
28887AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28888supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
28889SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
28890extensions.)
28891
28892@item bdver3
28893AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28894supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
28895PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
2889664-bit instruction set extensions.)
28897
28898@item bdver4
28899AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
28900supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
28901AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28902SSE4.2, ABM and 64-bit instruction set extensions.)
28903
28904@item znver1
28905AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
28906supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
28907SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28908SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
28909instruction set extensions.)
28910
28911@item znver2
28912AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28913supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28914MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28915SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28916WBNOINVD, and 64-bit instruction set extensions.)
28917
28918@item znver3
28919AMD Family 19h core based CPUs with x86-64 instruction set support. (This
28920supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28921MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28922SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28923WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
28924
28925@item btver1
28926CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
28927supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
28928instruction set extensions.)
28929
28930@item btver2
28931CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
28932includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
28933SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
28934
28935@item winchip-c6
28936IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
28937set support.
28938
28939@item winchip2
28940IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
28941instruction set support.
28942
28943@item c3
28944VIA C3 CPU with MMX and 3DNow!@: instruction set support.
28945(No scheduling is implemented for this chip.)
28946
28947@item c3-2
28948VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
28949(No scheduling is implemented for this chip.)
28950
28951@item c7
28952VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28953(No scheduling is implemented for this chip.)
28954
28955@item samuel-2
28956VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
28957(No scheduling is implemented for this chip.)
28958
28959@item nehemiah
28960VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28961(No scheduling is implemented for this chip.)
28962
28963@item esther
28964VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28965(No scheduling is implemented for this chip.)
28966
28967@item eden-x2
28968VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
28969(No scheduling is implemented for this chip.)
28970
28971@item eden-x4
28972VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
28973AVX and AVX2 instruction set support.
28974(No scheduling is implemented for this chip.)
28975
28976@item nano
28977Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28978instruction set support.
28979(No scheduling is implemented for this chip.)
28980
28981@item nano-1000
28982VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28983instruction set support.
28984(No scheduling is implemented for this chip.)
28985
28986@item nano-2000
28987VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28988instruction set support.
28989(No scheduling is implemented for this chip.)
28990
28991@item nano-3000
28992VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28993instruction set support.
28994(No scheduling is implemented for this chip.)
28995
28996@item nano-x2
28997VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28998instruction set support.
28999(No scheduling is implemented for this chip.)
29000
29001@item nano-x4
29002VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
29003instruction set support.
29004(No scheduling is implemented for this chip.)
29005
29006@item geode
29007AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
29008@end table
29009
29010@item -mtune=@var{cpu-type}
29011@opindex mtune
29012Tune to @var{cpu-type} everything applicable about the generated code, except
29013for the ABI and the set of available instructions.
29014While picking a specific @var{cpu-type} schedules things appropriately
29015for that particular chip, the compiler does not generate any code that
29016cannot run on the default machine type unless you use a
29017@option{-march=@var{cpu-type}} option.
29018For example, if GCC is configured for i686-pc-linux-gnu
29019then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
29020but still runs on i686 machines.
29021
29022The choices for @var{cpu-type} are the same as for @option{-march}.
29023In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
29024
29025@table @samp
29026@item generic
29027Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
29028If you know the CPU on which your code will run, then you should use
29029the corresponding @option{-mtune} or @option{-march} option instead of
29030@option{-mtune=generic}.  But, if you do not know exactly what CPU users
29031of your application will have, then you should use this option.
29032
29033As new processors are deployed in the marketplace, the behavior of this
29034option will change.  Therefore, if you upgrade to a newer version of
29035GCC, code generation controlled by this option will change to reflect
29036the processors
29037that are most common at the time that version of GCC is released.
29038
29039There is no @option{-march=generic} option because @option{-march}
29040indicates the instruction set the compiler can use, and there is no
29041generic instruction set applicable to all processors.  In contrast,
29042@option{-mtune} indicates the processor (or, in this case, collection of
29043processors) for which the code is optimized.
29044
29045@item intel
29046Produce code optimized for the most current Intel processors, which are
29047Haswell and Silvermont for this version of GCC.  If you know the CPU
29048on which your code will run, then you should use the corresponding
29049@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
29050But, if you want your application performs better on both Haswell and
29051Silvermont, then you should use this option.
29052
29053As new Intel processors are deployed in the marketplace, the behavior of
29054this option will change.  Therefore, if you upgrade to a newer version of
29055GCC, code generation controlled by this option will change to reflect
29056the most current Intel processors at the time that version of GCC is
29057released.
29058
29059There is no @option{-march=intel} option because @option{-march} indicates
29060the instruction set the compiler can use, and there is no common
29061instruction set applicable to all processors.  In contrast,
29062@option{-mtune} indicates the processor (or, in this case, collection of
29063processors) for which the code is optimized.
29064@end table
29065
29066@item -mcpu=@var{cpu-type}
29067@opindex mcpu
29068A deprecated synonym for @option{-mtune}.
29069
29070@item -mfpmath=@var{unit}
29071@opindex mfpmath
29072Generate floating-point arithmetic for selected unit @var{unit}.  The choices
29073for @var{unit} are:
29074
29075@table @samp
29076@item 387
29077Use the standard 387 floating-point coprocessor present on the majority of chips and
29078emulated otherwise.  Code compiled with this option runs almost everywhere.
29079The temporary results are computed in 80-bit precision instead of the precision
29080specified by the type, resulting in slightly different results compared to most
29081of other chips.  See @option{-ffloat-store} for more detailed description.
29082
29083This is the default choice for non-Darwin x86-32 targets.
29084
29085@item sse
29086Use scalar floating-point instructions present in the SSE instruction set.
29087This instruction set is supported by Pentium III and newer chips,
29088and in the AMD line
29089by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
29090instruction set supports only single-precision arithmetic, thus the double and
29091extended-precision arithmetic are still done using 387.  A later version, present
29092only in Pentium 4 and AMD x86-64 chips, supports double-precision
29093arithmetic too.
29094
29095For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
29096or @option{-msse2} switches to enable SSE extensions and make this option
29097effective.  For the x86-64 compiler, these extensions are enabled by default.
29098
29099The resulting code should be considerably faster in the majority of cases and avoid
29100the numerical instability problems of 387 code, but may break some existing
29101code that expects temporaries to be 80 bits.
29102
29103This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
29104and the default choice for x86-32 targets with the SSE2 instruction set
29105when @option{-ffast-math} is enabled.
29106
29107@item sse,387
29108@itemx sse+387
29109@itemx both
29110Attempt to utilize both instruction sets at once.  This effectively doubles the
29111amount of available registers, and on chips with separate execution units for
29112387 and SSE the execution resources too.  Use this option with care, as it is
29113still experimental, because the GCC register allocator does not model separate
29114functional units well, resulting in unstable performance.
29115@end table
29116
29117@item -masm=@var{dialect}
29118@opindex masm=@var{dialect}
29119Output assembly instructions using selected @var{dialect}.  Also affects
29120which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
29121extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
29122order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
29123not support @samp{intel}.
29124
29125@item -mieee-fp
29126@itemx -mno-ieee-fp
29127@opindex mieee-fp
29128@opindex mno-ieee-fp
29129Control whether or not the compiler uses IEEE floating-point
29130comparisons.  These correctly handle the case where the result of a
29131comparison is unordered.
29132
29133@item -m80387
29134@itemx -mhard-float
29135@opindex 80387
29136@opindex mhard-float
29137Generate output containing 80387 instructions for floating point.
29138
29139@item -mno-80387
29140@itemx -msoft-float
29141@opindex no-80387
29142@opindex msoft-float
29143Generate output containing library calls for floating point.
29144
29145@strong{Warning:} the requisite libraries are not part of GCC@.
29146Normally the facilities of the machine's usual C compiler are used, but
29147this cannot be done directly in cross-compilation.  You must make your
29148own arrangements to provide suitable library functions for
29149cross-compilation.
29150
29151On machines where a function returns floating-point results in the 80387
29152register stack, some floating-point opcodes may be emitted even if
29153@option{-msoft-float} is used.
29154
29155@item -mno-fp-ret-in-387
29156@opindex mno-fp-ret-in-387
29157@opindex mfp-ret-in-387
29158Do not use the FPU registers for return values of functions.
29159
29160The usual calling convention has functions return values of types
29161@code{float} and @code{double} in an FPU register, even if there
29162is no FPU@.  The idea is that the operating system should emulate
29163an FPU@.
29164
29165The option @option{-mno-fp-ret-in-387} causes such values to be returned
29166in ordinary CPU registers instead.
29167
29168@item -mno-fancy-math-387
29169@opindex mno-fancy-math-387
29170@opindex mfancy-math-387
29171Some 387 emulators do not support the @code{sin}, @code{cos} and
29172@code{sqrt} instructions for the 387.  Specify this option to avoid
29173generating those instructions.
29174This option is overridden when @option{-march}
29175indicates that the target CPU always has an FPU and so the
29176instruction does not need emulation.  These
29177instructions are not generated unless you also use the
29178@option{-funsafe-math-optimizations} switch.
29179
29180@item -malign-double
29181@itemx -mno-align-double
29182@opindex malign-double
29183@opindex mno-align-double
29184Control whether GCC aligns @code{double}, @code{long double}, and
29185@code{long long} variables on a two-word boundary or a one-word
29186boundary.  Aligning @code{double} variables on a two-word boundary
29187produces code that runs somewhat faster on a Pentium at the
29188expense of more memory.
29189
29190On x86-64, @option{-malign-double} is enabled by default.
29191
29192@strong{Warning:} if you use the @option{-malign-double} switch,
29193structures containing the above types are aligned differently than
29194the published application binary interface specifications for the x86-32
29195and are not binary compatible with structures in code compiled
29196without that switch.
29197
29198@item -m96bit-long-double
29199@itemx -m128bit-long-double
29200@opindex m96bit-long-double
29201@opindex m128bit-long-double
29202These switches control the size of @code{long double} type.  The x86-32
29203application binary interface specifies the size to be 96 bits,
29204so @option{-m96bit-long-double} is the default in 32-bit mode.
29205
29206Modern architectures (Pentium and newer) prefer @code{long double}
29207to be aligned to an 8- or 16-byte boundary.  In arrays or structures
29208conforming to the ABI, this is not possible.  So specifying
29209@option{-m128bit-long-double} aligns @code{long double}
29210to a 16-byte boundary by padding the @code{long double} with an additional
2921132-bit zero.
29212
29213In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29214its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29215
29216Notice that neither of these options enable any extra precision over the x87
29217standard of 80 bits for a @code{long double}.
29218
29219@strong{Warning:} if you override the default value for your target ABI, this
29220changes the size of
29221structures and arrays containing @code{long double} variables,
29222as well as modifying the function calling convention for functions taking
29223@code{long double}.  Hence they are not binary-compatible
29224with code compiled without that switch.
29225
29226@item -mlong-double-64
29227@itemx -mlong-double-80
29228@itemx -mlong-double-128
29229@opindex mlong-double-64
29230@opindex mlong-double-80
29231@opindex mlong-double-128
29232These switches control the size of @code{long double} type. A size
29233of 64 bits makes the @code{long double} type equivalent to the @code{double}
29234type. This is the default for 32-bit Bionic C library.  A size
29235of 128 bits makes the @code{long double} type equivalent to the
29236@code{__float128} type. This is the default for 64-bit Bionic C library.
29237
29238@strong{Warning:} if you override the default value for your target ABI, this
29239changes the size of
29240structures and arrays containing @code{long double} variables,
29241as well as modifying the function calling convention for functions taking
29242@code{long double}.  Hence they are not binary-compatible
29243with code compiled without that switch.
29244
29245@item -malign-data=@var{type}
29246@opindex malign-data
29247Control how GCC aligns variables.  Supported values for @var{type} are
29248@samp{compat} uses increased alignment value compatible uses GCC 4.8
29249and earlier, @samp{abi} uses alignment value as specified by the
29250psABI, and @samp{cacheline} uses increased alignment value to match
29251the cache line size.  @samp{compat} is the default.
29252
29253@item -mlarge-data-threshold=@var{threshold}
29254@opindex mlarge-data-threshold
29255When @option{-mcmodel=medium} is specified, data objects larger than
29256@var{threshold} are placed in the large data section.  This value must be the
29257same across all objects linked into the binary, and defaults to 65535.
29258
29259@item -mrtd
29260@opindex mrtd
29261Use a different function-calling convention, in which functions that
29262take a fixed number of arguments return with the @code{ret @var{num}}
29263instruction, which pops their arguments while returning.  This saves one
29264instruction in the caller since there is no need to pop the arguments
29265there.
29266
29267You can specify that an individual function is called with this calling
29268sequence with the function attribute @code{stdcall}.  You can also
29269override the @option{-mrtd} option by using the function attribute
29270@code{cdecl}.  @xref{Function Attributes}.
29271
29272@strong{Warning:} this calling convention is incompatible with the one
29273normally used on Unix, so you cannot use it if you need to call
29274libraries compiled with the Unix compiler.
29275
29276Also, you must provide function prototypes for all functions that
29277take variable numbers of arguments (including @code{printf});
29278otherwise incorrect code is generated for calls to those
29279functions.
29280
29281In addition, seriously incorrect code results if you call a
29282function with too many arguments.  (Normally, extra arguments are
29283harmlessly ignored.)
29284
29285@item -mregparm=@var{num}
29286@opindex mregparm
29287Control how many registers are used to pass integer arguments.  By
29288default, no registers are used to pass arguments, and at most 3
29289registers can be used.  You can control this behavior for a specific
29290function by using the function attribute @code{regparm}.
29291@xref{Function Attributes}.
29292
29293@strong{Warning:} if you use this switch, and
29294@var{num} is nonzero, then you must build all modules with the same
29295value, including any libraries.  This includes the system libraries and
29296startup modules.
29297
29298@item -msseregparm
29299@opindex msseregparm
29300Use SSE register passing conventions for float and double arguments
29301and return values.  You can control this behavior for a specific
29302function by using the function attribute @code{sseregparm}.
29303@xref{Function Attributes}.
29304
29305@strong{Warning:} if you use this switch then you must build all
29306modules with the same value, including any libraries.  This includes
29307the system libraries and startup modules.
29308
29309@item -mvect8-ret-in-mem
29310@opindex mvect8-ret-in-mem
29311Return 8-byte vectors in memory instead of MMX registers.  This is the
29312default on VxWorks to match the ABI of the Sun Studio compilers until
29313version 12.  @emph{Only} use this option if you need to remain
29314compatible with existing code produced by those previous compiler
29315versions or older versions of GCC@.
29316
29317@item -mpc32
29318@itemx -mpc64
29319@itemx -mpc80
29320@opindex mpc32
29321@opindex mpc64
29322@opindex mpc80
29323
29324Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
29325is specified, the significands of results of floating-point operations are
29326rounded to 24 bits (single precision); @option{-mpc64} rounds the
29327significands of results of floating-point operations to 53 bits (double
29328precision) and @option{-mpc80} rounds the significands of results of
29329floating-point operations to 64 bits (extended double precision), which is
29330the default.  When this option is used, floating-point operations in higher
29331precisions are not available to the programmer without setting the FPU
29332control word explicitly.
29333
29334Setting the rounding of floating-point operations to less than the default
2933580 bits can speed some programs by 2% or more.  Note that some mathematical
29336libraries assume that extended-precision (80-bit) floating-point operations
29337are enabled by default; routines in such libraries could suffer significant
29338loss of accuracy, typically through so-called ``catastrophic cancellation'',
29339when this option is used to set the precision to less than extended precision.
29340
29341@item -mstackrealign
29342@opindex mstackrealign
29343Realign the stack at entry.  On the x86, the @option{-mstackrealign}
29344option generates an alternate prologue and epilogue that realigns the
29345run-time stack if necessary.  This supports mixing legacy codes that keep
293464-byte stack alignment with modern codes that keep 16-byte stack alignment for
29347SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
29348applicable to individual functions.
29349
29350@item -mpreferred-stack-boundary=@var{num}
29351@opindex mpreferred-stack-boundary
29352Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29353byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29354the default is 4 (16 bytes or 128 bits).
29355
29356@strong{Warning:} When generating code for the x86-64 architecture with
29357SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29358used to keep the stack boundary aligned to 8 byte boundary.  Since
29359x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29360intended to be used in controlled environment where stack space is
29361important limitation.  This option leads to wrong code when functions
29362compiled with 16 byte stack alignment (such as functions from a standard
29363library) are called with misaligned stack.  In this case, SSE
29364instructions may lead to misaligned memory access traps.  In addition,
29365variable arguments are handled incorrectly for 16 byte aligned
29366objects (including x87 long double and __int128), leading to wrong
29367results.  You must build all modules with
29368@option{-mpreferred-stack-boundary=3}, including any libraries.  This
29369includes the system libraries and startup modules.
29370
29371@item -mincoming-stack-boundary=@var{num}
29372@opindex mincoming-stack-boundary
29373Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29374boundary.  If @option{-mincoming-stack-boundary} is not specified,
29375the one specified by @option{-mpreferred-stack-boundary} is used.
29376
29377On Pentium and Pentium Pro, @code{double} and @code{long double} values
29378should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29379suffer significant run time performance penalties.  On Pentium III, the
29380Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29381properly if it is not 16-byte aligned.
29382
29383To ensure proper alignment of this values on the stack, the stack boundary
29384must be as aligned as that required by any value stored on the stack.
29385Further, every function must be generated such that it keeps the stack
29386aligned.  Thus calling a function compiled with a higher preferred
29387stack boundary from a function compiled with a lower preferred stack
29388boundary most likely misaligns the stack.  It is recommended that
29389libraries that use callbacks always use the default setting.
29390
29391This extra alignment does consume extra stack space, and generally
29392increases code size.  Code that is sensitive to stack space usage, such
29393as embedded systems and operating system kernels, may want to reduce the
29394preferred alignment to @option{-mpreferred-stack-boundary=2}.
29395
29396@need 200
29397@item -mmmx
29398@opindex mmmx
29399@need 200
29400@itemx -msse
29401@opindex msse
29402@need 200
29403@itemx -msse2
29404@opindex msse2
29405@need 200
29406@itemx -msse3
29407@opindex msse3
29408@need 200
29409@itemx -mssse3
29410@opindex mssse3
29411@need 200
29412@itemx -msse4
29413@opindex msse4
29414@need 200
29415@itemx -msse4a
29416@opindex msse4a
29417@need 200
29418@itemx -msse4.1
29419@opindex msse4.1
29420@need 200
29421@itemx -msse4.2
29422@opindex msse4.2
29423@need 200
29424@itemx -mavx
29425@opindex mavx
29426@need 200
29427@itemx -mavx2
29428@opindex mavx2
29429@need 200
29430@itemx -mavx512f
29431@opindex mavx512f
29432@need 200
29433@itemx -mavx512pf
29434@opindex mavx512pf
29435@need 200
29436@itemx -mavx512er
29437@opindex mavx512er
29438@need 200
29439@itemx -mavx512cd
29440@opindex mavx512cd
29441@need 200
29442@itemx -mavx512vl
29443@opindex mavx512vl
29444@need 200
29445@itemx -mavx512bw
29446@opindex mavx512bw
29447@need 200
29448@itemx -mavx512dq
29449@opindex mavx512dq
29450@need 200
29451@itemx -mavx512ifma
29452@opindex mavx512ifma
29453@need 200
29454@itemx -mavx512vbmi
29455@opindex mavx512vbmi
29456@need 200
29457@itemx -msha
29458@opindex msha
29459@need 200
29460@itemx -maes
29461@opindex maes
29462@need 200
29463@itemx -mpclmul
29464@opindex mpclmul
29465@need 200
29466@itemx -mclflushopt
29467@opindex mclflushopt
29468@need 200
29469@itemx -mclwb
29470@opindex mclwb
29471@need 200
29472@itemx -mfsgsbase
29473@opindex mfsgsbase
29474@need 200
29475@itemx -mptwrite
29476@opindex mptwrite
29477@need 200
29478@itemx -mrdrnd
29479@opindex mrdrnd
29480@need 200
29481@itemx -mf16c
29482@opindex mf16c
29483@need 200
29484@itemx -mfma
29485@opindex mfma
29486@need 200
29487@itemx -mpconfig
29488@opindex mpconfig
29489@need 200
29490@itemx -mwbnoinvd
29491@opindex mwbnoinvd
29492@need 200
29493@itemx -mfma4
29494@opindex mfma4
29495@need 200
29496@itemx -mprfchw
29497@opindex mprfchw
29498@need 200
29499@itemx -mrdpid
29500@opindex mrdpid
29501@need 200
29502@itemx -mprefetchwt1
29503@opindex mprefetchwt1
29504@need 200
29505@itemx -mrdseed
29506@opindex mrdseed
29507@need 200
29508@itemx -msgx
29509@opindex msgx
29510@need 200
29511@itemx -mxop
29512@opindex mxop
29513@need 200
29514@itemx -mlwp
29515@opindex mlwp
29516@need 200
29517@itemx -m3dnow
29518@opindex m3dnow
29519@need 200
29520@itemx -m3dnowa
29521@opindex m3dnowa
29522@need 200
29523@itemx -mpopcnt
29524@opindex mpopcnt
29525@need 200
29526@itemx -mabm
29527@opindex mabm
29528@need 200
29529@itemx -madx
29530@opindex madx
29531@need 200
29532@itemx -mbmi
29533@opindex mbmi
29534@need 200
29535@itemx -mbmi2
29536@opindex mbmi2
29537@need 200
29538@itemx -mlzcnt
29539@opindex mlzcnt
29540@need 200
29541@itemx -mfxsr
29542@opindex mfxsr
29543@need 200
29544@itemx -mxsave
29545@opindex mxsave
29546@need 200
29547@itemx -mxsaveopt
29548@opindex mxsaveopt
29549@need 200
29550@itemx -mxsavec
29551@opindex mxsavec
29552@need 200
29553@itemx -mxsaves
29554@opindex mxsaves
29555@need 200
29556@itemx -mrtm
29557@opindex mrtm
29558@need 200
29559@itemx -mhle
29560@opindex mhle
29561@need 200
29562@itemx -mtbm
29563@opindex mtbm
29564@need 200
29565@itemx -mmwaitx
29566@opindex mmwaitx
29567@need 200
29568@itemx -mclzero
29569@opindex mclzero
29570@need 200
29571@itemx -mpku
29572@opindex mpku
29573@need 200
29574@itemx -mavx512vbmi2
29575@opindex mavx512vbmi2
29576@need 200
29577@itemx -mavx512bf16
29578@opindex mavx512bf16
29579@need 200
29580@itemx -mgfni
29581@opindex mgfni
29582@need 200
29583@itemx -mvaes
29584@opindex mvaes
29585@need 200
29586@itemx -mwaitpkg
29587@opindex mwaitpkg
29588@need 200
29589@itemx -mvpclmulqdq
29590@opindex mvpclmulqdq
29591@need 200
29592@itemx -mavx512bitalg
29593@opindex mavx512bitalg
29594@need 200
29595@itemx -mmovdiri
29596@opindex mmovdiri
29597@need 200
29598@itemx -mmovdir64b
29599@opindex mmovdir64b
29600@need 200
29601@itemx -menqcmd
29602@opindex menqcmd
29603@need 200
29604@itemx -mavx512vpopcntdq
29605@opindex mavx512vpopcntdq
29606@need 200
29607@itemx -mavx512vp2intersect
29608@opindex mavx512vp2intersect
29609@need 200
29610@itemx -mavx5124fmaps
29611@opindex mavx5124fmaps
29612@need 200
29613@itemx -mavx512vnni
29614@opindex mavx512vnni
29615@need 200
29616@itemx -mavx5124vnniw
29617@opindex mavx5124vnniw
29618@need 200
29619@itemx -mcldemote
29620@opindex mcldemote
29621These switches enable the use of instructions in the MMX, SSE,
29622SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29623AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29624AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29625WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
296263DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29627XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29628GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29629ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
29630extended instruction sets.  Each has a corresponding @option{-mno-} option to
29631disable use of these instructions.
29632
29633These extensions are also available as built-in functions: see
29634@ref{x86 Built-in Functions}, for details of the functions enabled and
29635disabled by these switches.
29636
29637To generate SSE/SSE2 instructions automatically from floating-point
29638code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29639
29640GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29641generates new AVX instructions or AVX equivalence for all SSEx instructions
29642when needed.
29643
29644These options enable GCC to use these extended instructions in
29645generated code, even without @option{-mfpmath=sse}.  Applications that
29646perform run-time CPU detection must compile separate files for each
29647supported architecture, using the appropriate flags.  In particular,
29648the file containing the CPU detection code should be compiled without
29649these options.
29650
29651@item -mdump-tune-features
29652@opindex mdump-tune-features
29653This option instructs GCC to dump the names of the x86 performance
29654tuning features and default settings. The names can be used in
29655@option{-mtune-ctrl=@var{feature-list}}.
29656
29657@item -mtune-ctrl=@var{feature-list}
29658@opindex mtune-ctrl=@var{feature-list}
29659This option is used to do fine grain control of x86 code generation features.
29660@var{feature-list} is a comma separated list of @var{feature} names. See also
29661@option{-mdump-tune-features}. When specified, the @var{feature} is turned
29662on if it is not preceded with @samp{^}, otherwise, it is turned off.
29663@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29664developers. Using it may lead to code paths not covered by testing and can
29665potentially result in compiler ICEs or runtime errors.
29666
29667@item -mno-default
29668@opindex mno-default
29669This option instructs GCC to turn off all tunable features. See also
29670@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29671
29672@item -mcld
29673@opindex mcld
29674This option instructs GCC to emit a @code{cld} instruction in the prologue
29675of functions that use string instructions.  String instructions depend on
29676the DF flag to select between autoincrement or autodecrement mode.  While the
29677ABI specifies the DF flag to be cleared on function entry, some operating
29678systems violate this specification by not clearing the DF flag in their
29679exception dispatchers.  The exception handler can be invoked with the DF flag
29680set, which leads to wrong direction mode when string instructions are used.
29681This option can be enabled by default on 32-bit x86 targets by configuring
29682GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
29683instructions can be suppressed with the @option{-mno-cld} compiler option
29684in this case.
29685
29686@item -mvzeroupper
29687@opindex mvzeroupper
29688This option instructs GCC to emit a @code{vzeroupper} instruction
29689before a transfer of control flow out of the function to minimize
29690the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29691intrinsics.
29692
29693@item -mprefer-avx128
29694@opindex mprefer-avx128
29695This option instructs GCC to use 128-bit AVX instructions instead of
29696256-bit AVX instructions in the auto-vectorizer.
29697
29698@item -mprefer-vector-width=@var{opt}
29699@opindex mprefer-vector-width
29700This option instructs GCC to use @var{opt}-bit vector width in instructions
29701instead of default on the selected platform.
29702
29703@table @samp
29704@item none
29705No extra limitations applied to GCC other than defined by the selected platform.
29706
29707@item 128
29708Prefer 128-bit vector width for instructions.
29709
29710@item 256
29711Prefer 256-bit vector width for instructions.
29712
29713@item 512
29714Prefer 512-bit vector width for instructions.
29715@end table
29716
29717@item -mcx16
29718@opindex mcx16
29719This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29720code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29721objects.  This is useful for atomic updates of data structures exceeding one
29722machine word in size.  The compiler uses this instruction to implement
29723@ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
29724128-bit integers, a library call is always used.
29725
29726@item -msahf
29727@opindex msahf
29728This option enables generation of @code{SAHF} instructions in 64-bit code.
29729Early Intel Pentium 4 CPUs with Intel 64 support,
29730prior to the introduction of Pentium 4 G1 step in December 2005,
29731lacked the @code{LAHF} and @code{SAHF} instructions
29732which are supported by AMD64.
29733These are load and store instructions, respectively, for certain status flags.
29734In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29735@code{drem}, and @code{remainder} built-in functions;
29736see @ref{Other Builtins} for details.
29737
29738@item -mmovbe
29739@opindex mmovbe
29740This option enables use of the @code{movbe} instruction to implement
29741@code{__builtin_bswap32} and @code{__builtin_bswap64}.
29742
29743@item -mshstk
29744@opindex mshstk
29745The @option{-mshstk} option enables shadow stack built-in functions
29746from x86 Control-flow Enforcement Technology (CET).
29747
29748@item -mcrc32
29749@opindex mcrc32
29750This option enables built-in functions @code{__builtin_ia32_crc32qi},
29751@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29752@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29753
29754@item -mrecip
29755@opindex mrecip
29756This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29757(and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29758with an additional Newton-Raphson step
29759to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29760(and their vectorized
29761variants) for single-precision floating-point arguments.  These instructions
29762are generated only when @option{-funsafe-math-optimizations} is enabled
29763together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29764Note that while the throughput of the sequence is higher than the throughput
29765of the non-reciprocal instruction, the precision of the sequence can be
29766decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29767
29768Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29769(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29770combination), and doesn't need @option{-mrecip}.
29771
29772Also note that GCC emits the above sequence with additional Newton-Raphson step
29773for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
29774already with @option{-ffast-math} (or the above option combination), and
29775doesn't need @option{-mrecip}.
29776
29777@item -mrecip=@var{opt}
29778@opindex mrecip=opt
29779This option controls which reciprocal estimate instructions
29780may be used.  @var{opt} is a comma-separated list of options, which may
29781be preceded by a @samp{!} to invert the option:
29782
29783@table @samp
29784@item all
29785Enable all estimate instructions.
29786
29787@item default
29788Enable the default instructions, equivalent to @option{-mrecip}.
29789
29790@item none
29791Disable all estimate instructions, equivalent to @option{-mno-recip}.
29792
29793@item div
29794Enable the approximation for scalar division.
29795
29796@item vec-div
29797Enable the approximation for vectorized division.
29798
29799@item sqrt
29800Enable the approximation for scalar square root.
29801
29802@item vec-sqrt
29803Enable the approximation for vectorized square root.
29804@end table
29805
29806So, for example, @option{-mrecip=all,!sqrt} enables
29807all of the reciprocal approximations, except for square root.
29808
29809@item -mveclibabi=@var{type}
29810@opindex mveclibabi
29811Specifies the ABI type to use for vectorizing intrinsics using an
29812external library.  Supported values for @var{type} are @samp{svml}
29813for the Intel short
29814vector math library and @samp{acml} for the AMD math core library.
29815To use this option, both @option{-ftree-vectorize} and
29816@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
29817ABI-compatible library must be specified at link time.
29818
29819GCC currently emits calls to @code{vmldExp2},
29820@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
29821@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
29822@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
29823@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
29824@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
29825@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
29826@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
29827@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
29828@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
29829function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
29830@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
29831@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
29832@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
29833@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
29834when @option{-mveclibabi=acml} is used.
29835
29836@item -mabi=@var{name}
29837@opindex mabi
29838Generate code for the specified calling convention.  Permissible values
29839are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
29840@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
29841ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
29842You can control this behavior for specific functions by
29843using the function attributes @code{ms_abi} and @code{sysv_abi}.
29844@xref{Function Attributes}.
29845
29846@item -mforce-indirect-call
29847@opindex mforce-indirect-call
29848Force all calls to functions to be indirect. This is useful
29849when using Intel Processor Trace where it generates more precise timing
29850information for function calls.
29851
29852@item -mmanual-endbr
29853@opindex mmanual-endbr
29854Insert ENDBR instruction at function entry only via the @code{cf_check}
29855function attribute. This is useful when used with the option
29856@option{-fcf-protection=branch} to control ENDBR insertion at the
29857function entry.
29858
29859@item -mcall-ms2sysv-xlogues
29860@opindex mcall-ms2sysv-xlogues
29861@opindex mno-call-ms2sysv-xlogues
29862Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
29863System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
29864default, the code for saving and restoring these registers is emitted inline,
29865resulting in fairly lengthy prologues and epilogues.  Using
29866@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
29867use stubs in the static portion of libgcc to perform these saves and restores,
29868thus reducing function size at the cost of a few extra instructions.
29869
29870@item -mtls-dialect=@var{type}
29871@opindex mtls-dialect
29872Generate code to access thread-local storage using the @samp{gnu} or
29873@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
29874@samp{gnu2} is more efficient, but it may add compile- and run-time
29875requirements that cannot be satisfied on all systems.
29876
29877@item -mpush-args
29878@itemx -mno-push-args
29879@opindex mpush-args
29880@opindex mno-push-args
29881Use PUSH operations to store outgoing parameters.  This method is shorter
29882and usually equally fast as method using SUB/MOV operations and is enabled
29883by default.  In some cases disabling it may improve performance because of
29884improved scheduling and reduced dependencies.
29885
29886@item -maccumulate-outgoing-args
29887@opindex maccumulate-outgoing-args
29888If enabled, the maximum amount of space required for outgoing arguments is
29889computed in the function prologue.  This is faster on most modern CPUs
29890because of reduced dependencies, improved scheduling and reduced stack usage
29891when the preferred stack boundary is not equal to 2.  The drawback is a notable
29892increase in code size.  This switch implies @option{-mno-push-args}.
29893
29894@item -mthreads
29895@opindex mthreads
29896Support thread-safe exception handling on MinGW.  Programs that rely
29897on thread-safe exception handling must compile and link all code with the
29898@option{-mthreads} option.  When compiling, @option{-mthreads} defines
29899@option{-D_MT}; when linking, it links in a special thread helper library
29900@option{-lmingwthrd} which cleans up per-thread exception-handling data.
29901
29902@item -mms-bitfields
29903@itemx -mno-ms-bitfields
29904@opindex mms-bitfields
29905@opindex mno-ms-bitfields
29906
29907Enable/disable bit-field layout compatible with the native Microsoft
29908Windows compiler.
29909
29910If @code{packed} is used on a structure, or if bit-fields are used,
29911it may be that the Microsoft ABI lays out the structure differently
29912than the way GCC normally does.  Particularly when moving packed
29913data between functions compiled with GCC and the native Microsoft compiler
29914(either via function call or as data in a file), it may be necessary to access
29915either format.
29916
29917This option is enabled by default for Microsoft Windows
29918targets.  This behavior can also be controlled locally by use of variable
29919or type attributes.  For more information, see @ref{x86 Variable Attributes}
29920and @ref{x86 Type Attributes}.
29921
29922The Microsoft structure layout algorithm is fairly simple with the exception
29923of the bit-field packing.
29924The padding and alignment of members of structures and whether a bit-field
29925can straddle a storage-unit boundary are determine by these rules:
29926
29927@enumerate
29928@item Structure members are stored sequentially in the order in which they are
29929declared: the first member has the lowest memory address and the last member
29930the highest.
29931
29932@item Every data object has an alignment requirement.  The alignment requirement
29933for all data except structures, unions, and arrays is either the size of the
29934object or the current packing size (specified with either the
29935@code{aligned} attribute or the @code{pack} pragma),
29936whichever is less.  For structures, unions, and arrays,
29937the alignment requirement is the largest alignment requirement of its members.
29938Every object is allocated an offset so that:
29939
29940@smallexample
29941offset % alignment_requirement == 0
29942@end smallexample
29943
29944@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
29945unit if the integral types are the same size and if the next bit-field fits
29946into the current allocation unit without crossing the boundary imposed by the
29947common alignment requirements of the bit-fields.
29948@end enumerate
29949
29950MSVC interprets zero-length bit-fields in the following ways:
29951
29952@enumerate
29953@item If a zero-length bit-field is inserted between two bit-fields that
29954are normally coalesced, the bit-fields are not coalesced.
29955
29956For example:
29957
29958@smallexample
29959struct
29960 @{
29961   unsigned long bf_1 : 12;
29962   unsigned long : 0;
29963   unsigned long bf_2 : 12;
29964 @} t1;
29965@end smallexample
29966
29967@noindent
29968The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
29969zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
29970
29971@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
29972alignment of the zero-length bit-field is greater than the member that follows it,
29973@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
29974
29975For example:
29976
29977@smallexample
29978struct
29979 @{
29980   char foo : 4;
29981   short : 0;
29982   char bar;
29983 @} t2;
29984
29985struct
29986 @{
29987   char foo : 4;
29988   short : 0;
29989   double bar;
29990 @} t3;
29991@end smallexample
29992
29993@noindent
29994For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
29995Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
29996bit-field does not affect the alignment of @code{bar} or, as a result, the size
29997of the structure.
29998
29999Taking this into account, it is important to note the following:
30000
30001@enumerate
30002@item If a zero-length bit-field follows a normal bit-field, the type of the
30003zero-length bit-field may affect the alignment of the structure as whole. For
30004example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
30005normal bit-field, and is of type short.
30006
30007@item Even if a zero-length bit-field is not followed by a normal bit-field, it may
30008still affect the alignment of the structure:
30009
30010@smallexample
30011struct
30012 @{
30013   char foo : 6;
30014   long : 0;
30015 @} t4;
30016@end smallexample
30017
30018@noindent
30019Here, @code{t4} takes up 4 bytes.
30020@end enumerate
30021
30022@item Zero-length bit-fields following non-bit-field members are ignored:
30023
30024@smallexample
30025struct
30026 @{
30027   char foo;
30028   long : 0;
30029   char bar;
30030 @} t5;
30031@end smallexample
30032
30033@noindent
30034Here, @code{t5} takes up 2 bytes.
30035@end enumerate
30036
30037
30038@item -mno-align-stringops
30039@opindex mno-align-stringops
30040@opindex malign-stringops
30041Do not align the destination of inlined string operations.  This switch reduces
30042code size and improves performance in case the destination is already aligned,
30043but GCC doesn't know about it.
30044
30045@item -minline-all-stringops
30046@opindex minline-all-stringops
30047By default GCC inlines string operations only when the destination is
30048known to be aligned to least a 4-byte boundary.
30049This enables more inlining and increases code
30050size, but may improve performance of code that depends on fast
30051@code{memcpy} and @code{memset} for short lengths.
30052The option enables inline expansion of @code{strlen} for all
30053pointer alignments.
30054
30055@item -minline-stringops-dynamically
30056@opindex minline-stringops-dynamically
30057For string operations of unknown size, use run-time checks with
30058inline code for small blocks and a library call for large blocks.
30059
30060@item -mstringop-strategy=@var{alg}
30061@opindex mstringop-strategy=@var{alg}
30062Override the internal decision heuristic for the particular algorithm to use
30063for inlining string operations.  The allowed values for @var{alg} are:
30064
30065@table @samp
30066@item rep_byte
30067@itemx rep_4byte
30068@itemx rep_8byte
30069Expand using i386 @code{rep} prefix of the specified size.
30070
30071@item byte_loop
30072@itemx loop
30073@itemx unrolled_loop
30074Expand into an inline loop.
30075
30076@item libcall
30077Always use a library call.
30078@end table
30079
30080@item -mmemcpy-strategy=@var{strategy}
30081@opindex mmemcpy-strategy=@var{strategy}
30082Override the internal decision heuristic to decide if @code{__builtin_memcpy}
30083should be inlined and what inline algorithm to use when the expected size
30084of the copy operation is known. @var{strategy}
30085is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
30086@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
30087the max byte size with which inline algorithm @var{alg} is allowed.  For the last
30088triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
30089in the list must be specified in increasing order.  The minimal byte size for
30090@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
30091preceding range.
30092
30093@item -mmemset-strategy=@var{strategy}
30094@opindex mmemset-strategy=@var{strategy}
30095The option is similar to @option{-mmemcpy-strategy=} except that it is to control
30096@code{__builtin_memset} expansion.
30097
30098@item -momit-leaf-frame-pointer
30099@opindex momit-leaf-frame-pointer
30100Don't keep the frame pointer in a register for leaf functions.  This
30101avoids the instructions to save, set up, and restore frame pointers and
30102makes an extra register available in leaf functions.  The option
30103@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
30104which might make debugging harder.
30105
30106@item -mtls-direct-seg-refs
30107@itemx -mno-tls-direct-seg-refs
30108@opindex mtls-direct-seg-refs
30109Controls whether TLS variables may be accessed with offsets from the
30110TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
30111or whether the thread base pointer must be added.  Whether or not this
30112is valid depends on the operating system, and whether it maps the
30113segment to cover the entire TLS area.
30114
30115For systems that use the GNU C Library, the default is on.
30116
30117@item -msse2avx
30118@itemx -mno-sse2avx
30119@opindex msse2avx
30120Specify that the assembler should encode SSE instructions with VEX
30121prefix.  The option @option{-mavx} turns this on by default.
30122
30123@item -mfentry
30124@itemx -mno-fentry
30125@opindex mfentry
30126If profiling is active (@option{-pg}), put the profiling
30127counter call before the prologue.
30128Note: On x86 architectures the attribute @code{ms_hook_prologue}
30129isn't possible at the moment for @option{-mfentry} and @option{-pg}.
30130
30131@item -mrecord-mcount
30132@itemx -mno-record-mcount
30133@opindex mrecord-mcount
30134If profiling is active (@option{-pg}), generate a __mcount_loc section
30135that contains pointers to each profiling call. This is useful for
30136automatically patching and out calls.
30137
30138@item -mnop-mcount
30139@itemx -mno-nop-mcount
30140@opindex mnop-mcount
30141If profiling is active (@option{-pg}), generate the calls to
30142the profiling functions as NOPs. This is useful when they
30143should be patched in later dynamically. This is likely only
30144useful together with @option{-mrecord-mcount}.
30145
30146@item -minstrument-return=@var{type}
30147@opindex minstrument-return
30148Instrument function exit in -pg -mfentry instrumented functions with
30149call to specified function. This only instruments true returns ending
30150with ret, but not sibling calls ending with jump. Valid types
30151are @var{none} to not instrument, @var{call} to generate a call to __return__,
30152or @var{nop5} to generate a 5 byte nop.
30153
30154@item -mrecord-return
30155@itemx -mno-record-return
30156@opindex mrecord-return
30157Generate a __return_loc section pointing to all return instrumentation code.
30158
30159@item -mfentry-name=@var{name}
30160@opindex mfentry-name
30161Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
30162
30163@item -mfentry-section=@var{name}
30164@opindex mfentry-section
30165Set name of section to record -mrecord-mcount calls (default __mcount_loc).
30166
30167@item -mskip-rax-setup
30168@itemx -mno-skip-rax-setup
30169@opindex mskip-rax-setup
30170When generating code for the x86-64 architecture with SSE extensions
30171disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30172register when there are no variable arguments passed in vector registers.
30173
30174@strong{Warning:} Since RAX register is used to avoid unnecessarily
30175saving vector registers on stack when passing variable arguments, the
30176impacts of this option are callees may waste some stack space,
30177misbehave or jump to a random location.  GCC 4.4 or newer don't have
30178those issues, regardless the RAX register value.
30179
30180@item -m8bit-idiv
30181@itemx -mno-8bit-idiv
30182@opindex m8bit-idiv
30183On some processors, like Intel Atom, 8-bit unsigned integer divide is
30184much faster than 32-bit/64-bit integer divide.  This option generates a
30185run-time check.  If both dividend and divisor are within range of 0
30186to 255, 8-bit unsigned integer divide is used instead of
3018732-bit/64-bit integer divide.
30188
30189@item -mavx256-split-unaligned-load
30190@itemx -mavx256-split-unaligned-store
30191@opindex mavx256-split-unaligned-load
30192@opindex mavx256-split-unaligned-store
30193Split 32-byte AVX unaligned load and store.
30194
30195@item -mstack-protector-guard=@var{guard}
30196@itemx -mstack-protector-guard-reg=@var{reg}
30197@itemx -mstack-protector-guard-offset=@var{offset}
30198@opindex mstack-protector-guard
30199@opindex mstack-protector-guard-reg
30200@opindex mstack-protector-guard-offset
30201Generate stack protection code using canary at @var{guard}.  Supported
30202locations are @samp{global} for global canary or @samp{tls} for per-thread
30203canary in the TLS block (the default).  This option has effect only when
30204@option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30205
30206With the latter choice the options
30207@option{-mstack-protector-guard-reg=@var{reg}} and
30208@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30209which segment register (@code{%fs} or @code{%gs}) to use as base register
30210for reading the canary, and from what offset from that base register.
30211The default for those is as specified in the relevant ABI.
30212
30213@item -mgeneral-regs-only
30214@opindex mgeneral-regs-only
30215Generate code that uses only the general-purpose registers.  This
30216prevents the compiler from using floating-point, vector, mask and bound
30217registers.
30218
30219@item -mindirect-branch=@var{choice}
30220@opindex mindirect-branch
30221Convert indirect call and jump with @var{choice}.  The default is
30222@samp{keep}, which keeps indirect call and jump unmodified.
30223@samp{thunk} converts indirect call and jump to call and return thunk.
30224@samp{thunk-inline} converts indirect call and jump to inlined call
30225and return thunk.  @samp{thunk-extern} converts indirect call and jump
30226to external call and return thunk provided in a separate object file.
30227You can control this behavior for a specific function by using the
30228function attribute @code{indirect_branch}.  @xref{Function Attributes}.
30229
30230Note that @option{-mcmodel=large} is incompatible with
30231@option{-mindirect-branch=thunk} and
30232@option{-mindirect-branch=thunk-extern} since the thunk function may
30233not be reachable in the large code model.
30234
30235Note that @option{-mindirect-branch=thunk-extern} is compatible with
30236@option{-fcf-protection=branch} since the external thunk can be made
30237to enable control-flow check.
30238
30239@item -mfunction-return=@var{choice}
30240@opindex mfunction-return
30241Convert function return with @var{choice}.  The default is @samp{keep},
30242which keeps function return unmodified.  @samp{thunk} converts function
30243return to call and return thunk.  @samp{thunk-inline} converts function
30244return to inlined call and return thunk.  @samp{thunk-extern} converts
30245function return to external call and return thunk provided in a separate
30246object file.  You can control this behavior for a specific function by
30247using the function attribute @code{function_return}.
30248@xref{Function Attributes}.
30249
30250Note that @option{-mindirect-return=thunk-extern} is compatible with
30251@option{-fcf-protection=branch} since the external thunk can be made
30252to enable control-flow check.
30253
30254Note that @option{-mcmodel=large} is incompatible with
30255@option{-mfunction-return=thunk} and
30256@option{-mfunction-return=thunk-extern} since the thunk function may
30257not be reachable in the large code model.
30258
30259
30260@item -mindirect-branch-register
30261@opindex mindirect-branch-register
30262Force indirect call and jump via register.
30263
30264@end table
30265
30266These @samp{-m} switches are supported in addition to the above
30267on x86-64 processors in 64-bit environments.
30268
30269@table @gcctabopt
30270@item -m32
30271@itemx -m64
30272@itemx -mx32
30273@itemx -m16
30274@itemx -miamcu
30275@opindex m32
30276@opindex m64
30277@opindex mx32
30278@opindex m16
30279@opindex miamcu
30280Generate code for a 16-bit, 32-bit or 64-bit environment.
30281The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30282to 32 bits, and
30283generates code that runs in 32-bit mode.
30284
30285The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30286types to 64 bits, and generates code for the x86-64 architecture.
30287For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30288and @option{-mdynamic-no-pic} options.
30289
30290The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30291to 32 bits, and
30292generates code for the x86-64 architecture.
30293
30294The @option{-m16} option is the same as @option{-m32}, except for that
30295it outputs the @code{.code16gcc} assembly directive at the beginning of
30296the assembly output so that the binary can run in 16-bit mode.
30297
30298The @option{-miamcu} option generates code which conforms to Intel MCU
30299psABI.  It requires the @option{-m32} option to be turned on.
30300
30301@item -mno-red-zone
30302@opindex mno-red-zone
30303@opindex mred-zone
30304Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
30305by the x86-64 ABI; it is a 128-byte area beyond the location of the
30306stack pointer that is not modified by signal or interrupt handlers
30307and therefore can be used for temporary data without adjusting the stack
30308pointer.  The flag @option{-mno-red-zone} disables this red zone.
30309
30310@item -mcmodel=small
30311@opindex mcmodel=small
30312Generate code for the small code model: the program and its symbols must
30313be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
30314Programs can be statically or dynamically linked.  This is the default
30315code model.
30316
30317@item -mcmodel=kernel
30318@opindex mcmodel=kernel
30319Generate code for the kernel code model.  The kernel runs in the
30320negative 2 GB of the address space.
30321This model has to be used for Linux kernel code.
30322
30323@item -mcmodel=medium
30324@opindex mcmodel=medium
30325Generate code for the medium model: the program is linked in the lower 2
30326GB of the address space.  Small symbols are also placed there.  Symbols
30327with sizes larger than @option{-mlarge-data-threshold} are put into
30328large data or BSS sections and can be located above 2GB.  Programs can
30329be statically or dynamically linked.
30330
30331@item -mcmodel=large
30332@opindex mcmodel=large
30333Generate code for the large model.  This model makes no assumptions
30334about addresses and sizes of sections.
30335
30336@item -maddress-mode=long
30337@opindex maddress-mode=long
30338Generate code for long address mode.  This is only supported for 64-bit
30339and x32 environments.  It is the default address mode for 64-bit
30340environments.
30341
30342@item -maddress-mode=short
30343@opindex maddress-mode=short
30344Generate code for short address mode.  This is only supported for 32-bit
30345and x32 environments.  It is the default address mode for 32-bit and
30346x32 environments.
30347@end table
30348
30349@node x86 Windows Options
30350@subsection x86 Windows Options
30351@cindex x86 Windows Options
30352@cindex Windows Options for x86
30353
30354These additional options are available for Microsoft Windows targets:
30355
30356@table @gcctabopt
30357@item -mconsole
30358@opindex mconsole
30359This option
30360specifies that a console application is to be generated, by
30361instructing the linker to set the PE header subsystem type
30362required for console applications.
30363This option is available for Cygwin and MinGW targets and is
30364enabled by default on those targets.
30365
30366@item -mdll
30367@opindex mdll
30368This option is available for Cygwin and MinGW targets.  It
30369specifies that a DLL---a dynamic link library---is to be
30370generated, enabling the selection of the required runtime
30371startup object and entry point.
30372
30373@item -mnop-fun-dllimport
30374@opindex mnop-fun-dllimport
30375This option is available for Cygwin and MinGW targets.  It
30376specifies that the @code{dllimport} attribute should be ignored.
30377
30378@item -mthread
30379@opindex mthread
30380This option is available for MinGW targets. It specifies
30381that MinGW-specific thread support is to be used.
30382
30383@item -municode
30384@opindex municode
30385This option is available for MinGW-w64 targets.  It causes
30386the @code{UNICODE} preprocessor macro to be predefined, and
30387chooses Unicode-capable runtime startup code.
30388
30389@item -mwin32
30390@opindex mwin32
30391This option is available for Cygwin and MinGW targets.  It
30392specifies that the typical Microsoft Windows predefined macros are to
30393be set in the pre-processor, but does not influence the choice
30394of runtime library/startup code.
30395
30396@item -mwindows
30397@opindex mwindows
30398This option is available for Cygwin and MinGW targets.  It
30399specifies that a GUI application is to be generated by
30400instructing the linker to set the PE header subsystem type
30401appropriately.
30402
30403@item -fno-set-stack-executable
30404@opindex fno-set-stack-executable
30405@opindex fset-stack-executable
30406This option is available for MinGW targets. It specifies that
30407the executable flag for the stack used by nested functions isn't
30408set. This is necessary for binaries running in kernel mode of
30409Microsoft Windows, as there the User32 API, which is used to set executable
30410privileges, isn't available.
30411
30412@item -fwritable-relocated-rdata
30413@opindex fno-writable-relocated-rdata
30414@opindex fwritable-relocated-rdata
30415This option is available for MinGW and Cygwin targets.  It specifies
30416that relocated-data in read-only section is put into the @code{.data}
30417section.  This is a necessary for older runtimes not supporting
30418modification of @code{.rdata} sections for pseudo-relocation.
30419
30420@item -mpe-aligned-commons
30421@opindex mpe-aligned-commons
30422This option is available for Cygwin and MinGW targets.  It
30423specifies that the GNU extension to the PE file format that
30424permits the correct alignment of COMMON variables should be
30425used when generating code.  It is enabled by default if
30426GCC detects that the target assembler found during configuration
30427supports the feature.
30428
30429@item -mindirect-branch=@var{choice}
30430@opindex -mindirect-branch
30431Convert indirect call and jump with @var{choice}.  The default is
30432@samp{keep}, which keeps indirect call and jump unmodified.
30433@samp{thunk} converts indirect call and jump to call and return thunk.
30434@samp{thunk-inline} converts indirect call and jump to inlined call
30435and return thunk.  @samp{thunk-extern} converts indirect call and jump
30436to external call and return thunk provided in a separate object file.
30437You can control this behavior for a specific function by using the
30438function attribute @code{indirect_branch}.  @xref{Function Attributes}.
30439
30440Note that @option{-mcmodel=large} is incompatible with
30441@option{-mindirect-branch=thunk} nor
30442@option{-mindirect-branch=thunk-extern} since the thunk function may
30443not be reachable in large code model.
30444
30445@item -mfunction-return=@var{choice}
30446@opindex -mfunction-return
30447Convert function return with @var{choice}.  The default is @samp{keep},
30448which keeps function return unmodified.  @samp{thunk} converts function
30449return to call and return thunk.  @samp{thunk-inline} converts function
30450return to inlined call and return thunk.  @samp{thunk-extern} converts
30451function return to external call and return thunk provided in a separate
30452object file.  You can control this behavior for a specific function by
30453using the function attribute @code{function_return}.
30454@xref{Function Attributes}.
30455
30456Note that @option{-mcmodel=large} is incompatible with
30457@option{-mfunction-return=thunk} nor
30458@option{-mfunction-return=thunk-extern} since the thunk function may
30459not be reachable in large code model.
30460
30461@item -mindirect-branch-register
30462@opindex -mindirect-branch-register
30463Force indirect call and jump via register.
30464@end table
30465
30466See also under @ref{x86 Options} for standard options.
30467
30468@node Xstormy16 Options
30469@subsection Xstormy16 Options
30470@cindex Xstormy16 Options
30471
30472These options are defined for Xstormy16:
30473
30474@table @gcctabopt
30475@item -msim
30476@opindex msim
30477Choose startup files and linker script suitable for the simulator.
30478@end table
30479
30480@node Xtensa Options
30481@subsection Xtensa Options
30482@cindex Xtensa Options
30483
30484These options are supported for Xtensa targets:
30485
30486@table @gcctabopt
30487@item -mconst16
30488@itemx -mno-const16
30489@opindex mconst16
30490@opindex mno-const16
30491Enable or disable use of @code{CONST16} instructions for loading
30492constant values.  The @code{CONST16} instruction is currently not a
30493standard option from Tensilica.  When enabled, @code{CONST16}
30494instructions are always used in place of the standard @code{L32R}
30495instructions.  The use of @code{CONST16} is enabled by default only if
30496the @code{L32R} instruction is not available.
30497
30498@item -mfused-madd
30499@itemx -mno-fused-madd
30500@opindex mfused-madd
30501@opindex mno-fused-madd
30502Enable or disable use of fused multiply/add and multiply/subtract
30503instructions in the floating-point option.  This has no effect if the
30504floating-point option is not also enabled.  Disabling fused multiply/add
30505and multiply/subtract instructions forces the compiler to use separate
30506instructions for the multiply and add/subtract operations.  This may be
30507desirable in some cases where strict IEEE 754-compliant results are
30508required: the fused multiply add/subtract instructions do not round the
30509intermediate result, thereby producing results with @emph{more} bits of
30510precision than specified by the IEEE standard.  Disabling fused multiply
30511add/subtract instructions also ensures that the program output is not
30512sensitive to the compiler's ability to combine multiply and add/subtract
30513operations.
30514
30515@item -mserialize-volatile
30516@itemx -mno-serialize-volatile
30517@opindex mserialize-volatile
30518@opindex mno-serialize-volatile
30519When this option is enabled, GCC inserts @code{MEMW} instructions before
30520@code{volatile} memory references to guarantee sequential consistency.
30521The default is @option{-mserialize-volatile}.  Use
30522@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30523
30524@item -mforce-no-pic
30525@opindex mforce-no-pic
30526For targets, like GNU/Linux, where all user-mode Xtensa code must be
30527position-independent code (PIC), this option disables PIC for compiling
30528kernel code.
30529
30530@item -mtext-section-literals
30531@itemx -mno-text-section-literals
30532@opindex mtext-section-literals
30533@opindex mno-text-section-literals
30534These options control the treatment of literal pools.  The default is
30535@option{-mno-text-section-literals}, which places literals in a separate
30536section in the output file.  This allows the literal pool to be placed
30537in a data RAM/ROM, and it also allows the linker to combine literal
30538pools from separate object files to remove redundant literals and
30539improve code size.  With @option{-mtext-section-literals}, the literals
30540are interspersed in the text section in order to keep them as close as
30541possible to their references.  This may be necessary for large assembly
30542files.  Literals for each function are placed right before that function.
30543
30544@item -mauto-litpools
30545@itemx -mno-auto-litpools
30546@opindex mauto-litpools
30547@opindex mno-auto-litpools
30548These options control the treatment of literal pools.  The default is
30549@option{-mno-auto-litpools}, which places literals in a separate
30550section in the output file unless @option{-mtext-section-literals} is
30551used.  With @option{-mauto-litpools} the literals are interspersed in
30552the text section by the assembler.  Compiler does not produce explicit
30553@code{.literal} directives and loads literals into registers with
30554@code{MOVI} instructions instead of @code{L32R} to let the assembler
30555do relaxation and place literals as necessary.  This option allows
30556assembler to create several literal pools per function and assemble
30557very big functions, which may not be possible with
30558@option{-mtext-section-literals}.
30559
30560@item -mtarget-align
30561@itemx -mno-target-align
30562@opindex mtarget-align
30563@opindex mno-target-align
30564When this option is enabled, GCC instructs the assembler to
30565automatically align instructions to reduce branch penalties at the
30566expense of some code density.  The assembler attempts to widen density
30567instructions to align branch targets and the instructions following call
30568instructions.  If there are not enough preceding safe density
30569instructions to align a target, no widening is performed.  The
30570default is @option{-mtarget-align}.  These options do not affect the
30571treatment of auto-aligned instructions like @code{LOOP}, which the
30572assembler always aligns, either by widening density instructions or
30573by inserting NOP instructions.
30574
30575@item -mlongcalls
30576@itemx -mno-longcalls
30577@opindex mlongcalls
30578@opindex mno-longcalls
30579When this option is enabled, GCC instructs the assembler to translate
30580direct calls to indirect calls unless it can determine that the target
30581of a direct call is in the range allowed by the call instruction.  This
30582translation typically occurs for calls to functions in other source
30583files.  Specifically, the assembler translates a direct @code{CALL}
30584instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30585The default is @option{-mno-longcalls}.  This option should be used in
30586programs where the call target can potentially be out of range.  This
30587option is implemented in the assembler, not the compiler, so the
30588assembly code generated by GCC still shows direct call
30589instructions---look at the disassembled object code to see the actual
30590instructions.  Note that the assembler uses an indirect call for
30591every cross-file call, not just those that really are out of range.
30592@end table
30593
30594@node zSeries Options
30595@subsection zSeries Options
30596@cindex zSeries options
30597
30598These are listed under @xref{S/390 and zSeries Options}.
30599
30600
30601@c man end
30602
30603@node Spec Files
30604@section Specifying Subprocesses and the Switches to Pass to Them
30605@cindex Spec Files
30606
30607@command{gcc} is a driver program.  It performs its job by invoking a
30608sequence of other programs to do the work of compiling, assembling and
30609linking.  GCC interprets its command-line parameters and uses these to
30610deduce which programs it should invoke, and which command-line options
30611it ought to place on their command lines.  This behavior is controlled
30612by @dfn{spec strings}.  In most cases there is one spec string for each
30613program that GCC can invoke, but a few programs have multiple spec
30614strings to control their behavior.  The spec strings built into GCC can
30615be overridden by using the @option{-specs=} command-line switch to specify
30616a spec file.
30617
30618@dfn{Spec files} are plain-text files that are used to construct spec
30619strings.  They consist of a sequence of directives separated by blank
30620lines.  The type of directive is determined by the first non-whitespace
30621character on the line, which can be one of the following:
30622
30623@table @code
30624@item %@var{command}
30625Issues a @var{command} to the spec file processor.  The commands that can
30626appear here are:
30627
30628@table @code
30629@item %include <@var{file}>
30630@cindex @code{%include}
30631Search for @var{file} and insert its text at the current point in the
30632specs file.
30633
30634@item %include_noerr <@var{file}>
30635@cindex @code{%include_noerr}
30636Just like @samp{%include}, but do not generate an error message if the include
30637file cannot be found.
30638
30639@item %rename @var{old_name} @var{new_name}
30640@cindex @code{%rename}
30641Rename the spec string @var{old_name} to @var{new_name}.
30642
30643@end table
30644
30645@item *[@var{spec_name}]:
30646This tells the compiler to create, override or delete the named spec
30647string.  All lines after this directive up to the next directive or
30648blank line are considered to be the text for the spec string.  If this
30649results in an empty string then the spec is deleted.  (Or, if the
30650spec did not exist, then nothing happens.)  Otherwise, if the spec
30651does not currently exist a new spec is created.  If the spec does
30652exist then its contents are overridden by the text of this
30653directive, unless the first character of that text is the @samp{+}
30654character, in which case the text is appended to the spec.
30655
30656@item [@var{suffix}]:
30657Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
30658and up to the next directive or blank line are considered to make up the
30659spec string for the indicated suffix.  When the compiler encounters an
30660input file with the named suffix, it processes the spec string in
30661order to work out how to compile that file.  For example:
30662
30663@smallexample
30664.ZZ:
30665z-compile -input %i
30666@end smallexample
30667
30668This says that any input file whose name ends in @samp{.ZZ} should be
30669passed to the program @samp{z-compile}, which should be invoked with the
30670command-line switch @option{-input} and with the result of performing the
30671@samp{%i} substitution.  (See below.)
30672
30673As an alternative to providing a spec string, the text following a
30674suffix directive can be one of the following:
30675
30676@table @code
30677@item @@@var{language}
30678This says that the suffix is an alias for a known @var{language}.  This is
30679similar to using the @option{-x} command-line switch to GCC to specify a
30680language explicitly.  For example:
30681
30682@smallexample
30683.ZZ:
30684@@c++
30685@end smallexample
30686
30687Says that .ZZ files are, in fact, C++ source files.
30688
30689@item #@var{name}
30690This causes an error messages saying:
30691
30692@smallexample
30693@var{name} compiler not installed on this system.
30694@end smallexample
30695@end table
30696
30697GCC already has an extensive list of suffixes built into it.
30698This directive adds an entry to the end of the list of suffixes, but
30699since the list is searched from the end backwards, it is effectively
30700possible to override earlier entries using this technique.
30701
30702@end table
30703
30704GCC has the following spec strings built into it.  Spec files can
30705override these strings or create their own.  Note that individual
30706targets can also add their own spec strings to this list.
30707
30708@smallexample
30709asm          Options to pass to the assembler
30710asm_final    Options to pass to the assembler post-processor
30711cpp          Options to pass to the C preprocessor
30712cc1          Options to pass to the C compiler
30713cc1plus      Options to pass to the C++ compiler
30714endfile      Object files to include at the end of the link
30715link         Options to pass to the linker
30716lib          Libraries to include on the command line to the linker
30717libgcc       Decides which GCC support library to pass to the linker
30718linker       Sets the name of the linker
30719predefines   Defines to be passed to the C preprocessor
30720signed_char  Defines to pass to CPP to say whether @code{char} is signed
30721             by default
30722startfile    Object files to include at the start of the link
30723@end smallexample
30724
30725Here is a small example of a spec file:
30726
30727@smallexample
30728%rename lib                 old_lib
30729
30730*lib:
30731--start-group -lgcc -lc -leval1 --end-group %(old_lib)
30732@end smallexample
30733
30734This example renames the spec called @samp{lib} to @samp{old_lib} and
30735then overrides the previous definition of @samp{lib} with a new one.
30736The new definition adds in some extra command-line options before
30737including the text of the old definition.
30738
30739@dfn{Spec strings} are a list of command-line options to be passed to their
30740corresponding program.  In addition, the spec strings can contain
30741@samp{%}-prefixed sequences to substitute variable text or to
30742conditionally insert text into the command line.  Using these constructs
30743it is possible to generate quite complex command lines.
30744
30745Here is a table of all defined @samp{%}-sequences for spec
30746strings.  Note that spaces are not generated automatically around the
30747results of expanding these sequences.  Therefore you can concatenate them
30748together or combine them with constant text in a single argument.
30749
30750@table @code
30751@item %%
30752Substitute one @samp{%} into the program name or argument.
30753
30754@item %i
30755Substitute the name of the input file being processed.
30756
30757@item %b
30758Substitute the basename of the input file being processed.
30759This is the substring up to (and not including) the last period
30760and not including the directory.
30761
30762@item %B
30763This is the same as @samp{%b}, but include the file suffix (text after
30764the last period).
30765
30766@item %d
30767Marks the argument containing or following the @samp{%d} as a
30768temporary file name, so that that file is deleted if GCC exits
30769successfully.  Unlike @samp{%g}, this contributes no text to the
30770argument.
30771
30772@item %g@var{suffix}
30773Substitute a file name that has suffix @var{suffix} and is chosen
30774once per compilation, and mark the argument in the same way as
30775@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
30776name is now chosen in a way that is hard to predict even when previously
30777chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30778might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
30779the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30780treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
30781was simply substituted with a file name chosen once per compilation,
30782without regard to any appended suffix (which was therefore treated
30783just like ordinary text), making such attacks more likely to succeed.
30784
30785@item %u@var{suffix}
30786Like @samp{%g}, but generates a new temporary file name
30787each time it appears instead of once per compilation.
30788
30789@item %U@var{suffix}
30790Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30791new one if there is no such last file name.  In the absence of any
30792@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30793the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30794involves the generation of two distinct file names, one
30795for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
30796simply substituted with a file name chosen for the previous @samp{%u},
30797without regard to any appended suffix.
30798
30799@item %j@var{suffix}
30800Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30801writable, and if @option{-save-temps} is not used;
30802otherwise, substitute the name
30803of a temporary file, just like @samp{%u}.  This temporary file is not
30804meant for communication between processes, but rather as a junk
30805disposal mechanism.
30806
30807@item %|@var{suffix}
30808@itemx %m@var{suffix}
30809Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
30810@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
30811all.  These are the two most common ways to instruct a program that it
30812should read from standard input or write to standard output.  If you
30813need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
30814construct: see for example @file{gcc/fortran/lang-specs.h}.
30815
30816@item %.@var{SUFFIX}
30817Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
30818when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
30819terminated by the next space or %.
30820
30821@item %w
30822Marks the argument containing or following the @samp{%w} as the
30823designated output file of this compilation.  This puts the argument
30824into the sequence of arguments that @samp{%o} substitutes.
30825
30826@item %o
30827Substitutes the names of all the output files, with spaces
30828automatically placed around them.  You should write spaces
30829around the @samp{%o} as well or the results are undefined.
30830@samp{%o} is for use in the specs for running the linker.
30831Input files whose names have no recognized suffix are not compiled
30832at all, but they are included among the output files, so they are
30833linked.
30834
30835@item %O
30836Substitutes the suffix for object files.  Note that this is
30837handled specially when it immediately follows @samp{%g, %u, or %U},
30838because of the need for those to form complete file names.  The
30839handling is such that @samp{%O} is treated exactly as if it had already
30840been substituted, except that @samp{%g, %u, and %U} do not currently
30841support additional @var{suffix} characters following @samp{%O} as they do
30842following, for example, @samp{.o}.
30843
30844@item %p
30845Substitutes the standard macro predefinitions for the
30846current target machine.  Use this when running @command{cpp}.
30847
30848@item %P
30849Like @samp{%p}, but puts @samp{__} before and after the name of each
30850predefined macro, except for macros that start with @samp{__} or with
30851@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
30852C@.
30853
30854@item %I
30855Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
30856@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
30857@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
30858and @option{-imultilib} as necessary.
30859
30860@item %s
30861Current argument is the name of a library or startup file of some sort.
30862Search for that file in a standard list of directories and substitute
30863the full name found.  The current working directory is included in the
30864list of directories scanned.
30865
30866@item %T
30867Current argument is the name of a linker script.  Search for that file
30868in the current list of directories to scan for libraries. If the file
30869is located insert a @option{--script} option into the command line
30870followed by the full path name found.  If the file is not found then
30871generate an error message.  Note: the current working directory is not
30872searched.
30873
30874@item %e@var{str}
30875Print @var{str} as an error message.  @var{str} is terminated by a newline.
30876Use this when inconsistent options are detected.
30877
30878@item %(@var{name})
30879Substitute the contents of spec string @var{name} at this point.
30880
30881@item %x@{@var{option}@}
30882Accumulate an option for @samp{%X}.
30883
30884@item %X
30885Output the accumulated linker options specified by a @samp{%x} spec string.
30886
30887@item %Y
30888Output the accumulated assembler options specified by @option{-Wa}.
30889
30890@item %Z
30891Output the accumulated preprocessor options specified by @option{-Wp}.
30892
30893@item %a
30894Process the @code{asm} spec.  This is used to compute the
30895switches to be passed to the assembler.
30896
30897@item %A
30898Process the @code{asm_final} spec.  This is a spec string for
30899passing switches to an assembler post-processor, if such a program is
30900needed.
30901
30902@item %l
30903Process the @code{link} spec.  This is the spec for computing the
30904command line passed to the linker.  Typically it makes use of the
30905@samp{%L %G %S %D and %E} sequences.
30906
30907@item %D
30908Dump out a @option{-L} option for each directory that GCC believes might
30909contain startup files.  If the target supports multilibs then the
30910current multilib directory is prepended to each of these paths.
30911
30912@item %L
30913Process the @code{lib} spec.  This is a spec string for deciding which
30914libraries are included on the command line to the linker.
30915
30916@item %G
30917Process the @code{libgcc} spec.  This is a spec string for deciding
30918which GCC support library is included on the command line to the linker.
30919
30920@item %S
30921Process the @code{startfile} spec.  This is a spec for deciding which
30922object files are the first ones passed to the linker.  Typically
30923this might be a file named @file{crt0.o}.
30924
30925@item %E
30926Process the @code{endfile} spec.  This is a spec string that specifies
30927the last object files that are passed to the linker.
30928
30929@item %C
30930Process the @code{cpp} spec.  This is used to construct the arguments
30931to be passed to the C preprocessor.
30932
30933@item %1
30934Process the @code{cc1} spec.  This is used to construct the options to be
30935passed to the actual C compiler (@command{cc1}).
30936
30937@item %2
30938Process the @code{cc1plus} spec.  This is used to construct the options to be
30939passed to the actual C++ compiler (@command{cc1plus}).
30940
30941@item %*
30942Substitute the variable part of a matched option.  See below.
30943Note that each comma in the substituted string is replaced by
30944a single space.
30945
30946@item %<S
30947Remove all occurrences of @code{-S} from the command line.  Note---this
30948command is position dependent.  @samp{%} commands in the spec string
30949before this one see @code{-S}, @samp{%} commands in the spec string
30950after this one do not.
30951
30952@item %:@var{function}(@var{args})
30953Call the named function @var{function}, passing it @var{args}.
30954@var{args} is first processed as a nested spec string, then split
30955into an argument vector in the usual fashion.  The function returns
30956a string which is processed as if it had appeared literally as part
30957of the current spec.
30958
30959The following built-in spec functions are provided:
30960
30961@table @code
30962@item @code{getenv}
30963The @code{getenv} spec function takes two arguments: an environment
30964variable name and a string.  If the environment variable is not
30965defined, a fatal error is issued.  Otherwise, the return value is the
30966value of the environment variable concatenated with the string.  For
30967example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
30968
30969@smallexample
30970%:getenv(TOPDIR /include)
30971@end smallexample
30972
30973expands to @file{/path/to/top/include}.
30974
30975@item @code{if-exists}
30976The @code{if-exists} spec function takes one argument, an absolute
30977pathname to a file.  If the file exists, @code{if-exists} returns the
30978pathname.  Here is a small example of its usage:
30979
30980@smallexample
30981*startfile:
30982crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
30983@end smallexample
30984
30985@item @code{if-exists-else}
30986The @code{if-exists-else} spec function is similar to the @code{if-exists}
30987spec function, except that it takes two arguments.  The first argument is
30988an absolute pathname to a file.  If the file exists, @code{if-exists-else}
30989returns the pathname.  If it does not exist, it returns the second argument.
30990This way, @code{if-exists-else} can be used to select one file or another,
30991based on the existence of the first.  Here is a small example of its usage:
30992
30993@smallexample
30994*startfile:
30995crt0%O%s %:if-exists(crti%O%s) \
30996%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
30997@end smallexample
30998
30999@item @code{replace-outfile}
31000The @code{replace-outfile} spec function takes two arguments.  It looks for the
31001first argument in the outfiles array and replaces it with the second argument.  Here
31002is a small example of its usage:
31003
31004@smallexample
31005%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
31006@end smallexample
31007
31008@item @code{remove-outfile}
31009The @code{remove-outfile} spec function takes one argument.  It looks for the
31010first argument in the outfiles array and removes it.  Here is a small example
31011its usage:
31012
31013@smallexample
31014%:remove-outfile(-lm)
31015@end smallexample
31016
31017@item @code{pass-through-libs}
31018The @code{pass-through-libs} spec function takes any number of arguments.  It
31019finds any @option{-l} options and any non-options ending in @file{.a} (which it
31020assumes are the names of linker input library archive files) and returns a
31021result containing all the found arguments each prepended by
31022@option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
31023intended to be passed to the LTO linker plugin.
31024
31025@smallexample
31026%:pass-through-libs(%G %L %G)
31027@end smallexample
31028
31029@item @code{print-asm-header}
31030The @code{print-asm-header} function takes no arguments and simply
31031prints a banner like:
31032
31033@smallexample
31034Assembler options
31035=================
31036
31037Use "-Wa,OPTION" to pass "OPTION" to the assembler.
31038@end smallexample
31039
31040It is used to separate compiler options from assembler options
31041in the @option{--target-help} output.
31042@end table
31043
31044@item %@{S@}
31045Substitutes the @code{-S} switch, if that switch is given to GCC@.
31046If that switch is not specified, this substitutes nothing.  Note that
31047the leading dash is omitted when specifying this option, and it is
31048automatically inserted if the substitution is performed.  Thus the spec
31049string @samp{%@{foo@}} matches the command-line option @option{-foo}
31050and outputs the command-line option @option{-foo}.
31051
31052@item %W@{S@}
31053Like %@{@code{S}@} but mark last argument supplied within as a file to be
31054deleted on failure.
31055
31056@item %@{S*@}
31057Substitutes all the switches specified to GCC whose names start
31058with @code{-S}, but which also take an argument.  This is used for
31059switches like @option{-o}, @option{-D}, @option{-I}, etc.
31060GCC considers @option{-o foo} as being
31061one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
31062text, including the space.  Thus two arguments are generated.
31063
31064@item %@{S*&T*@}
31065Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
31066(the order of @code{S} and @code{T} in the spec is not significant).
31067There can be any number of ampersand-separated variables; for each the
31068wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
31069
31070@item %@{S:X@}
31071Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
31072
31073@item %@{!S:X@}
31074Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
31075
31076@item %@{S*:X@}
31077Substitutes @code{X} if one or more switches whose names start with
31078@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
31079once, no matter how many such switches appeared.  However, if @code{%*}
31080appears somewhere in @code{X}, then @code{X} is substituted once
31081for each matching switch, with the @code{%*} replaced by the part of
31082that switch matching the @code{*}.
31083
31084If @code{%*} appears as the last part of a spec sequence then a space
31085is added after the end of the last substitution.  If there is more
31086text in the sequence, however, then a space is not generated.  This
31087allows the @code{%*} substitution to be used as part of a larger
31088string.  For example, a spec string like this:
31089
31090@smallexample
31091%@{mcu=*:--script=%*/memory.ld@}
31092@end smallexample
31093
31094@noindent
31095when matching an option like @option{-mcu=newchip} produces:
31096
31097@smallexample
31098--script=newchip/memory.ld
31099@end smallexample
31100
31101@item %@{.S:X@}
31102Substitutes @code{X}, if processing a file with suffix @code{S}.
31103
31104@item %@{!.S:X@}
31105Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
31106
31107@item %@{,S:X@}
31108Substitutes @code{X}, if processing a file for language @code{S}.
31109
31110@item %@{!,S:X@}
31111Substitutes @code{X}, if not processing a file for language @code{S}.
31112
31113@item %@{S|P:X@}
31114Substitutes @code{X} if either @code{-S} or @code{-P} is given to
31115GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
31116@code{*} sequences as well, although they have a stronger binding than
31117the @samp{|}.  If @code{%*} appears in @code{X}, all of the
31118alternatives must be starred, and only the first matching alternative
31119is substituted.
31120
31121For example, a spec string like this:
31122
31123@smallexample
31124%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
31125@end smallexample
31126
31127@noindent
31128outputs the following command-line options from the following input
31129command-line options:
31130
31131@smallexample
31132fred.c        -foo -baz
31133jim.d         -bar -boggle
31134-d fred.c     -foo -baz -boggle
31135-d jim.d      -bar -baz -boggle
31136@end smallexample
31137
31138@item %@{S:X; T:Y; :D@}
31139
31140If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
31141given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
31142be as many clauses as you need.  This may be combined with @code{.},
31143@code{,}, @code{!}, @code{|}, and @code{*} as needed.
31144
31145
31146@end table
31147
31148The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
31149or similar construct can use a backslash to ignore the special meaning
31150of the character following it, thus allowing literal matching of a
31151character that is otherwise specially treated.  For example,
31152@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
31153@option{-std=iso9899:1999} option is given.
31154
31155The conditional text @code{X} in a @samp{%@{S:X@}} or similar
31156construct may contain other nested @samp{%} constructs or spaces, or
31157even newlines.  They are processed as usual, as described above.
31158Trailing white space in @code{X} is ignored.  White space may also
31159appear anywhere on the left side of the colon in these constructs,
31160except between @code{.} or @code{*} and the corresponding word.
31161
31162The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
31163handled specifically in these constructs.  If another value of
31164@option{-O} or the negated form of a @option{-f}, @option{-m}, or
31165@option{-W} switch is found later in the command line, the earlier
31166switch value is ignored, except with @{@code{S}*@} where @code{S} is
31167just one letter, which passes all matching options.
31168
31169The character @samp{|} at the beginning of the predicate text is used to
31170indicate that a command should be piped to the following command, but
31171only if @option{-pipe} is specified.
31172
31173It is built into GCC which switches take arguments and which do not.
31174(You might think it would be useful to generalize this to allow each
31175compiler's spec to say which switches take arguments.  But this cannot
31176be done in a consistent fashion.  GCC cannot even decide which input
31177files have been specified without knowing which switches take arguments,
31178and it must know which input files to compile in order to tell which
31179compilers to run).
31180
31181GCC also knows implicitly that arguments starting in @option{-l} are to be
31182treated as compiler output files, and passed to the linker in their
31183proper position among the other output files.
31184
31185@node Environment Variables
31186@section Environment Variables Affecting GCC
31187@cindex environment variables
31188
31189@c man begin ENVIRONMENT
31190This section describes several environment variables that affect how GCC
31191operates.  Some of them work by specifying directories or prefixes to use
31192when searching for various kinds of files.  Some are used to specify other
31193aspects of the compilation environment.
31194
31195Note that you can also specify places to search using options such as
31196@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
31197take precedence over places specified using environment variables, which
31198in turn take precedence over those specified by the configuration of GCC@.
31199@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
31200GNU Compiler Collection (GCC) Internals}.
31201
31202@table @env
31203@item LANG
31204@itemx LC_CTYPE
31205@c @itemx LC_COLLATE
31206@itemx LC_MESSAGES
31207@c @itemx LC_MONETARY
31208@c @itemx LC_NUMERIC
31209@c @itemx LC_TIME
31210@itemx LC_ALL
31211@findex LANG
31212@findex LC_CTYPE
31213@c @findex LC_COLLATE
31214@findex LC_MESSAGES
31215@c @findex LC_MONETARY
31216@c @findex LC_NUMERIC
31217@c @findex LC_TIME
31218@findex LC_ALL
31219@cindex locale
31220These environment variables control the way that GCC uses
31221localization information which allows GCC to work with different
31222national conventions.  GCC inspects the locale categories
31223@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31224so.  These locale categories can be set to any value supported by your
31225installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
31226Kingdom encoded in UTF-8.
31227
31228The @env{LC_CTYPE} environment variable specifies character
31229classification.  GCC uses it to determine the character boundaries in
31230a string; this is needed for some multibyte encodings that contain quote
31231and escape characters that are otherwise interpreted as a string
31232end or escape.
31233
31234The @env{LC_MESSAGES} environment variable specifies the language to
31235use in diagnostic messages.
31236
31237If the @env{LC_ALL} environment variable is set, it overrides the value
31238of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31239and @env{LC_MESSAGES} default to the value of the @env{LANG}
31240environment variable.  If none of these variables are set, GCC
31241defaults to traditional C English behavior.
31242
31243@item TMPDIR
31244@findex TMPDIR
31245If @env{TMPDIR} is set, it specifies the directory to use for temporary
31246files.  GCC uses temporary files to hold the output of one stage of
31247compilation which is to be used as input to the next stage: for example,
31248the output of the preprocessor, which is the input to the compiler
31249proper.
31250
31251@item GCC_COMPARE_DEBUG
31252@findex GCC_COMPARE_DEBUG
31253Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31254@option{-fcompare-debug} to the compiler driver.  See the documentation
31255of this option for more details.
31256
31257@item GCC_EXEC_PREFIX
31258@findex GCC_EXEC_PREFIX
31259If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31260names of the subprograms executed by the compiler.  No slash is added
31261when this prefix is combined with the name of a subprogram, but you can
31262specify a prefix that ends with a slash if you wish.
31263
31264If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31265an appropriate prefix to use based on the pathname it is invoked with.
31266
31267If GCC cannot find the subprogram using the specified prefix, it
31268tries looking in the usual places for the subprogram.
31269
31270The default value of @env{GCC_EXEC_PREFIX} is
31271@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31272the installed compiler. In many cases @var{prefix} is the value
31273of @code{prefix} when you ran the @file{configure} script.
31274
31275Other prefixes specified with @option{-B} take precedence over this prefix.
31276
31277This prefix is also used for finding files such as @file{crt0.o} that are
31278used for linking.
31279
31280In addition, the prefix is used in an unusual way in finding the
31281directories to search for header files.  For each of the standard
31282directories whose name normally begins with @samp{/usr/local/lib/gcc}
31283(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31284replacing that beginning with the specified prefix to produce an
31285alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
31286@file{foo/bar} just before it searches the standard directory
31287@file{/usr/local/lib/bar}.
31288If a standard directory begins with the configured
31289@var{prefix} then the value of @var{prefix} is replaced by
31290@env{GCC_EXEC_PREFIX} when looking for header files.
31291
31292@item COMPILER_PATH
31293@findex COMPILER_PATH
31294The value of @env{COMPILER_PATH} is a colon-separated list of
31295directories, much like @env{PATH}.  GCC tries the directories thus
31296specified when searching for subprograms, if it cannot find the
31297subprograms using @env{GCC_EXEC_PREFIX}.
31298
31299@item LIBRARY_PATH
31300@findex LIBRARY_PATH
31301The value of @env{LIBRARY_PATH} is a colon-separated list of
31302directories, much like @env{PATH}.  When configured as a native compiler,
31303GCC tries the directories thus specified when searching for special
31304linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
31305using GCC also uses these directories when searching for ordinary
31306libraries for the @option{-l} option (but directories specified with
31307@option{-L} come first).
31308
31309@item LANG
31310@findex LANG
31311@cindex locale definition
31312This variable is used to pass locale information to the compiler.  One way in
31313which this information is used is to determine the character set to be used
31314when character literals, string literals and comments are parsed in C and C++.
31315When the compiler is configured to allow multibyte characters,
31316the following values for @env{LANG} are recognized:
31317
31318@table @samp
31319@item C-JIS
31320Recognize JIS characters.
31321@item C-SJIS
31322Recognize SJIS characters.
31323@item C-EUCJP
31324Recognize EUCJP characters.
31325@end table
31326
31327If @env{LANG} is not defined, or if it has some other value, then the
31328compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31329recognize and translate multibyte characters.
31330@end table
31331
31332@noindent
31333Some additional environment variables affect the behavior of the
31334preprocessor.
31335
31336@include cppenv.texi
31337
31338@c man end
31339
31340@node Precompiled Headers
31341@section Using Precompiled Headers
31342@cindex precompiled headers
31343@cindex speed of compilation
31344
31345Often large projects have many header files that are included in every
31346source file.  The time the compiler takes to process these header files
31347over and over again can account for nearly all of the time required to
31348build the project.  To make builds faster, GCC allows you to
31349@dfn{precompile} a header file.
31350
31351To create a precompiled header file, simply compile it as you would any
31352other file, if necessary using the @option{-x} option to make the driver
31353treat it as a C or C++ header file.  You may want to use a
31354tool like @command{make} to keep the precompiled header up-to-date when
31355the headers it contains change.
31356
31357A precompiled header file is searched for when @code{#include} is
31358seen in the compilation.  As it searches for the included file
31359(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31360compiler looks for a precompiled header in each directory just before it
31361looks for the include file in that directory.  The name searched for is
31362the name specified in the @code{#include} with @samp{.gch} appended.  If
31363the precompiled header file cannot be used, it is ignored.
31364
31365For instance, if you have @code{#include "all.h"}, and you have
31366@file{all.h.gch} in the same directory as @file{all.h}, then the
31367precompiled header file is used if possible, and the original
31368header is used otherwise.
31369
31370Alternatively, you might decide to put the precompiled header file in a
31371directory and use @option{-I} to ensure that directory is searched
31372before (or instead of) the directory containing the original header.
31373Then, if you want to check that the precompiled header file is always
31374used, you can put a file of the same name as the original header in this
31375directory containing an @code{#error} command.
31376
31377This also works with @option{-include}.  So yet another way to use
31378precompiled headers, good for projects not designed with precompiled
31379header files in mind, is to simply take most of the header files used by
31380a project, include them from another header file, precompile that header
31381file, and @option{-include} the precompiled header.  If the header files
31382have guards against multiple inclusion, they are skipped because
31383they've already been included (in the precompiled header).
31384
31385If you need to precompile the same header file for different
31386languages, targets, or compiler options, you can instead make a
31387@emph{directory} named like @file{all.h.gch}, and put each precompiled
31388header in the directory, perhaps using @option{-o}.  It doesn't matter
31389what you call the files in the directory; every precompiled header in
31390the directory is considered.  The first precompiled header
31391encountered in the directory that is valid for this compilation is
31392used; they're searched in no particular order.
31393
31394There are many other possibilities, limited only by your imagination,
31395good sense, and the constraints of your build system.
31396
31397A precompiled header file can be used only when these conditions apply:
31398
31399@itemize
31400@item
31401Only one precompiled header can be used in a particular compilation.
31402
31403@item
31404A precompiled header cannot be used once the first C token is seen.  You
31405can have preprocessor directives before a precompiled header; you cannot
31406include a precompiled header from inside another header.
31407
31408@item
31409The precompiled header file must be produced for the same language as
31410the current compilation.  You cannot use a C precompiled header for a C++
31411compilation.
31412
31413@item
31414The precompiled header file must have been produced by the same compiler
31415binary as the current compilation is using.
31416
31417@item
31418Any macros defined before the precompiled header is included must
31419either be defined in the same way as when the precompiled header was
31420generated, or must not affect the precompiled header, which usually
31421means that they don't appear in the precompiled header at all.
31422
31423The @option{-D} option is one way to define a macro before a
31424precompiled header is included; using a @code{#define} can also do it.
31425There are also some options that define macros implicitly, like
31426@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31427defined this way.
31428
31429@item If debugging information is output when using the precompiled
31430header, using @option{-g} or similar, the same kind of debugging information
31431must have been output when building the precompiled header.  However,
31432a precompiled header built using @option{-g} can be used in a compilation
31433when no debugging information is being output.
31434
31435@item The same @option{-m} options must generally be used when building
31436and using the precompiled header.  @xref{Submodel Options},
31437for any cases where this rule is relaxed.
31438
31439@item Each of the following options must be the same when building and using
31440the precompiled header:
31441
31442@gccoptlist{-fexceptions}
31443
31444@item
31445Some other command-line options starting with @option{-f},
31446@option{-p}, or @option{-O} must be defined in the same way as when
31447the precompiled header was generated.  At present, it's not clear
31448which options are safe to change and which are not; the safest choice
31449is to use exactly the same options when generating and using the
31450precompiled header.  The following are known to be safe:
31451
31452@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
31453-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
31454-fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
31455-pedantic-errors}
31456
31457@item Address space layout randomization (ASLR) can lead to not binary identical
31458PCH files.  If you rely on stable PCH file contents disable ASLR when generating
31459PCH files.
31460
31461@end itemize
31462
31463For all of these except the last, the compiler automatically
31464ignores the precompiled header if the conditions aren't met.  If you
31465find an option combination that doesn't work and doesn't cause the
31466precompiled header to be ignored, please consider filing a bug report,
31467see @ref{Bugs}.
31468
31469If you do use differing options when generating and using the
31470precompiled header, the actual behavior is a mixture of the
31471behavior for the options.  For instance, if you use @option{-g} to
31472generate the precompiled header but not when using it, you may or may
31473not get debugging information for routines in the precompiled header.
31474