1@c Copyright (C) 1988-2021 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-2021 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 @command{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* C++ Modules::		Experimental C++20 module system.
176@end menu
177
178@c man begin OPTIONS
179
180@node Option Summary
181@section Option Summary
182
183Here is a summary of all the options, grouped by type.  Explanations are
184in the following sections.
185
186@table @emph
187@item Overall Options
188@xref{Overall Options,,Options Controlling the Kind of Output}.
189@gccoptlist{-c  -S  -E  -o @var{file} @gol
190-dumpbase @var{dumpbase}  -dumpbase-ext @var{auxdropsuf} @gol
191-dumpdir @var{dumppfx}  -x @var{language}  @gol
192-v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version @gol
193-pass-exit-codes  -pipe  -specs=@var{file}  -wrapper  @gol
194@@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  @gol
195-fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}  @gol
196-fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
197
198@item C Language Options
199@xref{C Dialect Options,,Options Controlling C Dialect}.
200@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
201-fpermitted-flt-eval-methods=@var{standard} @gol
202-aux-info @var{filename}  -fallow-parameterless-variadic-functions @gol
203-fno-asm  -fno-builtin  -fno-builtin-@var{function}  -fgimple@gol
204-fhosted  -ffreestanding @gol
205-fopenacc  -fopenacc-dim=@var{geom} @gol
206-fopenmp  -fopenmp-simd @gol
207-fms-extensions  -fplan9-extensions  -fsso-struct=@var{endianness} @gol
208-fallow-single-precision  -fcond-mismatch  -flax-vector-conversions @gol
209-fsigned-bitfields  -fsigned-char @gol
210-funsigned-bitfields  -funsigned-char}
211
212@item C++ Language Options
213@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
214@gccoptlist{-fabi-version=@var{n}  -fno-access-control @gol
215-faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new @gol
216-fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n} @gol
217-fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n} @gol
218-fno-elide-constructors @gol
219-fno-enforce-eh-specs @gol
220-fno-gnu-keywords @gol
221-fno-implicit-templates @gol
222-fno-implicit-inline-templates @gol
223-fno-implement-inlines  @gol
224-fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts @gol
225-fmodule-implicit-inline @gol
226-fno-module-lazy @gol
227-fmodule-mapper=@var{specification} @gol
228-fmodule-version-ignore @gol
229-fms-extensions @gol
230-fnew-inheriting-ctors @gol
231-fnew-ttp-matching @gol
232-fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names @gol
233-fno-optional-diags  -fpermissive @gol
234-fno-pretty-templates @gol
235-fno-rtti  -fsized-deallocation @gol
236-ftemplate-backtrace-limit=@var{n} @gol
237-ftemplate-depth=@var{n} @gol
238-fno-threadsafe-statics  -fuse-cxa-atexit @gol
239-fno-weak  -nostdinc++ @gol
240-fvisibility-inlines-hidden @gol
241-fvisibility-ms-compat @gol
242-fext-numeric-literals @gol
243-flang-info-include-translate@r{[}=@var{header}@r{]} @gol
244-flang-info-include-translate-not @gol
245-flang-info-module-cmi@r{[}=@var{module}@r{]} @gol
246-stdlib=@var{libstdc++,libc++} @gol
247-Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n} @gol
248-Wno-class-conversion  -Wclass-memaccess @gol
249-Wcomma-subscript  -Wconditionally-supported @gol
250-Wno-conversion-null  -Wctad-maybe-unsupported @gol
251-Wctor-dtor-privacy  -Wno-delete-incomplete @gol
252-Wdelete-non-virtual-dtor  -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
253-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
254-Weffc++  -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base @gol
255-Wno-inherited-variadic-ctor  -Wno-init-list-lifetime @gol
256-Winvalid-imported-macros @gol
257-Wno-invalid-offsetof  -Wno-literal-suffix @gol
258-Wno-mismatched-new-delete -Wmismatched-tags @gol
259-Wmultiple-inheritance  -Wnamespaces  -Wnarrowing @gol
260-Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor @gol
261-Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n} @gol
262-Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
263-Wreorder  -Wregister @gol
264-Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates @gol
265-Wno-non-template-friend  -Wold-style-cast @gol
266-Woverloaded-virtual  -Wno-pmf-conversions -Wsign-promo @gol
267-Wsized-deallocation  -Wsuggest-final-methods @gol
268-Wsuggest-final-types  -Wsuggest-override  @gol
269-Wno-terminate  -Wuseless-cast  -Wno-vexing-parse  @gol
270-Wvirtual-inheritance  @gol
271-Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
272
273@item Objective-C and Objective-C++ Language Options
274@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
275Objective-C and Objective-C++ Dialects}.
276@gccoptlist{-fconstant-string-class=@var{class-name} @gol
277-fgnu-runtime  -fnext-runtime @gol
278-fno-nil-receivers @gol
279-fobjc-abi-version=@var{n} @gol
280-fobjc-call-cxx-cdtors @gol
281-fobjc-direct-dispatch @gol
282-fobjc-exceptions @gol
283-fobjc-gc @gol
284-fobjc-nilcheck @gol
285-fobjc-std=objc1 @gol
286-fno-local-ivars @gol
287-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
288-freplace-objc-classes @gol
289-fzero-link @gol
290-gen-decls @gol
291-Wassign-intercept  -Wno-property-assign-default @gol
292-Wno-protocol -Wobjc-root-class -Wselector @gol
293-Wstrict-selector-match @gol
294-Wundeclared-selector}
295
296@item Diagnostic Message Formatting Options
297@xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
298@gccoptlist{-fmessage-length=@var{n}  @gol
299-fdiagnostics-plain-output @gol
300-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
301-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
302-fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}  @gol
303-fdiagnostics-format=@r{[}text@r{|}json@r{]}  @gol
304-fno-diagnostics-show-option  -fno-diagnostics-show-caret @gol
305-fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers @gol
306-fno-diagnostics-show-cwe  @gol
307-fdiagnostics-minimum-margin-width=@var{width} @gol
308-fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch @gol
309-fdiagnostics-show-template-tree  -fno-elide-type @gol
310-fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
311-fdiagnostics-show-path-depths @gol
312-fno-show-column @gol
313-fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]} @gol
314-fdiagnostics-column-origin=@var{origin}}
315
316@item Warning Options
317@xref{Warning Options,,Options to Request or Suppress Warnings}.
318@gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic @gol
319-pedantic-errors @gol
320-w  -Wextra  -Wall  -Wabi=@var{n} @gol
321-Waddress  -Wno-address-of-packed-member  -Waggregate-return @gol
322-Walloc-size-larger-than=@var{byte-size}  -Walloc-zero @gol
323-Walloca  -Walloca-larger-than=@var{byte-size} @gol
324-Wno-aggressive-loop-optimizations @gol
325-Warith-conversion @gol
326-Warray-bounds  -Warray-bounds=@var{n} @gol
327-Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
328-Wno-attribute-warning  -Wbool-compare  -Wbool-operation @gol
329-Wno-builtin-declaration-mismatch @gol
330-Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat @gol
331-Wc11-c2x-compat @gol
332-Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat  @gol
333-Wc++20-compat  @gol
334-Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual  @gol
335-Wchar-subscripts @gol
336-Wclobbered  -Wcomment @gol
337-Wconversion  -Wno-coverage-mismatch  -Wno-cpp @gol
338-Wdangling-else  -Wdate-time @gol
339-Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init @gol
340-Wdisabled-optimization @gol
341-Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers @gol
342-Wno-div-by-zero  -Wdouble-promotion @gol
343-Wduplicated-branches  -Wduplicated-cond @gol
344-Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion @gol
345-Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors @gol
346-Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2 @gol
347-Wno-format-contains-nul  -Wno-format-extra-args  @gol
348-Wformat-nonliteral  -Wformat-overflow=@var{n} @gol
349-Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n} @gol
350-Wformat-y2k  -Wframe-address @gol
351-Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object @gol
352-Wno-if-not-aligned  -Wno-ignored-attributes @gol
353-Wignored-qualifiers  -Wno-incompatible-pointer-types @gol
354-Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
355-Wno-implicit-function-declaration  -Wno-implicit-int @gol
356-Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
357-Wno-int-to-pointer-cast  -Wno-invalid-memory-model @gol
358-Winvalid-pch  -Wjump-misses-init  -Wlarger-than=@var{byte-size} @gol
359-Wlogical-not-parentheses  -Wlogical-op  -Wlong-long @gol
360-Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized @gol
361-Wmemset-elt-size  -Wmemset-transposed-args @gol
362-Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces @gol
363-Wmissing-field-initializers  -Wmissing-format-attribute @gol
364-Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile @gol
365-Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare @gol
366-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
367-Wnull-dereference  -Wno-odr  -Wopenmp-simd  @gol
368-Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects @gol
369-Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded @gol
370-Wparentheses  -Wno-pedantic-ms-format @gol
371-Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast @gol
372-Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls @gol
373-Wrestrict  -Wno-return-local-addr  -Wreturn-type @gol
374-Wno-scalar-storage-order  -Wsequence-point @gol
375-Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local @gol
376-Wno-shadow-ivar @gol
377-Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value @gol
378-Wno-shift-overflow  -Wshift-overflow=@var{n} @gol
379-Wsign-compare  -Wsign-conversion @gol
380-Wno-sizeof-array-argument @gol
381-Wsizeof-array-div @gol
382-Wsizeof-pointer-div  -Wsizeof-pointer-memaccess @gol
383-Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing @gol
384-Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n} @gol
385-Wstring-compare @gol
386-Wno-stringop-overflow -Wno-stringop-overread @gol
387-Wno-stringop-truncation @gol
388-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
389-Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum @gol
390-Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand @gol
391-Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs @gol
392-Wtsan -Wtype-limits  -Wundef @gol
393-Wuninitialized  -Wunknown-pragmas @gol
394-Wunsuffixed-float-constants  -Wunused @gol
395-Wunused-but-set-parameter  -Wunused-but-set-variable @gol
396-Wunused-const-variable  -Wunused-const-variable=@var{n} @gol
397-Wunused-function  -Wunused-label  -Wunused-local-typedefs @gol
398-Wunused-macros @gol
399-Wunused-parameter  -Wno-unused-result @gol
400-Wunused-value  -Wunused-variable @gol
401-Wno-varargs  -Wvariadic-macros @gol
402-Wvector-operation-performance @gol
403-Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than @gol
404-Wvolatile-register-var  -Wwrite-strings @gol
405-Wzero-length-bounds}
406
407@item Static Analyzer Options
408@gccoptlist{
409-fanalyzer @gol
410-fanalyzer-call-summaries @gol
411-fanalyzer-checker=@var{name} @gol
412-fno-analyzer-feasibility @gol
413-fanalyzer-fine-grained @gol
414-fanalyzer-state-merge @gol
415-fanalyzer-state-purge @gol
416-fanalyzer-transitivity @gol
417-fanalyzer-verbose-edges @gol
418-fanalyzer-verbose-state-changes @gol
419-fanalyzer-verbosity=@var{level} @gol
420-fdump-analyzer @gol
421-fdump-analyzer-stderr @gol
422-fdump-analyzer-callgraph @gol
423-fdump-analyzer-exploded-graph @gol
424-fdump-analyzer-exploded-nodes @gol
425-fdump-analyzer-exploded-nodes-2 @gol
426-fdump-analyzer-exploded-nodes-3 @gol
427-fdump-analyzer-feasibility @gol
428-fdump-analyzer-json @gol
429-fdump-analyzer-state-purge @gol
430-fdump-analyzer-supergraph @gol
431-Wno-analyzer-double-fclose @gol
432-Wno-analyzer-double-free @gol
433-Wno-analyzer-exposure-through-output-file @gol
434-Wno-analyzer-file-leak @gol
435-Wno-analyzer-free-of-non-heap @gol
436-Wno-analyzer-malloc-leak @gol
437-Wno-analyzer-mismatching-deallocation @gol
438-Wno-analyzer-null-argument @gol
439-Wno-analyzer-null-dereference @gol
440-Wno-analyzer-possible-null-argument @gol
441-Wno-analyzer-possible-null-dereference @gol
442-Wno-analyzer-shift-count-negative @gol
443-Wno-analyzer-shift-count-overflow @gol
444-Wno-analyzer-stale-setjmp-buffer @gol
445-Wno-analyzer-tainted-array-index @gol
446-Wanalyzer-too-complex @gol
447-Wno-analyzer-unsafe-call-within-signal-handler @gol
448-Wno-analyzer-use-after-free @gol
449-Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
450-Wno-analyzer-use-of-uninitialized-value @gol
451-Wno-analyzer-write-to-const @gol
452-Wno-analyzer-write-to-string-literal @gol
453}
454
455@item C and Objective-C-only Warning Options
456@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
457-Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
458-Wold-style-declaration  -Wold-style-definition @gol
459-Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
460-Wdeclaration-after-statement  -Wpointer-sign}
461
462@item Debugging Options
463@xref{Debugging Options,,Options for Debugging Your Program}.
464@gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version} @gol
465-ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
466-gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
467-gas-loc-support  -gno-as-loc-support @gol
468-gas-locview-support  -gno-as-locview-support @gol
469-gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64 @gol
470-gstatement-frontiers  -gno-statement-frontiers @gol
471-gvariable-location-views  -gno-variable-location-views @gol
472-ginternal-reset-location-views  -gno-internal-reset-location-views @gol
473-ginline-points  -gno-inline-points @gol
474-gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
475-gsplit-dwarf  -gdescribe-dies  -gno-describe-dies @gol
476-fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
477-fno-eliminate-unused-debug-types @gol
478-femit-struct-debug-baseonly  -femit-struct-debug-reduced @gol
479-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
480-fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
481-fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
482-fvar-tracking  -fvar-tracking-assignments}
483
484@item Optimization Options
485@xref{Optimize Options,,Options that Control Optimization}.
486@gccoptlist{-faggressive-loop-optimizations @gol
487-falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
488-falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
489-falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
490-falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
491-fno-allocation-dce -fallow-store-data-races @gol
492-fassociative-math  -fauto-profile  -fauto-profile[=@var{path}] @gol
493-fauto-inc-dec  -fbranch-probabilities @gol
494-fcaller-saves @gol
495-fcombine-stack-adjustments  -fconserve-stack @gol
496-fcompare-elim  -fcprop-registers  -fcrossjumping @gol
497-fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules @gol
498-fcx-limited-range @gol
499-fdata-sections  -fdce  -fdelayed-branch @gol
500-fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively @gol
501-fdevirtualize-at-ltrans  -fdse @gol
502-fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects @gol
503-ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style} @gol
504-ffinite-loops @gol
505-fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections @gol
506-fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity @gol
507-fgcse-sm  -fhoist-adjacent-loads  -fif-conversion @gol
508-fif-conversion2  -findirect-inlining @gol
509-finline-functions  -finline-functions-called-once  -finline-limit=@var{n} @gol
510-finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone @gol
511-fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const @gol
512-fipa-reference  -fipa-reference-addressable @gol
513-fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm} @gol
514-flive-patching=@var{level} @gol
515-fira-region=@var{region}  -fira-hoist-pressure @gol
516-fira-loop-pressure  -fno-ira-share-save-slots @gol
517-fno-ira-share-spill-slots @gol
518-fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute @gol
519-fivopts  -fkeep-inline-functions  -fkeep-static-functions @gol
520-fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage @gol
521-floop-block  -floop-interchange  -floop-strip-mine @gol
522-floop-unroll-and-jam  -floop-nest-optimize @gol
523-floop-parallelize-all  -flra-remat  -flto  -flto-compression-level @gol
524-flto-partition=@var{alg}  -fmerge-all-constants @gol
525-fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves @gol
526-fmove-loop-invariants  -fno-branch-count-reg @gol
527-fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse @gol
528-fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole @gol
529-fno-peephole2  -fno-printf-return-value  -fno-sched-interblock @gol
530-fno-sched-spec  -fno-signed-zeros @gol
531-fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss @gol
532-fomit-frame-pointer  -foptimize-sibling-calls @gol
533-fpartial-inlining  -fpeel-loops  -fpredictive-commoning @gol
534-fprefetch-loop-arrays @gol
535-fprofile-correction @gol
536-fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training @gol
537-fprofile-values -fprofile-reorder-functions @gol
538-freciprocal-math  -free  -frename-registers  -freorder-blocks @gol
539-freorder-blocks-algorithm=@var{algorithm} @gol
540-freorder-blocks-and-partition  -freorder-functions @gol
541-frerun-cse-after-loop  -freschedule-modulo-scheduled-loops @gol
542-frounding-math  -fsave-optimization-record @gol
543-fsched2-use-superblocks  -fsched-pressure @gol
544-fsched-spec-load  -fsched-spec-load-dangerous @gol
545-fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}] @gol
546-fsched-group-heuristic  -fsched-critical-path-heuristic @gol
547-fsched-spec-insn-heuristic  -fsched-rank-heuristic @gol
548-fsched-last-insn-heuristic  -fsched-dep-count-heuristic @gol
549-fschedule-fusion @gol
550-fschedule-insns  -fschedule-insns2  -fsection-anchors @gol
551-fselective-scheduling  -fselective-scheduling2 @gol
552-fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops @gol
553-fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate @gol
554-fsignaling-nans @gol
555-fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops@gol
556-fsplit-paths @gol
557-fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt @gol
558-fstdarg-opt  -fstore-merging  -fstrict-aliasing @gol
559-fthread-jumps  -ftracer  -ftree-bit-ccp @gol
560-ftree-builtin-call-dce  -ftree-ccp  -ftree-ch @gol
561-ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts @gol
562-ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting @gol
563-ftree-loop-if-convert  -ftree-loop-im @gol
564-ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns @gol
565-ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize @gol
566-ftree-loop-vectorize @gol
567-ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta @gol
568-ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra @gol
569-ftree-switch-conversion  -ftree-tail-merge @gol
570-ftree-ter  -ftree-vectorize  -ftree-vrp  -funconstrained-commons @gol
571-funit-at-a-time  -funroll-all-loops  -funroll-loops @gol
572-funsafe-math-optimizations  -funswitch-loops @gol
573-fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt @gol
574-fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs @gol
575--param @var{name}=@var{value}
576-O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og}
577
578@item Program Instrumentation Options
579@xref{Instrumentation Options,,Program Instrumentation Options}.
580@gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage @gol
581-fprofile-abs-path @gol
582-fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path} @gol
583-fprofile-info-section  -fprofile-info-section=@var{name} @gol
584-fprofile-note=@var{path} -fprofile-prefix-path=@var{path} @gol
585-fprofile-update=@var{method} -fprofile-filter-files=@var{regex} @gol
586-fprofile-exclude-files=@var{regex} @gol
587-fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]} @gol
588-fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style} @gol
589-fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},... @gol
590-fsanitize-undefined-trap-on-error  -fbounds-check @gol
591-fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]} @gol
592-fstack-protector  -fstack-protector-all  -fstack-protector-strong @gol
593-fstack-protector-explicit  -fstack-check @gol
594-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
595-fno-stack-limit  -fsplit-stack @gol
596-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
597-fvtv-counts  -fvtv-debug @gol
598-finstrument-functions @gol
599-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
600-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
601
602@item Preprocessor Options
603@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
604@gccoptlist{-A@var{question}=@var{answer} @gol
605-A-@var{question}@r{[}=@var{answer}@r{]} @gol
606-C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]} @gol
607-dD  -dI  -dM  -dN  -dU @gol
608-fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers  @gol
609-fexec-charset=@var{charset}  -fextended-identifiers  @gol
610-finput-charset=@var{charset}  -flarge-source-files  @gol
611-fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth} @gol
612-fno-canonical-system-headers  -fpch-deps  -fpch-preprocess  @gol
613-fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion  @gol
614-fwide-exec-charset=@var{charset}  -fworking-directory @gol
615-H  -imacros @var{file}  -include @var{file} @gol
616-M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules @gol
617-no-integrated-cpp  -P  -pthread  -remap @gol
618-traditional  -traditional-cpp  -trigraphs @gol
619-U@var{macro}  -undef  @gol
620-Wp,@var{option}  -Xpreprocessor @var{option}}
621
622@item Assembler Options
623@xref{Assembler Options,,Passing Options to the Assembler}.
624@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
625
626@item Linker Options
627@xref{Link Options,,Options for Linking}.
628@gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library} @gol
629-nostartfiles  -nodefaultlibs  -nolibc  -nostdlib @gol
630-e @var{entry}  --entry=@var{entry} @gol
631-pie  -pthread  -r  -rdynamic @gol
632-s  -static  -static-pie  -static-libgcc  -static-libstdc++ @gol
633-static-libasan  -static-libtsan  -static-liblsan  -static-libubsan @gol
634-shared  -shared-libgcc  -symbolic @gol
635-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
636-u @var{symbol}  -z @var{keyword}}
637
638@item Directory Options
639@xref{Directory Options,,Options for Directory Search}.
640@gccoptlist{-B@var{prefix}  -I@var{dir}  -I- @gol
641-idirafter @var{dir} @gol
642-imacros @var{file}  -imultilib @var{dir} @gol
643-iplugindir=@var{dir}  -iprefix @var{file} @gol
644-iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir} @gol
645-iwithprefix @var{dir}  -iwithprefixbefore @var{dir}  @gol
646-L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix @gol
647-nostdinc  -nostdinc++  --sysroot=@var{dir}}
648
649@item Code Generation Options
650@xref{Code Gen Options,,Options for Code Generation Conventions}.
651@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
652-ffixed-@var{reg}  -fexceptions @gol
653-fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables @gol
654-fasynchronous-unwind-tables @gol
655-fno-gnu-unique @gol
656-finhibit-size-directive  -fcommon  -fno-ident @gol
657-fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
658-fno-jump-tables -fno-bit-tests @gol
659-frecord-gcc-switches @gol
660-freg-struct-return  -fshort-enums  -fshort-wchar @gol
661-fverbose-asm  -fpack-struct[=@var{n}]  @gol
662-fleading-underscore  -ftls-model=@var{model} @gol
663-fstack-reuse=@var{reuse_level} @gol
664-ftrampolines  -ftrapv  -fwrapv @gol
665-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
666-fstrict-volatile-bitfields  -fsync-libcalls}
667
668@item Developer Options
669@xref{Developer Options,,GCC Developer Options}.
670@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
671-dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
672-fchecking  -fchecking=@var{n}
673-fdbg-cnt-list @gol  -fdbg-cnt=@var{counter-value-list} @gol
674-fdisable-ipa-@var{pass_name} @gol
675-fdisable-rtl-@var{pass_name} @gol
676-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
677-fdisable-tree-@var{pass_name} @gol
678-fdisable-tree-@var{pass-name}=@var{range-list} @gol
679-fdump-debug  -fdump-earlydebug @gol
680-fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
681-fdump-final-insns@r{[}=@var{file}@r{]} @gol
682-fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
683-fdump-lang-all @gol
684-fdump-lang-@var{switch} @gol
685-fdump-lang-@var{switch}-@var{options} @gol
686-fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
687-fdump-passes @gol
688-fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
689-fdump-statistics @gol
690-fdump-tree-all @gol
691-fdump-tree-@var{switch} @gol
692-fdump-tree-@var{switch}-@var{options} @gol
693-fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
694-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
695-fenable-@var{kind}-@var{pass} @gol
696-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
697-fira-verbose=@var{n} @gol
698-flto-report  -flto-report-wpa  -fmem-report-wpa @gol
699-fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report @gol
700-fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
701-fprofile-report @gol
702-frandom-seed=@var{string}  -fsched-verbose=@var{n} @gol
703-fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose @gol
704-fstats  -fstack-usage  -ftime-report  -ftime-report-details @gol
705-fvar-tracking-assignments-toggle  -gtoggle @gol
706-print-file-name=@var{library}  -print-libgcc-file-name @gol
707-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
708-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
709-print-sysroot  -print-sysroot-headers-suffix @gol
710-save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
711
712@item Machine-Dependent Options
713@xref{Submodel Options,,Machine-Dependent Options}.
714@c This list is ordered alphanumerically by subsection name.
715@c Try and put the significant identifier (CPU or system) first,
716@c so users have a clue at guessing where the ones they want will be.
717
718@emph{AArch64 Options}
719@gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian @gol
720-mgeneral-regs-only @gol
721-mcmodel=tiny  -mcmodel=small  -mcmodel=large @gol
722-mstrict-align  -mno-strict-align @gol
723-momit-leaf-frame-pointer @gol
724-mtls-dialect=desc  -mtls-dialect=traditional @gol
725-mtls-size=@var{size} @gol
726-mfix-cortex-a53-835769  -mfix-cortex-a53-843419 @gol
727-mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div @gol
728-mpc-relative-literal-loads @gol
729-msign-return-address=@var{scope} @gol
730-mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
731+@var{b-key}]|@var{bti} @gol
732-mharden-sls=@var{opts} @gol
733-march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}  @gol
734-moverride=@var{string}  -mverbose-cost-dump @gol
735-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
736-mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
737-moutline-atomics }
738
739@emph{Adapteva Epiphany Options}
740@gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs @gol
741-mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf @gol
742-msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num} @gol
743-mround-nearest  -mlong-calls  -mshort-calls  -msmall16 @gol
744-mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num} @gol
745-msplit-vecmove-early  -m1reg-@var{reg}}
746
747@emph{AMD GCN Options}
748@gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
749
750@emph{ARC Options}
751@gccoptlist{-mbarrel-shifter  -mjli-always @gol
752-mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700 @gol
753-mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr @gol
754-mea  -mno-mpy  -mmul32x16  -mmul64  -matomic @gol
755-mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap @gol
756-mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape @gol
757-mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof @gol
758-mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved @gol
759-mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num} @gol
760-mvolatile-cache  -mtp-regno=@var{regno} @gol
761-malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc @gol
762-mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi @gol
763-mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none @gol
764-mlra-priority-compact mlra-priority-noncompact  -mmillicode @gol
765-mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level} @gol
766-mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame @gol
767-munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo} @gol
768-mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
769
770@emph{ARM Options}
771@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
772-mabi=@var{name} @gol
773-mapcs-stack-check  -mno-apcs-stack-check @gol
774-mapcs-reentrant  -mno-apcs-reentrant @gol
775-mgeneral-regs-only @gol
776-msched-prolog  -mno-sched-prolog @gol
777-mlittle-endian  -mbig-endian @gol
778-mbe8  -mbe32 @gol
779-mfloat-abi=@var{name} @gol
780-mfp16-format=@var{name}
781-mthumb-interwork  -mno-thumb-interwork @gol
782-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
783-mtune=@var{name}  -mprint-tune-info @gol
784-mstructure-size-boundary=@var{n} @gol
785-mabort-on-noreturn @gol
786-mlong-calls  -mno-long-calls @gol
787-msingle-pic-base  -mno-single-pic-base @gol
788-mpic-register=@var{reg} @gol
789-mnop-fun-dllimport @gol
790-mpoke-function-name @gol
791-mthumb  -marm  -mflip-thumb @gol
792-mtpcs-frame  -mtpcs-leaf-frame @gol
793-mcaller-super-interworking  -mcallee-super-interworking @gol
794-mtp=@var{name}  -mtls-dialect=@var{dialect} @gol
795-mword-relocations @gol
796-mfix-cortex-m3-ldrd @gol
797-munaligned-access @gol
798-mneon-for-64bits @gol
799-mslow-flash-data @gol
800-masm-syntax-unified @gol
801-mrestrict-it @gol
802-mverbose-cost-dump @gol
803-mpure-code @gol
804-mcmse @gol
805-mfix-cmse-cve-2021-35465 @gol
806-mfdpic}
807
808@emph{AVR Options}
809@gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args @gol
810-mbranch-cost=@var{cost} @gol
811-mcall-prologues  -mgas-isr-prologues  -mint8 @gol
812-mdouble=@var{bits} -mlong-double=@var{bits} @gol
813-mn_flash=@var{size}  -mno-interrupts @gol
814-mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack @gol
815-mfract-convert-truncate @gol
816-mshort-calls  -nodevicelib  -nodevicespecs @gol
817-Waddr-space-convert  -Wmisspelled-isr}
818
819@emph{Blackfin Options}
820@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
821-msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
822-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
823-mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
824-mno-id-shared-library  -mshared-library-id=@var{n} @gol
825-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
826-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
827-mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram @gol
828-micplb}
829
830@emph{C6X Options}
831@gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu} @gol
832-msim  -msdata=@var{sdata-type}}
833
834@emph{CRIS Options}
835@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
836-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
837-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
838-mstack-align  -mdata-align  -mconst-align @gol
839-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
840-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
841-mmul-bug-workaround  -mno-mul-bug-workaround}
842
843@emph{CR16 Options}
844@gccoptlist{-mmac @gol
845-mcr16cplus  -mcr16c @gol
846-msim  -mint32  -mbit-ops
847-mdata-model=@var{model}}
848
849@emph{C-SKY Options}
850@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu} @gol
851-mbig-endian  -EB  -mlittle-endian  -EL @gol
852-mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu @gol
853-mfloat-abi=@var{name} @gol
854-melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust @gol
855-mdsp  -medsp  -mvdsp @gol
856-mdiv  -msmart  -mhigh-registers  -manchor @gol
857-mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt @gol
858-mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
859
860@emph{Darwin Options}
861@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
862-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
863-client_name  -compatibility_version  -current_version @gol
864-dead_strip @gol
865-dependency-file  -dylib_file  -dylinker_install_name @gol
866-dynamic  -dynamiclib  -exported_symbols_list @gol
867-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
868-force_flat_namespace  -headerpad_max_install_names @gol
869-iframework @gol
870-image_base  -init  -install_name  -keep_private_externs @gol
871-multi_module  -multiply_defined  -multiply_defined_unused @gol
872-noall_load   -no_dead_strip_inits_and_terms @gol
873-nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit @gol
874-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
875-private_bundle  -read_only_relocs  -sectalign @gol
876-sectobjectsymbols  -whyload  -seg1addr @gol
877-sectcreate  -sectobjectsymbols  -sectorder @gol
878-segaddr  -segs_read_only_addr  -segs_read_write_addr @gol
879-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
880-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
881-single_module  -static  -sub_library  -sub_umbrella @gol
882-twolevel_namespace  -umbrella  -undefined @gol
883-unexported_symbols_list  -weak_reference_mismatches @gol
884-whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version} @gol
885-mkernel  -mone-byte-bool}
886
887@emph{DEC Alpha Options}
888@gccoptlist{-mno-fp-regs  -msoft-float @gol
889-mieee  -mieee-with-inexact  -mieee-conformant @gol
890-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
891-mtrap-precision=@var{mode}  -mbuild-constants @gol
892-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
893-mbwx  -mmax  -mfix  -mcix @gol
894-mfloat-vax  -mfloat-ieee @gol
895-mexplicit-relocs  -msmall-data  -mlarge-data @gol
896-msmall-text  -mlarge-text @gol
897-mmemory-latency=@var{time}}
898
899@emph{eBPF Options}
900@gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
901-mframe-limit=@var{bytes} -mxbpf}
902
903@emph{FR30 Options}
904@gccoptlist{-msmall-model  -mno-lsim}
905
906@emph{FT32 Options}
907@gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
908
909@emph{FRV Options}
910@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
911-mhard-float  -msoft-float @gol
912-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
913-mdouble  -mno-double @gol
914-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
915-mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic @gol
916-mlinked-fp  -mlong-calls  -malign-labels @gol
917-mlibrary-pic  -macc-4  -macc-8 @gol
918-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
919-moptimize-membar  -mno-optimize-membar @gol
920-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
921-mvliw-branch  -mno-vliw-branch @gol
922-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
923-mno-nested-cond-exec  -mtomcat-stats @gol
924-mTLS  -mtls @gol
925-mcpu=@var{cpu}}
926
927@emph{GNU/Linux Options}
928@gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid @gol
929-tno-android-cc  -tno-android-ld}
930
931@emph{H8/300 Options}
932@gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
933
934@emph{HPPA Options}
935@gccoptlist{-march=@var{architecture-type} @gol
936-mcaller-copies  -mdisable-fpregs  -mdisable-indexing @gol
937-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
938-mfixed-range=@var{register-range} @gol
939-mjump-in-delay  -mlinker-opt  -mlong-calls @gol
940-mlong-load-store  -mno-disable-fpregs @gol
941-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
942-mno-jump-in-delay  -mno-long-load-store @gol
943-mno-portable-runtime  -mno-soft-float @gol
944-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
945-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
946-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
947-munix=@var{unix-std}  -nolibdld  -static  -threads}
948
949@emph{IA-64 Options}
950@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
951-mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata @gol
952-mconstant-gp  -mauto-pic  -mfused-madd @gol
953-minline-float-divide-min-latency @gol
954-minline-float-divide-max-throughput @gol
955-mno-inline-float-divide @gol
956-minline-int-divide-min-latency @gol
957-minline-int-divide-max-throughput  @gol
958-mno-inline-int-divide @gol
959-minline-sqrt-min-latency  -minline-sqrt-max-throughput @gol
960-mno-inline-sqrt @gol
961-mdwarf2-asm  -mearly-stop-bits @gol
962-mfixed-range=@var{register-range}  -mtls-size=@var{tls-size} @gol
963-mtune=@var{cpu-type}  -milp32  -mlp64 @gol
964-msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec @gol
965-msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec @gol
966-msched-spec-ldc  -msched-spec-control-ldc @gol
967-msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns @gol
968-msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path @gol
969-msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost @gol
970-msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
971
972@emph{LM32 Options}
973@gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled @gol
974-msign-extend-enabled  -muser-enabled}
975
976@emph{M32R/D Options}
977@gccoptlist{-m32r2  -m32rx  -m32r @gol
978-mdebug @gol
979-malign-loops  -mno-align-loops @gol
980-missue-rate=@var{number} @gol
981-mbranch-cost=@var{number} @gol
982-mmodel=@var{code-size-model-type} @gol
983-msdata=@var{sdata-type} @gol
984-mno-flush-func  -mflush-func=@var{name} @gol
985-mno-flush-trap  -mflush-trap=@var{number} @gol
986-G @var{num}}
987
988@emph{M32C Options}
989@gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
990
991@emph{M680x0 Options}
992@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune} @gol
993-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
994-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
995-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
996-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
997-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
998-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
999-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
1000-mxgot  -mno-xgot  -mlong-jump-table-offsets}
1001
1002@emph{MCore Options}
1003@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
1004-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
1005-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
1006-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
1007-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1008
1009@emph{MeP Options}
1010@gccoptlist{-mabsdiff  -mall-opts  -maverage  -mbased=@var{n}  -mbitops @gol
1011-mc=@var{n}  -mclip  -mconfig=@var{name}  -mcop  -mcop32  -mcop64  -mivc2 @gol
1012-mdc  -mdiv  -meb  -mel  -mio-volatile  -ml  -mleadz  -mm  -mminmax @gol
1013-mmult  -mno-opts  -mrepeat  -ms  -msatur  -msdram  -msim  -msimnovec  -mtf @gol
1014-mtiny=@var{n}}
1015
1016@emph{MicroBlaze Options}
1017@gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu} @gol
1018-mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift @gol
1019-mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss @gol
1020-mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt @gol
1021-mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model} @gol
1022-mpic-data-is-text-relative}
1023
1024@emph{MIPS Options}
1025@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
1026-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5 @gol
1027-mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6 @gol
1028-mips16  -mno-mips16  -mflip-mips16 @gol
1029-minterlink-compressed  -mno-interlink-compressed @gol
1030-minterlink-mips16  -mno-interlink-mips16 @gol
1031-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
1032-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
1033-mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float @gol
1034-mno-float  -msingle-float  -mdouble-float @gol
1035-modd-spreg  -mno-odd-spreg @gol
1036-mabs=@var{mode}  -mnan=@var{encoding} @gol
1037-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
1038-mmcu  -mmno-mcu @gol
1039-meva  -mno-eva @gol
1040-mvirt  -mno-virt @gol
1041-mxpa  -mno-xpa @gol
1042-mcrc  -mno-crc @gol
1043-mginv  -mno-ginv @gol
1044-mmicromips  -mno-micromips @gol
1045-mmsa  -mno-msa @gol
1046-mloongson-mmi  -mno-loongson-mmi @gol
1047-mloongson-ext  -mno-loongson-ext @gol
1048-mloongson-ext2  -mno-loongson-ext2 @gol
1049-mfpu=@var{fpu-type} @gol
1050-msmartmips  -mno-smartmips @gol
1051-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
1052-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
1053-mlong64  -mlong32  -msym32  -mno-sym32 @gol
1054-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
1055-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
1056-membedded-data  -mno-embedded-data @gol
1057-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
1058-mcode-readable=@var{setting} @gol
1059-msplit-addresses  -mno-split-addresses @gol
1060-mexplicit-relocs  -mno-explicit-relocs @gol
1061-mcheck-zero-division  -mno-check-zero-division @gol
1062-mdivide-traps  -mdivide-breaks @gol
1063-mload-store-pairs  -mno-load-store-pairs @gol
1064-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
1065-mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp @gol
1066-mfix-24k  -mno-fix-24k @gol
1067-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
1068-mfix-r5900  -mno-fix-r5900 @gol
1069-mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000 @gol
1070-mfix-vr4120  -mno-fix-vr4120 @gol
1071-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
1072-mflush-func=@var{func}  -mno-flush-func @gol
1073-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
1074-mcompact-branches=@var{policy} @gol
1075-mfp-exceptions  -mno-fp-exceptions @gol
1076-mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci @gol
1077-mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4 @gol
1078-mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address @gol
1079-mframe-header-opt  -mno-frame-header-opt}
1080
1081@emph{MMIX Options}
1082@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
1083-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
1084-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
1085-mno-base-addresses  -msingle-exit  -mno-single-exit}
1086
1087@emph{MN10300 Options}
1088@gccoptlist{-mmult-bug  -mno-mult-bug @gol
1089-mno-am33  -mam33  -mam33-2  -mam34 @gol
1090-mtune=@var{cpu-type} @gol
1091-mreturn-pointer-on-d0 @gol
1092-mno-crt0  -mrelax  -mliw  -msetlb}
1093
1094@emph{Moxie Options}
1095@gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1096
1097@emph{MSP430 Options}
1098@gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax @gol
1099-mwarn-mcu @gol
1100-mcode-region=  -mdata-region= @gol
1101-msilicon-errata=  -msilicon-errata-warn= @gol
1102-mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1103
1104@emph{NDS32 Options}
1105@gccoptlist{-mbig-endian  -mlittle-endian @gol
1106-mreduced-regs  -mfull-regs @gol
1107-mcmov  -mno-cmov @gol
1108-mext-perf  -mno-ext-perf @gol
1109-mext-perf2  -mno-ext-perf2 @gol
1110-mext-string  -mno-ext-string @gol
1111-mv3push  -mno-v3push @gol
1112-m16bit  -mno-16bit @gol
1113-misr-vector-size=@var{num} @gol
1114-mcache-block-size=@var{num} @gol
1115-march=@var{arch} @gol
1116-mcmodel=@var{code-model} @gol
1117-mctor-dtor  -mrelax}
1118
1119@emph{Nios II Options}
1120@gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt @gol
1121-mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp} @gol
1122-mel  -meb @gol
1123-mno-bypass-cache  -mbypass-cache @gol
1124-mno-cache-volatile  -mcache-volatile @gol
1125-mno-fast-sw-div  -mfast-sw-div @gol
1126-mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div @gol
1127-mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn} @gol
1128-mcustom-fpu-cfg=@var{name} @gol
1129-mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name} @gol
1130-march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1131
1132@emph{Nvidia PTX Options}
1133@gccoptlist{-m64  -mmainkernel  -moptimize}
1134
1135@emph{OpenRISC Options}
1136@gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
1137-msoft-mul  -msoft-div @gol
1138-msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
1139-mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
1140
1141@emph{PDP-11 Options}
1142@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
1143-mint32  -mno-int16  -mint16  -mno-int32 @gol
1144-msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1145
1146@emph{picoChip Options}
1147@gccoptlist{-mae=@var{ae_type}  -mvliw-lookahead=@var{N} @gol
1148-msymbol-as-address  -mno-inefficient-warnings}
1149
1150@emph{PowerPC Options}
1151See RS/6000 and PowerPC Options.
1152
1153@emph{PRU Options}
1154@gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop @gol
1155-mabi=@var{variant} @gol}
1156
1157@emph{RISC-V Options}
1158@gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1159-mplt  -mno-plt @gol
1160-mabi=@var{ABI-string} @gol
1161-mfdiv  -mno-fdiv @gol
1162-mdiv  -mno-div @gol
1163-march=@var{ISA-string} @gol
1164-mtune=@var{processor-string} @gol
1165-mpreferred-stack-boundary=@var{num} @gol
1166-msmall-data-limit=@var{N-bytes} @gol
1167-msave-restore  -mno-save-restore @gol
1168-mshorten-memrefs  -mno-shorten-memrefs @gol
1169-mstrict-align  -mno-strict-align @gol
1170-mcmodel=medlow  -mcmodel=medany @gol
1171-mexplicit-relocs  -mno-explicit-relocs @gol
1172-mrelax  -mno-relax @gol
1173-mriscv-attribute  -mmo-riscv-attribute @gol
1174-malign-data=@var{type} @gol
1175-mbig-endian  -mlittle-endian @gol
1176+-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1177+-mstack-protector-guard-offset=@var{offset}}
1178
1179@emph{RL78 Options}
1180@gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
1181-mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14 @gol
1182-m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1183
1184@emph{RS/6000 and PowerPC Options}
1185@gccoptlist{-mcpu=@var{cpu-type} @gol
1186-mtune=@var{cpu-type} @gol
1187-mcmodel=@var{code-model} @gol
1188-mpowerpc64 @gol
1189-maltivec  -mno-altivec @gol
1190-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
1191-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
1192-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd @gol
1193-mfprnd  -mno-fprnd @gol
1194-mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp @gol
1195-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
1196-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
1197-malign-power  -malign-natural @gol
1198-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
1199-mupdate  -mno-update @gol
1200-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
1201-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
1202-mstrict-align  -mno-strict-align  -mrelocatable @gol
1203-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
1204-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
1205-mdynamic-no-pic  -mswdiv  -msingle-pic-base @gol
1206-mprioritize-restricted-insns=@var{priority} @gol
1207-msched-costly-dep=@var{dependence_type} @gol
1208-minsert-sched-nops=@var{scheme} @gol
1209-mcall-aixdesc  -mcall-eabi  -mcall-freebsd  @gol
1210-mcall-linux  -mcall-netbsd  -mcall-openbsd  @gol
1211-mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi @gol
1212-mtraceback=@var{traceback_type} @gol
1213-maix-struct-return  -msvr4-struct-return @gol
1214-mabi=@var{abi-type}  -msecure-plt  -mbss-plt @gol
1215-mlongcall  -mno-longcall  -mpltseq  -mno-pltseq  @gol
1216-mblock-move-inline-limit=@var{num} @gol
1217-mblock-compare-inline-limit=@var{num} @gol
1218-mblock-compare-inline-loop-limit=@var{num} @gol
1219-mno-block-ops-unaligned-vsx @gol
1220-mstring-compare-inline-limit=@var{num} @gol
1221-misel  -mno-isel @gol
1222-mvrsave  -mno-vrsave @gol
1223-mmulhw  -mno-mulhw @gol
1224-mdlmzb  -mno-dlmzb @gol
1225-mprototype  -mno-prototype @gol
1226-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
1227-msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num} @gol
1228-mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision @gol
1229-mno-recip-precision @gol
1230-mveclibabi=@var{type}  -mfriz  -mno-friz @gol
1231-mpointers-to-nested-functions  -mno-pointers-to-nested-functions @gol
1232-msave-toc-indirect  -mno-save-toc-indirect @gol
1233-mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector @gol
1234-mcrypto  -mno-crypto  -mhtm  -mno-htm @gol
1235-mquad-memory  -mno-quad-memory @gol
1236-mquad-memory-atomic  -mno-quad-memory-atomic @gol
1237-mcompat-align-parm  -mno-compat-align-parm @gol
1238-mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware @gol
1239-mgnu-attribute  -mno-gnu-attribute @gol
1240-mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1241-mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1242-mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect @gol
1243-mprivileged -mno-privileged}
1244
1245@emph{RX Options}
1246@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
1247-mcpu=@gol
1248-mbig-endian-data  -mlittle-endian-data @gol
1249-msmall-data @gol
1250-msim  -mno-sim@gol
1251-mas100-syntax  -mno-as100-syntax@gol
1252-mrelax@gol
1253-mmax-constant-size=@gol
1254-mint-register=@gol
1255-mpid@gol
1256-mallow-string-insns  -mno-allow-string-insns@gol
1257-mjsr@gol
1258-mno-warn-multiple-fast-interrupts@gol
1259-msave-acc-in-interrupts}
1260
1261@emph{S/390 and zSeries Options}
1262@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1263-mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp @gol
1264-mlong-double-64  -mlong-double-128 @gol
1265-mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack @gol
1266-msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle @gol
1267-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
1268-mhtm  -mvx  -mzvector @gol
1269-mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip @gol
1270-mfused-madd  -mno-fused-madd @gol
1271-mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard @gol
1272-mhotpatch=@var{halfwords},@var{halfwords}}
1273
1274@emph{Score Options}
1275@gccoptlist{-meb  -mel @gol
1276-mnhwloop @gol
1277-muls @gol
1278-mmac @gol
1279-mscore5  -mscore5u  -mscore7  -mscore7d}
1280
1281@emph{SH Options}
1282@gccoptlist{-m1  -m2  -m2e @gol
1283-m2a-nofpu  -m2a-single-only  -m2a-single  -m2a @gol
1284-m3  -m3e @gol
1285-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
1286-m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al @gol
1287-mb  -ml  -mdalign  -mrelax @gol
1288-mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave @gol
1289-mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct @gol
1290-mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy} @gol
1291-mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range} @gol
1292-maccumulate-outgoing-args @gol
1293-matomic-model=@var{atomic-model} @gol
1294-mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch @gol
1295-mcbranch-force-delay-slot @gol
1296-mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra @gol
1297-mpretend-cmove  -mtas}
1298
1299@emph{Solaris 2 Options}
1300@gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text @gol
1301-pthreads}
1302
1303@emph{SPARC Options}
1304@gccoptlist{-mcpu=@var{cpu-type} @gol
1305-mtune=@var{cpu-type} @gol
1306-mcmodel=@var{code-model} @gol
1307-mmemory-model=@var{mem-model} @gol
1308-m32  -m64  -mapp-regs  -mno-app-regs @gol
1309-mfaster-structs  -mno-faster-structs  -mflat  -mno-flat @gol
1310-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1311-mhard-quad-float  -msoft-quad-float @gol
1312-mstack-bias  -mno-stack-bias @gol
1313-mstd-struct-return  -mno-std-struct-return @gol
1314-munaligned-doubles  -mno-unaligned-doubles @gol
1315-muser-mode  -mno-user-mode @gol
1316-mv8plus  -mno-v8plus  -mvis  -mno-vis @gol
1317-mvis2  -mno-vis2  -mvis3  -mno-vis3 @gol
1318-mvis4  -mno-vis4  -mvis4b  -mno-vis4b @gol
1319-mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld  @gol
1320-mpopc  -mno-popc  -msubxc  -mno-subxc @gol
1321-mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc @gol
1322-mlra  -mno-lra}
1323
1324@emph{System V Options}
1325@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1326
1327@emph{TILE-Gx Options}
1328@gccoptlist{-mcpu=CPU  -m32  -m64  -mbig-endian  -mlittle-endian @gol
1329-mcmodel=@var{code-model}}
1330
1331@emph{TILEPro Options}
1332@gccoptlist{-mcpu=@var{cpu}  -m32}
1333
1334@emph{V850 Options}
1335@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
1336-mprolog-function  -mno-prolog-function  -mspace @gol
1337-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
1338-mapp-regs  -mno-app-regs @gol
1339-mdisable-callt  -mno-disable-callt @gol
1340-mv850e2v3  -mv850e2  -mv850e1  -mv850es @gol
1341-mv850e  -mv850  -mv850e3v5 @gol
1342-mloop @gol
1343-mrelax @gol
1344-mlong-jumps @gol
1345-msoft-float @gol
1346-mhard-float @gol
1347-mgcc-abi @gol
1348-mrh850-abi @gol
1349-mbig-switch}
1350
1351@emph{VAX Options}
1352@gccoptlist{-mg  -mgnu  -munix}
1353
1354@emph{Visium Options}
1355@gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
1356-mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1357
1358@emph{VMS Options}
1359@gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64 @gol
1360-mpointer-size=@var{size}}
1361
1362@emph{VxWorks Options}
1363@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
1364-Xbind-lazy  -Xbind-now}
1365
1366@emph{x86 Options}
1367@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
1368-mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default @gol
1369-mfpmath=@var{unit} @gol
1370-masm=@var{dialect}  -mno-fancy-math-387 @gol
1371-mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float @gol
1372-mno-wide-multiply  -mrtd  -malign-double @gol
1373-mpreferred-stack-boundary=@var{num} @gol
1374-mincoming-stack-boundary=@var{num} @gol
1375-mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait @gol
1376-mrecip  -mrecip=@var{opt} @gol
1377-mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt} @gol
1378-mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx @gol
1379-mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl @gol
1380-mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes @gol
1381-mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd  @gol
1382-mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves @gol
1383-msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop @gol
1384-madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp @gol
1385-mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg @gol
1386-mshstk -mmanual-endbr -mforce-indirect-call  -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1387-mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq @gol
1388-mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid @gol
1389-mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
1390-mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni@gol
1391-mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops @gol
1392-minline-stringops-dynamically  -mstringop-strategy=@var{alg} @gol
1393-mkl -mwidekl @gol
1394-mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy} @gol
1395-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
1396-m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128 @gol
1397-mregparm=@var{num}  -msseregparm @gol
1398-mveclibabi=@var{type}  -mvect8-ret-in-mem @gol
1399-mpc32  -mpc64  -mpc80  -mstackrealign @gol
1400-momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs @gol
1401-mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode} @gol
1402-m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num} @gol
1403-msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
1404-minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1405-mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
1406-malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
1407-mstack-protector-guard-reg=@var{reg} @gol
1408-mstack-protector-guard-offset=@var{offset} @gol
1409-mstack-protector-guard-symbol=@var{symbol} @gol
1410-mgeneral-regs-only  -mcall-ms2sysv-xlogues @gol
1411-mindirect-branch=@var{choice}  -mfunction-return=@var{choice} @gol
1412-mindirect-branch-register -mneeded}
1413
1414@emph{x86 Windows Options}
1415@gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
1416-mnop-fun-dllimport  -mthread @gol
1417-municode  -mwin32  -mwindows  -fno-set-stack-executable}
1418
1419@emph{Xstormy16 Options}
1420@gccoptlist{-msim}
1421
1422@emph{Xtensa Options}
1423@gccoptlist{-mconst16  -mno-const16 @gol
1424-mfused-madd  -mno-fused-madd @gol
1425-mforce-no-pic @gol
1426-mserialize-volatile  -mno-serialize-volatile @gol
1427-mtext-section-literals  -mno-text-section-literals @gol
1428-mauto-litpools  -mno-auto-litpools @gol
1429-mtarget-align  -mno-target-align @gol
1430-mlongcalls  -mno-longcalls @gol
1431-mabi=@var{abi-type}}
1432
1433@emph{zSeries Options}
1434See S/390 and zSeries Options.
1435@end table
1436
1437
1438@node Overall Options
1439@section Options Controlling the Kind of Output
1440
1441Compilation can involve up to four stages: preprocessing, compilation
1442proper, assembly and linking, always in that order.  GCC is capable of
1443preprocessing and compiling several files either into several
1444assembler input files, or into one assembler input file; then each
1445assembler input file produces an object file, and linking combines all
1446the object files (those newly compiled, and those specified as input)
1447into an executable file.
1448
1449@cindex file name suffix
1450For any given input file, the file name suffix determines what kind of
1451compilation is done:
1452
1453@table @gcctabopt
1454@item @var{file}.c
1455C source code that must be preprocessed.
1456
1457@item @var{file}.i
1458C source code that should not be preprocessed.
1459
1460@item @var{file}.ii
1461C++ source code that should not be preprocessed.
1462
1463@item @var{file}.m
1464Objective-C source code.  Note that you must link with the @file{libobjc}
1465library to make an Objective-C program work.
1466
1467@item @var{file}.mi
1468Objective-C source code that should not be preprocessed.
1469
1470@item @var{file}.mm
1471@itemx @var{file}.M
1472Objective-C++ source code.  Note that you must link with the @file{libobjc}
1473library to make an Objective-C++ program work.  Note that @samp{.M} refers
1474to a literal capital M@.
1475
1476@item @var{file}.mii
1477Objective-C++ source code that should not be preprocessed.
1478
1479@item @var{file}.h
1480C, C++, Objective-C or Objective-C++ header file to be turned into a
1481precompiled header (default), or C, C++ header file to be turned into an
1482Ada spec (via the @option{-fdump-ada-spec} switch).
1483
1484@item @var{file}.cc
1485@itemx @var{file}.cp
1486@itemx @var{file}.cxx
1487@itemx @var{file}.cpp
1488@itemx @var{file}.CPP
1489@itemx @var{file}.c++
1490@itemx @var{file}.C
1491C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1492the last two letters must both be literally @samp{x}.  Likewise,
1493@samp{.C} refers to a literal capital C@.
1494
1495@item @var{file}.mm
1496@itemx @var{file}.M
1497Objective-C++ source code that must be preprocessed.
1498
1499@item @var{file}.mii
1500Objective-C++ source code that should not be preprocessed.
1501
1502@item @var{file}.hh
1503@itemx @var{file}.H
1504@itemx @var{file}.hp
1505@itemx @var{file}.hxx
1506@itemx @var{file}.hpp
1507@itemx @var{file}.HPP
1508@itemx @var{file}.h++
1509@itemx @var{file}.tcc
1510C++ header file to be turned into a precompiled header or Ada spec.
1511
1512@item @var{file}.f
1513@itemx @var{file}.for
1514@itemx @var{file}.ftn
1515Fixed form Fortran source code that should not be preprocessed.
1516
1517@item @var{file}.F
1518@itemx @var{file}.FOR
1519@itemx @var{file}.fpp
1520@itemx @var{file}.FPP
1521@itemx @var{file}.FTN
1522Fixed form Fortran source code that must be preprocessed (with the traditional
1523preprocessor).
1524
1525@item @var{file}.f90
1526@itemx @var{file}.f95
1527@itemx @var{file}.f03
1528@itemx @var{file}.f08
1529Free form Fortran source code that should not be preprocessed.
1530
1531@item @var{file}.F90
1532@itemx @var{file}.F95
1533@itemx @var{file}.F03
1534@itemx @var{file}.F08
1535Free form Fortran source code that must be preprocessed (with the
1536traditional preprocessor).
1537
1538@item @var{file}.go
1539Go source code.
1540
1541@item @var{file}.brig
1542BRIG files (binary representation of HSAIL).
1543
1544@item @var{file}.d
1545D source code.
1546
1547@item @var{file}.di
1548D interface file.
1549
1550@item @var{file}.dd
1551D documentation code (Ddoc).
1552
1553@item @var{file}.ads
1554Ada source code file that contains a library unit declaration (a
1555declaration of a package, subprogram, or generic, or a generic
1556instantiation), or a library unit renaming declaration (a package,
1557generic, or subprogram renaming declaration).  Such files are also
1558called @dfn{specs}.
1559
1560@item @var{file}.adb
1561Ada source code file containing a library unit body (a subprogram or
1562package body).  Such files are also called @dfn{bodies}.
1563
1564@c GCC also knows about some suffixes for languages not yet included:
1565@c Ratfor:
1566@c @var{file}.r
1567
1568@item @var{file}.s
1569Assembler code.
1570
1571@item @var{file}.S
1572@itemx @var{file}.sx
1573Assembler code that must be preprocessed.
1574
1575@item @var{other}
1576An object file to be fed straight into linking.
1577Any file name with no recognized suffix is treated this way.
1578@end table
1579
1580@opindex x
1581You can specify the input language explicitly with the @option{-x} option:
1582
1583@table @gcctabopt
1584@item -x @var{language}
1585Specify explicitly the @var{language} for the following input files
1586(rather than letting the compiler choose a default based on the file
1587name suffix).  This option applies to all following input files until
1588the next @option{-x} option.  Possible values for @var{language} are:
1589@smallexample
1590c  c-header  cpp-output
1591c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1592objective-c  objective-c-header  objective-c-cpp-output
1593objective-c++ objective-c++-header objective-c++-cpp-output
1594assembler  assembler-with-cpp
1595ada
1596d
1597f77  f77-cpp-input f95  f95-cpp-input
1598go
1599brig
1600@end smallexample
1601
1602@item -x none
1603Turn off any specification of a language, so that subsequent files are
1604handled according to their file name suffixes (as they are if @option{-x}
1605has not been used at all).
1606@end table
1607
1608If you only want some of the stages of compilation, you can use
1609@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1610one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1611@command{gcc} is to stop.  Note that some combinations (for example,
1612@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1613
1614@table @gcctabopt
1615@item -c
1616@opindex c
1617Compile or assemble the source files, but do not link.  The linking
1618stage simply is not done.  The ultimate output is in the form of an
1619object file for each source file.
1620
1621By default, the object file name for a source file is made by replacing
1622the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1623
1624Unrecognized input files, not requiring compilation or assembly, are
1625ignored.
1626
1627@item -S
1628@opindex S
1629Stop after the stage of compilation proper; do not assemble.  The output
1630is in the form of an assembler code file for each non-assembler input
1631file specified.
1632
1633By default, the assembler file name for a source file is made by
1634replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1635
1636Input files that don't require compilation are ignored.
1637
1638@item -E
1639@opindex E
1640Stop after the preprocessing stage; do not run the compiler proper.  The
1641output is in the form of preprocessed source code, which is sent to the
1642standard output.
1643
1644Input files that don't require preprocessing are ignored.
1645
1646@cindex output file option
1647@item -o @var{file}
1648@opindex o
1649Place the primary output in file @var{file}.  This applies to whatever
1650sort of output is being produced, whether it be an executable file, an
1651object file, an assembler file or preprocessed C code.
1652
1653If @option{-o} is not specified, the default is to put an executable
1654file in @file{a.out}, the object file for
1655@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1656assembler file in @file{@var{source}.s}, a precompiled header file in
1657@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1658standard output.
1659
1660Though @option{-o} names only the primary output, it also affects the
1661naming of auxiliary and dump outputs.  See the examples below.  Unless
1662overridden, both auxiliary outputs and dump outputs are placed in the
1663same directory as the primary output.  In auxiliary outputs, the suffix
1664of the input file is replaced with that of the auxiliary output file
1665type; in dump outputs, the suffix of the dump file is appended to the
1666input file suffix.  In compilation commands, the base name of both
1667auxiliary and dump outputs is that of the primary output; in compile and
1668link commands, the primary output name, minus the executable suffix, is
1669combined with the input file name.  If both share the same base name,
1670disregarding the suffix, the result of the combination is that base
1671name, otherwise, they are concatenated, separated by a dash.
1672
1673@smallexample
1674gcc -c foo.c ...
1675@end smallexample
1676
1677will use @file{foo.o} as the primary output, and place aux outputs and
1678dumps next to it, e.g., aux file @file{foo.dwo} for
1679@option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1680@option{-fdump-rtl-final}.
1681
1682If a non-linker output file is explicitly specified, aux and dump files
1683by default take the same base name:
1684
1685@smallexample
1686gcc -c foo.c -o dir/foobar.o ...
1687@end smallexample
1688
1689will name aux outputs @file{dir/foobar.*} and dump outputs
1690@file{dir/foobar.c.*}.
1691
1692A linker output will instead prefix aux and dump outputs:
1693
1694@smallexample
1695gcc foo.c bar.c -o dir/foobar ...
1696@end smallexample
1697
1698will generally name aux outputs @file{dir/foobar-foo.*} and
1699@file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1700@file{dir/foobar-bar.c.*}.
1701
1702The one exception to the above is when the executable shares the base
1703name with the single input:
1704
1705@smallexample
1706gcc foo.c -o dir/foo ...
1707@end smallexample
1708
1709in which case aux outputs are named @file{dir/foo.*} and dump outputs
1710named @file{dir/foo.c.*}.
1711
1712The location and the names of auxiliary and dump outputs can be adjusted
1713by the options @option{-dumpbase}, @option{-dumpbase-ext},
1714@option{-dumpdir}, @option{-save-temps=cwd}, and
1715@option{-save-temps=obj}.
1716
1717
1718@item -dumpbase @var{dumpbase}
1719@opindex dumpbase
1720This option sets the base name for auxiliary and dump output files.  It
1721does not affect the name of the primary output file.  Intermediate
1722outputs, when preserved, are not regarded as primary outputs, but as
1723auxiliary outputs:
1724
1725@smallexample
1726gcc -save-temps -S foo.c
1727@end smallexample
1728
1729saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1730then compiles to the (implied) output file @file{foo.s}, whereas:
1731
1732@smallexample
1733gcc -save-temps -dumpbase save-foo -c foo.c
1734@end smallexample
1735
1736preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1737an intermediate, thus auxiliary output), and then assembles to the
1738(implied) output file @file{foo.o}.
1739
1740Absent this option, dump and aux files take their names from the input
1741file, or from the (non-linker) output file, if one is explicitly
1742specified: dump output files (e.g. those requested by @option{-fdump-*}
1743options) with the input name suffix, and aux output files (those
1744requested by other non-dump options, e.g. @code{-save-temps},
1745@code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1746
1747Similar suffix differentiation of dump and aux outputs can be attained
1748for explicitly-given @option{-dumpbase basename.suf} by also specifying
1749@option{-dumpbase-ext .suf}.
1750
1751If @var{dumpbase} is explicitly specified with any directory component,
1752any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1753@option{-save-temps=*}) is ignored, and instead of appending to it,
1754@var{dumpbase} fully overrides it:
1755
1756@smallexample
1757gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1758  -dumpdir pfx- -save-temps=cwd ...
1759@end smallexample
1760
1761creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1762@file{dir/} in @option{-o}, the @file{./} prefix implied by
1763@option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1764
1765When @option{-dumpbase} is specified in a command that compiles multiple
1766inputs, or that compiles and then links, it may be combined with
1767@var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1768file is compiled using the combined @var{dumppfx}, and default values
1769for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1770file:
1771
1772@smallexample
1773gcc foo.c bar.c -c -dumpbase main ...
1774@end smallexample
1775
1776creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1777overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1778as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1779and @file{main-bar.*}.
1780
1781An empty string specified as @var{dumpbase} avoids the influence of the
1782output basename in the naming of auxiliary and dump outputs during
1783compilation, computing default values :
1784
1785@smallexample
1786gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1787@end smallexample
1788
1789will name aux outputs @file{dir/foo.*} and dump outputs
1790@file{dir/foo.c.*}.  Note how their basenames are taken from the input
1791name, but the directory still defaults to that of the output.
1792
1793The empty-string dumpbase does not prevent the use of the output
1794basename for outputs during linking:
1795
1796@smallexample
1797gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1798@end smallexample
1799
1800The compilation of the source files will name auxiliary outputs
1801@file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1802@file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1803linking will use @file{dir/foobar.} as the prefix for dumps and
1804auxiliary files.
1805
1806
1807@item -dumpbase-ext @var{auxdropsuf}
1808@opindex dumpbase-ext
1809When forming the name of an auxiliary (but not a dump) output file, drop
1810trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1811suffixes.  If not specified, this option defaults to the suffix of a
1812default @var{dumpbase}, i.e., the suffix of the input file when
1813@option{-dumpbase} is not present in the command line, or @var{dumpbase}
1814is combined with @var{dumppfx}.
1815
1816@smallexample
1817gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1818@end smallexample
1819
1820creates @file{dir/foo.o} as the main output, and generates auxiliary
1821outputs in @file{dir/x-foo.*}, taking the location of the primary
1822output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1823outputs retain the suffix: @file{dir/x-foo.c.*}.
1824
1825This option is disregarded if it does not match the suffix of a
1826specified @var{dumpbase}, except as an alternative to the executable
1827suffix when appending the linker output base name to @var{dumppfx}, as
1828specified below:
1829
1830@smallexample
1831gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1832@end smallexample
1833
1834creates @file{main.out} as the primary output, and avoids overwriting
1835the auxiliary and dump outputs by using the executable name minus
1836@var{auxdropsuf} as a prefix, creating auxiliary outputs named
1837@file{main-foo.*} and @file{main-bar.*} and dump outputs named
1838@file{main-foo.c.*} and @file{main-bar.c.*}.
1839
1840
1841@item -dumpdir @var{dumppfx}
1842@opindex dumpdir
1843When forming the name of an auxiliary or dump output file, use
1844@var{dumppfx} as a prefix:
1845
1846@smallexample
1847gcc -dumpdir pfx- -c foo.c ...
1848@end smallexample
1849
1850creates @file{foo.o} as the primary output, and auxiliary outputs named
1851@file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1852@var{dumpbase} derived from the default primary output, derived in turn
1853from the input name.  Dump outputs also take the input name suffix:
1854@file{pfx-foo.c.*}.
1855
1856If @var{dumppfx} is to be used as a directory name, it must end with a
1857directory separator:
1858
1859@smallexample
1860gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1861@end smallexample
1862
1863creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1864named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1865default @var{dumpbase} derived from the primary output name.  Dump
1866outputs also take the input name suffix: @file{dir/bar.c.*}.
1867
1868It defaults to the location of the output file; options
1869@option{-save-temps=cwd} and @option{-save-temps=obj} override this
1870default, just like an explicit @option{-dumpdir} option.  In case
1871multiple such options are given, the last one prevails:
1872
1873@smallexample
1874gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1875@end smallexample
1876
1877outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1878@option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1879@option{-dumpdir} option.  It does not matter that @option{=obj} is the
1880default for @option{-save-temps}, nor that the output directory is
1881implicitly the current directory.  Dump outputs are named
1882@file{foo.c.*}.
1883
1884When compiling from multiple input files, if @option{-dumpbase} is
1885specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1886are appended to (or override, if containing any directory components) an
1887explicit or defaulted @var{dumppfx}, so that each of the multiple
1888compilations gets differently-named aux and dump outputs.
1889
1890@smallexample
1891gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1892@end smallexample
1893
1894outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1895@file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1896Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1897and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1898single-input compilation:
1899
1900@smallexample
1901gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1902@end smallexample
1903
1904that, applying @option{-dumpbase} to a single source, does not compute
1905and append a separate @var{dumpbase} per input file.  Its auxiliary and
1906dump outputs go in @file{dir/pfx-main.*}.
1907
1908When compiling and then linking from multiple input files, a defaulted
1909or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1910transformation above (e.g. the compilation of @file{foo.c} and
1911@file{bar.c} above, but without @option{-c}).  If neither
1912@option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1913base name, minus @var{auxdropsuf}, if specified, or the executable
1914suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1915instead.  Note, however, that unlike earlier cases of linking:
1916
1917@smallexample
1918gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1919@end smallexample
1920
1921does not append the output name @file{main} to @var{dumppfx}, because
1922@option{-dumpdir} is explicitly specified.  The goal is that the
1923explicitly-specified @var{dumppfx} may contain the specified output name
1924as part of the prefix, if desired; only an explicitly-specified
1925@option{-dumpbase} would be combined with it, in order to avoid simply
1926discarding a meaningful option.
1927
1928When compiling and then linking from a single input file, the linker
1929output base name will only be appended to the default @var{dumppfx} as
1930above if it does not share the base name with the single input file
1931name.  This has been covered in single-input linking cases above, but
1932not with an explicit @option{-dumpdir} that inhibits the combination,
1933even if overridden by @option{-save-temps=*}:
1934
1935@smallexample
1936gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1937@end smallexample
1938
1939Auxiliary outputs are named @file{foo.*}, and dump outputs
1940@file{foo.c.*}, in the current working directory as ultimately requested
1941by @option{-save-temps=cwd}.
1942
1943Summing it all up for an intuitive though slightly imprecise data flow:
1944the primary output name is broken into a directory part and a basename
1945part; @var{dumppfx} is set to the former, unless overridden by
1946@option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
1947to the latter, unless overriden by @option{-dumpbase}.  If there are
1948multiple inputs or linking, this @var{dumpbase} may be combined with
1949@var{dumppfx} and taken from each input file.  Auxiliary output names
1950for each input are formed by combining @var{dumppfx}, @var{dumpbase}
1951minus suffix, and the auxiliary output suffix; dump output names are
1952only different in that the suffix from @var{dumpbase} is retained.
1953
1954When it comes to auxiliary and dump outputs created during LTO
1955recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
1956given or as derived from the linker output name but not from inputs,
1957even in cases in which this combination would not otherwise be used as
1958such, is passed down with a trailing period replacing the compiler-added
1959dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
1960being involved in linking, this program does not normally get any
1961@option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
1962
1963When running sub-compilers, @command{lto-wrapper} appends LTO stage
1964names to the received @var{dumppfx}, ensures it contains a directory
1965component so that it overrides any @option{-dumpdir}, and passes that as
1966@option{-dumpbase} to sub-compilers.
1967
1968@item -v
1969@opindex v
1970Print (on standard error output) the commands executed to run the stages
1971of compilation.  Also print the version number of the compiler driver
1972program and of the preprocessor and the compiler proper.
1973
1974@item -###
1975@opindex ###
1976Like @option{-v} except the commands are not executed and arguments
1977are quoted unless they contain only alphanumeric characters or @code{./-_}.
1978This is useful for shell scripts to capture the driver-generated command lines.
1979
1980@item --help
1981@opindex help
1982Print (on the standard output) a description of the command-line options
1983understood by @command{gcc}.  If the @option{-v} option is also specified
1984then @option{--help} is also passed on to the various processes
1985invoked by @command{gcc}, so that they can display the command-line options
1986they accept.  If the @option{-Wextra} option has also been specified
1987(prior to the @option{--help} option), then command-line options that
1988have no documentation associated with them are also displayed.
1989
1990@item --target-help
1991@opindex target-help
1992Print (on the standard output) a description of target-specific command-line
1993options for each tool.  For some targets extra target-specific
1994information may also be printed.
1995
1996@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1997Print (on the standard output) a description of the command-line
1998options understood by the compiler that fit into all specified classes
1999and qualifiers.  These are the supported classes:
2000
2001@table @asis
2002@item @samp{optimizers}
2003Display all of the optimization options supported by the
2004compiler.
2005
2006@item @samp{warnings}
2007Display all of the options controlling warning messages
2008produced by the compiler.
2009
2010@item @samp{target}
2011Display target-specific options.  Unlike the
2012@option{--target-help} option however, target-specific options of the
2013linker and assembler are not displayed.  This is because those
2014tools do not currently support the extended @option{--help=} syntax.
2015
2016@item @samp{params}
2017Display the values recognized by the @option{--param}
2018option.
2019
2020@item @var{language}
2021Display the options supported for @var{language}, where
2022@var{language} is the name of one of the languages supported in this
2023version of GCC@.  If an option is supported by all languages, one needs
2024to select @samp{common} class.
2025
2026@item @samp{common}
2027Display the options that are common to all languages.
2028@end table
2029
2030These are the supported qualifiers:
2031
2032@table @asis
2033@item @samp{undocumented}
2034Display only those options that are undocumented.
2035
2036@item @samp{joined}
2037Display options taking an argument that appears after an equal
2038sign in the same continuous piece of text, such as:
2039@samp{--help=target}.
2040
2041@item @samp{separate}
2042Display options taking an argument that appears as a separate word
2043following the original option, such as: @samp{-o output-file}.
2044@end table
2045
2046Thus for example to display all the undocumented target-specific
2047switches supported by the compiler, use:
2048
2049@smallexample
2050--help=target,undocumented
2051@end smallexample
2052
2053The sense of a qualifier can be inverted by prefixing it with the
2054@samp{^} character, so for example to display all binary warning
2055options (i.e., ones that are either on or off and that do not take an
2056argument) that have a description, use:
2057
2058@smallexample
2059--help=warnings,^joined,^undocumented
2060@end smallexample
2061
2062The argument to @option{--help=} should not consist solely of inverted
2063qualifiers.
2064
2065Combining several classes is possible, although this usually
2066restricts the output so much that there is nothing to display.  One
2067case where it does work, however, is when one of the classes is
2068@var{target}.  For example, to display all the target-specific
2069optimization options, use:
2070
2071@smallexample
2072--help=target,optimizers
2073@end smallexample
2074
2075The @option{--help=} option can be repeated on the command line.  Each
2076successive use displays its requested class of options, skipping
2077those that have already been displayed.  If @option{--help} is also
2078specified anywhere on the command line then this takes precedence
2079over any @option{--help=} option.
2080
2081If the @option{-Q} option appears on the command line before the
2082@option{--help=} option, then the descriptive text displayed by
2083@option{--help=} is changed.  Instead of describing the displayed
2084options, an indication is given as to whether the option is enabled,
2085disabled or set to a specific value (assuming that the compiler
2086knows this at the point where the @option{--help=} option is used).
2087
2088Here is a truncated example from the ARM port of @command{gcc}:
2089
2090@smallexample
2091  % gcc -Q -mabi=2 --help=target -c
2092  The following options are target specific:
2093  -mabi=                                2
2094  -mabort-on-noreturn                   [disabled]
2095  -mapcs                                [disabled]
2096@end smallexample
2097
2098The output is sensitive to the effects of previous command-line
2099options, so for example it is possible to find out which optimizations
2100are enabled at @option{-O2} by using:
2101
2102@smallexample
2103-Q -O2 --help=optimizers
2104@end smallexample
2105
2106Alternatively you can discover which binary optimizations are enabled
2107by @option{-O3} by using:
2108
2109@smallexample
2110gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2111gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2112diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2113@end smallexample
2114
2115@item --version
2116@opindex version
2117Display the version number and copyrights of the invoked GCC@.
2118
2119@item -pass-exit-codes
2120@opindex pass-exit-codes
2121Normally the @command{gcc} program exits with the code of 1 if any
2122phase of the compiler returns a non-success return code.  If you specify
2123@option{-pass-exit-codes}, the @command{gcc} program instead returns with
2124the numerically highest error produced by any phase returning an error
2125indication.  The C, C++, and Fortran front ends return 4 if an internal
2126compiler error is encountered.
2127
2128@item -pipe
2129@opindex pipe
2130Use pipes rather than temporary files for communication between the
2131various stages of compilation.  This fails to work on some systems where
2132the assembler is unable to read from a pipe; but the GNU assembler has
2133no trouble.
2134
2135@item -specs=@var{file}
2136@opindex specs
2137Process @var{file} after the compiler reads in the standard @file{specs}
2138file, in order to override the defaults which the @command{gcc} driver
2139program uses when determining what switches to pass to @command{cc1},
2140@command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2141@option{-specs=@var{file}} can be specified on the command line, and they
2142are processed in order, from left to right.  @xref{Spec Files}, for
2143information about the format of the @var{file}.
2144
2145@item -wrapper
2146@opindex wrapper
2147Invoke all subcommands under a wrapper program.  The name of the
2148wrapper program and its parameters are passed as a comma separated
2149list.
2150
2151@smallexample
2152gcc -c t.c -wrapper gdb,--args
2153@end smallexample
2154
2155@noindent
2156This invokes all subprograms of @command{gcc} under
2157@samp{gdb --args}, thus the invocation of @command{cc1} is
2158@samp{gdb --args cc1 @dots{}}.
2159
2160@item -ffile-prefix-map=@var{old}=@var{new}
2161@opindex ffile-prefix-map
2162When compiling files residing in directory @file{@var{old}}, record
2163any references to them in the result of the compilation as if the
2164files resided in directory @file{@var{new}} instead.  Specifying this
2165option is equivalent to specifying all the individual
2166@option{-f*-prefix-map} options.  This can be used to make reproducible
2167builds that are location independent.  See also
2168@option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
2169
2170@item -fplugin=@var{name}.so
2171@opindex fplugin
2172Load the plugin code in file @var{name}.so, assumed to be a
2173shared object to be dlopen'd by the compiler.  The base name of
2174the shared object file is used to identify the plugin for the
2175purposes of argument parsing (See
2176@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2177Each plugin should define the callback functions specified in the
2178Plugins API.
2179
2180@item -fplugin-arg-@var{name}-@var{key}=@var{value}
2181@opindex fplugin-arg
2182Define an argument called @var{key} with a value of @var{value}
2183for the plugin called @var{name}.
2184
2185@item -fdump-ada-spec@r{[}-slim@r{]}
2186@opindex fdump-ada-spec
2187For C and C++ source and include files, generate corresponding Ada specs.
2188@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2189GNAT User's Guide}, which provides detailed documentation on this feature.
2190
2191@item -fada-spec-parent=@var{unit}
2192@opindex fada-spec-parent
2193In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2194Ada specs as child units of parent @var{unit}.
2195
2196@item -fdump-go-spec=@var{file}
2197@opindex fdump-go-spec
2198For input files in any language, generate corresponding Go
2199declarations in @var{file}.  This generates Go @code{const},
2200@code{type}, @code{var}, and @code{func} declarations which may be a
2201useful way to start writing a Go interface to code written in some
2202other language.
2203
2204@include @value{srcdir}/../libiberty/at-file.texi
2205@end table
2206
2207@node Invoking G++
2208@section Compiling C++ Programs
2209
2210@cindex suffixes for C++ source
2211@cindex C++ source file suffixes
2212C++ source files conventionally use one of the suffixes @samp{.C},
2213@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2214@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2215@samp{.H}, or (for shared template code) @samp{.tcc}; and
2216preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2217files with these names and compiles them as C++ programs even if you
2218call the compiler the same way as for compiling C programs (usually
2219with the name @command{gcc}).
2220
2221@findex g++
2222@findex c++
2223However, the use of @command{gcc} does not add the C++ library.
2224@command{g++} is a program that calls GCC and automatically specifies linking
2225against the C++ library.  It treats @samp{.c},
2226@samp{.h} and @samp{.i} files as C++ source files instead of C source
2227files unless @option{-x} is used.  This program is also useful when
2228precompiling a C header file with a @samp{.h} extension for use in C++
2229compilations.  On many systems, @command{g++} is also installed with
2230the name @command{c++}.
2231
2232@cindex invoking @command{g++}
2233When you compile C++ programs, you may specify many of the same
2234command-line options that you use for compiling programs in any
2235language; or command-line options meaningful for C and related
2236languages; or options that are meaningful only for C++ programs.
2237@xref{C Dialect Options,,Options Controlling C Dialect}, for
2238explanations of options for languages related to C@.
2239@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2240explanations of options that are meaningful only for C++ programs.
2241
2242@node C Dialect Options
2243@section Options Controlling C Dialect
2244@cindex dialect options
2245@cindex language dialect options
2246@cindex options, dialect
2247
2248The following options control the dialect of C (or languages derived
2249from C, such as C++, Objective-C and Objective-C++) that the compiler
2250accepts:
2251
2252@table @gcctabopt
2253@cindex ANSI support
2254@cindex ISO support
2255@item -ansi
2256@opindex ansi
2257In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2258equivalent to @option{-std=c++98}.
2259
2260This turns off certain features of GCC that are incompatible with ISO
2261C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2262such as the @code{asm} and @code{typeof} keywords, and
2263predefined macros such as @code{unix} and @code{vax} that identify the
2264type of system you are using.  It also enables the undesirable and
2265rarely used ISO trigraph feature.  For the C compiler,
2266it disables recognition of C++ style @samp{//} comments as well as
2267the @code{inline} keyword.
2268
2269The alternate keywords @code{__asm__}, @code{__extension__},
2270@code{__inline__} and @code{__typeof__} continue to work despite
2271@option{-ansi}.  You would not want to use them in an ISO C program, of
2272course, but it is useful to put them in header files that might be included
2273in compilations done with @option{-ansi}.  Alternate predefined macros
2274such as @code{__unix__} and @code{__vax__} are also available, with or
2275without @option{-ansi}.
2276
2277The @option{-ansi} option does not cause non-ISO programs to be
2278rejected gratuitously.  For that, @option{-Wpedantic} is required in
2279addition to @option{-ansi}.  @xref{Warning Options}.
2280
2281The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2282option is used.  Some header files may notice this macro and refrain
2283from declaring certain functions or defining certain macros that the
2284ISO standard doesn't call for; this is to avoid interfering with any
2285programs that might use these names for other things.
2286
2287Functions that are normally built in but do not have semantics
2288defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2289functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2290built-in functions provided by GCC}, for details of the functions
2291affected.
2292
2293@item -std=
2294@opindex std
2295Determine the language standard. @xref{Standards,,Language Standards
2296Supported by GCC}, for details of these standard versions.  This option
2297is currently only supported when compiling C or C++.
2298
2299The compiler can accept several base standards, such as @samp{c90} or
2300@samp{c++98}, and GNU dialects of those standards, such as
2301@samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2302compiler accepts all programs following that standard plus those
2303using GNU extensions that do not contradict it.  For example,
2304@option{-std=c90} turns off certain features of GCC that are
2305incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2306keywords, but not other GNU extensions that do not have a meaning in
2307ISO C90, such as omitting the middle term of a @code{?:}
2308expression. On the other hand, when a GNU dialect of a standard is
2309specified, all features supported by the compiler are enabled, even when
2310those features change the meaning of the base standard.  As a result, some
2311strict-conforming programs may be rejected.  The particular standard
2312is used by @option{-Wpedantic} to identify which features are GNU
2313extensions given that version of the standard. For example
2314@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2315comments, while @option{-std=gnu99 -Wpedantic} does not.
2316
2317A value for this option must be provided; possible values are
2318
2319@table @samp
2320@item c90
2321@itemx c89
2322@itemx iso9899:1990
2323Support all ISO C90 programs (certain GNU extensions that conflict
2324with ISO C90 are disabled). Same as @option{-ansi} for C code.
2325
2326@item iso9899:199409
2327ISO C90 as modified in amendment 1.
2328
2329@item c99
2330@itemx c9x
2331@itemx iso9899:1999
2332@itemx iso9899:199x
2333ISO C99.  This standard is substantially completely supported, modulo
2334bugs and floating-point issues
2335(mainly but not entirely relating to optional C99 features from
2336Annexes F and G).  See
2337@w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
2338names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2339
2340@item c11
2341@itemx c1x
2342@itemx iso9899:2011
2343ISO C11, the 2011 revision of the ISO C standard.  This standard is
2344substantially completely supported, modulo bugs, floating-point issues
2345(mainly but not entirely relating to optional C11 features from
2346Annexes F and G) and the optional Annexes K (Bounds-checking
2347interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2348
2349@item c17
2350@itemx c18
2351@itemx iso9899:2017
2352@itemx iso9899:2018
2353ISO C17, the 2017 revision of the ISO C standard
2354(published in 2018).  This standard is
2355same as C11 except for corrections of defects (all of which are also
2356applied with @option{-std=c11}) and a new value of
2357@code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2358
2359@item c2x
2360The next version of the ISO C standard, still under development.  The
2361support for this version is experimental and incomplete.
2362
2363@item gnu90
2364@itemx gnu89
2365GNU dialect of ISO C90 (including some C99 features).
2366
2367@item gnu99
2368@itemx gnu9x
2369GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2370
2371@item gnu11
2372@itemx gnu1x
2373GNU dialect of ISO C11.
2374The name @samp{gnu1x} is deprecated.
2375
2376@item gnu17
2377@itemx gnu18
2378GNU dialect of ISO C17.  This is the default for C code.
2379
2380@item gnu2x
2381The next version of the ISO C standard, still under development, plus
2382GNU extensions.  The support for this version is experimental and
2383incomplete.
2384
2385@item c++98
2386@itemx c++03
2387The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2388additional defect reports. Same as @option{-ansi} for C++ code.
2389
2390@item gnu++98
2391@itemx gnu++03
2392GNU dialect of @option{-std=c++98}.
2393
2394@item c++11
2395@itemx c++0x
2396The 2011 ISO C++ standard plus amendments.
2397The name @samp{c++0x} is deprecated.
2398
2399@item gnu++11
2400@itemx gnu++0x
2401GNU dialect of @option{-std=c++11}.
2402The name @samp{gnu++0x} is deprecated.
2403
2404@item c++14
2405@itemx c++1y
2406The 2014 ISO C++ standard plus amendments.
2407The name @samp{c++1y} is deprecated.
2408
2409@item gnu++14
2410@itemx gnu++1y
2411GNU dialect of @option{-std=c++14}.
2412The name @samp{gnu++1y} is deprecated.
2413
2414@item c++17
2415@itemx c++1z
2416The 2017 ISO C++ standard plus amendments.
2417The name @samp{c++1z} is deprecated.
2418
2419@item gnu++17
2420@itemx gnu++1z
2421GNU dialect of @option{-std=c++17}.
2422This is the default for C++ code.
2423The name @samp{gnu++1z} is deprecated.
2424
2425@item c++20
2426@itemx c++2a
2427The 2020 ISO C++ standard plus amendments.
2428Support is experimental, and could change in incompatible ways in
2429future releases.
2430The name @samp{c++2a} is deprecated.
2431
2432@item gnu++20
2433@itemx gnu++2a
2434GNU dialect of @option{-std=c++20}.
2435Support is experimental, and could change in incompatible ways in
2436future releases.
2437The name @samp{gnu++2a} is deprecated.
2438
2439@item c++2b
2440@itemx c++23
2441The next revision of the ISO C++ standard, planned for
24422023.  Support is highly experimental, and will almost certainly
2443change in incompatible ways in future releases.
2444
2445@item gnu++2b
2446@itemx gnu++23
2447GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2448and will almost certainly change in incompatible ways in future
2449releases.
2450@end table
2451
2452@item -fgnu89-inline
2453@opindex fgnu89-inline
2454The option @option{-fgnu89-inline} tells GCC to use the traditional
2455GNU semantics for @code{inline} functions when in C99 mode.
2456@xref{Inline,,An Inline Function is As Fast As a Macro}.
2457Using this option is roughly equivalent to adding the
2458@code{gnu_inline} function attribute to all inline functions
2459(@pxref{Function Attributes}).
2460
2461The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2462C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2463specifies the default behavior).
2464This option is not supported in @option{-std=c90} or
2465@option{-std=gnu90} mode.
2466
2467The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2468@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2469in effect for @code{inline} functions.  @xref{Common Predefined
2470Macros,,,cpp,The C Preprocessor}.
2471
2472@item -fpermitted-flt-eval-methods=@var{style}
2473@opindex fpermitted-flt-eval-methods
2474@opindex fpermitted-flt-eval-methods=c11
2475@opindex fpermitted-flt-eval-methods=ts-18661-3
2476ISO/IEC TS 18661-3 defines new permissible values for
2477@code{FLT_EVAL_METHOD} that indicate that operations and constants with
2478a semantic type that is an interchange or extended format should be
2479evaluated to the precision and range of that type.  These new values are
2480a superset of those permitted under C99/C11, which does not specify the
2481meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2482conforming to C11 may not have been written expecting the possibility of
2483the new values.
2484
2485@option{-fpermitted-flt-eval-methods} specifies whether the compiler
2486should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2487or the extended set of values specified in ISO/IEC TS 18661-3.
2488
2489@var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2490
2491The default when in a standards compliant mode (@option{-std=c11} or similar)
2492is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2493dialect (@option{-std=gnu11} or similar) is
2494@option{-fpermitted-flt-eval-methods=ts-18661-3}.
2495
2496@item -aux-info @var{filename}
2497@opindex aux-info
2498Output to the given filename prototyped declarations for all functions
2499declared and/or defined in a translation unit, including those in header
2500files.  This option is silently ignored in any language other than C@.
2501
2502Besides declarations, the file indicates, in comments, the origin of
2503each declaration (source file and line), whether the declaration was
2504implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2505@samp{O} for old, respectively, in the first character after the line
2506number and the colon), and whether it came from a declaration or a
2507definition (@samp{C} or @samp{F}, respectively, in the following
2508character).  In the case of function definitions, a K&R-style list of
2509arguments followed by their declarations is also provided, inside
2510comments, after the declaration.
2511
2512@item -fallow-parameterless-variadic-functions
2513@opindex fallow-parameterless-variadic-functions
2514Accept variadic functions without named parameters.
2515
2516Although it is possible to define such a function, this is not very
2517useful as it is not possible to read the arguments.  This is only
2518supported for C as this construct is allowed by C++.
2519
2520@item -fno-asm
2521@opindex fno-asm
2522@opindex fasm
2523Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2524keyword, so that code can use these words as identifiers.  You can use
2525the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2526instead.  @option{-ansi} implies @option{-fno-asm}.
2527
2528In C++, this switch only affects the @code{typeof} keyword, since
2529@code{asm} and @code{inline} are standard keywords.  You may want to
2530use the @option{-fno-gnu-keywords} flag instead, which has the same
2531effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2532switch only affects the @code{asm} and @code{typeof} keywords, since
2533@code{inline} is a standard keyword in ISO C99.
2534
2535@item -fno-builtin
2536@itemx -fno-builtin-@var{function}
2537@opindex fno-builtin
2538@opindex fbuiltin
2539@cindex built-in functions
2540Don't recognize built-in functions that do not begin with
2541@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2542functions provided by GCC}, for details of the functions affected,
2543including those which are not built-in functions when @option{-ansi} or
2544@option{-std} options for strict ISO C conformance are used because they
2545do not have an ISO standard meaning.
2546
2547GCC normally generates special code to handle certain built-in functions
2548more efficiently; for instance, calls to @code{alloca} may become single
2549instructions which adjust the stack directly, and calls to @code{memcpy}
2550may become inline copy loops.  The resulting code is often both smaller
2551and faster, but since the function calls no longer appear as such, you
2552cannot set a breakpoint on those calls, nor can you change the behavior
2553of the functions by linking with a different library.  In addition,
2554when a function is recognized as a built-in function, GCC may use
2555information about that function to warn about problems with calls to
2556that function, or to generate more efficient code, even if the
2557resulting code still contains calls to that function.  For example,
2558warnings are given with @option{-Wformat} for bad calls to
2559@code{printf} when @code{printf} is built in and @code{strlen} is
2560known not to modify global memory.
2561
2562With the @option{-fno-builtin-@var{function}} option
2563only the built-in function @var{function} is
2564disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2565function is named that is not built-in in this version of GCC, this
2566option is ignored.  There is no corresponding
2567@option{-fbuiltin-@var{function}} option; if you wish to enable
2568built-in functions selectively when using @option{-fno-builtin} or
2569@option{-ffreestanding}, you may define macros such as:
2570
2571@smallexample
2572#define abs(n)          __builtin_abs ((n))
2573#define strcpy(d, s)    __builtin_strcpy ((d), (s))
2574@end smallexample
2575
2576@item -fgimple
2577@opindex fgimple
2578
2579Enable parsing of function definitions marked with @code{__GIMPLE}.
2580This is an experimental feature that allows unit testing of GIMPLE
2581passes.
2582
2583@item -fhosted
2584@opindex fhosted
2585@cindex hosted environment
2586
2587Assert that compilation targets a hosted environment.  This implies
2588@option{-fbuiltin}.  A hosted environment is one in which the
2589entire standard library is available, and in which @code{main} has a return
2590type of @code{int}.  Examples are nearly everything except a kernel.
2591This is equivalent to @option{-fno-freestanding}.
2592
2593@item -ffreestanding
2594@opindex ffreestanding
2595@cindex hosted environment
2596
2597Assert that compilation targets a freestanding environment.  This
2598implies @option{-fno-builtin}.  A freestanding environment
2599is one in which the standard library may not exist, and program startup may
2600not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2601This is equivalent to @option{-fno-hosted}.
2602
2603@xref{Standards,,Language Standards Supported by GCC}, for details of
2604freestanding and hosted environments.
2605
2606@item -fopenacc
2607@opindex fopenacc
2608@cindex OpenACC accelerator programming
2609Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2610@code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2611compiler generates accelerated code according to the OpenACC Application
2612Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2613implies @option{-pthread}, and thus is only supported on targets that
2614have support for @option{-pthread}.
2615
2616@item -fopenacc-dim=@var{geom}
2617@opindex fopenacc-dim
2618@cindex OpenACC accelerator programming
2619Specify default compute dimensions for parallel offload regions that do
2620not explicitly specify.  The @var{geom} value is a triple of
2621':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2622can be omitted, to use a target-specific default value.
2623
2624@item -fopenmp
2625@opindex fopenmp
2626@cindex OpenMP parallel
2627Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2628@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2629compiler generates parallel code according to the OpenMP Application
2630Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2631implies @option{-pthread}, and thus is only supported on targets that
2632have support for @option{-pthread}. @option{-fopenmp} implies
2633@option{-fopenmp-simd}.
2634
2635@item -fopenmp-simd
2636@opindex fopenmp-simd
2637@cindex OpenMP SIMD
2638@cindex SIMD
2639Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2640in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2641are ignored.
2642
2643@item -fgnu-tm
2644@opindex fgnu-tm
2645When the option @option{-fgnu-tm} is specified, the compiler
2646generates code for the Linux variant of Intel's current Transactional
2647Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2648an experimental feature whose interface may change in future versions
2649of GCC, as the official specification changes.  Please note that not
2650all architectures are supported for this feature.
2651
2652For more information on GCC's support for transactional memory,
2653@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2654Transactional Memory Library}.
2655
2656Note that the transactional memory feature is not supported with
2657non-call exceptions (@option{-fnon-call-exceptions}).
2658
2659@item -fms-extensions
2660@opindex fms-extensions
2661Accept some non-standard constructs used in Microsoft header files.
2662
2663In C++ code, this allows member names in structures to be similar
2664to previous types declarations.
2665
2666@smallexample
2667typedef int UOW;
2668struct ABC @{
2669  UOW UOW;
2670@};
2671@end smallexample
2672
2673Some cases of unnamed fields in structures and unions are only
2674accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2675fields within structs/unions}, for details.
2676
2677Note that this option is off for all targets except for x86
2678targets using ms-abi.
2679
2680@item -fplan9-extensions
2681@opindex fplan9-extensions
2682Accept some non-standard constructs used in Plan 9 code.
2683
2684This enables @option{-fms-extensions}, permits passing pointers to
2685structures with anonymous fields to functions that expect pointers to
2686elements of the type of the field, and permits referring to anonymous
2687fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2688struct/union fields within structs/unions}, for details.  This is only
2689supported for C, not C++.
2690
2691@item -fcond-mismatch
2692@opindex fcond-mismatch
2693Allow conditional expressions with mismatched types in the second and
2694third arguments.  The value of such an expression is void.  This option
2695is not supported for C++.
2696
2697@item -flax-vector-conversions
2698@opindex flax-vector-conversions
2699Allow implicit conversions between vectors with differing numbers of
2700elements and/or incompatible element types.  This option should not be
2701used for new code.
2702
2703@item -funsigned-char
2704@opindex funsigned-char
2705Let the type @code{char} be unsigned, like @code{unsigned char}.
2706
2707Each kind of machine has a default for what @code{char} should
2708be.  It is either like @code{unsigned char} by default or like
2709@code{signed char} by default.
2710
2711Ideally, a portable program should always use @code{signed char} or
2712@code{unsigned char} when it depends on the signedness of an object.
2713But many programs have been written to use plain @code{char} and
2714expect it to be signed, or expect it to be unsigned, depending on the
2715machines they were written for.  This option, and its inverse, let you
2716make such a program work with the opposite default.
2717
2718The type @code{char} is always a distinct type from each of
2719@code{signed char} or @code{unsigned char}, even though its behavior
2720is always just like one of those two.
2721
2722@item -fsigned-char
2723@opindex fsigned-char
2724Let the type @code{char} be signed, like @code{signed char}.
2725
2726Note that this is equivalent to @option{-fno-unsigned-char}, which is
2727the negative form of @option{-funsigned-char}.  Likewise, the option
2728@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2729
2730@item -fsigned-bitfields
2731@itemx -funsigned-bitfields
2732@itemx -fno-signed-bitfields
2733@itemx -fno-unsigned-bitfields
2734@opindex fsigned-bitfields
2735@opindex funsigned-bitfields
2736@opindex fno-signed-bitfields
2737@opindex fno-unsigned-bitfields
2738These options control whether a bit-field is signed or unsigned, when the
2739declaration does not use either @code{signed} or @code{unsigned}.  By
2740default, such a bit-field is signed, because this is consistent: the
2741basic integer types such as @code{int} are signed types.
2742
2743@item -fsso-struct=@var{endianness}
2744@opindex fsso-struct
2745Set the default scalar storage order of structures and unions to the
2746specified endianness.  The accepted values are @samp{big-endian},
2747@samp{little-endian} and @samp{native} for the native endianness of
2748the target (the default).  This option is not supported for C++.
2749
2750@strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2751code that is not binary compatible with code generated without it if the
2752specified endianness is not the native endianness of the target.
2753@end table
2754
2755@node C++ Dialect Options
2756@section Options Controlling C++ Dialect
2757
2758@cindex compiler options, C++
2759@cindex C++ options, command-line
2760@cindex options, C++
2761This section describes the command-line options that are only meaningful
2762for C++ programs.  You can also use most of the GNU compiler options
2763regardless of what language your program is in.  For example, you
2764might compile a file @file{firstClass.C} like this:
2765
2766@smallexample
2767g++ -g -fstrict-enums -O -c firstClass.C
2768@end smallexample
2769
2770@noindent
2771In this example, only @option{-fstrict-enums} is an option meant
2772only for C++ programs; you can use the other options with any
2773language supported by GCC@.
2774
2775Some options for compiling C programs, such as @option{-std}, are also
2776relevant for C++ programs.
2777@xref{C Dialect Options,,Options Controlling C Dialect}.
2778
2779Here is a list of options that are @emph{only} for compiling C++ programs:
2780
2781@table @gcctabopt
2782
2783@item -fabi-version=@var{n}
2784@opindex fabi-version
2785Use version @var{n} of the C++ ABI@.  The default is version 0.
2786
2787Version 0 refers to the version conforming most closely to
2788the C++ ABI specification.  Therefore, the ABI obtained using version 0
2789will change in different versions of G++ as ABI bugs are fixed.
2790
2791Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2792
2793Version 2 is the version of the C++ ABI that first appeared in G++
27943.4, and was the default through G++ 4.9.
2795
2796Version 3 corrects an error in mangling a constant address as a
2797template argument.
2798
2799Version 4, which first appeared in G++ 4.5, implements a standard
2800mangling for vector types.
2801
2802Version 5, which first appeared in G++ 4.6, corrects the mangling of
2803attribute const/volatile on function pointer types, decltype of a
2804plain decl, and use of a function parameter in the declaration of
2805another parameter.
2806
2807Version 6, which first appeared in G++ 4.7, corrects the promotion
2808behavior of C++11 scoped enums and the mangling of template argument
2809packs, const/static_cast, prefix ++ and --, and a class scope function
2810used as a template argument.
2811
2812Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2813builtin type and corrects the mangling of lambdas in default argument
2814scope.
2815
2816Version 8, which first appeared in G++ 4.9, corrects the substitution
2817behavior of function types with function-cv-qualifiers.
2818
2819Version 9, which first appeared in G++ 5.2, corrects the alignment of
2820@code{nullptr_t}.
2821
2822Version 10, which first appeared in G++ 6.1, adds mangling of
2823attributes that affect type identity, such as ia32 calling convention
2824attributes (e.g.@: @samp{stdcall}).
2825
2826Version 11, which first appeared in G++ 7, corrects the mangling of
2827sizeof... expressions and operator names.  For multiple entities with
2828the same name within a function, that are declared in different scopes,
2829the mangling now changes starting with the twelfth occurrence.  It also
2830implies @option{-fnew-inheriting-ctors}.
2831
2832Version 12, which first appeared in G++ 8, corrects the calling
2833conventions for empty classes on the x86_64 target and for classes
2834with only deleted copy/move constructors.  It accidentally changes the
2835calling convention for classes with a deleted copy constructor and a
2836trivial move constructor.
2837
2838Version 13, which first appeared in G++ 8.2, fixes the accidental
2839change in version 12.
2840
2841Version 14, which first appeared in G++ 10, corrects the mangling of
2842the nullptr expression.
2843
2844Version 15, which first appeared in G++ 11, changes the mangling of
2845@code{__alignof__} to be distinct from that of @code{alignof}, and
2846dependent operator names.
2847
2848See also @option{-Wabi}.
2849
2850@item -fabi-compat-version=@var{n}
2851@opindex fabi-compat-version
2852On targets that support strong aliases, G++
2853works around mangling changes by creating an alias with the correct
2854mangled name when defining a symbol with an incorrect mangled name.
2855This switch specifies which ABI version to use for the alias.
2856
2857With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2858compatibility).  If another ABI version is explicitly selected, this
2859defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
2860use @option{-fabi-compat-version=2}.
2861
2862If this option is not provided but @option{-Wabi=@var{n}} is, that
2863version is used for compatibility aliases.  If this option is provided
2864along with @option{-Wabi} (without the version), the version from this
2865option is used for the warning.
2866
2867@item -fno-access-control
2868@opindex fno-access-control
2869@opindex faccess-control
2870Turn off all access checking.  This switch is mainly useful for working
2871around bugs in the access control code.
2872
2873@item -faligned-new
2874@opindex faligned-new
2875Enable support for C++17 @code{new} of types that require more
2876alignment than @code{void* ::operator new(std::size_t)} provides.  A
2877numeric argument such as @code{-faligned-new=32} can be used to
2878specify how much alignment (in bytes) is provided by that function,
2879but few users will need to override the default of
2880@code{alignof(std::max_align_t)}.
2881
2882This flag is enabled by default for @option{-std=c++17}.
2883
2884@item -fchar8_t
2885@itemx -fno-char8_t
2886@opindex fchar8_t
2887@opindex fno-char8_t
2888Enable support for @code{char8_t} as adopted for C++20.  This includes
2889the addition of a new @code{char8_t} fundamental type, changes to the
2890types of UTF-8 string and character literals, new signatures for
2891user-defined literals, associated standard library updates, and new
2892@code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2893
2894This option enables functions to be overloaded for ordinary and UTF-8
2895strings:
2896
2897@smallexample
2898int f(const char *);    // #1
2899int f(const char8_t *); // #2
2900int v1 = f("text");     // Calls #1
2901int v2 = f(u8"text");   // Calls #2
2902@end smallexample
2903
2904@noindent
2905and introduces new signatures for user-defined literals:
2906
2907@smallexample
2908int operator""_udl1(char8_t);
2909int v3 = u8'x'_udl1;
2910int operator""_udl2(const char8_t*, std::size_t);
2911int v4 = u8"text"_udl2;
2912template<typename T, T...> int operator""_udl3();
2913int v5 = u8"text"_udl3;
2914@end smallexample
2915
2916@noindent
2917The change to the types of UTF-8 string and character literals introduces
2918incompatibilities with ISO C++11 and later standards.  For example, the
2919following code is well-formed under ISO C++11, but is ill-formed when
2920@option{-fchar8_t} is specified.
2921
2922@smallexample
2923char ca[] = u8"xx";     // error: char-array initialized from wide
2924                        //        string
2925const char *cp = u8"xx";// error: invalid conversion from
2926                        //        `const char8_t*' to `const char*'
2927int f(const char*);
2928auto v = f(u8"xx");     // error: invalid conversion from
2929                        //        `const char8_t*' to `const char*'
2930std::string s@{u8"xx"@};  // error: no matching function for call to
2931                        //        `std::basic_string<char>::basic_string()'
2932using namespace std::literals;
2933s = u8"xx"s;            // error: conversion from
2934                        //        `basic_string<char8_t>' to non-scalar
2935                        //        type `basic_string<char>' requested
2936@end smallexample
2937
2938@item -fcheck-new
2939@opindex fcheck-new
2940Check that the pointer returned by @code{operator new} is non-null
2941before attempting to modify the storage allocated.  This check is
2942normally unnecessary because the C++ standard specifies that
2943@code{operator new} only returns @code{0} if it is declared
2944@code{throw()}, in which case the compiler always checks the
2945return value even without this option.  In all other cases, when
2946@code{operator new} has a non-empty exception specification, memory
2947exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
2948@samp{new (nothrow)}.
2949
2950@item -fconcepts
2951@itemx -fconcepts-ts
2952@opindex fconcepts
2953@opindex fconcepts-ts
2954Below @option{-std=c++20}, @option{-fconcepts} enables support for the
2955C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2956
2957With @option{-std=c++20} and above, Concepts are part of the language
2958standard, so @option{-fconcepts} defaults to on.  But the standard
2959specification of Concepts differs significantly from the TS, so some
2960constructs that were allowed in the TS but didn't make it into the
2961standard can still be enabled by @option{-fconcepts-ts}.
2962
2963@item -fconstexpr-depth=@var{n}
2964@opindex fconstexpr-depth
2965Set the maximum nested evaluation depth for C++11 constexpr functions
2966to @var{n}.  A limit is needed to detect endless recursion during
2967constant expression evaluation.  The minimum specified by the standard
2968is 512.
2969
2970@item -fconstexpr-cache-depth=@var{n}
2971@opindex fconstexpr-cache-depth
2972Set the maximum level of nested evaluation depth for C++11 constexpr
2973functions that will be cached to @var{n}.  This is a heuristic that
2974trades off compilation speed (when the cache avoids repeated
2975calculations) against memory consumption (when the cache grows very
2976large from highly recursive evaluations).  The default is 8.  Very few
2977users are likely to want to adjust it, but if your code does heavy
2978constexpr calculations you might want to experiment to find which
2979value works best for you.
2980
2981@item -fconstexpr-loop-limit=@var{n}
2982@opindex fconstexpr-loop-limit
2983Set the maximum number of iterations for a loop in C++14 constexpr functions
2984to @var{n}.  A limit is needed to detect infinite loops during
2985constant expression evaluation.  The default is 262144 (1<<18).
2986
2987@item -fconstexpr-ops-limit=@var{n}
2988@opindex fconstexpr-ops-limit
2989Set the maximum number of operations during a single constexpr evaluation.
2990Even when number of iterations of a single loop is limited with the above limit,
2991if there are several nested loops and each of them has many iterations but still
2992smaller than the above limit, or if in a body of some loop or even outside
2993of a loop too many expressions need to be evaluated, the resulting constexpr
2994evaluation might take too long.
2995The default is 33554432 (1<<25).
2996
2997@item -fcoroutines
2998@opindex fcoroutines
2999Enable support for the C++ coroutines extension (experimental).
3000
3001@item -fno-elide-constructors
3002@opindex fno-elide-constructors
3003@opindex felide-constructors
3004The C++ standard allows an implementation to omit creating a temporary
3005that is only used to initialize another object of the same type.
3006Specifying this option disables that optimization, and forces G++ to
3007call the copy constructor in all cases.  This option also causes G++
3008to call trivial member functions which otherwise would be expanded inline.
3009
3010In C++17, the compiler is required to omit these temporaries, but this
3011option still affects trivial member functions.
3012
3013@item -fno-enforce-eh-specs
3014@opindex fno-enforce-eh-specs
3015@opindex fenforce-eh-specs
3016Don't generate code to check for violation of exception specifications
3017at run time.  This option violates the C++ standard, but may be useful
3018for reducing code size in production builds, much like defining
3019@code{NDEBUG}.  This does not give user code permission to throw
3020exceptions in violation of the exception specifications; the compiler
3021still optimizes based on the specifications, so throwing an
3022unexpected exception results in undefined behavior at run time.
3023
3024@item -fextern-tls-init
3025@itemx -fno-extern-tls-init
3026@opindex fextern-tls-init
3027@opindex fno-extern-tls-init
3028The C++11 and OpenMP standards allow @code{thread_local} and
3029@code{threadprivate} variables to have dynamic (runtime)
3030initialization.  To support this, any use of such a variable goes
3031through a wrapper function that performs any necessary initialization.
3032When the use and definition of the variable are in the same
3033translation unit, this overhead can be optimized away, but when the
3034use is in a different translation unit there is significant overhead
3035even if the variable doesn't actually need dynamic initialization.  If
3036the programmer can be sure that no use of the variable in a
3037non-defining TU needs to trigger dynamic initialization (either
3038because the variable is statically initialized, or a use of the
3039variable in the defining TU will be executed before any uses in
3040another TU), they can avoid this overhead with the
3041@option{-fno-extern-tls-init} option.
3042
3043On targets that support symbol aliases, the default is
3044@option{-fextern-tls-init}.  On targets that do not support symbol
3045aliases, the default is @option{-fno-extern-tls-init}.
3046
3047@item -fno-gnu-keywords
3048@opindex fno-gnu-keywords
3049@opindex fgnu-keywords
3050Do not recognize @code{typeof} as a keyword, so that code can use this
3051word as an identifier.  You can use the keyword @code{__typeof__} instead.
3052This option is implied by the strict ISO C++ dialects: @option{-ansi},
3053@option{-std=c++98}, @option{-std=c++11}, etc.
3054
3055@item -fno-implicit-templates
3056@opindex fno-implicit-templates
3057@opindex fimplicit-templates
3058Never emit code for non-inline templates that are instantiated
3059implicitly (i.e.@: by use); only emit code for explicit instantiations.
3060If you use this option, you must take care to structure your code to
3061include all the necessary explicit instantiations to avoid getting
3062undefined symbols at link time.
3063@xref{Template Instantiation}, for more information.
3064
3065@item -fno-implicit-inline-templates
3066@opindex fno-implicit-inline-templates
3067@opindex fimplicit-inline-templates
3068Don't emit code for implicit instantiations of inline templates, either.
3069The default is to handle inlines differently so that compiles with and
3070without optimization need the same set of explicit instantiations.
3071
3072@item -fno-implement-inlines
3073@opindex fno-implement-inlines
3074@opindex fimplement-inlines
3075To save space, do not emit out-of-line copies of inline functions
3076controlled by @code{#pragma implementation}.  This causes linker
3077errors if these functions are not inlined everywhere they are called.
3078
3079@item -fmodules-ts
3080@itemx -fno-modules-ts
3081@opindex fmodules-ts
3082@opindex fno-modules-ts
3083Enable support for C++20 modules (@xref{C++ Modules}).  The
3084@option{-fno-modules-ts} is usually not needed, as that is the
3085default.  Even though this is a C++20 feature, it is not currently
3086implicitly enabled by selecting that standard version.
3087
3088@item -fmodule-header
3089@itemx -fmodule-header=user
3090@itemx -fmodule-header=system
3091@opindex fmodule-header
3092Compile a header file to create an importable header unit.
3093
3094@item -fmodule-implicit-inline
3095@opindex fmodule-implicit-inline
3096Member functions defined in their class definitions are not implicitly
3097inline for modular code.  This is different to traditional C++
3098behavior, for good reasons.  However, it may result in a difficulty
3099during code porting.  This option makes such function definitions
3100implicitly inline.  It does however generate an ABI incompatibility,
3101so you must use it everywhere or nowhere.  (Such definitions outside
3102of a named module remain implicitly inline, regardless.)
3103
3104@item -fno-module-lazy
3105@opindex fno-module-lazy
3106@opindex fmodule-lazy
3107Disable lazy module importing and module mapper creation.
3108
3109@item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3110@itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3111@itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3112@itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3113@itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3114@itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3115@vindex CXX_MODULE_MAPPER @r{environment variable}
3116@opindex fmodule-mapper
3117An oracle to query for module name to filename mappings.  If
3118unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3119and if that is unset, an in-process default is provided.
3120
3121@item -fmodule-only
3122@opindex fmodule-only
3123Only emit the Compiled Module Interface, inhibiting any object file.
3124
3125@item -fms-extensions
3126@opindex fms-extensions
3127Disable Wpedantic warnings about constructs used in MFC, such as implicit
3128int and getting a pointer to member function via non-standard syntax.
3129
3130@item -fnew-inheriting-ctors
3131@opindex fnew-inheriting-ctors
3132Enable the P0136 adjustment to the semantics of C++11 constructor
3133inheritance.  This is part of C++17 but also considered to be a Defect
3134Report against C++11 and C++14.  This flag is enabled by default
3135unless @option{-fabi-version=10} or lower is specified.
3136
3137@item -fnew-ttp-matching
3138@opindex fnew-ttp-matching
3139Enable the P0522 resolution to Core issue 150, template template
3140parameters and default arguments: this allows a template with default
3141template arguments as an argument for a template template parameter
3142with fewer template parameters.  This flag is enabled by default for
3143@option{-std=c++17}.
3144
3145@item -fno-nonansi-builtins
3146@opindex fno-nonansi-builtins
3147@opindex fnonansi-builtins
3148Disable built-in declarations of functions that are not mandated by
3149ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3150@code{index}, @code{bzero}, @code{conjf}, and other related functions.
3151
3152@item -fnothrow-opt
3153@opindex fnothrow-opt
3154Treat a @code{throw()} exception specification as if it were a
3155@code{noexcept} specification to reduce or eliminate the text size
3156overhead relative to a function with no exception specification.  If
3157the function has local variables of types with non-trivial
3158destructors, the exception specification actually makes the
3159function smaller because the EH cleanups for those variables can be
3160optimized away.  The semantic effect is that an exception thrown out of
3161a function with such an exception specification results in a call
3162to @code{terminate} rather than @code{unexpected}.
3163
3164@item -fno-operator-names
3165@opindex fno-operator-names
3166@opindex foperator-names
3167Do not treat the operator name keywords @code{and}, @code{bitand},
3168@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3169synonyms as keywords.
3170
3171@item -fno-optional-diags
3172@opindex fno-optional-diags
3173@opindex foptional-diags
3174Disable diagnostics that the standard says a compiler does not need to
3175issue.  Currently, the only such diagnostic issued by G++ is the one for
3176a name having multiple meanings within a class.
3177
3178@item -fpermissive
3179@opindex fpermissive
3180Downgrade some diagnostics about nonconformant code from errors to
3181warnings.  Thus, using @option{-fpermissive} allows some
3182nonconforming code to compile.
3183
3184@item -fno-pretty-templates
3185@opindex fno-pretty-templates
3186@opindex fpretty-templates
3187When an error message refers to a specialization of a function
3188template, the compiler normally prints the signature of the
3189template followed by the template arguments and any typedefs or
3190typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3191rather than @code{void f(int)}) so that it's clear which template is
3192involved.  When an error message refers to a specialization of a class
3193template, the compiler omits any template arguments that match
3194the default template arguments for that template.  If either of these
3195behaviors make it harder to understand the error message rather than
3196easier, you can use @option{-fno-pretty-templates} to disable them.
3197
3198@item -fno-rtti
3199@opindex fno-rtti
3200@opindex frtti
3201Disable generation of information about every class with virtual
3202functions for use by the C++ run-time type identification features
3203(@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3204of the language, you can save some space by using this flag.  Note that
3205exception handling uses the same information, but G++ generates it as
3206needed. The @code{dynamic_cast} operator can still be used for casts that
3207do not require run-time type information, i.e.@: casts to @code{void *} or to
3208unambiguous base classes.
3209
3210Mixing code compiled with @option{-frtti} with that compiled with
3211@option{-fno-rtti} may not work.  For example, programs may
3212fail to link if a class compiled with @option{-fno-rtti} is used as a base
3213for a class compiled with @option{-frtti}.
3214
3215@item -fsized-deallocation
3216@opindex fsized-deallocation
3217Enable the built-in global declarations
3218@smallexample
3219void operator delete (void *, std::size_t) noexcept;
3220void operator delete[] (void *, std::size_t) noexcept;
3221@end smallexample
3222as introduced in C++14.  This is useful for user-defined replacement
3223deallocation functions that, for example, use the size of the object
3224to make deallocation faster.  Enabled by default under
3225@option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3226warns about places that might want to add a definition.
3227
3228@item -fstrict-enums
3229@opindex fstrict-enums
3230Allow the compiler to optimize using the assumption that a value of
3231enumerated type can only be one of the values of the enumeration (as
3232defined in the C++ standard; basically, a value that can be
3233represented in the minimum number of bits needed to represent all the
3234enumerators).  This assumption may not be valid if the program uses a
3235cast to convert an arbitrary integer value to the enumerated type.
3236
3237@item -fstrong-eval-order
3238@opindex fstrong-eval-order
3239Evaluate member access, array subscripting, and shift expressions in
3240left-to-right order, and evaluate assignment in right-to-left order,
3241as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3242@option{-fstrong-eval-order=some} enables just the ordering of member
3243access and shift expressions, and is the default without
3244@option{-std=c++17}.
3245
3246@item -ftemplate-backtrace-limit=@var{n}
3247@opindex ftemplate-backtrace-limit
3248Set the maximum number of template instantiation notes for a single
3249warning or error to @var{n}.  The default value is 10.
3250
3251@item -ftemplate-depth=@var{n}
3252@opindex ftemplate-depth
3253Set the maximum instantiation depth for template classes to @var{n}.
3254A limit on the template instantiation depth is needed to detect
3255endless recursions during template class instantiation.  ANSI/ISO C++
3256conforming programs must not rely on a maximum depth greater than 17
3257(changed to 1024 in C++11).  The default value is 900, as the compiler
3258can run out of stack space before hitting 1024 in some situations.
3259
3260@item -fno-threadsafe-statics
3261@opindex fno-threadsafe-statics
3262@opindex fthreadsafe-statics
3263Do not emit the extra code to use the routines specified in the C++
3264ABI for thread-safe initialization of local statics.  You can use this
3265option to reduce code size slightly in code that doesn't need to be
3266thread-safe.
3267
3268@item -fuse-cxa-atexit
3269@opindex fuse-cxa-atexit
3270Register destructors for objects with static storage duration with the
3271@code{__cxa_atexit} function rather than the @code{atexit} function.
3272This option is required for fully standards-compliant handling of static
3273destructors, but only works if your C library supports
3274@code{__cxa_atexit}.
3275
3276@item -fno-use-cxa-get-exception-ptr
3277@opindex fno-use-cxa-get-exception-ptr
3278@opindex fuse-cxa-get-exception-ptr
3279Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3280causes @code{std::uncaught_exception} to be incorrect, but is necessary
3281if the runtime routine is not available.
3282
3283@item -fvisibility-inlines-hidden
3284@opindex fvisibility-inlines-hidden
3285This switch declares that the user does not attempt to compare
3286pointers to inline functions or methods where the addresses of the two functions
3287are taken in different shared objects.
3288
3289The effect of this is that GCC may, effectively, mark inline methods with
3290@code{__attribute__ ((visibility ("hidden")))} so that they do not
3291appear in the export table of a DSO and do not require a PLT indirection
3292when used within the DSO@.  Enabling this option can have a dramatic effect
3293on load and link times of a DSO as it massively reduces the size of the
3294dynamic export table when the library makes heavy use of templates.
3295
3296The behavior of this switch is not quite the same as marking the
3297methods as hidden directly, because it does not affect static variables
3298local to the function or cause the compiler to deduce that
3299the function is defined in only one shared object.
3300
3301You may mark a method as having a visibility explicitly to negate the
3302effect of the switch for that method.  For example, if you do want to
3303compare pointers to a particular inline method, you might mark it as
3304having default visibility.  Marking the enclosing class with explicit
3305visibility has no effect.
3306
3307Explicitly instantiated inline methods are unaffected by this option
3308as their linkage might otherwise cross a shared library boundary.
3309@xref{Template Instantiation}.
3310
3311@item -fvisibility-ms-compat
3312@opindex fvisibility-ms-compat
3313This flag attempts to use visibility settings to make GCC's C++
3314linkage model compatible with that of Microsoft Visual Studio.
3315
3316The flag makes these changes to GCC's linkage model:
3317
3318@enumerate
3319@item
3320It sets the default visibility to @code{hidden}, like
3321@option{-fvisibility=hidden}.
3322
3323@item
3324Types, but not their members, are not hidden by default.
3325
3326@item
3327The One Definition Rule is relaxed for types without explicit
3328visibility specifications that are defined in more than one
3329shared object: those declarations are permitted if they are
3330permitted when this option is not used.
3331@end enumerate
3332
3333In new code it is better to use @option{-fvisibility=hidden} and
3334export those classes that are intended to be externally visible.
3335Unfortunately it is possible for code to rely, perhaps accidentally,
3336on the Visual Studio behavior.
3337
3338Among the consequences of these changes are that static data members
3339of the same type with the same name but defined in different shared
3340objects are different, so changing one does not change the other;
3341and that pointers to function members defined in different shared
3342objects may not compare equal.  When this flag is given, it is a
3343violation of the ODR to define types with the same name differently.
3344
3345@item -fno-weak
3346@opindex fno-weak
3347@opindex fweak
3348Do not use weak symbol support, even if it is provided by the linker.
3349By default, G++ uses weak symbols if they are available.  This
3350option exists only for testing, and should not be used by end-users;
3351it results in inferior code and has no benefits.  This option may
3352be removed in a future release of G++.
3353
3354@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3355@opindex fext-numeric-literals
3356@opindex fno-ext-numeric-literals
3357Accept imaginary, fixed-point, or machine-defined
3358literal number suffixes as GNU extensions.
3359When this option is turned off these suffixes are treated
3360as C++11 user-defined literal numeric suffixes.
3361This is on by default for all pre-C++11 dialects and all GNU dialects:
3362@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3363@option{-std=gnu++14}.
3364This option is off by default
3365for ISO C++11 onwards (@option{-std=c++11}, ...).
3366
3367@item -nostdinc++
3368@opindex nostdinc++
3369Do not search for header files in the standard directories specific to
3370C++, but do still search the other standard directories.  (This option
3371is used when building the C++ library.)
3372
3373@item -flang-info-include-translate
3374@itemx -flang-info-include-translate-not
3375@itemx -flang-info-include-translate=@var{header}
3376@opindex flang-info-include-translate
3377@opindex flang-info-include-translate-not
3378Inform of include translation events.  The first will note accepted
3379include translations, the second will note declined include
3380translations.  The @var{header} form will inform of include
3381translations relating to that specific header.  If @var{header} is of
3382the form @code{"user"} or @code{<system>} it will be resolved to a
3383specific user or system header using the include path.
3384
3385@item -flang-info-module-cmi
3386@itemx -flang-info-module-cmi=@var{module}
3387@opindex flang-info-module-cmi
3388Inform of Compiled Module Interface pathnames.  The first will note
3389all read CMI pathnames.  The @var{module} form will not reading a
3390specific module's CMI.  @var{module} may be a named module or a
3391header-unit (the latter indicated by either being a pathname containing
3392directory separators or enclosed in @code{<>} or @code{""}).
3393
3394@item -stdlib=@var{libstdc++,libc++}
3395@opindex stdlib
3396When G++ is configured to support this option, it allows specification of
3397alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3398(the default, native C++ runtime for G++) and @var{libc++} which is the
3399C++ runtime installed on some operating systems (e.g. Darwin versions from
3400Darwin11 onwards).  The option switches G++ to use the headers from the
3401specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3402when a C++ runtime is required for linking.
3403@end table
3404
3405In addition, these warning options have meanings only for C++ programs:
3406
3407@table @gcctabopt
3408@item -Wabi-tag @r{(C++ and Objective-C++ only)}
3409@opindex Wabi-tag
3410Warn when a type with an ABI tag is used in a context that does not
3411have that ABI tag.  See @ref{C++ Attributes} for more information
3412about ABI tags.
3413
3414@item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3415@opindex Wcomma-subscript
3416@opindex Wno-comma-subscript
3417Warn about uses of a comma expression within a subscripting expression.
3418This usage was deprecated in C++20.  However, a comma expression wrapped
3419in @code{( )} is not deprecated.  Example:
3420
3421@smallexample
3422@group
3423void f(int *a, int b, int c) @{
3424    a[b,c];     // deprecated
3425    a[(b,c)];   // OK
3426@}
3427@end group
3428@end smallexample
3429
3430Enabled by default with @option{-std=c++20}.
3431
3432@item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3433@opindex Wctad-maybe-unsupported
3434@opindex Wno-ctad-maybe-unsupported
3435Warn when performing class template argument deduction (CTAD) on a type with
3436no explicitly written deduction guides.  This warning will point out cases
3437where CTAD succeeded only because the compiler synthesized the implicit
3438deduction guides, which might not be what the programmer intended.  Certain
3439style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3440types that are designed to support CTAD.  This warning can be suppressed with
3441the following pattern:
3442
3443@smallexample
3444struct allow_ctad_t; // any name works
3445template <typename T> struct S @{
3446  S(T) @{ @}
3447@};
3448S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
3449@end smallexample
3450
3451@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3452@opindex Wctor-dtor-privacy
3453@opindex Wno-ctor-dtor-privacy
3454Warn when a class seems unusable because all the constructors or
3455destructors in that class are private, and it has neither friends nor
3456public static member functions.  Also warn if there are no non-private
3457methods, and there's at least one private member function that isn't
3458a constructor or destructor.
3459
3460@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3461@opindex Wdelete-non-virtual-dtor
3462@opindex Wno-delete-non-virtual-dtor
3463Warn when @code{delete} is used to destroy an instance of a class that
3464has virtual functions and non-virtual destructor. It is unsafe to delete
3465an instance of a derived class through a pointer to a base class if the
3466base class does not have a virtual destructor.  This warning is enabled
3467by @option{-Wall}.
3468
3469@item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3470@opindex Wdeprecated-copy
3471@opindex Wno-deprecated-copy
3472Warn that the implicit declaration of a copy constructor or copy
3473assignment operator is deprecated if the class has a user-provided
3474copy constructor or copy assignment operator, in C++11 and up.  This
3475warning is enabled by @option{-Wextra}.  With
3476@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3477user-provided destructor.
3478
3479@item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3480@opindex Wdeprecated-enum-enum-conversion
3481@opindex Wno-deprecated-enum-enum-conversion
3482Disable the warning about the case when the usual arithmetic conversions
3483are applied on operands where one is of enumeration type and the other is
3484of a different enumeration type.  This conversion was deprecated in C++20.
3485For example:
3486
3487@smallexample
3488enum E1 @{ e @};
3489enum E2 @{ f @};
3490int k = f - e;
3491@end smallexample
3492
3493@option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3494@option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3495by @option{-Wenum-conversion}.
3496
3497@item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3498@opindex Wdeprecated-enum-float-conversion
3499@opindex Wno-deprecated-enum-float-conversion
3500Disable the warning about the case when the usual arithmetic conversions
3501are applied on operands where one is of enumeration type and the other is
3502of a floating-point type.  This conversion was deprecated in C++20.  For
3503example:
3504
3505@smallexample
3506enum E1 @{ e @};
3507enum E2 @{ f @};
3508bool b = e <= 3.7;
3509@end smallexample
3510
3511@option{-Wdeprecated-enum-float-conversion} is enabled by default with
3512@option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3513by @option{-Wenum-conversion}.
3514
3515@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3516@opindex Winit-list-lifetime
3517@opindex Wno-init-list-lifetime
3518Do not warn about uses of @code{std::initializer_list} that are likely
3519to result in dangling pointers.  Since the underlying array for an
3520@code{initializer_list} is handled like a normal C++ temporary object,
3521it is easy to inadvertently keep a pointer to the array past the end
3522of the array's lifetime.  For example:
3523
3524@itemize @bullet
3525@item
3526If a function returns a temporary @code{initializer_list}, or a local
3527@code{initializer_list} variable, the array's lifetime ends at the end
3528of the return statement, so the value returned has a dangling pointer.
3529
3530@item
3531If a new-expression creates an @code{initializer_list}, the array only
3532lives until the end of the enclosing full-expression, so the
3533@code{initializer_list} in the heap has a dangling pointer.
3534
3535@item
3536When an @code{initializer_list} variable is assigned from a
3537brace-enclosed initializer list, the temporary array created for the
3538right side of the assignment only lives until the end of the
3539full-expression, so at the next statement the @code{initializer_list}
3540variable has a dangling pointer.
3541
3542@smallexample
3543// li's initial underlying array lives as long as li
3544std::initializer_list<int> li = @{ 1,2,3 @};
3545// assignment changes li to point to a temporary array
3546li = @{ 4, 5 @};
3547// now the temporary is gone and li has a dangling pointer
3548int i = li.begin()[0] // undefined behavior
3549@end smallexample
3550
3551@item
3552When a list constructor stores the @code{begin} pointer from the
3553@code{initializer_list} argument, this doesn't extend the lifetime of
3554the array, so if a class variable is constructed from a temporary
3555@code{initializer_list}, the pointer is left dangling by the end of
3556the variable declaration statement.
3557
3558@end itemize
3559
3560@item -Winvalid-imported-macros
3561@opindex Winvalid-imported-macros
3562@opindex Wno-invalid-imported-macros
3563Verify all imported macro definitions are valid at the end of
3564compilation.  This is not enabled by default, as it requires
3565additional processing to determine.  It may be useful when preparing
3566sets of header-units to ensure consistent macros.
3567
3568@item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3569@opindex Wliteral-suffix
3570@opindex Wno-literal-suffix
3571Do not warn when a string or character literal is followed by a
3572ud-suffix which does not begin with an underscore.  As a conforming
3573extension, GCC treats such suffixes as separate preprocessing tokens
3574in order to maintain backwards compatibility with code that uses
3575formatting macros from @code{<inttypes.h>}.  For example:
3576
3577@smallexample
3578#define __STDC_FORMAT_MACROS
3579#include <inttypes.h>
3580#include <stdio.h>
3581
3582int main() @{
3583  int64_t i64 = 123;
3584  printf("My int64: %" PRId64"\n", i64);
3585@}
3586@end smallexample
3587
3588In this case, @code{PRId64} is treated as a separate preprocessing token.
3589
3590This option also controls warnings when a user-defined literal
3591operator is declared with a literal suffix identifier that doesn't
3592begin with an underscore. Literal suffix identifiers that don't begin
3593with an underscore are reserved for future standardization.
3594
3595These warnings are enabled by default.
3596
3597@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3598@opindex Wnarrowing
3599@opindex Wno-narrowing
3600For C++11 and later standards, narrowing conversions are diagnosed by default,
3601as required by the standard.  A narrowing conversion from a constant produces
3602an error, and a narrowing conversion from a non-constant produces a warning,
3603but @option{-Wno-narrowing} suppresses the diagnostic.
3604Note that this does not affect the meaning of well-formed code;
3605narrowing conversions are still considered ill-formed in SFINAE contexts.
3606
3607With @option{-Wnarrowing} in C++98, warn when a narrowing
3608conversion prohibited by C++11 occurs within
3609@samp{@{ @}}, e.g.
3610
3611@smallexample
3612int i = @{ 2.2 @}; // error: narrowing from double to int
3613@end smallexample
3614
3615This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3616
3617@item -Wnoexcept @r{(C++ and Objective-C++ only)}
3618@opindex Wnoexcept
3619@opindex Wno-noexcept
3620Warn when a noexcept-expression evaluates to false because of a call
3621to a function that does not have a non-throwing exception
3622specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3623the compiler to never throw an exception.
3624
3625@item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3626@opindex Wnoexcept-type
3627@opindex Wno-noexcept-type
3628Warn if the C++17 feature making @code{noexcept} part of a function
3629type changes the mangled name of a symbol relative to C++14.  Enabled
3630by @option{-Wabi} and @option{-Wc++17-compat}.
3631
3632As an example:
3633
3634@smallexample
3635template <class T> void f(T t) @{ t(); @};
3636void g() noexcept;
3637void h() @{ f(g); @}
3638@end smallexample
3639
3640@noindent
3641In C++14, @code{f} calls @code{f<void(*)()>}, but in
3642C++17 it calls @code{f<void(*)()noexcept>}.
3643
3644@item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3645@opindex Wclass-memaccess
3646@opindex Wno-class-memaccess
3647Warn when the destination of a call to a raw memory function such as
3648@code{memset} or @code{memcpy} is an object of class type, and when writing
3649into such an object might bypass the class non-trivial or deleted constructor
3650or copy assignment, violate const-correctness or encapsulation, or corrupt
3651virtual table pointers.  Modifying the representation of such objects may
3652violate invariants maintained by member functions of the class.  For example,
3653the call to @code{memset} below is undefined because it modifies a non-trivial
3654class object and is, therefore, diagnosed.  The safe way to either initialize
3655or clear the storage of objects of such types is by using the appropriate
3656constructor or assignment operator, if one is available.
3657@smallexample
3658std::string str = "abc";
3659memset (&str, 0, sizeof str);
3660@end smallexample
3661The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3662Explicitly casting the pointer to the class object to @code{void *} or
3663to a type that can be safely accessed by the raw memory function suppresses
3664the warning.
3665
3666@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3667@opindex Wnon-virtual-dtor
3668@opindex Wno-non-virtual-dtor
3669Warn when a class has virtual functions and an accessible non-virtual
3670destructor itself or in an accessible polymorphic base class, in which
3671case it is possible but unsafe to delete an instance of a derived
3672class through a pointer to the class itself or base class.  This
3673warning is automatically enabled if @option{-Weffc++} is specified.
3674
3675@item -Wregister @r{(C++ and Objective-C++ only)}
3676@opindex Wregister
3677@opindex Wno-register
3678Warn on uses of the @code{register} storage class specifier, except
3679when it is part of the GNU @ref{Explicit Register Variables} extension.
3680The use of the @code{register} keyword as storage class specifier has
3681been deprecated in C++11 and removed in C++17.
3682Enabled by default with @option{-std=c++17}.
3683
3684@item -Wreorder @r{(C++ and Objective-C++ only)}
3685@opindex Wreorder
3686@opindex Wno-reorder
3687@cindex reordering, warning
3688@cindex warning for reordering of member initializers
3689Warn when the order of member initializers given in the code does not
3690match the order in which they must be executed.  For instance:
3691
3692@smallexample
3693struct A @{
3694  int i;
3695  int j;
3696  A(): j (0), i (1) @{ @}
3697@};
3698@end smallexample
3699
3700@noindent
3701The compiler rearranges the member initializers for @code{i}
3702and @code{j} to match the declaration order of the members, emitting
3703a warning to that effect.  This warning is enabled by @option{-Wall}.
3704
3705@item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3706@opindex Wpessimizing-move
3707@opindex Wno-pessimizing-move
3708This warning warns when a call to @code{std::move} prevents copy
3709elision.  A typical scenario when copy elision can occur is when returning in
3710a function with a class return type, when the expression being returned is the
3711name of a non-volatile automatic object, and is not a function parameter, and
3712has the same type as the function return type.
3713
3714@smallexample
3715struct T @{
3716@dots{}
3717@};
3718T fn()
3719@{
3720  T t;
3721  @dots{}
3722  return std::move (t);
3723@}
3724@end smallexample
3725
3726But in this example, the @code{std::move} call prevents copy elision.
3727
3728This warning is enabled by @option{-Wall}.
3729
3730@item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3731@opindex Wredundant-move
3732@opindex Wno-redundant-move
3733This warning warns about redundant calls to @code{std::move}; that is, when
3734a move operation would have been performed even without the @code{std::move}
3735call.  This happens because the compiler is forced to treat the object as if
3736it were an rvalue in certain situations such as returning a local variable,
3737where copy elision isn't applicable.  Consider:
3738
3739@smallexample
3740struct T @{
3741@dots{}
3742@};
3743T fn(T t)
3744@{
3745  @dots{}
3746  return std::move (t);
3747@}
3748@end smallexample
3749
3750Here, the @code{std::move} call is redundant.  Because G++ implements Core
3751Issue 1579, another example is:
3752
3753@smallexample
3754struct T @{ // convertible to U
3755@dots{}
3756@};
3757struct U @{
3758@dots{}
3759@};
3760U fn()
3761@{
3762  T t;
3763  @dots{}
3764  return std::move (t);
3765@}
3766@end smallexample
3767In this example, copy elision isn't applicable because the type of the
3768expression being returned and the function return type differ, yet G++
3769treats the return value as if it were designated by an rvalue.
3770
3771This warning is enabled by @option{-Wextra}.
3772
3773@item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
3774@opindex Wrange-loop-construct
3775@opindex Wno-range-loop-construct
3776This warning warns when a C++ range-based for-loop is creating an unnecessary
3777copy.  This can happen when the range declaration is not a reference, but
3778probably should be.  For example:
3779
3780@smallexample
3781struct S @{ char arr[128]; @};
3782void fn () @{
3783  S arr[5];
3784  for (const auto x : arr) @{ @dots{} @}
3785@}
3786@end smallexample
3787
3788It does not warn when the type being copied is a trivially-copyable type whose
3789size is less than 64 bytes.
3790
3791This warning also warns when a loop variable in a range-based for-loop is
3792initialized with a value of a different type resulting in a copy.  For example:
3793
3794@smallexample
3795void fn() @{
3796  int arr[10];
3797  for (const double &x : arr) @{ @dots{} @}
3798@}
3799@end smallexample
3800
3801In the example above, in every iteration of the loop a temporary value of
3802type @code{double} is created and destroyed, to which the reference
3803@code{const double &} is bound.
3804
3805This warning is enabled by @option{-Wall}.
3806
3807@item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3808@opindex Wredundant-tags
3809@opindex Wno-redundant-tags
3810Warn about redundant class-key and enum-key in references to class types
3811and enumerated types in contexts where the key can be eliminated without
3812causing an ambiguity.  For example:
3813
3814@smallexample
3815struct foo;
3816struct foo *p;   // warn that keyword struct can be eliminated
3817@end smallexample
3818
3819@noindent
3820On the other hand, in this example there is no warning:
3821
3822@smallexample
3823struct foo;
3824void foo ();   // "hides" struct foo
3825void bar (struct foo&);  // no warning, keyword struct is necessary
3826@end smallexample
3827
3828@item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3829@opindex Wsubobject-linkage
3830@opindex Wno-subobject-linkage
3831Do not warn
3832if a class type has a base or a field whose type uses the anonymous
3833namespace or depends on a type with no linkage.  If a type A depends on
3834a type B with no or internal linkage, defining it in multiple
3835translation units would be an ODR violation because the meaning of B
3836is different in each translation unit.  If A only appears in a single
3837translation unit, the best way to silence the warning is to give it
3838internal linkage by putting it in an anonymous namespace as well.  The
3839compiler doesn't give this warning for types defined in the main .C
3840file, as those are unlikely to have multiple definitions.
3841@option{-Wsubobject-linkage} is enabled by default.
3842
3843@item -Weffc++ @r{(C++ and Objective-C++ only)}
3844@opindex Weffc++
3845@opindex Wno-effc++
3846Warn about violations of the following style guidelines from Scott Meyers'
3847@cite{Effective C++} series of books:
3848
3849@itemize @bullet
3850@item
3851Define a copy constructor and an assignment operator for classes
3852with dynamically-allocated memory.
3853
3854@item
3855Prefer initialization to assignment in constructors.
3856
3857@item
3858Have @code{operator=} return a reference to @code{*this}.
3859
3860@item
3861Don't try to return a reference when you must return an object.
3862
3863@item
3864Distinguish between prefix and postfix forms of increment and
3865decrement operators.
3866
3867@item
3868Never overload @code{&&}, @code{||}, or @code{,}.
3869
3870@end itemize
3871
3872This option also enables @option{-Wnon-virtual-dtor}, which is also
3873one of the effective C++ recommendations.  However, the check is
3874extended to warn about the lack of virtual destructor in accessible
3875non-polymorphic bases classes too.
3876
3877When selecting this option, be aware that the standard library
3878headers do not obey all of these guidelines; use @samp{grep -v}
3879to filter out those warnings.
3880
3881@item -Wno-exceptions @r{(C++ and Objective-C++ only)}
3882@opindex Wexceptions
3883@opindex Wno-exceptions
3884Disable the warning about the case when an exception handler is shadowed by
3885another handler, which can point out a wrong ordering of exception handlers.
3886
3887@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3888@opindex Wstrict-null-sentinel
3889@opindex Wno-strict-null-sentinel
3890Warn about the use of an uncasted @code{NULL} as sentinel.  When
3891compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3892to @code{__null}.  Although it is a null pointer constant rather than a
3893null pointer, it is guaranteed to be of the same size as a pointer.
3894But this use is not portable across different compilers.
3895
3896@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3897@opindex Wno-non-template-friend
3898@opindex Wnon-template-friend
3899Disable warnings when non-template friend functions are declared
3900within a template.  In very old versions of GCC that predate implementation
3901of the ISO standard, declarations such as
3902@samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3903could be interpreted as a particular specialization of a template
3904function; the warning exists to diagnose compatibility problems,
3905and is enabled by default.
3906
3907@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3908@opindex Wold-style-cast
3909@opindex Wno-old-style-cast
3910Warn if an old-style (C-style) cast to a non-void type is used within
3911a C++ program.  The new-style casts (@code{dynamic_cast},
3912@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3913less vulnerable to unintended effects and much easier to search for.
3914
3915@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3916@opindex Woverloaded-virtual
3917@opindex Wno-overloaded-virtual
3918@cindex overloaded virtual function, warning
3919@cindex warning for overloaded virtual function
3920Warn when a function declaration hides virtual functions from a
3921base class.  For example, in:
3922
3923@smallexample
3924struct A @{
3925  virtual void f();
3926@};
3927
3928struct B: public A @{
3929  void f(int);
3930@};
3931@end smallexample
3932
3933the @code{A} class version of @code{f} is hidden in @code{B}, and code
3934like:
3935
3936@smallexample
3937B* b;
3938b->f();
3939@end smallexample
3940
3941@noindent
3942fails to compile.
3943
3944@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3945@opindex Wno-pmf-conversions
3946@opindex Wpmf-conversions
3947Disable the diagnostic for converting a bound pointer to member function
3948to a plain pointer.
3949
3950@item -Wsign-promo @r{(C++ and Objective-C++ only)}
3951@opindex Wsign-promo
3952@opindex Wno-sign-promo
3953Warn when overload resolution chooses a promotion from unsigned or
3954enumerated type to a signed type, over a conversion to an unsigned type of
3955the same size.  Previous versions of G++ tried to preserve
3956unsignedness, but the standard mandates the current behavior.
3957
3958@item -Wtemplates @r{(C++ and Objective-C++ only)}
3959@opindex Wtemplates
3960@opindex Wno-templates
3961Warn when a primary template declaration is encountered.  Some coding
3962rules disallow templates, and this may be used to enforce that rule.
3963The warning is inactive inside a system header file, such as the STL, so
3964one can still use the STL.  One may also instantiate or specialize
3965templates.
3966
3967@item -Wno-mismatched-new-delete @r{(C++ and Objective-C++ only)}
3968@opindex Wmismatched-new-delete
3969@opindex Wno-mismatched-new-delete
3970Warn for mismatches between calls to @code{operator new} or @code{operator
3971delete} and the corresponding call to the allocation or deallocation function.
3972This includes invocations of C++ @code{operator delete} with pointers
3973returned from either mismatched forms of @code{operator new}, or from other
3974functions that allocate objects for which the @code{operator delete} isn't
3975a suitable deallocator, as well as calls to other deallocation functions
3976with pointers returned from @code{operator new} for which the deallocation
3977function isn't suitable.
3978
3979For example, the @code{delete} expression in the function below is diagnosed
3980because it doesn't match the array form of the @code{new} expression
3981the pointer argument was returned from.  Similarly, the call to @code{free}
3982is also diagnosed.
3983
3984@smallexample
3985void f ()
3986@{
3987  int *a = new int[n];
3988  delete a;   // warning: mismatch in array forms of expressions
3989
3990  char *p = new char[n];
3991  free (p);   // warning: mismatch between new and free
3992@}
3993@end smallexample
3994
3995The related option @option{-Wmismatched-dealloc} diagnoses mismatches
3996involving allocation and deallocation functions other than @code{operator
3997new} and @code{operator delete}.
3998
3999@option{-Wmismatched-new-delete} is enabled by default.
4000
4001@item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4002@opindex Wmismatched-tags
4003@opindex Wno-mismatched-tags
4004Warn for declarations of structs, classes, and class templates and their
4005specializations with a class-key that does not match either the definition
4006or the first declaration if no definition is provided.
4007
4008For example, the declaration of @code{struct Object} in the argument list
4009of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4010class-key @code{struct} or replace it with @code{class} to match its definition.
4011@smallexample
4012class Object @{
4013public:
4014  virtual ~Object () = 0;
4015@};
4016void draw (struct Object*);
4017@end smallexample
4018
4019It is not wrong to declare a class with the class-key @code{struct} as
4020the example above shows.  The @option{-Wmismatched-tags} option is intended
4021to help achieve a consistent style of class declarations.  In code that is
4022intended to be portable to Windows-based compilers the warning helps prevent
4023unresolved references due to the difference in the mangling of symbols
4024declared with different class-keys.  The option can be used either on its
4025own or in conjunction with @option{-Wredundant-tags}.
4026
4027@item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4028@opindex Wmultiple-inheritance
4029@opindex Wno-multiple-inheritance
4030Warn when a class is defined with multiple direct base classes.  Some
4031coding rules disallow multiple inheritance, and this may be used to
4032enforce that rule.  The warning is inactive inside a system header file,
4033such as the STL, so one can still use the STL.  One may also define
4034classes that indirectly use multiple inheritance.
4035
4036@item -Wvirtual-inheritance
4037@opindex Wvirtual-inheritance
4038@opindex Wno-virtual-inheritance
4039Warn when a class is defined with a virtual direct base class.  Some
4040coding rules disallow multiple inheritance, and this may be used to
4041enforce that rule.  The warning is inactive inside a system header file,
4042such as the STL, so one can still use the STL.  One may also define
4043classes that indirectly use virtual inheritance.
4044
4045@item -Wno-virtual-move-assign
4046@opindex Wvirtual-move-assign
4047@opindex Wno-virtual-move-assign
4048Suppress warnings about inheriting from a virtual base with a
4049non-trivial C++11 move assignment operator.  This is dangerous because
4050if the virtual base is reachable along more than one path, it is
4051moved multiple times, which can mean both objects end up in the
4052moved-from state.  If the move assignment operator is written to avoid
4053moving from a moved-from object, this warning can be disabled.
4054
4055@item -Wnamespaces
4056@opindex Wnamespaces
4057@opindex Wno-namespaces
4058Warn when a namespace definition is opened.  Some coding rules disallow
4059namespaces, and this may be used to enforce that rule.  The warning is
4060inactive inside a system header file, such as the STL, so one can still
4061use the STL.  One may also use using directives and qualified names.
4062
4063@item -Wno-terminate @r{(C++ and Objective-C++ only)}
4064@opindex Wterminate
4065@opindex Wno-terminate
4066Disable the warning about a throw-expression that will immediately
4067result in a call to @code{terminate}.
4068
4069@item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4070@opindex Wvexing-parse
4071@opindex Wno-vexing-parse
4072Warn about the most vexing parse syntactic ambiguity.  This warns about
4073the cases when a declaration looks like a variable definition, but the
4074C++ language requires it to be interpreted as a function declaration.
4075For instance:
4076
4077@smallexample
4078void f(double a) @{
4079  int i();        // extern int i (void);
4080  int n(int(a));  // extern int n (int);
4081@}
4082@end smallexample
4083
4084Another example:
4085
4086@smallexample
4087struct S @{ S(int); @};
4088void f(double a) @{
4089  S x(int(a));   // extern struct S x (int);
4090  S y(int());    // extern struct S y (int (*) (void));
4091  S z();         // extern struct S z (void);
4092@}
4093@end smallexample
4094
4095The warning will suggest options how to deal with such an ambiguity; e.g.,
4096it can suggest removing the parentheses or using braces instead.
4097
4098This warning is enabled by default.
4099
4100@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4101@opindex Wno-class-conversion
4102@opindex Wclass-conversion
4103Do not warn when a conversion function converts an
4104object to the same type, to a base class of that type, or to void; such
4105a conversion function will never be called.
4106
4107@item -Wvolatile @r{(C++ and Objective-C++ only)}
4108@opindex Wvolatile
4109@opindex Wno-volatile
4110Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4111postfix and prefix @code{++} and @code{--} expressions of
4112@code{volatile}-qualified types, using simple assignments where the left
4113operand is a @code{volatile}-qualified non-class type for their value,
4114compound assignments where the left operand is a @code{volatile}-qualified
4115non-class type, @code{volatile}-qualified function return type,
4116@code{volatile}-qualified parameter type, and structured bindings of a
4117@code{volatile}-qualified type.  This usage was deprecated in C++20.
4118
4119Enabled by default with @option{-std=c++20}.
4120
4121@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4122@opindex Wzero-as-null-pointer-constant
4123@opindex Wno-zero-as-null-pointer-constant
4124Warn when a literal @samp{0} is used as null pointer constant.  This can
4125be useful to facilitate the conversion to @code{nullptr} in C++11.
4126
4127@item -Waligned-new
4128@opindex Waligned-new
4129@opindex Wno-aligned-new
4130Warn about a new-expression of a type that requires greater alignment
4131than the @code{alignof(std::max_align_t)} but uses an allocation
4132function without an explicit alignment parameter. This option is
4133enabled by @option{-Wall}.
4134
4135Normally this only warns about global allocation functions, but
4136@option{-Waligned-new=all} also warns about class member allocation
4137functions.
4138
4139@item -Wno-placement-new
4140@itemx -Wplacement-new=@var{n}
4141@opindex Wplacement-new
4142@opindex Wno-placement-new
4143Warn about placement new expressions with undefined behavior, such as
4144constructing an object in a buffer that is smaller than the type of
4145the object.  For example, the placement new expression below is diagnosed
4146because it attempts to construct an array of 64 integers in a buffer only
414764 bytes large.
4148@smallexample
4149char buf [64];
4150new (buf) int[64];
4151@end smallexample
4152This warning is enabled by default.
4153
4154@table @gcctabopt
4155@item -Wplacement-new=1
4156This is the default warning level of @option{-Wplacement-new}.  At this
4157level the warning is not issued for some strictly undefined constructs that
4158GCC allows as extensions for compatibility with legacy code.  For example,
4159the following @code{new} expression is not diagnosed at this level even
4160though it has undefined behavior according to the C++ standard because
4161it writes past the end of the one-element array.
4162@smallexample
4163struct S @{ int n, a[1]; @};
4164S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4165new (s->a)int [32]();
4166@end smallexample
4167
4168@item -Wplacement-new=2
4169At this level, in addition to diagnosing all the same constructs as at level
41701, a diagnostic is also issued for placement new expressions that construct
4171an object in the last member of structure whose type is an array of a single
4172element and whose size is less than the size of the object being constructed.
4173While the previous example would be diagnosed, the following construct makes
4174use of the flexible member array extension to avoid the warning at level 2.
4175@smallexample
4176struct S @{ int n, a[]; @};
4177S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4178new (s->a)int [32]();
4179@end smallexample
4180
4181@end table
4182
4183@item -Wcatch-value
4184@itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4185@opindex Wcatch-value
4186@opindex Wno-catch-value
4187Warn about catch handlers that do not catch via reference.
4188With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4189warn about polymorphic class types that are caught by value.
4190With @option{-Wcatch-value=2} warn about all class types that are caught
4191by value. With @option{-Wcatch-value=3} warn about all types that are
4192not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4193
4194@item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4195@opindex Wconditionally-supported
4196@opindex Wno-conditionally-supported
4197Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4198
4199@item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4200@opindex Wdelete-incomplete
4201@opindex Wno-delete-incomplete
4202Do not warn when deleting a pointer to incomplete type, which may cause
4203undefined behavior at runtime.  This warning is enabled by default.
4204
4205@item -Wextra-semi @r{(C++, Objective-C++ only)}
4206@opindex Wextra-semi
4207@opindex Wno-extra-semi
4208Warn about redundant semicolons after in-class function definitions.
4209
4210@item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4211@opindex Winaccessible-base
4212@opindex Wno-inaccessible-base
4213This option controls warnings
4214when a base class is inaccessible in a class derived from it due to
4215ambiguity.  The warning is enabled by default.
4216Note that the warning for ambiguous virtual
4217bases is enabled by the @option{-Wextra} option.
4218@smallexample
4219@group
4220struct A @{ int a; @};
4221
4222struct B : A @{ @};
4223
4224struct C : B, A @{ @};
4225@end group
4226@end smallexample
4227
4228@item -Wno-inherited-variadic-ctor
4229@opindex Winherited-variadic-ctor
4230@opindex Wno-inherited-variadic-ctor
4231Suppress warnings about use of C++11 inheriting constructors when the
4232base class inherited from has a C variadic constructor; the warning is
4233on by default because the ellipsis is not inherited.
4234
4235@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4236@opindex Wno-invalid-offsetof
4237@opindex Winvalid-offsetof
4238Suppress warnings from applying the @code{offsetof} macro to a non-POD
4239type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4240to a non-standard-layout type is undefined.  In existing C++ implementations,
4241however, @code{offsetof} typically gives meaningful results.
4242This flag is for users who are aware that they are
4243writing nonportable code and who have deliberately chosen to ignore the
4244warning about it.
4245
4246The restrictions on @code{offsetof} may be relaxed in a future version
4247of the C++ standard.
4248
4249@item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4250@opindex Wsized-deallocation
4251@opindex Wno-sized-deallocation
4252Warn about a definition of an unsized deallocation function
4253@smallexample
4254void operator delete (void *) noexcept;
4255void operator delete[] (void *) noexcept;
4256@end smallexample
4257without a definition of the corresponding sized deallocation function
4258@smallexample
4259void operator delete (void *, std::size_t) noexcept;
4260void operator delete[] (void *, std::size_t) noexcept;
4261@end smallexample
4262or vice versa.  Enabled by @option{-Wextra} along with
4263@option{-fsized-deallocation}.
4264
4265@item -Wsuggest-final-types
4266@opindex Wno-suggest-final-types
4267@opindex Wsuggest-final-types
4268Warn about types with virtual methods where code quality would be improved
4269if the type were declared with the C++11 @code{final} specifier,
4270or, if possible,
4271declared in an anonymous namespace. This allows GCC to more aggressively
4272devirtualize the polymorphic calls. This warning is more effective with
4273link-time optimization,
4274where the information about the class hierarchy graph is
4275more complete.
4276
4277@item -Wsuggest-final-methods
4278@opindex Wno-suggest-final-methods
4279@opindex Wsuggest-final-methods
4280Warn about virtual methods where code quality would be improved if the method
4281were declared with the C++11 @code{final} specifier,
4282or, if possible, its type were
4283declared in an anonymous namespace or with the @code{final} specifier.
4284This warning is
4285more effective with link-time optimization, where the information about the
4286class hierarchy graph is more complete. It is recommended to first consider
4287suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4288annotations.
4289
4290@item -Wsuggest-override
4291@opindex Wsuggest-override
4292@opindex Wno-suggest-override
4293Warn about overriding virtual functions that are not marked with the
4294@code{override} keyword.
4295
4296@item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4297@opindex Wuseless-cast
4298@opindex Wno-useless-cast
4299Warn when an expression is casted to its own type.
4300
4301@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4302@opindex Wconversion-null
4303@opindex Wno-conversion-null
4304Do not warn for conversions between @code{NULL} and non-pointer
4305types. @option{-Wconversion-null} is enabled by default.
4306
4307@end table
4308
4309@node Objective-C and Objective-C++ Dialect Options
4310@section Options Controlling Objective-C and Objective-C++ Dialects
4311
4312@cindex compiler options, Objective-C and Objective-C++
4313@cindex Objective-C and Objective-C++ options, command-line
4314@cindex options, Objective-C and Objective-C++
4315(NOTE: This manual does not describe the Objective-C and Objective-C++
4316languages themselves.  @xref{Standards,,Language Standards
4317Supported by GCC}, for references.)
4318
4319This section describes the command-line options that are only meaningful
4320for Objective-C and Objective-C++ programs.  You can also use most of
4321the language-independent GNU compiler options.
4322For example, you might compile a file @file{some_class.m} like this:
4323
4324@smallexample
4325gcc -g -fgnu-runtime -O -c some_class.m
4326@end smallexample
4327
4328@noindent
4329In this example, @option{-fgnu-runtime} is an option meant only for
4330Objective-C and Objective-C++ programs; you can use the other options with
4331any language supported by GCC@.
4332
4333Note that since Objective-C is an extension of the C language, Objective-C
4334compilations may also use options specific to the C front-end (e.g.,
4335@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4336C++-specific options (e.g., @option{-Wabi}).
4337
4338Here is a list of options that are @emph{only} for compiling Objective-C
4339and Objective-C++ programs:
4340
4341@table @gcctabopt
4342@item -fconstant-string-class=@var{class-name}
4343@opindex fconstant-string-class
4344Use @var{class-name} as the name of the class to instantiate for each
4345literal string specified with the syntax @code{@@"@dots{}"}.  The default
4346class name is @code{NXConstantString} if the GNU runtime is being used, and
4347@code{NSConstantString} if the NeXT runtime is being used (see below).  The
4348@option{-fconstant-cfstrings} option, if also present, overrides the
4349@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
4350to be laid out as constant CoreFoundation strings.
4351
4352@item -fgnu-runtime
4353@opindex fgnu-runtime
4354Generate object code compatible with the standard GNU Objective-C
4355runtime.  This is the default for most types of systems.
4356
4357@item -fnext-runtime
4358@opindex fnext-runtime
4359Generate output compatible with the NeXT runtime.  This is the default
4360for NeXT-based systems, including Darwin and Mac OS X@.  The macro
4361@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4362used.
4363
4364@item -fno-nil-receivers
4365@opindex fno-nil-receivers
4366@opindex fnil-receivers
4367Assume that all Objective-C message dispatches (@code{[receiver
4368message:arg]}) in this translation unit ensure that the receiver is
4369not @code{nil}.  This allows for more efficient entry points in the
4370runtime to be used.  This option is only available in conjunction with
4371the NeXT runtime and ABI version 0 or 1.
4372
4373@item -fobjc-abi-version=@var{n}
4374@opindex fobjc-abi-version
4375Use version @var{n} of the Objective-C ABI for the selected runtime.
4376This option is currently supported only for the NeXT runtime.  In that
4377case, Version 0 is the traditional (32-bit) ABI without support for
4378properties and other Objective-C 2.0 additions.  Version 1 is the
4379traditional (32-bit) ABI with support for properties and other
4380Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4381nothing is specified, the default is Version 0 on 32-bit target
4382machines, and Version 2 on 64-bit target machines.
4383
4384@item -fobjc-call-cxx-cdtors
4385@opindex fobjc-call-cxx-cdtors
4386For each Objective-C class, check if any of its instance variables is a
4387C++ object with a non-trivial default constructor.  If so, synthesize a
4388special @code{- (id) .cxx_construct} instance method which runs
4389non-trivial default constructors on any such instance variables, in order,
4390and then return @code{self}.  Similarly, check if any instance variable
4391is a C++ object with a non-trivial destructor, and if so, synthesize a
4392special @code{- (void) .cxx_destruct} method which runs
4393all such default destructors, in reverse order.
4394
4395The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4396methods thusly generated only operate on instance variables
4397declared in the current Objective-C class, and not those inherited
4398from superclasses.  It is the responsibility of the Objective-C
4399runtime to invoke all such methods in an object's inheritance
4400hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4401by the runtime immediately after a new object instance is allocated;
4402the @code{- (void) .cxx_destruct} methods are invoked immediately
4403before the runtime deallocates an object instance.
4404
4405As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4406support for invoking the @code{- (id) .cxx_construct} and
4407@code{- (void) .cxx_destruct} methods.
4408
4409@item -fobjc-direct-dispatch
4410@opindex fobjc-direct-dispatch
4411Allow fast jumps to the message dispatcher.  On Darwin this is
4412accomplished via the comm page.
4413
4414@item -fobjc-exceptions
4415@opindex fobjc-exceptions
4416Enable syntactic support for structured exception handling in
4417Objective-C, similar to what is offered by C++.  This option
4418is required to use the Objective-C keywords @code{@@try},
4419@code{@@throw}, @code{@@catch}, @code{@@finally} and
4420@code{@@synchronized}.  This option is available with both the GNU
4421runtime and the NeXT runtime (but not available in conjunction with
4422the NeXT runtime on Mac OS X 10.2 and earlier).
4423
4424@item -fobjc-gc
4425@opindex fobjc-gc
4426Enable garbage collection (GC) in Objective-C and Objective-C++
4427programs.  This option is only available with the NeXT runtime; the
4428GNU runtime has a different garbage collection implementation that
4429does not require special compiler flags.
4430
4431@item -fobjc-nilcheck
4432@opindex fobjc-nilcheck
4433For the NeXT runtime with version 2 of the ABI, check for a nil
4434receiver in method invocations before doing the actual method call.
4435This is the default and can be disabled using
4436@option{-fno-objc-nilcheck}.  Class methods and super calls are never
4437checked for nil in this way no matter what this flag is set to.
4438Currently this flag does nothing when the GNU runtime, or an older
4439version of the NeXT runtime ABI, is used.
4440
4441@item -fobjc-std=objc1
4442@opindex fobjc-std
4443Conform to the language syntax of Objective-C 1.0, the language
4444recognized by GCC 4.0.  This only affects the Objective-C additions to
4445the C/C++ language; it does not affect conformance to C/C++ standards,
4446which is controlled by the separate C/C++ dialect option flags.  When
4447this option is used with the Objective-C or Objective-C++ compiler,
4448any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4449This is useful if you need to make sure that your Objective-C code can
4450be compiled with older versions of GCC@.
4451
4452@item -freplace-objc-classes
4453@opindex freplace-objc-classes
4454Emit a special marker instructing @command{ld(1)} not to statically link in
4455the resulting object file, and allow @command{dyld(1)} to load it in at
4456run time instead.  This is used in conjunction with the Fix-and-Continue
4457debugging mode, where the object file in question may be recompiled and
4458dynamically reloaded in the course of program execution, without the need
4459to restart the program itself.  Currently, Fix-and-Continue functionality
4460is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4461and later.
4462
4463@item -fzero-link
4464@opindex fzero-link
4465When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4466to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4467compile time) with static class references that get initialized at load time,
4468which improves run-time performance.  Specifying the @option{-fzero-link} flag
4469suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4470to be retained.  This is useful in Zero-Link debugging mode, since it allows
4471for individual class implementations to be modified during program execution.
4472The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4473regardless of command-line options.
4474
4475@item -fno-local-ivars
4476@opindex fno-local-ivars
4477@opindex flocal-ivars
4478By default instance variables in Objective-C can be accessed as if
4479they were local variables from within the methods of the class they're
4480declared in.  This can lead to shadowing between instance variables
4481and other variables declared either locally inside a class method or
4482globally with the same name.  Specifying the @option{-fno-local-ivars}
4483flag disables this behavior thus avoiding variable shadowing issues.
4484
4485@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4486@opindex fivar-visibility
4487Set the default instance variable visibility to the specified option
4488so that instance variables declared outside the scope of any access
4489modifier directives default to the specified visibility.
4490
4491@item -gen-decls
4492@opindex gen-decls
4493Dump interface declarations for all classes seen in the source file to a
4494file named @file{@var{sourcename}.decl}.
4495
4496@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4497@opindex Wassign-intercept
4498@opindex Wno-assign-intercept
4499Warn whenever an Objective-C assignment is being intercepted by the
4500garbage collector.
4501
4502@item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
4503@opindex Wproperty-assign-default
4504@opindex Wno-property-assign-default
4505Do not warn if a property for an Objective-C object has no assign
4506semantics specified.
4507
4508@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
4509@opindex Wno-protocol
4510@opindex Wprotocol
4511If a class is declared to implement a protocol, a warning is issued for
4512every method in the protocol that is not implemented by the class.  The
4513default behavior is to issue a warning for every method not explicitly
4514implemented in the class, even if a method implementation is inherited
4515from the superclass.  If you use the @option{-Wno-protocol} option, then
4516methods inherited from the superclass are considered to be implemented,
4517and no warning is issued for them.
4518
4519@item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
4520@opindex Wobjc-root-class
4521Warn if a class interface lacks a superclass. Most classes will inherit
4522from @code{NSObject} (or @code{Object}) for example.  When declaring
4523classes intended to be root classes, the warning can be suppressed by
4524marking their interfaces with @code{__attribute__((objc_root_class))}.
4525
4526@item -Wselector @r{(Objective-C and Objective-C++ only)}
4527@opindex Wselector
4528@opindex Wno-selector
4529Warn if multiple methods of different types for the same selector are
4530found during compilation.  The check is performed on the list of methods
4531in the final stage of compilation.  Additionally, a check is performed
4532for each selector appearing in a @code{@@selector(@dots{})}
4533expression, and a corresponding method for that selector has been found
4534during compilation.  Because these checks scan the method table only at
4535the end of compilation, these warnings are not produced if the final
4536stage of compilation is not reached, for example because an error is
4537found during compilation, or because the @option{-fsyntax-only} option is
4538being used.
4539
4540@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
4541@opindex Wstrict-selector-match
4542@opindex Wno-strict-selector-match
4543Warn if multiple methods with differing argument and/or return types are
4544found for a given selector when attempting to send a message using this
4545selector to a receiver of type @code{id} or @code{Class}.  When this flag
4546is off (which is the default behavior), the compiler omits such warnings
4547if any differences found are confined to types that share the same size
4548and alignment.
4549
4550@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
4551@opindex Wundeclared-selector
4552@opindex Wno-undeclared-selector
4553Warn if a @code{@@selector(@dots{})} expression referring to an
4554undeclared selector is found.  A selector is considered undeclared if no
4555method with that name has been declared before the
4556@code{@@selector(@dots{})} expression, either explicitly in an
4557@code{@@interface} or @code{@@protocol} declaration, or implicitly in
4558an @code{@@implementation} section.  This option always performs its
4559checks as soon as a @code{@@selector(@dots{})} expression is found,
4560while @option{-Wselector} only performs its checks in the final stage of
4561compilation.  This also enforces the coding style convention
4562that methods and selectors must be declared before being used.
4563
4564@item -print-objc-runtime-info
4565@opindex print-objc-runtime-info
4566Generate C header describing the largest structure that is passed by
4567value, if any.
4568
4569@end table
4570
4571@node Diagnostic Message Formatting Options
4572@section Options to Control Diagnostic Messages Formatting
4573@cindex options to control diagnostics formatting
4574@cindex diagnostic messages
4575@cindex message formatting
4576
4577Traditionally, diagnostic messages have been formatted irrespective of
4578the output device's aspect (e.g.@: its width, @dots{}).  You can use the
4579options described below
4580to control the formatting algorithm for diagnostic messages,
4581e.g.@: how many characters per line, how often source location
4582information should be reported.  Note that some language front ends may not
4583honor these options.
4584
4585@table @gcctabopt
4586@item -fmessage-length=@var{n}
4587@opindex fmessage-length
4588Try to format error messages so that they fit on lines of about
4589@var{n} characters.  If @var{n} is zero, then no line-wrapping is
4590done; each error message appears on a single line.  This is the
4591default for all front ends.
4592
4593Note - this option also affects the display of the @samp{#error} and
4594@samp{#warning} pre-processor directives, and the @samp{deprecated}
4595function/type/variable attribute.  It does not however affect the
4596@samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
4597
4598@item -fdiagnostics-plain-output
4599This option requests that diagnostic output look as plain as possible, which
4600may be useful when running @command{dejagnu} or other utilities that need to
4601parse diagnostics output and prefer that it remain more stable over time.
4602@option{-fdiagnostics-plain-output} is currently equivalent to the following
4603options:
4604@gccoptlist{-fno-diagnostics-show-caret @gol
4605-fno-diagnostics-show-line-numbers @gol
4606-fdiagnostics-color=never @gol
4607-fdiagnostics-urls=never @gol
4608-fdiagnostics-path-format=separate-events}
4609In the future, if GCC changes the default appearance of its diagnostics, the
4610corresponding option to disable the new behavior will be added to this list.
4611
4612@item -fdiagnostics-show-location=once
4613@opindex fdiagnostics-show-location
4614Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
4615reporter to emit source location information @emph{once}; that is, in
4616case the message is too long to fit on a single physical line and has to
4617be wrapped, the source location won't be emitted (as prefix) again,
4618over and over, in subsequent continuation lines.  This is the default
4619behavior.
4620
4621@item -fdiagnostics-show-location=every-line
4622Only meaningful in line-wrapping mode.  Instructs the diagnostic
4623messages reporter to emit the same source location information (as
4624prefix) for physical lines that result from the process of breaking
4625a message which is too long to fit on a single line.
4626
4627@item -fdiagnostics-color[=@var{WHEN}]
4628@itemx -fno-diagnostics-color
4629@opindex fdiagnostics-color
4630@cindex highlight, color
4631@vindex GCC_COLORS @r{environment variable}
4632Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
4633or @samp{auto}.  The default depends on how the compiler has been configured,
4634it can be any of the above @var{WHEN} options or also @samp{never}
4635if @env{GCC_COLORS} environment variable isn't present in the environment,
4636and @samp{auto} otherwise.
4637@samp{auto} makes GCC use color only when the standard error is a terminal,
4638and when not executing in an emacs shell.
4639The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4640aliases for @option{-fdiagnostics-color=always} and
4641@option{-fdiagnostics-color=never}, respectively.
4642
4643The colors are defined by the environment variable @env{GCC_COLORS}.
4644Its value is a colon-separated list of capabilities and Select Graphic
4645Rendition (SGR) substrings. SGR commands are interpreted by the
4646terminal or terminal emulator.  (See the section in the documentation
4647of your text terminal for permitted values and their meanings as
4648character attributes.)  These substring values are integers in decimal
4649representation and can be concatenated with semicolons.
4650Common values to concatenate include
4651@samp{1} for bold,
4652@samp{4} for underline,
4653@samp{5} for blink,
4654@samp{7} for inverse,
4655@samp{39} for default foreground color,
4656@samp{30} to @samp{37} for foreground colors,
4657@samp{90} to @samp{97} for 16-color mode foreground colors,
4658@samp{38;5;0} to @samp{38;5;255}
4659for 88-color and 256-color modes foreground colors,
4660@samp{49} for default background color,
4661@samp{40} to @samp{47} for background colors,
4662@samp{100} to @samp{107} for 16-color mode background colors,
4663and @samp{48;5;0} to @samp{48;5;255}
4664for 88-color and 256-color modes background colors.
4665
4666The default @env{GCC_COLORS} is
4667@smallexample
4668error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4669quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4670diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4671type-diff=01;32
4672@end smallexample
4673@noindent
4674where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4675@samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4676@samp{01} is bold, and @samp{31} is red.
4677Setting @env{GCC_COLORS} to the empty string disables colors.
4678Supported capabilities are as follows.
4679
4680@table @code
4681@item error=
4682@vindex error GCC_COLORS @r{capability}
4683SGR substring for error: markers.
4684
4685@item warning=
4686@vindex warning GCC_COLORS @r{capability}
4687SGR substring for warning: markers.
4688
4689@item note=
4690@vindex note GCC_COLORS @r{capability}
4691SGR substring for note: markers.
4692
4693@item path=
4694@vindex path GCC_COLORS @r{capability}
4695SGR substring for colorizing paths of control-flow events as printed
4696via @option{-fdiagnostics-path-format=}, such as the identifiers of
4697individual events and lines indicating interprocedural calls and returns.
4698
4699@item range1=
4700@vindex range1 GCC_COLORS @r{capability}
4701SGR substring for first additional range.
4702
4703@item range2=
4704@vindex range2 GCC_COLORS @r{capability}
4705SGR substring for second additional range.
4706
4707@item locus=
4708@vindex locus GCC_COLORS @r{capability}
4709SGR substring for location information, @samp{file:line} or
4710@samp{file:line:column} etc.
4711
4712@item quote=
4713@vindex quote GCC_COLORS @r{capability}
4714SGR substring for information printed within quotes.
4715
4716@item fixit-insert=
4717@vindex fixit-insert GCC_COLORS @r{capability}
4718SGR substring for fix-it hints suggesting text to
4719be inserted or replaced.
4720
4721@item fixit-delete=
4722@vindex fixit-delete GCC_COLORS @r{capability}
4723SGR substring for fix-it hints suggesting text to
4724be deleted.
4725
4726@item diff-filename=
4727@vindex diff-filename GCC_COLORS @r{capability}
4728SGR substring for filename headers within generated patches.
4729
4730@item diff-hunk=
4731@vindex diff-hunk GCC_COLORS @r{capability}
4732SGR substring for the starts of hunks within generated patches.
4733
4734@item diff-delete=
4735@vindex diff-delete GCC_COLORS @r{capability}
4736SGR substring for deleted lines within generated patches.
4737
4738@item diff-insert=
4739@vindex diff-insert GCC_COLORS @r{capability}
4740SGR substring for inserted lines within generated patches.
4741
4742@item type-diff=
4743@vindex type-diff GCC_COLORS @r{capability}
4744SGR substring for highlighting mismatching types within template
4745arguments in the C++ frontend.
4746@end table
4747
4748@item -fdiagnostics-urls[=@var{WHEN}]
4749@opindex fdiagnostics-urls
4750@cindex urls
4751@vindex GCC_URLS @r{environment variable}
4752@vindex TERM_URLS @r{environment variable}
4753Use escape sequences to embed URLs in diagnostics.  For example, when
4754@option{-fdiagnostics-show-option} emits text showing the command-line
4755option controlling a diagnostic, embed a URL for documentation of that
4756option.
4757
4758@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4759@samp{auto} makes GCC use URL escape sequences only when the standard error
4760is a terminal, and when not executing in an emacs shell or any graphical
4761terminal which is known to be incompatible with this feature, see below.
4762
4763The default depends on how the compiler has been configured.
4764It can be any of the above @var{WHEN} options.
4765
4766GCC can also be configured (via the
4767@option{--with-diagnostics-urls=auto-if-env} configure-time option)
4768so that the default is affected by environment variables.
4769Under such a configuration, GCC defaults to using @samp{auto}
4770if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4771present and non-empty in the environment of the compiler, or @samp{never}
4772if neither are.
4773
4774However, even with @option{-fdiagnostics-urls=always} the behavior is
4775dependent on those environment variables:
4776If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4777diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
4778If set to @samp{bel}, the default, URLs use BEL escape sequences.
4779Any other non-empty value enables the feature.
4780If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4781Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4782BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4783
4784At this time GCC tries to detect also a few terminals that are known to
4785not implement the URL feature, and have bugs or at least had bugs in
4786some versions that are still in use, where the URL escapes are likely
4787to misbehave, i.e. print garbage on the screen.
4788That list is currently xfce4-terminal, certain known to be buggy
4789gnome-terminal versions, the linux console, and mingw.
4790This check can be skipped with the @option{-fdiagnostics-urls=always}.
4791
4792@item -fno-diagnostics-show-option
4793@opindex fno-diagnostics-show-option
4794@opindex fdiagnostics-show-option
4795By default, each diagnostic emitted includes text indicating the
4796command-line option that directly controls the diagnostic (if such an
4797option is known to the diagnostic machinery).  Specifying the
4798@option{-fno-diagnostics-show-option} flag suppresses that behavior.
4799
4800@item -fno-diagnostics-show-caret
4801@opindex fno-diagnostics-show-caret
4802@opindex fdiagnostics-show-caret
4803By default, each diagnostic emitted includes the original source line
4804and a caret @samp{^} indicating the column.  This option suppresses this
4805information.  The source line is truncated to @var{n} characters, if
4806the @option{-fmessage-length=n} option is given.  When the output is done
4807to the terminal, the width is limited to the width given by the
4808@env{COLUMNS} environment variable or, if not set, to the terminal width.
4809
4810@item -fno-diagnostics-show-labels
4811@opindex fno-diagnostics-show-labels
4812@opindex fdiagnostics-show-labels
4813By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4814diagnostics can label ranges of source code with pertinent information, such
4815as the types of expressions:
4816
4817@smallexample
4818    printf ("foo %s bar", long_i + long_j);
4819                 ~^       ~~~~~~~~~~~~~~~
4820                  |              |
4821                  char *         long int
4822@end smallexample
4823
4824This option suppresses the printing of these labels (in the example above,
4825the vertical bars and the ``char *'' and ``long int'' text).
4826
4827@item -fno-diagnostics-show-cwe
4828@opindex fno-diagnostics-show-cwe
4829@opindex fdiagnostics-show-cwe
4830Diagnostic messages can optionally have an associated
4831@url{https://cwe.mitre.org/index.html, CWE} identifier.
4832GCC itself only provides such metadata for some of the @option{-fanalyzer}
4833diagnostics.  GCC plugins may also provide diagnostics with such metadata.
4834By default, if this information is present, it will be printed with
4835the diagnostic.  This option suppresses the printing of this metadata.
4836
4837@item -fno-diagnostics-show-line-numbers
4838@opindex fno-diagnostics-show-line-numbers
4839@opindex fdiagnostics-show-line-numbers
4840By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4841a left margin is printed, showing line numbers.  This option suppresses this
4842left margin.
4843
4844@item -fdiagnostics-minimum-margin-width=@var{width}
4845@opindex fdiagnostics-minimum-margin-width
4846This option controls the minimum width of the left margin printed by
4847@option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
4848
4849@item -fdiagnostics-parseable-fixits
4850@opindex fdiagnostics-parseable-fixits
4851Emit fix-it hints in a machine-parseable format, suitable for consumption
4852by IDEs.  For each fix-it, a line will be printed after the relevant
4853diagnostic, starting with the string ``fix-it:''.  For example:
4854
4855@smallexample
4856fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4857@end smallexample
4858
4859The location is expressed as a half-open range, expressed as a count of
4860bytes, starting at byte 1 for the initial column.  In the above example,
4861bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4862given string:
4863
4864@smallexample
486500000000011111111112222222222
486612345678901234567890123456789
4867  gtk_widget_showall (dlg);
4868  ^^^^^^^^^^^^^^^^^^
4869  gtk_widget_show_all
4870@end smallexample
4871
4872The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4873newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4874(e.g. vertical tab as ``\013'').
4875
4876An empty replacement string indicates that the given range is to be removed.
4877An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4878be inserted at the given position.
4879
4880@item -fdiagnostics-generate-patch
4881@opindex fdiagnostics-generate-patch
4882Print fix-it hints to stderr in unified diff format, after any diagnostics
4883are printed.  For example:
4884
4885@smallexample
4886--- test.c
4887+++ test.c
4888@@ -42,5 +42,5 @@
4889
4890 void show_cb(GtkDialog *dlg)
4891 @{
4892-  gtk_widget_showall(dlg);
4893+  gtk_widget_show_all(dlg);
4894 @}
4895
4896@end smallexample
4897
4898The diff may or may not be colorized, following the same rules
4899as for diagnostics (see @option{-fdiagnostics-color}).
4900
4901@item -fdiagnostics-show-template-tree
4902@opindex fdiagnostics-show-template-tree
4903
4904In the C++ frontend, when printing diagnostics showing mismatching
4905template types, such as:
4906
4907@smallexample
4908  could not convert 'std::map<int, std::vector<double> >()'
4909    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4910@end smallexample
4911
4912the @option{-fdiagnostics-show-template-tree} flag enables printing a
4913tree-like structure showing the common and differing parts of the types,
4914such as:
4915
4916@smallexample
4917  map<
4918    [...],
4919    vector<
4920      [double != float]>>
4921@end smallexample
4922
4923The parts that differ are highlighted with color (``double'' and
4924``float'' in this case).
4925
4926@item -fno-elide-type
4927@opindex fno-elide-type
4928@opindex felide-type
4929By default when the C++ frontend prints diagnostics showing mismatching
4930template types, common parts of the types are printed as ``[...]'' to
4931simplify the error message.  For example:
4932
4933@smallexample
4934  could not convert 'std::map<int, std::vector<double> >()'
4935    from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4936@end smallexample
4937
4938Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4939This flag also affects the output of the
4940@option{-fdiagnostics-show-template-tree} flag.
4941
4942@item -fdiagnostics-path-format=@var{KIND}
4943@opindex fdiagnostics-path-format
4944Specify how to print paths of control-flow events for diagnostics that
4945have such a path associated with them.
4946
4947@var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4948the default.
4949
4950@samp{none} means to not print diagnostic paths.
4951
4952@samp{separate-events} means to print a separate ``note'' diagnostic for
4953each event within the diagnostic.  For example:
4954
4955@smallexample
4956test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4957test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4958test.c:27:3: note: (2) when 'i < count'
4959test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4960@end smallexample
4961
4962@samp{inline-events} means to print the events ``inline'' within the source
4963code.  This view attempts to consolidate the events into runs of
4964sufficiently-close events, printing them as labelled ranges within the source.
4965
4966For example, the same events as above might be printed as:
4967
4968@smallexample
4969  'test': events 1-3
4970    |
4971    |   25 |   list = PyList_New(0);
4972    |      |          ^~~~~~~~~~~~~
4973    |      |          |
4974    |      |          (1) when 'PyList_New' fails, returning NULL
4975    |   26 |
4976    |   27 |   for (i = 0; i < count; i++) @{
4977    |      |   ~~~
4978    |      |   |
4979    |      |   (2) when 'i < count'
4980    |   28 |     item = PyLong_FromLong(random());
4981    |   29 |     PyList_Append(list, item);
4982    |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
4983    |      |     |
4984    |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4985    |
4986@end smallexample
4987
4988Interprocedural control flow is shown by grouping the events by stack frame,
4989and using indentation to show how stack frames are nested, pushed, and popped.
4990
4991For example:
4992
4993@smallexample
4994  'test': events 1-2
4995    |
4996    |  133 | @{
4997    |      | ^
4998    |      | |
4999    |      | (1) entering 'test'
5000    |  134 |   boxed_int *obj = make_boxed_int (i);
5001    |      |                    ~~~~~~~~~~~~~~~~~~
5002    |      |                    |
5003    |      |                    (2) calling 'make_boxed_int'
5004    |
5005    +--> 'make_boxed_int': events 3-4
5006           |
5007           |  120 | @{
5008           |      | ^
5009           |      | |
5010           |      | (3) entering 'make_boxed_int'
5011           |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5012           |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5013           |      |                                    |
5014           |      |                                    (4) calling 'wrapped_malloc'
5015           |
5016           +--> 'wrapped_malloc': events 5-6
5017                  |
5018                  |    7 | @{
5019                  |      | ^
5020                  |      | |
5021                  |      | (5) entering 'wrapped_malloc'
5022                  |    8 |   return malloc (size);
5023                  |      |          ~~~~~~~~~~~~~
5024                  |      |          |
5025                  |      |          (6) calling 'malloc'
5026                  |
5027    <-------------+
5028    |
5029 'test': event 7
5030    |
5031    |  138 |   free_boxed_int (obj);
5032    |      |   ^~~~~~~~~~~~~~~~~~~~
5033    |      |   |
5034    |      |   (7) calling 'free_boxed_int'
5035    |
5036(etc)
5037@end smallexample
5038
5039@item -fdiagnostics-show-path-depths
5040@opindex fdiagnostics-show-path-depths
5041This option provides additional information when printing control-flow paths
5042associated with a diagnostic.
5043
5044If this is option is provided then the stack depth will be printed for
5045each run of events within @option{-fdiagnostics-path-format=separate-events}.
5046
5047This is intended for use by GCC developers and plugin developers when
5048debugging diagnostics that report interprocedural control flow.
5049
5050@item -fno-show-column
5051@opindex fno-show-column
5052@opindex fshow-column
5053Do not print column numbers in diagnostics.  This may be necessary if
5054diagnostics are being scanned by a program that does not understand the
5055column numbers, such as @command{dejagnu}.
5056
5057@item -fdiagnostics-column-unit=@var{UNIT}
5058@opindex fdiagnostics-column-unit
5059Select the units for the column number.  This affects traditional diagnostics
5060(in the absence of @option{-fno-show-column}), as well as JSON format
5061diagnostics if requested.
5062
5063The default @var{UNIT}, @samp{display}, considers the number of display
5064columns occupied by each character.  This may be larger than the number
5065of bytes required to encode the character, in the case of tab
5066characters, or it may be smaller, in the case of multibyte characters.
5067For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5068display column, and its UTF-8 encoding requires two bytes; the character
5069``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5070its UTF-8 encoding requires four bytes.
5071
5072Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5073count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5074
5075@item -fdiagnostics-column-origin=@var{ORIGIN}
5076@opindex fdiagnostics-column-origin
5077Select the origin for column numbers, i.e. the column number assigned to the
5078first column.  The default value of 1 corresponds to traditional GCC
5079behavior and to the GNU style guide.  Some utilities may perform better with an
5080origin of 0; any non-negative value may be specified.
5081
5082@item -fdiagnostics-format=@var{FORMAT}
5083@opindex fdiagnostics-format
5084Select a different format for printing diagnostics.
5085@var{FORMAT} is @samp{text} or @samp{json}.
5086The default is @samp{text}.
5087
5088The @samp{json} format consists of a top-level JSON array containing JSON
5089objects representing the diagnostics.
5090
5091The JSON is emitted as one line, without formatting; the examples below
5092have been formatted for clarity.
5093
5094Diagnostics can have child diagnostics.  For example, this error and note:
5095
5096@smallexample
5097misleading-indentation.c:15:3: warning: this 'if' clause does not
5098  guard... [-Wmisleading-indentation]
5099   15 |   if (flag)
5100      |   ^~
5101misleading-indentation.c:17:5: note: ...this statement, but the latter
5102  is misleadingly indented as if it were guarded by the 'if'
5103   17 |     y = 2;
5104      |     ^
5105@end smallexample
5106
5107@noindent
5108might be printed in JSON form (after formatting) like this:
5109
5110@smallexample
5111[
5112    @{
5113        "kind": "warning",
5114        "locations": [
5115            @{
5116                "caret": @{
5117		    "display-column": 3,
5118		    "byte-column": 3,
5119                    "column": 3,
5120                    "file": "misleading-indentation.c",
5121                    "line": 15
5122                @},
5123                "finish": @{
5124		    "display-column": 4,
5125		    "byte-column": 4,
5126                    "column": 4,
5127                    "file": "misleading-indentation.c",
5128                    "line": 15
5129                @}
5130            @}
5131        ],
5132        "message": "this \u2018if\u2019 clause does not guard...",
5133        "option": "-Wmisleading-indentation",
5134        "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5135        "children": [
5136            @{
5137                "kind": "note",
5138                "locations": [
5139                    @{
5140                        "caret": @{
5141			    "display-column": 5,
5142			    "byte-column": 5,
5143                            "column": 5,
5144                            "file": "misleading-indentation.c",
5145                            "line": 17
5146                        @}
5147                    @}
5148                ],
5149                "message": "...this statement, but the latter is @dots{}"
5150            @}
5151        ]
5152	"column-origin": 1,
5153    @},
5154    @dots{}
5155]
5156@end smallexample
5157
5158@noindent
5159where the @code{note} is a child of the @code{warning}.
5160
5161A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5162an @code{option} key describing the command-line option controlling the
5163warning.
5164
5165A diagnostic can contain zero or more locations.  Each location has an
5166optional @code{label} string and up to three positions within it: a
5167@code{caret} position and optional @code{start} and @code{finish} positions.
5168A position is described by a @code{file} name, a @code{line} number, and
5169three numbers indicating a column position:
5170@itemize @bullet
5171
5172@item
5173@code{display-column} counts display columns, accounting for tabs and
5174multibyte characters.
5175
5176@item
5177@code{byte-column} counts raw bytes.
5178
5179@item
5180@code{column} is equal to one of
5181the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5182option.
5183
5184@end itemize
5185All three columns are relative to the origin specified by
5186@option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5187be set, for instance, to 0 for compatibility with other utilities that
5188number columns from 0.  The column origin is recorded in the JSON output in
5189the @code{column-origin} tag.  In the remaining examples below, the extra
5190column number outputs have been omitted for brevity.
5191
5192For example, this error:
5193
5194@smallexample
5195bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5196   'struct s'@} and 'T' @{aka 'struct t'@})
5197   64 |   return callee_4a () + callee_4b ();
5198      |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5199      |          |              |
5200      |          |              T @{aka struct t@}
5201      |          S @{aka struct s@}
5202@end smallexample
5203
5204@noindent
5205has three locations.  Its primary location is at the ``+'' token at column
520623.  It has two secondary locations, describing the left and right-hand sides
5207of the expression, which have labels.  It might be printed in JSON form as:
5208
5209@smallexample
5210    @{
5211        "children": [],
5212        "kind": "error",
5213        "locations": [
5214            @{
5215                "caret": @{
5216                    "column": 23, "file": "bad-binary-ops.c", "line": 64
5217                @}
5218            @},
5219            @{
5220                "caret": @{
5221                    "column": 10, "file": "bad-binary-ops.c", "line": 64
5222                @},
5223                "finish": @{
5224                    "column": 21, "file": "bad-binary-ops.c", "line": 64
5225                @},
5226                "label": "S @{aka struct s@}"
5227            @},
5228            @{
5229                "caret": @{
5230                    "column": 25, "file": "bad-binary-ops.c", "line": 64
5231                @},
5232                "finish": @{
5233                    "column": 36, "file": "bad-binary-ops.c", "line": 64
5234                @},
5235                "label": "T @{aka struct t@}"
5236            @}
5237        ],
5238        "message": "invalid operands to binary + @dots{}"
5239    @}
5240@end smallexample
5241
5242If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5243consisting of half-open intervals, similar to the output of
5244@option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5245with a replacement fix-it hint:
5246
5247@smallexample
5248demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5249  mean 'color'?
5250    8 |   return ptr->colour;
5251      |               ^~~~~~
5252      |               color
5253@end smallexample
5254
5255@noindent
5256might be printed in JSON form as:
5257
5258@smallexample
5259    @{
5260        "children": [],
5261        "fixits": [
5262            @{
5263                "next": @{
5264                    "column": 21,
5265                    "file": "demo.c",
5266                    "line": 8
5267                @},
5268                "start": @{
5269                    "column": 15,
5270                    "file": "demo.c",
5271                    "line": 8
5272                @},
5273                "string": "color"
5274            @}
5275        ],
5276        "kind": "error",
5277        "locations": [
5278            @{
5279                "caret": @{
5280                    "column": 15,
5281                    "file": "demo.c",
5282                    "line": 8
5283                @},
5284                "finish": @{
5285                    "column": 20,
5286                    "file": "demo.c",
5287                    "line": 8
5288                @}
5289            @}
5290        ],
5291        "message": "\u2018struct s\u2019 has no member named @dots{}"
5292    @}
5293@end smallexample
5294
5295@noindent
5296where the fix-it hint suggests replacing the text from @code{start} up
5297to but not including @code{next} with @code{string}'s value.  Deletions
5298are expressed via an empty value for @code{string}, insertions by
5299having @code{start} equal @code{next}.
5300
5301If the diagnostic has a path of control-flow events associated with it,
5302it has a @code{path} array of objects representing the events.  Each
5303event object has a @code{description} string, a @code{location} object,
5304along with a @code{function} string and a @code{depth} number for
5305representing interprocedural paths.  The @code{function} represents the
5306current function at that event, and the @code{depth} represents the
5307stack depth relative to some baseline: the higher, the more frames are
5308within the stack.
5309
5310For example, the intraprocedural example shown for
5311@option{-fdiagnostics-path-format=} might have this JSON for its path:
5312
5313@smallexample
5314    "path": [
5315        @{
5316            "depth": 0,
5317            "description": "when 'PyList_New' fails, returning NULL",
5318            "function": "test",
5319            "location": @{
5320                "column": 10,
5321                "file": "test.c",
5322                "line": 25
5323            @}
5324        @},
5325        @{
5326            "depth": 0,
5327            "description": "when 'i < count'",
5328            "function": "test",
5329            "location": @{
5330                "column": 3,
5331                "file": "test.c",
5332                "line": 27
5333            @}
5334        @},
5335        @{
5336            "depth": 0,
5337            "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5338            "function": "test",
5339            "location": @{
5340                "column": 5,
5341                "file": "test.c",
5342                "line": 29
5343            @}
5344        @}
5345    ]
5346@end smallexample
5347
5348@end table
5349
5350@node Warning Options
5351@section Options to Request or Suppress Warnings
5352@cindex options to control warnings
5353@cindex warning messages
5354@cindex messages, warning
5355@cindex suppressing warnings
5356
5357Warnings are diagnostic messages that report constructions that
5358are not inherently erroneous but that are risky or suggest there
5359may have been an error.
5360
5361The following language-independent options do not enable specific
5362warnings but control the kinds of diagnostics produced by GCC@.
5363
5364@table @gcctabopt
5365@cindex syntax checking
5366@item -fsyntax-only
5367@opindex fsyntax-only
5368Check the code for syntax errors, but don't do anything beyond that.
5369
5370@item -fmax-errors=@var{n}
5371@opindex fmax-errors
5372Limits the maximum number of error messages to @var{n}, at which point
5373GCC bails out rather than attempting to continue processing the source
5374code.  If @var{n} is 0 (the default), there is no limit on the number
5375of error messages produced.  If @option{-Wfatal-errors} is also
5376specified, then @option{-Wfatal-errors} takes precedence over this
5377option.
5378
5379@item -w
5380@opindex w
5381Inhibit all warning messages.
5382
5383@item -Werror
5384@opindex Werror
5385@opindex Wno-error
5386Make all warnings into errors.
5387
5388@item -Werror=
5389@opindex Werror=
5390@opindex Wno-error=
5391Make the specified warning into an error.  The specifier for a warning
5392is appended; for example @option{-Werror=switch} turns the warnings
5393controlled by @option{-Wswitch} into errors.  This switch takes a
5394negative form, to be used to negate @option{-Werror} for specific
5395warnings; for example @option{-Wno-error=switch} makes
5396@option{-Wswitch} warnings not be errors, even when @option{-Werror}
5397is in effect.
5398
5399The warning message for each controllable warning includes the
5400option that controls the warning.  That option can then be used with
5401@option{-Werror=} and @option{-Wno-error=} as described above.
5402(Printing of the option in the warning message can be disabled using the
5403@option{-fno-diagnostics-show-option} flag.)
5404
5405Note that specifying @option{-Werror=}@var{foo} automatically implies
5406@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
5407imply anything.
5408
5409@item -Wfatal-errors
5410@opindex Wfatal-errors
5411@opindex Wno-fatal-errors
5412This option causes the compiler to abort compilation on the first error
5413occurred rather than trying to keep going and printing further error
5414messages.
5415
5416@end table
5417
5418You can request many specific warnings with options beginning with
5419@samp{-W}, for example @option{-Wimplicit} to request warnings on
5420implicit declarations.  Each of these specific warning options also
5421has a negative form beginning @samp{-Wno-} to turn off warnings; for
5422example, @option{-Wno-implicit}.  This manual lists only one of the
5423two forms, whichever is not the default.  For further
5424language-specific options also refer to @ref{C++ Dialect Options} and
5425@ref{Objective-C and Objective-C++ Dialect Options}.
5426Additional warnings can be produced by enabling the static analyzer;
5427@xref{Static Analyzer Options}.
5428
5429Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
5430options, such as @option{-Wunused}, which may turn on further options,
5431such as @option{-Wunused-value}. The combined effect of positive and
5432negative forms is that more specific options have priority over less
5433specific ones, independently of their position in the command-line. For
5434options of the same specificity, the last one takes effect. Options
5435enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
5436as if they appeared at the end of the command-line.
5437
5438When an unrecognized warning option is requested (e.g.,
5439@option{-Wunknown-warning}), GCC emits a diagnostic stating
5440that the option is not recognized.  However, if the @option{-Wno-} form
5441is used, the behavior is slightly different: no diagnostic is
5442produced for @option{-Wno-unknown-warning} unless other diagnostics
5443are being produced.  This allows the use of new @option{-Wno-} options
5444with old compilers, but if something goes wrong, the compiler
5445warns that an unrecognized option is present.
5446
5447The effectiveness of some warnings depends on optimizations also being
5448enabled. For example @option{-Wsuggest-final-types} is more effective
5449with link-time optimization and @option{-Wmaybe-uninitialized} does not
5450warn at all unless optimization is enabled.
5451
5452@table @gcctabopt
5453@item -Wpedantic
5454@itemx -pedantic
5455@opindex pedantic
5456@opindex Wpedantic
5457@opindex Wno-pedantic
5458Issue all the warnings demanded by strict ISO C and ISO C++;
5459reject all programs that use forbidden extensions, and some other
5460programs that do not follow ISO C and ISO C++.  For ISO C, follows the
5461version of the ISO C standard specified by any @option{-std} option used.
5462
5463Valid ISO C and ISO C++ programs should compile properly with or without
5464this option (though a rare few require @option{-ansi} or a
5465@option{-std} option specifying the required version of ISO C)@.  However,
5466without this option, certain GNU extensions and traditional C and C++
5467features are supported as well.  With this option, they are rejected.
5468
5469@option{-Wpedantic} does not cause warning messages for use of the
5470alternate keywords whose names begin and end with @samp{__}.  This alternate
5471format can also be used to disable warnings for non-ISO @samp{__intN} types,
5472i.e. @samp{__intN__}.
5473Pedantic warnings are also disabled in the expression that follows
5474@code{__extension__}.  However, only system header files should use
5475these escape routes; application programs should avoid them.
5476@xref{Alternate Keywords}.
5477
5478Some users try to use @option{-Wpedantic} to check programs for strict ISO
5479C conformance.  They soon find that it does not do quite what they want:
5480it finds some non-ISO practices, but not all---only those for which
5481ISO C @emph{requires} a diagnostic, and some others for which
5482diagnostics have been added.
5483
5484A feature to report any failure to conform to ISO C might be useful in
5485some instances, but would require considerable additional work and would
5486be quite different from @option{-Wpedantic}.  We don't have plans to
5487support such a feature in the near future.
5488
5489Where the standard specified with @option{-std} represents a GNU
5490extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
5491corresponding @dfn{base standard}, the version of ISO C on which the GNU
5492extended dialect is based.  Warnings from @option{-Wpedantic} are given
5493where they are required by the base standard.  (It does not make sense
5494for such warnings to be given only for features not in the specified GNU
5495C dialect, since by definition the GNU dialects of C include all
5496features the compiler supports with the given option, and there would be
5497nothing to warn about.)
5498
5499@item -pedantic-errors
5500@opindex pedantic-errors
5501Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
5502requires a diagnostic, in some cases where there is undefined behavior
5503at compile-time and in some other cases that do not prevent compilation
5504of programs that are valid according to the standard. This is not
5505equivalent to @option{-Werror=pedantic}, since there are errors enabled
5506by this option and not enabled by the latter and vice versa.
5507
5508@item -Wall
5509@opindex Wall
5510@opindex Wno-all
5511This enables all the warnings about constructions that some users
5512consider questionable, and that are easy to avoid (or modify to
5513prevent the warning), even in conjunction with macros.  This also
5514enables some language-specific warnings described in @ref{C++ Dialect
5515Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
5516
5517@option{-Wall} turns on the following warning flags:
5518
5519@gccoptlist{-Waddress   @gol
5520-Warray-bounds=1 @r{(only with} @option{-O2}@r{)}  @gol
5521-Warray-parameter=2 @r{(C and Objective-C only)} @gol
5522-Wbool-compare  @gol
5523-Wbool-operation  @gol
5524-Wc++11-compat  -Wc++14-compat  @gol
5525-Wcatch-value @r{(C++ and Objective-C++ only)}  @gol
5526-Wchar-subscripts  @gol
5527-Wcomment  @gol
5528-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
5529-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
5530-Wformat   @gol
5531-Wformat-overflow  @gol
5532-Wformat-truncation  @gol
5533-Wint-in-bool-context  @gol
5534-Wimplicit @r{(C and Objective-C only)} @gol
5535-Wimplicit-int @r{(C and Objective-C only)} @gol
5536-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
5537-Winit-self @r{(only for C++)} @gol
5538-Wlogical-not-parentheses @gol
5539-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
5540-Wmaybe-uninitialized @gol
5541-Wmemset-elt-size @gol
5542-Wmemset-transposed-args @gol
5543-Wmisleading-indentation @r{(only for C/C++)} @gol
5544-Wmissing-attributes @gol
5545-Wmissing-braces @r{(only for C/ObjC)} @gol
5546-Wmultistatement-macros  @gol
5547-Wnarrowing @r{(only for C++)}  @gol
5548-Wnonnull  @gol
5549-Wnonnull-compare  @gol
5550-Wopenmp-simd @gol
5551-Wparentheses  @gol
5552-Wpessimizing-move @r{(only for C++)}  @gol
5553-Wpointer-sign  @gol
5554-Wrange-loop-construct @r{(only for C++)}  @gol
5555-Wreorder   @gol
5556-Wrestrict   @gol
5557-Wreturn-type  @gol
5558-Wsequence-point  @gol
5559-Wsign-compare @r{(only in C++)}  @gol
5560-Wsizeof-array-div @gol
5561-Wsizeof-pointer-div @gol
5562-Wsizeof-pointer-memaccess @gol
5563-Wstrict-aliasing  @gol
5564-Wstrict-overflow=1  @gol
5565-Wswitch  @gol
5566-Wtautological-compare  @gol
5567-Wtrigraphs  @gol
5568-Wuninitialized  @gol
5569-Wunknown-pragmas  @gol
5570-Wunused-function  @gol
5571-Wunused-label     @gol
5572-Wunused-value     @gol
5573-Wunused-variable  @gol
5574-Wvla-parameter @r{(C and Objective-C only)} @gol
5575-Wvolatile-register-var  @gol
5576-Wzero-length-bounds}
5577
5578Note that some warning flags are not implied by @option{-Wall}.  Some of
5579them warn about constructions that users generally do not consider
5580questionable, but which occasionally you might wish to check for;
5581others warn about constructions that are necessary or hard to avoid in
5582some cases, and there is no simple way to modify the code to suppress
5583the warning. Some of them are enabled by @option{-Wextra} but many of
5584them must be enabled individually.
5585
5586@item -Wextra
5587@opindex W
5588@opindex Wextra
5589@opindex Wno-extra
5590This enables some extra warning flags that are not enabled by
5591@option{-Wall}. (This option used to be called @option{-W}.  The older
5592name is still supported, but the newer name is more descriptive.)
5593
5594@gccoptlist{-Wclobbered  @gol
5595-Wcast-function-type  @gol
5596-Wdeprecated-copy @r{(C++ only)} @gol
5597-Wempty-body  @gol
5598-Wenum-conversion @r{(C only)} @gol
5599-Wignored-qualifiers @gol
5600-Wimplicit-fallthrough=3 @gol
5601-Wmissing-field-initializers  @gol
5602-Wmissing-parameter-type @r{(C only)}  @gol
5603-Wold-style-declaration @r{(C only)}  @gol
5604-Woverride-init  @gol
5605-Wsign-compare @r{(C only)} @gol
5606-Wstring-compare @gol
5607-Wredundant-move @r{(only for C++)}  @gol
5608-Wtype-limits  @gol
5609-Wuninitialized  @gol
5610-Wshift-negative-value @r{(in C++03 and in C99 and newer)}  @gol
5611-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
5612-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
5613
5614
5615The option @option{-Wextra} also prints warning messages for the
5616following cases:
5617
5618@itemize @bullet
5619
5620@item
5621A pointer is compared against integer zero with @code{<}, @code{<=},
5622@code{>}, or @code{>=}.
5623
5624@item
5625(C++ only) An enumerator and a non-enumerator both appear in a
5626conditional expression.
5627
5628@item
5629(C++ only) Ambiguous virtual bases.
5630
5631@item
5632(C++ only) Subscripting an array that has been declared @code{register}.
5633
5634@item
5635(C++ only) Taking the address of a variable that has been declared
5636@code{register}.
5637
5638@item
5639(C++ only) A base class is not initialized in the copy constructor
5640of a derived class.
5641
5642@end itemize
5643
5644@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
5645@opindex Wabi
5646@opindex Wno-abi
5647
5648Warn about code affected by ABI changes.  This includes code that may
5649not be compatible with the vendor-neutral C++ ABI as well as the psABI
5650for the particular target.
5651
5652Since G++ now defaults to updating the ABI with each major release,
5653normally @option{-Wabi} warns only about C++ ABI compatibility
5654problems if there is a check added later in a release series for an
5655ABI issue discovered since the initial release.  @option{-Wabi} warns
5656about more things if an older ABI version is selected (with
5657@option{-fabi-version=@var{n}}).
5658
5659@option{-Wabi} can also be used with an explicit version number to
5660warn about C++ ABI compatibility with a particular @option{-fabi-version}
5661level, e.g.@: @option{-Wabi=2} to warn about changes relative to
5662@option{-fabi-version=2}.
5663
5664If an explicit version number is provided and
5665@option{-fabi-compat-version} is not specified, the version number
5666from this option is used for compatibility aliases.  If no explicit
5667version number is provided with this option, but
5668@option{-fabi-compat-version} is specified, that version number is
5669used for C++ ABI warnings.
5670
5671Although an effort has been made to warn about
5672all such cases, there are probably some cases that are not warned about,
5673even though G++ is generating incompatible code.  There may also be
5674cases where warnings are emitted even though the code that is generated
5675is compatible.
5676
5677You should rewrite your code to avoid these warnings if you are
5678concerned about the fact that code generated by G++ may not be binary
5679compatible with code generated by other compilers.
5680
5681Known incompatibilities in @option{-fabi-version=2} (which was the
5682default from GCC 3.4 to 4.9) include:
5683
5684@itemize @bullet
5685
5686@item
5687A template with a non-type template parameter of reference type was
5688mangled incorrectly:
5689@smallexample
5690extern int N;
5691template <int &> struct S @{@};
5692void n (S<N>) @{2@}
5693@end smallexample
5694
5695This was fixed in @option{-fabi-version=3}.
5696
5697@item
5698SIMD vector types declared using @code{__attribute ((vector_size))} were
5699mangled in a non-standard way that does not allow for overloading of
5700functions taking vectors of different sizes.
5701
5702The mangling was changed in @option{-fabi-version=4}.
5703
5704@item
5705@code{__attribute ((const))} and @code{noreturn} were mangled as type
5706qualifiers, and @code{decltype} of a plain declaration was folded away.
5707
5708These mangling issues were fixed in @option{-fabi-version=5}.
5709
5710@item
5711Scoped enumerators passed as arguments to a variadic function are
5712promoted like unscoped enumerators, causing @code{va_arg} to complain.
5713On most targets this does not actually affect the parameter passing
5714ABI, as there is no way to pass an argument smaller than @code{int}.
5715
5716Also, the ABI changed the mangling of template argument packs,
5717@code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5718a class scope function used as a template argument.
5719
5720These issues were corrected in @option{-fabi-version=6}.
5721
5722@item
5723Lambdas in default argument scope were mangled incorrectly, and the
5724ABI changed the mangling of @code{nullptr_t}.
5725
5726These issues were corrected in @option{-fabi-version=7}.
5727
5728@item
5729When mangling a function type with function-cv-qualifiers, the
5730un-qualified function type was incorrectly treated as a substitution
5731candidate.
5732
5733This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5734
5735@item
5736@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5737unaligned accesses.  Note that this did not affect the ABI of a
5738function with a @code{nullptr_t} parameter, as parameters have a
5739minimum alignment.
5740
5741This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5742
5743@item
5744Target-specific attributes that affect the identity of a type, such as
5745ia32 calling conventions on a function type (stdcall, regparm, etc.),
5746did not affect the mangled name, leading to name collisions when
5747function pointers were used as template arguments.
5748
5749This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5750
5751@end itemize
5752
5753This option also enables warnings about psABI-related changes.
5754The known psABI changes at this point include:
5755
5756@itemize @bullet
5757
5758@item
5759For SysV/x86-64, unions with @code{long double} members are
5760passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
5761the case.  For example:
5762
5763@smallexample
5764union U @{
5765  long double ld;
5766  int i;
5767@};
5768@end smallexample
5769
5770@noindent
5771@code{union U} is now always passed in memory.
5772
5773@end itemize
5774
5775@item -Wchar-subscripts
5776@opindex Wchar-subscripts
5777@opindex Wno-char-subscripts
5778Warn if an array subscript has type @code{char}.  This is a common cause
5779of error, as programmers often forget that this type is signed on some
5780machines.
5781This warning is enabled by @option{-Wall}.
5782
5783@item -Wno-coverage-mismatch
5784@opindex Wno-coverage-mismatch
5785@opindex Wcoverage-mismatch
5786Warn if feedback profiles do not match when using the
5787@option{-fprofile-use} option.
5788If a source file is changed between compiling with @option{-fprofile-generate}
5789and with @option{-fprofile-use}, the files with the profile feedback can fail
5790to match the source file and GCC cannot use the profile feedback
5791information.  By default, this warning is enabled and is treated as an
5792error.  @option{-Wno-coverage-mismatch} can be used to disable the
5793warning or @option{-Wno-error=coverage-mismatch} can be used to
5794disable the error.  Disabling the error for this warning can result in
5795poorly optimized code and is useful only in the
5796case of very minor changes such as bug fixes to an existing code-base.
5797Completely disabling the warning is not recommended.
5798
5799@item -Wno-cpp
5800@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5801@opindex Wno-cpp
5802@opindex Wcpp
5803Suppress warning messages emitted by @code{#warning} directives.
5804
5805@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5806@opindex Wdouble-promotion
5807@opindex Wno-double-promotion
5808Give a warning when a value of type @code{float} is implicitly
5809promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
5810floating-point unit implement @code{float} in hardware, but emulate
5811@code{double} in software.  On such a machine, doing computations
5812using @code{double} values is much more expensive because of the
5813overhead required for software emulation.
5814
5815It is easy to accidentally do computations with @code{double} because
5816floating-point literals are implicitly of type @code{double}.  For
5817example, in:
5818@smallexample
5819@group
5820float area(float radius)
5821@{
5822   return 3.14159 * radius * radius;
5823@}
5824@end group
5825@end smallexample
5826the compiler performs the entire computation with @code{double}
5827because the floating-point literal is a @code{double}.
5828
5829@item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5830@opindex Wduplicate-decl-specifier
5831@opindex Wno-duplicate-decl-specifier
5832Warn if a declaration has duplicate @code{const}, @code{volatile},
5833@code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
5834@option{-Wall}.
5835
5836@item -Wformat
5837@itemx -Wformat=@var{n}
5838@opindex Wformat
5839@opindex Wno-format
5840@opindex ffreestanding
5841@opindex fno-builtin
5842@opindex Wformat=
5843Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5844the arguments supplied have types appropriate to the format string
5845specified, and that the conversions specified in the format string make
5846sense.  This includes standard functions, and others specified by format
5847attributes (@pxref{Function Attributes}), in the @code{printf},
5848@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5849not in the C standard) families (or other target-specific families).
5850Which functions are checked without format attributes having been
5851specified depends on the standard version selected, and such checks of
5852functions without the attribute specified are disabled by
5853@option{-ffreestanding} or @option{-fno-builtin}.
5854
5855The formats are checked against the format features supported by GNU
5856libc version 2.2.  These include all ISO C90 and C99 features, as well
5857as features from the Single Unix Specification and some BSD and GNU
5858extensions.  Other library implementations may not support all these
5859features; GCC does not support warning about features that go beyond a
5860particular library's limitations.  However, if @option{-Wpedantic} is used
5861with @option{-Wformat}, warnings are given about format features not
5862in the selected standard version (but not for @code{strfmon} formats,
5863since those are not in any version of the C standard).  @xref{C Dialect
5864Options,,Options Controlling C Dialect}.
5865
5866@table @gcctabopt
5867@item -Wformat=1
5868@itemx -Wformat
5869@opindex Wformat
5870@opindex Wformat=1
5871Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5872@option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
5873@option{-Wformat} also checks for null format arguments for several
5874functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
5875aspects of this level of format checking can be disabled by the
5876options: @option{-Wno-format-contains-nul},
5877@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5878@option{-Wformat} is enabled by @option{-Wall}.
5879
5880@item -Wformat=2
5881@opindex Wformat=2
5882Enable @option{-Wformat} plus additional format checks.  Currently
5883equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5884-Wformat-y2k}.
5885@end table
5886
5887@item -Wno-format-contains-nul
5888@opindex Wno-format-contains-nul
5889@opindex Wformat-contains-nul
5890If @option{-Wformat} is specified, do not warn about format strings that
5891contain NUL bytes.
5892
5893@item -Wno-format-extra-args
5894@opindex Wno-format-extra-args
5895@opindex Wformat-extra-args
5896If @option{-Wformat} is specified, do not warn about excess arguments to a
5897@code{printf} or @code{scanf} format function.  The C standard specifies
5898that such arguments are ignored.
5899
5900Where the unused arguments lie between used arguments that are
5901specified with @samp{$} operand number specifications, normally
5902warnings are still given, since the implementation could not know what
5903type to pass to @code{va_arg} to skip the unused arguments.  However,
5904in the case of @code{scanf} formats, this option suppresses the
5905warning if the unused arguments are all pointers, since the Single
5906Unix Specification says that such unused arguments are allowed.
5907
5908@item -Wformat-overflow
5909@itemx -Wformat-overflow=@var{level}
5910@opindex Wformat-overflow
5911@opindex Wno-format-overflow
5912Warn about calls to formatted input/output functions such as @code{sprintf}
5913and @code{vsprintf} that might overflow the destination buffer.  When the
5914exact number of bytes written by a format directive cannot be determined
5915at compile-time it is estimated based on heuristics that depend on the
5916@var{level} argument and on optimization.  While enabling optimization
5917will in most cases improve the accuracy of the warning, it may also
5918result in false positives.
5919
5920@table @gcctabopt
5921@item -Wformat-overflow
5922@itemx -Wformat-overflow=1
5923@opindex Wformat-overflow
5924@opindex Wno-format-overflow
5925Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5926employs a conservative approach that warns only about calls that most
5927likely overflow the buffer.  At this level, numeric arguments to format
5928directives with unknown values are assumed to have the value of one, and
5929strings of unknown length to be empty.  Numeric arguments that are known
5930to be bounded to a subrange of their type, or string arguments whose output
5931is bounded either by their directive's precision or by a finite set of
5932string literals, are assumed to take on the value within the range that
5933results in the most bytes on output.  For example, the call to @code{sprintf}
5934below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5935the terminating NUL character (@code{'\0'}) appended by the function
5936to the destination buffer will be written past its end.  Increasing
5937the size of the buffer by a single byte is sufficient to avoid the
5938warning, though it may not be sufficient to avoid the overflow.
5939
5940@smallexample
5941void f (int a, int b)
5942@{
5943  char buf [13];
5944  sprintf (buf, "a = %i, b = %i\n", a, b);
5945@}
5946@end smallexample
5947
5948@item -Wformat-overflow=2
5949Level @var{2} warns also about calls that might overflow the destination
5950buffer given an argument of sufficient length or magnitude.  At level
5951@var{2}, unknown numeric arguments are assumed to have the minimum
5952representable value for signed types with a precision greater than 1, and
5953the maximum representable value otherwise.  Unknown string arguments whose
5954length cannot be assumed to be bounded either by the directive's precision,
5955or by a finite set of string literals they may evaluate to, or the character
5956array they may point to, are assumed to be 1 character long.
5957
5958At level @var{2}, the call in the example above is again diagnosed, but
5959this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5960@code{%i} directive will write some of its digits beyond the end of
5961the destination buffer.  To make the call safe regardless of the values
5962of the two variables, the size of the destination buffer must be increased
5963to at least 34 bytes.  GCC includes the minimum size of the buffer in
5964an informational note following the warning.
5965
5966An alternative to increasing the size of the destination buffer is to
5967constrain the range of formatted values.  The maximum length of string
5968arguments can be bounded by specifying the precision in the format
5969directive.  When numeric arguments of format directives can be assumed
5970to be bounded by less than the precision of their type, choosing
5971an appropriate length modifier to the format specifier will reduce
5972the required buffer size.  For example, if @var{a} and @var{b} in the
5973example above can be assumed to be within the precision of
5974the @code{short int} type then using either the @code{%hi} format
5975directive or casting the argument to @code{short} reduces the maximum
5976required size of the buffer to 24 bytes.
5977
5978@smallexample
5979void f (int a, int b)
5980@{
5981  char buf [23];
5982  sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5983@}
5984@end smallexample
5985@end table
5986
5987@item -Wno-format-zero-length
5988@opindex Wno-format-zero-length
5989@opindex Wformat-zero-length
5990If @option{-Wformat} is specified, do not warn about zero-length formats.
5991The C standard specifies that zero-length formats are allowed.
5992
5993@item -Wformat-nonliteral
5994@opindex Wformat-nonliteral
5995@opindex Wno-format-nonliteral
5996If @option{-Wformat} is specified, also warn if the format string is not a
5997string literal and so cannot be checked, unless the format function
5998takes its format arguments as a @code{va_list}.
5999
6000@item -Wformat-security
6001@opindex Wformat-security
6002@opindex Wno-format-security
6003If @option{-Wformat} is specified, also warn about uses of format
6004functions that represent possible security problems.  At present, this
6005warns about calls to @code{printf} and @code{scanf} functions where the
6006format string is not a string literal and there are no format arguments,
6007as in @code{printf (foo);}.  This may be a security hole if the format
6008string came from untrusted input and contains @samp{%n}.  (This is
6009currently a subset of what @option{-Wformat-nonliteral} warns about, but
6010in future warnings may be added to @option{-Wformat-security} that are not
6011included in @option{-Wformat-nonliteral}.)
6012
6013@item -Wformat-signedness
6014@opindex Wformat-signedness
6015@opindex Wno-format-signedness
6016If @option{-Wformat} is specified, also warn if the format string
6017requires an unsigned argument and the argument is signed and vice versa.
6018
6019@item -Wformat-truncation
6020@itemx -Wformat-truncation=@var{level}
6021@opindex Wformat-truncation
6022@opindex Wno-format-truncation
6023Warn about calls to formatted input/output functions such as @code{snprintf}
6024and @code{vsnprintf} that might result in output truncation.  When the exact
6025number of bytes written by a format directive cannot be determined at
6026compile-time it is estimated based on heuristics that depend on
6027the @var{level} argument and on optimization.  While enabling optimization
6028will in most cases improve the accuracy of the warning, it may also result
6029in false positives.  Except as noted otherwise, the option uses the same
6030logic @option{-Wformat-overflow}.
6031
6032@table @gcctabopt
6033@item -Wformat-truncation
6034@itemx -Wformat-truncation=1
6035@opindex Wformat-truncation
6036@opindex Wno-format-truncation
6037Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6038employs a conservative approach that warns only about calls to bounded
6039functions whose return value is unused and that will most likely result
6040in output truncation.
6041
6042@item -Wformat-truncation=2
6043Level @var{2} warns also about calls to bounded functions whose return
6044value is used and that might result in truncation given an argument of
6045sufficient length or magnitude.
6046@end table
6047
6048@item -Wformat-y2k
6049@opindex Wformat-y2k
6050@opindex Wno-format-y2k
6051If @option{-Wformat} is specified, also warn about @code{strftime}
6052formats that may yield only a two-digit year.
6053
6054@item -Wnonnull
6055@opindex Wnonnull
6056@opindex Wno-nonnull
6057Warn about passing a null pointer for arguments marked as
6058requiring a non-null value by the @code{nonnull} function attribute.
6059
6060@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6061can be disabled with the @option{-Wno-nonnull} option.
6062
6063@item -Wnonnull-compare
6064@opindex Wnonnull-compare
6065@opindex Wno-nonnull-compare
6066Warn when comparing an argument marked with the @code{nonnull}
6067function attribute against null inside the function.
6068
6069@option{-Wnonnull-compare} is included in @option{-Wall}.  It
6070can be disabled with the @option{-Wno-nonnull-compare} option.
6071
6072@item -Wnull-dereference
6073@opindex Wnull-dereference
6074@opindex Wno-null-dereference
6075Warn if the compiler detects paths that trigger erroneous or
6076undefined behavior due to dereferencing a null pointer.  This option
6077is only active when @option{-fdelete-null-pointer-checks} is active,
6078which is enabled by optimizations in most targets.  The precision of
6079the warnings depends on the optimization options used.
6080
6081@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6082@opindex Winit-self
6083@opindex Wno-init-self
6084Warn about uninitialized variables that are initialized with themselves.
6085Note this option can only be used with the @option{-Wuninitialized} option.
6086
6087For example, GCC warns about @code{i} being uninitialized in the
6088following snippet only when @option{-Winit-self} has been specified:
6089@smallexample
6090@group
6091int f()
6092@{
6093  int i = i;
6094  return i;
6095@}
6096@end group
6097@end smallexample
6098
6099This warning is enabled by @option{-Wall} in C++.
6100
6101@item -Wno-implicit-int @r{(C and Objective-C only)}
6102@opindex Wimplicit-int
6103@opindex Wno-implicit-int
6104This option controls warnings when a declaration does not specify a type.
6105This warning is enabled by default in C99 and later dialects of C,
6106and also by @option{-Wall}.
6107
6108@item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6109@opindex Wimplicit-function-declaration
6110@opindex Wno-implicit-function-declaration
6111This option controls warnings when a function is used before being declared.
6112This warning is enabled by default in C99 and later dialects of C,
6113and also by @option{-Wall}.
6114The warning is made into an error by @option{-pedantic-errors}.
6115
6116@item -Wimplicit @r{(C and Objective-C only)}
6117@opindex Wimplicit
6118@opindex Wno-implicit
6119Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6120This warning is enabled by @option{-Wall}.
6121
6122@item -Wimplicit-fallthrough
6123@opindex Wimplicit-fallthrough
6124@opindex Wno-implicit-fallthrough
6125@option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6126and @option{-Wno-implicit-fallthrough} is the same as
6127@option{-Wimplicit-fallthrough=0}.
6128
6129@item -Wimplicit-fallthrough=@var{n}
6130@opindex Wimplicit-fallthrough=
6131Warn when a switch case falls through.  For example:
6132
6133@smallexample
6134@group
6135switch (cond)
6136  @{
6137  case 1:
6138    a = 1;
6139    break;
6140  case 2:
6141    a = 2;
6142  case 3:
6143    a = 3;
6144    break;
6145  @}
6146@end group
6147@end smallexample
6148
6149This warning does not warn when the last statement of a case cannot
6150fall through, e.g. when there is a return statement or a call to function
6151declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6152also takes into account control flow statements, such as ifs, and only
6153warns when appropriate.  E.g.@:
6154
6155@smallexample
6156@group
6157switch (cond)
6158  @{
6159  case 1:
6160    if (i > 3) @{
6161      bar (5);
6162      break;
6163    @} else if (i < 1) @{
6164      bar (0);
6165    @} else
6166      return;
6167  default:
6168    @dots{}
6169  @}
6170@end group
6171@end smallexample
6172
6173Since there are occasions where a switch case fall through is desirable,
6174GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6175to be used along with a null statement to suppress this warning that
6176would normally occur:
6177
6178@smallexample
6179@group
6180switch (cond)
6181  @{
6182  case 1:
6183    bar (0);
6184    __attribute__ ((fallthrough));
6185  default:
6186    @dots{}
6187  @}
6188@end group
6189@end smallexample
6190
6191C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6192warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6193or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6194Instead of these attributes, it is also possible to add a fallthrough comment
6195to silence the warning.  The whole body of the C or C++ style comment should
6196match the given regular expressions listed below.  The option argument @var{n}
6197specifies what kind of comments are accepted:
6198
6199@itemize @bullet
6200
6201@item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6202
6203@item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6204expression, any comment is used as fallthrough comment.
6205
6206@item @option{-Wimplicit-fallthrough=2} case insensitively matches
6207@code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6208
6209@item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6210following regular expressions:
6211
6212@itemize @bullet
6213
6214@item @code{-fallthrough}
6215
6216@item @code{@@fallthrough@@}
6217
6218@item @code{lint -fallthrough[ \t]*}
6219
6220@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6221
6222@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6223
6224@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6225
6226@end itemize
6227
6228@item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6229following regular expressions:
6230
6231@itemize @bullet
6232
6233@item @code{-fallthrough}
6234
6235@item @code{@@fallthrough@@}
6236
6237@item @code{lint -fallthrough[ \t]*}
6238
6239@item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6240
6241@end itemize
6242
6243@item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6244fallthrough comments, only attributes disable the warning.
6245
6246@end itemize
6247
6248The comment needs to be followed after optional whitespace and other comments
6249by @code{case} or @code{default} keywords or by a user label that precedes some
6250@code{case} or @code{default} label.
6251
6252@smallexample
6253@group
6254switch (cond)
6255  @{
6256  case 1:
6257    bar (0);
6258    /* FALLTHRU */
6259  default:
6260    @dots{}
6261  @}
6262@end group
6263@end smallexample
6264
6265The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6266
6267@item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6268@opindex Wif-not-aligned
6269@opindex Wno-if-not-aligned
6270Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6271should be issued.  These warnings are enabled by default.
6272
6273@item -Wignored-qualifiers @r{(C and C++ only)}
6274@opindex Wignored-qualifiers
6275@opindex Wno-ignored-qualifiers
6276Warn if the return type of a function has a type qualifier
6277such as @code{const}.  For ISO C such a type qualifier has no effect,
6278since the value returned by a function is not an lvalue.
6279For C++, the warning is only emitted for scalar types or @code{void}.
6280ISO C prohibits qualified @code{void} return types on function
6281definitions, so such return types always receive a warning
6282even without this option.
6283
6284This warning is also enabled by @option{-Wextra}.
6285
6286@item -Wno-ignored-attributes @r{(C and C++ only)}
6287@opindex Wignored-attributes
6288@opindex Wno-ignored-attributes
6289This option controls warnings when an attribute is ignored.
6290This is different from the
6291@option{-Wattributes} option in that it warns whenever the compiler decides
6292to drop an attribute, not that the attribute is either unknown, used in a
6293wrong place, etc.  This warning is enabled by default.
6294
6295@item -Wmain
6296@opindex Wmain
6297@opindex Wno-main
6298Warn if the type of @code{main} is suspicious.  @code{main} should be
6299a function with external linkage, returning int, taking either zero
6300arguments, two, or three arguments of appropriate types.  This warning
6301is enabled by default in C++ and is enabled by either @option{-Wall}
6302or @option{-Wpedantic}.
6303
6304@item -Wmisleading-indentation @r{(C and C++ only)}
6305@opindex Wmisleading-indentation
6306@opindex Wno-misleading-indentation
6307Warn when the indentation of the code does not reflect the block structure.
6308Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6309@code{for} clauses with a guarded statement that does not use braces,
6310followed by an unguarded statement with the same indentation.
6311
6312In the following example, the call to ``bar'' is misleadingly indented as
6313if it were guarded by the ``if'' conditional.
6314
6315@smallexample
6316  if (some_condition ())
6317    foo ();
6318    bar ();  /* Gotcha: this is not guarded by the "if".  */
6319@end smallexample
6320
6321In the case of mixed tabs and spaces, the warning uses the
6322@option{-ftabstop=} option to determine if the statements line up
6323(defaulting to 8).
6324
6325The warning is not issued for code involving multiline preprocessor logic
6326such as the following example.
6327
6328@smallexample
6329  if (flagA)
6330    foo (0);
6331#if SOME_CONDITION_THAT_DOES_NOT_HOLD
6332  if (flagB)
6333#endif
6334    foo (1);
6335@end smallexample
6336
6337The warning is not issued after a @code{#line} directive, since this
6338typically indicates autogenerated code, and no assumptions can be made
6339about the layout of the file that the directive references.
6340
6341This warning is enabled by @option{-Wall} in C and C++.
6342
6343@item -Wmissing-attributes
6344@opindex Wmissing-attributes
6345@opindex Wno-missing-attributes
6346Warn when a declaration of a function is missing one or more attributes
6347that a related function is declared with and whose absence may adversely
6348affect the correctness or efficiency of generated code.  For example,
6349the warning is issued for declarations of aliases that use attributes
6350to specify less restrictive requirements than those of their targets.
6351This typically represents a potential optimization opportunity.
6352By contrast, the @option{-Wattribute-alias=2} option controls warnings
6353issued when the alias is more restrictive than the target, which could
6354lead to incorrect code generation.
6355Attributes considered include @code{alloc_align}, @code{alloc_size},
6356@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6357@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6358@code{returns_nonnull}, and @code{returns_twice}.
6359
6360In C++, the warning is issued when an explicit specialization of a primary
6361template declared with attribute @code{alloc_align}, @code{alloc_size},
6362@code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
6363or @code{nonnull} is declared without it.  Attributes @code{deprecated},
6364@code{error}, and @code{warning} suppress the warning.
6365(@pxref{Function Attributes}).
6366
6367You can use the @code{copy} attribute to apply the same
6368set of attributes to a declaration as that on another declaration without
6369explicitly enumerating the attributes. This attribute can be applied
6370to declarations of functions (@pxref{Common Function Attributes}),
6371variables (@pxref{Common Variable Attributes}), or types
6372(@pxref{Common Type Attributes}).
6373
6374@option{-Wmissing-attributes} is enabled by @option{-Wall}.
6375
6376For example, since the declaration of the primary function template
6377below makes use of both attribute @code{malloc} and @code{alloc_size}
6378the declaration of the explicit specialization of the template is
6379diagnosed because it is missing one of the attributes.
6380
6381@smallexample
6382template <class T>
6383T* __attribute__ ((malloc, alloc_size (1)))
6384allocate (size_t);
6385
6386template <>
6387void* __attribute__ ((malloc))   // missing alloc_size
6388allocate<void> (size_t);
6389@end smallexample
6390
6391@item -Wmissing-braces
6392@opindex Wmissing-braces
6393@opindex Wno-missing-braces
6394Warn if an aggregate or union initializer is not fully bracketed.  In
6395the following example, the initializer for @code{a} is not fully
6396bracketed, but that for @code{b} is fully bracketed.
6397
6398@smallexample
6399int a[2][2] = @{ 0, 1, 2, 3 @};
6400int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
6401@end smallexample
6402
6403This warning is enabled by @option{-Wall}.
6404
6405@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
6406@opindex Wmissing-include-dirs
6407@opindex Wno-missing-include-dirs
6408Warn if a user-supplied include directory does not exist.
6409
6410@item -Wno-missing-profile
6411@opindex Wmissing-profile
6412@opindex Wno-missing-profile
6413This option controls warnings if feedback profiles are missing when using the
6414@option{-fprofile-use} option.
6415This option diagnoses those cases where a new function or a new file is added
6416between compiling with @option{-fprofile-generate} and with
6417@option{-fprofile-use}, without regenerating the profiles.
6418In these cases, the profile feedback data files do not contain any
6419profile feedback information for
6420the newly added function or file respectively.  Also, in the case when profile
6421count data (.gcda) files are removed, GCC cannot use any profile feedback
6422information.  In all these cases, warnings are issued to inform you that a
6423profile generation step is due.
6424Ignoring the warning can result in poorly optimized code.
6425@option{-Wno-missing-profile} can be used to
6426disable the warning, but this is not recommended and should be done only
6427when non-existent profile data is justified.
6428
6429@item -Wno-mismatched-dealloc
6430@opindex Wmismatched-dealloc
6431@opindex Wno-mismatched-dealloc
6432
6433Warn for calls to deallocation functions with pointer arguments returned
6434from from allocations functions for which the former isn't a suitable
6435deallocator.  A pair of functions can be associated as matching allocators
6436and deallocators by use of attribute @code{malloc}.  Unless disabled by
6437the @option{-fno-builtin} option the standard functions @code{calloc},
6438@code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
6439forms of C++ @code{operator new} and @code{operator delete} are implicitly
6440associated as matching allocators and deallocators.  In the following
6441example @code{mydealloc} is the deallocator for pointers returned from
6442@code{myalloc}.
6443
6444@smallexample
6445void mydealloc (void*);
6446
6447__attribute__ ((malloc (mydealloc, 1))) void*
6448myalloc (size_t);
6449
6450void f (void)
6451@{
6452  void *p = myalloc (32);
6453  // @dots{}use p@dots{}
6454  free (p);   // warning: not a matching deallocator for myalloc
6455  mydealloc (p);   // ok
6456@}
6457@end smallexample
6458
6459In C++, the related option @option{-Wmismatched-new-delete} diagnoses
6460mismatches involving either @code{operator new} or @code{operator delete}.
6461
6462Option @option{-Wmismatched-dealloc} is enabled by default.
6463
6464@item -Wmultistatement-macros
6465@opindex Wmultistatement-macros
6466@opindex Wno-multistatement-macros
6467Warn about unsafe multiple statement macros that appear to be guarded
6468by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
6469@code{while}, in which only the first statement is actually guarded after
6470the macro is expanded.
6471
6472For example:
6473
6474@smallexample
6475#define DOIT x++; y++
6476if (c)
6477  DOIT;
6478@end smallexample
6479
6480will increment @code{y} unconditionally, not just when @code{c} holds.
6481The can usually be fixed by wrapping the macro in a do-while loop:
6482@smallexample
6483#define DOIT do @{ x++; y++; @} while (0)
6484if (c)
6485  DOIT;
6486@end smallexample
6487
6488This warning is enabled by @option{-Wall} in C and C++.
6489
6490@item -Wparentheses
6491@opindex Wparentheses
6492@opindex Wno-parentheses
6493Warn if parentheses are omitted in certain contexts, such
6494as when there is an assignment in a context where a truth value
6495is expected, or when operators are nested whose precedence people
6496often get confused about.
6497
6498Also warn if a comparison like @code{x<=y<=z} appears; this is
6499equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
6500interpretation from that of ordinary mathematical notation.
6501
6502Also warn for dangerous uses of the GNU extension to
6503@code{?:} with omitted middle operand. When the condition
6504in the @code{?}: operator is a boolean expression, the omitted value is
6505always 1.  Often programmers expect it to be a value computed
6506inside the conditional expression instead.
6507
6508For C++ this also warns for some cases of unnecessary parentheses in
6509declarations, which can indicate an attempt at a function call instead
6510of a declaration:
6511@smallexample
6512@{
6513  // Declares a local variable called mymutex.
6514  std::unique_lock<std::mutex> (mymutex);
6515  // User meant std::unique_lock<std::mutex> lock (mymutex);
6516@}
6517@end smallexample
6518
6519This warning is enabled by @option{-Wall}.
6520
6521@item -Wsequence-point
6522@opindex Wsequence-point
6523@opindex Wno-sequence-point
6524Warn about code that may have undefined semantics because of violations
6525of sequence point rules in the C and C++ standards.
6526
6527The C and C++ standards define the order in which expressions in a C/C++
6528program are evaluated in terms of @dfn{sequence points}, which represent
6529a partial ordering between the execution of parts of the program: those
6530executed before the sequence point, and those executed after it.  These
6531occur after the evaluation of a full expression (one which is not part
6532of a larger expression), after the evaluation of the first operand of a
6533@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
6534function is called (but after the evaluation of its arguments and the
6535expression denoting the called function), and in certain other places.
6536Other than as expressed by the sequence point rules, the order of
6537evaluation of subexpressions of an expression is not specified.  All
6538these rules describe only a partial order rather than a total order,
6539since, for example, if two functions are called within one expression
6540with no sequence point between them, the order in which the functions
6541are called is not specified.  However, the standards committee have
6542ruled that function calls do not overlap.
6543
6544It is not specified when between sequence points modifications to the
6545values of objects take effect.  Programs whose behavior depends on this
6546have undefined behavior; the C and C++ standards specify that ``Between
6547the previous and next sequence point an object shall have its stored
6548value modified at most once by the evaluation of an expression.
6549Furthermore, the prior value shall be read only to determine the value
6550to be stored.''.  If a program breaks these rules, the results on any
6551particular implementation are entirely unpredictable.
6552
6553Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
6554= b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
6555diagnosed by this option, and it may give an occasional false positive
6556result, but in general it has been found fairly effective at detecting
6557this sort of problem in programs.
6558
6559The C++17 standard will define the order of evaluation of operands in
6560more cases: in particular it requires that the right-hand side of an
6561assignment be evaluated before the left-hand side, so the above
6562examples are no longer undefined.  But this option will still warn
6563about them, to help people avoid writing code that is undefined in C
6564and earlier revisions of C++.
6565
6566The standard is worded confusingly, therefore there is some debate
6567over the precise meaning of the sequence point rules in subtle cases.
6568Links to discussions of the problem, including proposed formal
6569definitions, may be found on the GCC readings page, at
6570@uref{http://gcc.gnu.org/@/readings.html}.
6571
6572This warning is enabled by @option{-Wall} for C and C++.
6573
6574@item -Wno-return-local-addr
6575@opindex Wno-return-local-addr
6576@opindex Wreturn-local-addr
6577Do not warn about returning a pointer (or in C++, a reference) to a
6578variable that goes out of scope after the function returns.
6579
6580@item -Wreturn-type
6581@opindex Wreturn-type
6582@opindex Wno-return-type
6583Warn whenever a function is defined with a return type that defaults
6584to @code{int}.  Also warn about any @code{return} statement with no
6585return value in a function whose return type is not @code{void}
6586(falling off the end of the function body is considered returning
6587without a value).
6588
6589For C only, warn about a @code{return} statement with an expression in a
6590function whose return type is @code{void}, unless the expression type is
6591also @code{void}.  As a GNU extension, the latter case is accepted
6592without a warning unless @option{-Wpedantic} is used.  Attempting
6593to use the return value of a non-@code{void} function other than @code{main}
6594that flows off the end by reaching the closing curly brace that terminates
6595the function is undefined.
6596
6597Unlike in C, in C++, flowing off the end of a non-@code{void} function other
6598than @code{main} results in undefined behavior even when the value of
6599the function is not used.
6600
6601This warning is enabled by default in C++ and by @option{-Wall} otherwise.
6602
6603@item -Wno-shift-count-negative
6604@opindex Wshift-count-negative
6605@opindex Wno-shift-count-negative
6606Controls warnings if a shift count is negative.
6607This warning is enabled by default.
6608
6609@item -Wno-shift-count-overflow
6610@opindex Wshift-count-overflow
6611@opindex Wno-shift-count-overflow
6612Controls warnings if a shift count is greater than or equal to the bit width
6613of the type.  This warning is enabled by default.
6614
6615@item -Wshift-negative-value
6616@opindex Wshift-negative-value
6617@opindex Wno-shift-negative-value
6618Warn if left shifting a negative value.  This warning is enabled by
6619@option{-Wextra} in C99 and C++11 modes (and newer).
6620
6621@item -Wno-shift-overflow
6622@itemx -Wshift-overflow=@var{n}
6623@opindex Wshift-overflow
6624@opindex Wno-shift-overflow
6625These options control warnings about left shift overflows.
6626
6627@table @gcctabopt
6628@item -Wshift-overflow=1
6629This is the warning level of @option{-Wshift-overflow} and is enabled
6630by default in C99 and C++11 modes (and newer).  This warning level does
6631not warn about left-shifting 1 into the sign bit.  (However, in C, such
6632an overflow is still rejected in contexts where an integer constant expression
6633is required.)  No warning is emitted in C++20 mode (and newer), as signed left
6634shifts always wrap.
6635
6636@item -Wshift-overflow=2
6637This warning level also warns about left-shifting 1 into the sign bit,
6638unless C++14 mode (or newer) is active.
6639@end table
6640
6641@item -Wswitch
6642@opindex Wswitch
6643@opindex Wno-switch
6644Warn whenever a @code{switch} statement has an index of enumerated type
6645and lacks a @code{case} for one or more of the named codes of that
6646enumeration.  (The presence of a @code{default} label prevents this
6647warning.)  @code{case} labels outside the enumeration range also
6648provoke warnings when this option is used (even if there is a
6649@code{default} label).
6650This warning is enabled by @option{-Wall}.
6651
6652@item -Wswitch-default
6653@opindex Wswitch-default
6654@opindex Wno-switch-default
6655Warn whenever a @code{switch} statement does not have a @code{default}
6656case.
6657
6658@item -Wswitch-enum
6659@opindex Wswitch-enum
6660@opindex Wno-switch-enum
6661Warn whenever a @code{switch} statement has an index of enumerated type
6662and lacks a @code{case} for one or more of the named codes of that
6663enumeration.  @code{case} labels outside the enumeration range also
6664provoke warnings when this option is used.  The only difference
6665between @option{-Wswitch} and this option is that this option gives a
6666warning about an omitted enumeration code even if there is a
6667@code{default} label.
6668
6669@item -Wno-switch-bool
6670@opindex Wswitch-bool
6671@opindex Wno-switch-bool
6672Do not warn when a @code{switch} statement has an index of boolean type
6673and the case values are outside the range of a boolean type.
6674It is possible to suppress this warning by casting the controlling
6675expression to a type other than @code{bool}.  For example:
6676@smallexample
6677@group
6678switch ((int) (a == 4))
6679  @{
6680  @dots{}
6681  @}
6682@end group
6683@end smallexample
6684This warning is enabled by default for C and C++ programs.
6685
6686@item -Wno-switch-outside-range
6687@opindex Wswitch-outside-range
6688@opindex Wno-switch-outside-range
6689This option controls warnings when a @code{switch} case has a value
6690that is outside of its
6691respective type range.  This warning is enabled by default for
6692C and C++ programs.
6693
6694@item -Wno-switch-unreachable
6695@opindex Wswitch-unreachable
6696@opindex Wno-switch-unreachable
6697Do not warn when a @code{switch} statement contains statements between the
6698controlling expression and the first case label, which will never be
6699executed.  For example:
6700@smallexample
6701@group
6702switch (cond)
6703  @{
6704   i = 15;
6705  @dots{}
6706   case 5:
6707  @dots{}
6708  @}
6709@end group
6710@end smallexample
6711@option{-Wswitch-unreachable} does not warn if the statement between the
6712controlling expression and the first case label is just a declaration:
6713@smallexample
6714@group
6715switch (cond)
6716  @{
6717   int i;
6718  @dots{}
6719   case 5:
6720   i = 5;
6721  @dots{}
6722  @}
6723@end group
6724@end smallexample
6725This warning is enabled by default for C and C++ programs.
6726
6727@item -Wsync-nand @r{(C and C++ only)}
6728@opindex Wsync-nand
6729@opindex Wno-sync-nand
6730Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
6731built-in functions are used.  These functions changed semantics in GCC 4.4.
6732
6733@item -Wunused-but-set-parameter
6734@opindex Wunused-but-set-parameter
6735@opindex Wno-unused-but-set-parameter
6736Warn whenever a function parameter is assigned to, but otherwise unused
6737(aside from its declaration).
6738
6739To suppress this warning use the @code{unused} attribute
6740(@pxref{Variable Attributes}).
6741
6742This warning is also enabled by @option{-Wunused} together with
6743@option{-Wextra}.
6744
6745@item -Wunused-but-set-variable
6746@opindex Wunused-but-set-variable
6747@opindex Wno-unused-but-set-variable
6748Warn whenever a local variable is assigned to, but otherwise unused
6749(aside from its declaration).
6750This warning is enabled by @option{-Wall}.
6751
6752To suppress this warning use the @code{unused} attribute
6753(@pxref{Variable Attributes}).
6754
6755This warning is also enabled by @option{-Wunused}, which is enabled
6756by @option{-Wall}.
6757
6758@item -Wunused-function
6759@opindex Wunused-function
6760@opindex Wno-unused-function
6761Warn whenever a static function is declared but not defined or a
6762non-inline static function is unused.
6763This warning is enabled by @option{-Wall}.
6764
6765@item -Wunused-label
6766@opindex Wunused-label
6767@opindex Wno-unused-label
6768Warn whenever a label is declared but not used.
6769This warning is enabled by @option{-Wall}.
6770
6771To suppress this warning use the @code{unused} attribute
6772(@pxref{Variable Attributes}).
6773
6774@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6775@opindex Wunused-local-typedefs
6776@opindex Wno-unused-local-typedefs
6777Warn when a typedef locally defined in a function is not used.
6778This warning is enabled by @option{-Wall}.
6779
6780@item -Wunused-parameter
6781@opindex Wunused-parameter
6782@opindex Wno-unused-parameter
6783Warn whenever a function parameter is unused aside from its declaration.
6784
6785To suppress this warning use the @code{unused} attribute
6786(@pxref{Variable Attributes}).
6787
6788@item -Wno-unused-result
6789@opindex Wunused-result
6790@opindex Wno-unused-result
6791Do not warn if a caller of a function marked with attribute
6792@code{warn_unused_result} (@pxref{Function Attributes}) does not use
6793its return value. The default is @option{-Wunused-result}.
6794
6795@item -Wunused-variable
6796@opindex Wunused-variable
6797@opindex Wno-unused-variable
6798Warn whenever a local or static variable is unused aside from its
6799declaration. This option implies @option{-Wunused-const-variable=1} for C,
6800but not for C++. This warning is enabled by @option{-Wall}.
6801
6802To suppress this warning use the @code{unused} attribute
6803(@pxref{Variable Attributes}).
6804
6805@item -Wunused-const-variable
6806@itemx -Wunused-const-variable=@var{n}
6807@opindex Wunused-const-variable
6808@opindex Wno-unused-const-variable
6809Warn whenever a constant static variable is unused aside from its declaration.
6810@option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6811for C, but not for C++. In C this declares variable storage, but in C++ this
6812is not an error since const variables take the place of @code{#define}s.
6813
6814To suppress this warning use the @code{unused} attribute
6815(@pxref{Variable Attributes}).
6816
6817@table @gcctabopt
6818@item -Wunused-const-variable=1
6819This is the warning level that is enabled by @option{-Wunused-variable} for
6820C.  It warns only about unused static const variables defined in the main
6821compilation unit, but not about static const variables declared in any
6822header included.
6823
6824@item -Wunused-const-variable=2
6825This warning level also warns for unused constant static variables in
6826headers (excluding system headers).  This is the warning level of
6827@option{-Wunused-const-variable} and must be explicitly requested since
6828in C++ this isn't an error and in C it might be harder to clean up all
6829headers included.
6830@end table
6831
6832@item -Wunused-value
6833@opindex Wunused-value
6834@opindex Wno-unused-value
6835Warn whenever a statement computes a result that is explicitly not
6836used. To suppress this warning cast the unused expression to
6837@code{void}. This includes an expression-statement or the left-hand
6838side of a comma expression that contains no side effects. For example,
6839an expression such as @code{x[i,j]} causes a warning, while
6840@code{x[(void)i,j]} does not.
6841
6842This warning is enabled by @option{-Wall}.
6843
6844@item -Wunused
6845@opindex Wunused
6846@opindex Wno-unused
6847All the above @option{-Wunused} options combined.
6848
6849In order to get a warning about an unused function parameter, you must
6850either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6851@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6852
6853@item -Wuninitialized
6854@opindex Wuninitialized
6855@opindex Wno-uninitialized
6856Warn if an object with automatic or allocated storage duration is used
6857without having been initialized.  In C++, also warn if a non-static
6858reference or non-static @code{const} member appears in a class without
6859constructors.
6860
6861In addition, passing a pointer (or in C++, a reference) to an uninitialized
6862object to a @code{const}-qualified argument of a built-in function known to
6863read the object is also diagnosed by this warning.
6864(@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
6865
6866If you want to warn about code that uses the uninitialized value of the
6867variable in its own initializer, use the @option{-Winit-self} option.
6868
6869These warnings occur for individual uninitialized elements of
6870structure, union or array variables as well as for variables that are
6871uninitialized as a whole.  They do not occur for variables or elements
6872declared @code{volatile}.  Because these warnings depend on
6873optimization, the exact variables or elements for which there are
6874warnings depend on the precise optimization options and version of GCC
6875used.
6876
6877Note that there may be no warning about a variable that is used only
6878to compute a value that itself is never used, because such
6879computations may be deleted by data flow analysis before the warnings
6880are printed.
6881
6882@item -Wno-invalid-memory-model
6883@opindex Winvalid-memory-model
6884@opindex Wno-invalid-memory-model
6885This option controls warnings
6886for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6887and the C11 atomic generic functions with a memory consistency argument
6888that is either invalid for the operation or outside the range of values
6889of the @code{memory_order} enumeration.  For example, since the
6890@code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6891defined for the relaxed, release, and sequentially consistent memory
6892orders the following code is diagnosed:
6893
6894@smallexample
6895void store (int *i)
6896@{
6897  __atomic_store_n (i, 0, memory_order_consume);
6898@}
6899@end smallexample
6900
6901@option{-Winvalid-memory-model} is enabled by default.
6902
6903@item -Wmaybe-uninitialized
6904@opindex Wmaybe-uninitialized
6905@opindex Wno-maybe-uninitialized
6906For an object with automatic or allocated storage duration, if there exists
6907a path from the function entry to a use of the object that is initialized,
6908but there exist some other paths for which the object is not initialized,
6909the compiler emits a warning if it cannot prove the uninitialized paths
6910are not executed at run time.
6911
6912In addition, passing a pointer (or in C++, a reference) to an uninitialized
6913object to a @code{const}-qualified function argument is also diagnosed by
6914this warning.  (@option{-Wuninitialized} is issued for built-in functions
6915known to read the object.)  Annotating the function with attribute
6916@code{access (none)} indicates that the argument isn't used to access
6917the object and avoids the warning (@pxref{Common Function Attributes}).
6918
6919These warnings are only possible in optimizing compilation, because otherwise
6920GCC does not keep track of the state of variables.
6921
6922These warnings are made optional because GCC may not be able to determine when
6923the code is correct in spite of appearing to have an error.  Here is one
6924example of how this can happen:
6925
6926@smallexample
6927@group
6928@{
6929  int x;
6930  switch (y)
6931    @{
6932    case 1: x = 1;
6933      break;
6934    case 2: x = 4;
6935      break;
6936    case 3: x = 5;
6937    @}
6938  foo (x);
6939@}
6940@end group
6941@end smallexample
6942
6943@noindent
6944If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6945always initialized, but GCC doesn't know this. To suppress the
6946warning, you need to provide a default case with assert(0) or
6947similar code.
6948
6949@cindex @code{longjmp} warnings
6950This option also warns when a non-volatile automatic variable might be
6951changed by a call to @code{longjmp}.
6952The compiler sees only the calls to @code{setjmp}.  It cannot know
6953where @code{longjmp} will be called; in fact, a signal handler could
6954call it at any point in the code.  As a result, you may get a warning
6955even when there is in fact no problem because @code{longjmp} cannot
6956in fact be called at the place that would cause a problem.
6957
6958Some spurious warnings can be avoided if you declare all the functions
6959you use that never return as @code{noreturn}.  @xref{Function
6960Attributes}.
6961
6962This warning is enabled by @option{-Wall} or @option{-Wextra}.
6963
6964@item -Wunknown-pragmas
6965@opindex Wunknown-pragmas
6966@opindex Wno-unknown-pragmas
6967@cindex warning for unknown pragmas
6968@cindex unknown pragmas, warning
6969@cindex pragmas, warning of unknown
6970Warn when a @code{#pragma} directive is encountered that is not understood by
6971GCC@.  If this command-line option is used, warnings are even issued
6972for unknown pragmas in system header files.  This is not the case if
6973the warnings are only enabled by the @option{-Wall} command-line option.
6974
6975@item -Wno-pragmas
6976@opindex Wno-pragmas
6977@opindex Wpragmas
6978Do not warn about misuses of pragmas, such as incorrect parameters,
6979invalid syntax, or conflicts between pragmas.  See also
6980@option{-Wunknown-pragmas}.
6981
6982@item -Wno-prio-ctor-dtor
6983@opindex Wno-prio-ctor-dtor
6984@opindex Wprio-ctor-dtor
6985Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6986The use of constructor and destructor attributes allow you to assign a
6987priority to the constructor/destructor to control its order of execution
6988before @code{main} is called or after it returns.  The priority values must be
6989greater than 100 as the compiler reserves priority values between 0--100 for
6990the implementation.
6991
6992@item -Wstrict-aliasing
6993@opindex Wstrict-aliasing
6994@opindex Wno-strict-aliasing
6995This option is only active when @option{-fstrict-aliasing} is active.
6996It warns about code that might break the strict aliasing rules that the
6997compiler is using for optimization.  The warning does not catch all
6998cases, but does attempt to catch the more common pitfalls.  It is
6999included in @option{-Wall}.
7000It is equivalent to @option{-Wstrict-aliasing=3}
7001
7002@item -Wstrict-aliasing=n
7003@opindex Wstrict-aliasing=n
7004This option is only active when @option{-fstrict-aliasing} is active.
7005It warns about code that might break the strict aliasing rules that the
7006compiler is using for optimization.
7007Higher levels correspond to higher accuracy (fewer false positives).
7008Higher levels also correspond to more effort, similar to the way @option{-O}
7009works.
7010@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7011
7012Level 1: Most aggressive, quick, least accurate.
7013Possibly useful when higher levels
7014do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7015false negatives.  However, it has many false positives.
7016Warns for all pointer conversions between possibly incompatible types,
7017even if never dereferenced.  Runs in the front end only.
7018
7019Level 2: Aggressive, quick, not too precise.
7020May still have many false positives (not as many as level 1 though),
7021and few false negatives (but possibly more than level 1).
7022Unlike level 1, it only warns when an address is taken.  Warns about
7023incomplete types.  Runs in the front end only.
7024
7025Level 3 (default for @option{-Wstrict-aliasing}):
7026Should have very few false positives and few false
7027negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7028Takes care of the common pun+dereference pattern in the front end:
7029@code{*(int*)&some_float}.
7030If optimization is enabled, it also runs in the back end, where it deals
7031with multiple statement cases using flow-sensitive points-to information.
7032Only warns when the converted pointer is dereferenced.
7033Does not warn about incomplete types.
7034
7035@item -Wstrict-overflow
7036@itemx -Wstrict-overflow=@var{n}
7037@opindex Wstrict-overflow
7038@opindex Wno-strict-overflow
7039This option is only active when signed overflow is undefined.
7040It warns about cases where the compiler optimizes based on the
7041assumption that signed overflow does not occur.  Note that it does not
7042warn about all cases where the code might overflow: it only warns
7043about cases where the compiler implements some optimization.  Thus
7044this warning depends on the optimization level.
7045
7046An optimization that assumes that signed overflow does not occur is
7047perfectly safe if the values of the variables involved are such that
7048overflow never does, in fact, occur.  Therefore this warning can
7049easily give a false positive: a warning about code that is not
7050actually a problem.  To help focus on important issues, several
7051warning levels are defined.  No warnings are issued for the use of
7052undefined signed overflow when estimating how many iterations a loop
7053requires, in particular when determining whether a loop will be
7054executed at all.
7055
7056@table @gcctabopt
7057@item -Wstrict-overflow=1
7058Warn about cases that are both questionable and easy to avoid.  For
7059example the compiler simplifies
7060@code{x + 1 > x} to @code{1}.  This level of
7061@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7062are not, and must be explicitly requested.
7063
7064@item -Wstrict-overflow=2
7065Also warn about other cases where a comparison is simplified to a
7066constant.  For example: @code{abs (x) >= 0}.  This can only be
7067simplified when signed integer overflow is undefined, because
7068@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7069zero.  @option{-Wstrict-overflow} (with no level) is the same as
7070@option{-Wstrict-overflow=2}.
7071
7072@item -Wstrict-overflow=3
7073Also warn about other cases where a comparison is simplified.  For
7074example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7075
7076@item -Wstrict-overflow=4
7077Also warn about other simplifications not covered by the above cases.
7078For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7079
7080@item -Wstrict-overflow=5
7081Also warn about cases where the compiler reduces the magnitude of a
7082constant involved in a comparison.  For example: @code{x + 2 > y} is
7083simplified to @code{x + 1 >= y}.  This is reported only at the
7084highest warning level because this simplification applies to many
7085comparisons, so this warning level gives a very large number of
7086false positives.
7087@end table
7088
7089@item -Wstring-compare
7090@opindex Wstring-compare
7091@opindex Wno-string-compare
7092Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7093determined to be either zero or non-zero in tests for such equality
7094owing to the length of one argument being greater than the size of
7095the array the other argument is stored in (or the bound in the case
7096of @code{strncmp}).  Such calls could be mistakes.  For example,
7097the call to @code{strcmp} below is diagnosed because its result is
7098necessarily non-zero irrespective of the contents of the array @code{a}.
7099
7100@smallexample
7101extern char a[4];
7102void f (char *d)
7103@{
7104  strcpy (d, "string");
7105  @dots{}
7106  if (0 == strcmp (a, d))   // cannot be true
7107    puts ("a and d are the same");
7108@}
7109@end smallexample
7110
7111@option{-Wstring-compare} is enabled by @option{-Wextra}.
7112
7113@item -Wno-stringop-overflow
7114@item -Wstringop-overflow
7115@itemx -Wstringop-overflow=@var{type}
7116@opindex Wstringop-overflow
7117@opindex Wno-stringop-overflow
7118Warn for calls to string manipulation functions such as @code{memcpy} and
7119@code{strcpy} that are determined to overflow the destination buffer.  The
7120optional argument is one greater than the type of Object Size Checking to
7121perform to determine the size of the destination.  @xref{Object Size Checking}.
7122The argument is meaningful only for functions that operate on character arrays
7123but not for raw memory functions like @code{memcpy} which always make use
7124of Object Size type-0.  The option also warns for calls that specify a size
7125in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7126The option produces the best results with optimization enabled but can detect
7127a small subset of simple buffer overflows even without optimization in
7128calls to the GCC built-in functions like @code{__builtin_memcpy} that
7129correspond to the standard functions.  In any case, the option warns about
7130just a subset of buffer overflows detected by the corresponding overflow
7131checking built-ins.  For example, the option issues a warning for
7132the @code{strcpy} call below because it copies at least 5 characters
7133(the string @code{"blue"} including the terminating NUL) into the buffer
7134of size 4.
7135
7136@smallexample
7137enum Color @{ blue, purple, yellow @};
7138const char* f (enum Color clr)
7139@{
7140  static char buf [4];
7141  const char *str;
7142  switch (clr)
7143    @{
7144      case blue: str = "blue"; break;
7145      case purple: str = "purple"; break;
7146      case yellow: str = "yellow"; break;
7147    @}
7148
7149  return strcpy (buf, str);   // warning here
7150@}
7151@end smallexample
7152
7153Option @option{-Wstringop-overflow=2} is enabled by default.
7154
7155@table @gcctabopt
7156@item -Wstringop-overflow
7157@itemx -Wstringop-overflow=1
7158@opindex Wstringop-overflow
7159@opindex Wno-stringop-overflow
7160The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7161to determine the sizes of destination objects.  At this setting the option
7162does not warn for writes past the end of subobjects of larger objects accessed
7163by pointers unless the size of the largest surrounding object is known.  When
7164the destination may be one of several objects it is assumed to be the largest
7165one of them.  On Linux systems, when optimization is enabled at this setting
7166the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7167is defined to a non-zero value.
7168
7169@item -Wstringop-overflow=2
7170The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7171to determine the sizes of destination objects.  At this setting the option
7172warns about overflows when writing to members of the largest complete
7173objects whose exact size is known.  However, it does not warn for excessive
7174writes to the same members of unknown objects referenced by pointers since
7175they may point to arrays containing unknown numbers of elements.  This is
7176the default setting of the option.
7177
7178@item -Wstringop-overflow=3
7179The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7180to determine the sizes of destination objects.  At this setting the option
7181warns about overflowing the smallest object or data member.  This is the
7182most restrictive setting of the option that may result in warnings for safe
7183code.
7184
7185@item -Wstringop-overflow=4
7186The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7187to determine the sizes of destination objects.  At this setting the option
7188warns about overflowing any data members, and when the destination is
7189one of several objects it uses the size of the largest of them to decide
7190whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7191setting of the option may result in warnings for benign code.
7192@end table
7193
7194@item -Wno-stringop-overread
7195@opindex Wstringop-overread
7196@opindex Wno-stringop-overread
7197Warn for calls to string manipulation functions such as @code{memchr}, or
7198@code{strcpy} that are determined to read past the end of the source
7199sequence.
7200
7201Option @option{-Wstringop-overread} is enabled by default.
7202
7203@item -Wno-stringop-truncation
7204@opindex Wstringop-truncation
7205@opindex Wno-stringop-truncation
7206Do not warn for calls to bounded string manipulation functions
7207such as @code{strncat},
7208@code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7209or leave the destination unchanged.
7210
7211In the following example, the call to @code{strncat} specifies a bound that
7212is less than the length of the source string.  As a result, the copy of
7213the source will be truncated and so the call is diagnosed.  To avoid the
7214warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7215
7216@smallexample
7217void append (char *buf, size_t bufsize)
7218@{
7219  strncat (buf, ".txt", 3);
7220@}
7221@end smallexample
7222
7223As another example, the following call to @code{strncpy} results in copying
7224to @code{d} just the characters preceding the terminating NUL, without
7225appending the NUL to the end.  Assuming the result of @code{strncpy} is
7226necessarily a NUL-terminated string is a common mistake, and so the call
7227is diagnosed.  To avoid the warning when the result is not expected to be
7228NUL-terminated, call @code{memcpy} instead.
7229
7230@smallexample
7231void copy (char *d, const char *s)
7232@{
7233  strncpy (d, s, strlen (s));
7234@}
7235@end smallexample
7236
7237In the following example, the call to @code{strncpy} specifies the size
7238of the destination buffer as the bound.  If the length of the source
7239string is equal to or greater than this size the result of the copy will
7240not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
7241the warning, specify @code{sizeof buf - 1} as the bound and set the last
7242element of the buffer to @code{NUL}.
7243
7244@smallexample
7245void copy (const char *s)
7246@{
7247  char buf[80];
7248  strncpy (buf, s, sizeof buf);
7249  @dots{}
7250@}
7251@end smallexample
7252
7253In situations where a character array is intended to store a sequence
7254of bytes with no terminating @code{NUL} such an array may be annotated
7255with attribute @code{nonstring} to avoid this warning.  Such arrays,
7256however, are not suitable arguments to functions that expect
7257@code{NUL}-terminated strings.  To help detect accidental misuses of
7258such arrays GCC issues warnings unless it can prove that the use is
7259safe.  @xref{Common Variable Attributes}.
7260
7261@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
7262@opindex Wsuggest-attribute=
7263@opindex Wno-suggest-attribute=
7264Warn for cases where adding an attribute may be beneficial. The
7265attributes currently supported are listed below.
7266
7267@table @gcctabopt
7268@item -Wsuggest-attribute=pure
7269@itemx -Wsuggest-attribute=const
7270@itemx -Wsuggest-attribute=noreturn
7271@itemx -Wmissing-noreturn
7272@itemx -Wsuggest-attribute=malloc
7273@opindex Wsuggest-attribute=pure
7274@opindex Wno-suggest-attribute=pure
7275@opindex Wsuggest-attribute=const
7276@opindex Wno-suggest-attribute=const
7277@opindex Wsuggest-attribute=noreturn
7278@opindex Wno-suggest-attribute=noreturn
7279@opindex Wmissing-noreturn
7280@opindex Wno-missing-noreturn
7281@opindex Wsuggest-attribute=malloc
7282@opindex Wno-suggest-attribute=malloc
7283
7284Warn about functions that might be candidates for attributes
7285@code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
7286only warns for functions visible in other compilation units or (in the case of
7287@code{pure} and @code{const}) if it cannot prove that the function returns
7288normally. A function returns normally if it doesn't contain an infinite loop or
7289return abnormally by throwing, calling @code{abort} or trapping.  This analysis
7290requires option @option{-fipa-pure-const}, which is enabled by default at
7291@option{-O} and higher.  Higher optimization levels improve the accuracy
7292of the analysis.
7293
7294@item -Wsuggest-attribute=format
7295@itemx -Wmissing-format-attribute
7296@opindex Wsuggest-attribute=format
7297@opindex Wmissing-format-attribute
7298@opindex Wno-suggest-attribute=format
7299@opindex Wno-missing-format-attribute
7300@opindex Wformat
7301@opindex Wno-format
7302
7303Warn about function pointers that might be candidates for @code{format}
7304attributes.  Note these are only possible candidates, not absolute ones.
7305GCC guesses that function pointers with @code{format} attributes that
7306are used in assignment, initialization, parameter passing or return
7307statements should have a corresponding @code{format} attribute in the
7308resulting type.  I.e.@: the left-hand side of the assignment or
7309initialization, the type of the parameter variable, or the return type
7310of the containing function respectively should also have a @code{format}
7311attribute to avoid the warning.
7312
7313GCC also warns about function definitions that might be
7314candidates for @code{format} attributes.  Again, these are only
7315possible candidates.  GCC guesses that @code{format} attributes
7316might be appropriate for any function that calls a function like
7317@code{vprintf} or @code{vscanf}, but this might not always be the
7318case, and some functions for which @code{format} attributes are
7319appropriate may not be detected.
7320
7321@item -Wsuggest-attribute=cold
7322@opindex Wsuggest-attribute=cold
7323@opindex Wno-suggest-attribute=cold
7324
7325Warn about functions that might be candidates for @code{cold} attribute.  This
7326is based on static detection and generally only warns about functions which
7327always leads to a call to another @code{cold} function such as wrappers of
7328C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
7329@end table
7330
7331@item -Walloc-zero
7332@opindex Wno-alloc-zero
7333@opindex Walloc-zero
7334Warn about calls to allocation functions decorated with attribute
7335@code{alloc_size} that specify zero bytes, including those to the built-in
7336forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
7337@code{malloc}, and @code{realloc}.  Because the behavior of these functions
7338when called with a zero size differs among implementations (and in the case
7339of @code{realloc} has been deprecated) relying on it may result in subtle
7340portability bugs and should be avoided.
7341
7342@item -Walloc-size-larger-than=@var{byte-size}
7343@opindex Walloc-size-larger-than=
7344@opindex Wno-alloc-size-larger-than
7345Warn about calls to functions decorated with attribute @code{alloc_size}
7346that attempt to allocate objects larger than the specified number of bytes,
7347or where the result of the size computation in an integer type with infinite
7348precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
7349@option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7350Warnings controlled by the option can be disabled either by specifying
7351@var{byte-size} of @samp{SIZE_MAX} or more or by
7352@option{-Wno-alloc-size-larger-than}.
7353@xref{Function Attributes}.
7354
7355@item -Wno-alloc-size-larger-than
7356@opindex Wno-alloc-size-larger-than
7357Disable @option{-Walloc-size-larger-than=} warnings.  The option is
7358equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
7359larger.
7360
7361@item -Walloca
7362@opindex Wno-alloca
7363@opindex Walloca
7364This option warns on all uses of @code{alloca} in the source.
7365
7366@item -Walloca-larger-than=@var{byte-size}
7367@opindex Walloca-larger-than=
7368@opindex Wno-alloca-larger-than
7369This option warns on calls to @code{alloca} with an integer argument whose
7370value is either zero, or that is not bounded by a controlling predicate
7371that limits its value to at most @var{byte-size}.  It also warns for calls
7372to @code{alloca} where the bound value is unknown.  Arguments of non-integer
7373types are considered unbounded even if they appear to be constrained to
7374the expected range.
7375
7376For example, a bounded case of @code{alloca} could be:
7377
7378@smallexample
7379void func (size_t n)
7380@{
7381  void *p;
7382  if (n <= 1000)
7383    p = alloca (n);
7384  else
7385    p = malloc (n);
7386  f (p);
7387@}
7388@end smallexample
7389
7390In the above example, passing @code{-Walloca-larger-than=1000} would not
7391issue a warning because the call to @code{alloca} is known to be at most
73921000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
7393the compiler would emit a warning.
7394
7395Unbounded uses, on the other hand, are uses of @code{alloca} with no
7396controlling predicate constraining its integer argument.  For example:
7397
7398@smallexample
7399void func ()
7400@{
7401  void *p = alloca (n);
7402  f (p);
7403@}
7404@end smallexample
7405
7406If @code{-Walloca-larger-than=500} were passed, the above would trigger
7407a warning, but this time because of the lack of bounds checking.
7408
7409Note, that even seemingly correct code involving signed integers could
7410cause a warning:
7411
7412@smallexample
7413void func (signed int n)
7414@{
7415  if (n < 500)
7416    @{
7417      p = alloca (n);
7418      f (p);
7419    @}
7420@}
7421@end smallexample
7422
7423In the above example, @var{n} could be negative, causing a larger than
7424expected argument to be implicitly cast into the @code{alloca} call.
7425
7426This option also warns when @code{alloca} is used in a loop.
7427
7428@option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
7429but is usually only effective  when @option{-ftree-vrp} is active (default
7430for @option{-O2} and above).
7431
7432See also @option{-Wvla-larger-than=}@samp{byte-size}.
7433
7434@item -Wno-alloca-larger-than
7435@opindex Wno-alloca-larger-than
7436Disable @option{-Walloca-larger-than=} warnings.  The option is
7437equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
7438
7439@item -Warith-conversion
7440@opindex Warith-conversion
7441@opindex Wno-arith-conversion
7442Do warn about implicit conversions from arithmetic operations even
7443when conversion of the operands to the same type cannot change their
7444values.  This affects warnings from @option{-Wconversion},
7445@option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
7446
7447@smallexample
7448@group
7449void f (char c, int i)
7450@{
7451  c = c + i; // warns with @option{-Wconversion}
7452  c = c + 1; // only warns with @option{-Warith-conversion}
7453@}
7454@end group
7455@end smallexample
7456
7457@item -Warray-bounds
7458@itemx -Warray-bounds=@var{n}
7459@opindex Wno-array-bounds
7460@opindex Warray-bounds
7461This option is only active when @option{-ftree-vrp} is active
7462(default for @option{-O2} and above). It warns about subscripts to arrays
7463that are always out of bounds. This warning is enabled by @option{-Wall}.
7464
7465@table @gcctabopt
7466@item -Warray-bounds=1
7467This is the warning level of @option{-Warray-bounds} and is enabled
7468by @option{-Wall}; higher levels are not, and must be explicitly requested.
7469
7470@item -Warray-bounds=2
7471This warning level also warns about out of bounds access for
7472arrays at the end of a struct and for arrays accessed through
7473pointers. This warning level may give a larger number of
7474false positives and is deactivated by default.
7475@end table
7476
7477@item -Warray-parameter
7478@itemx -Warray-parameter=@var{n}
7479@opindex Wno-array-parameter
7480Warn about redeclarations of functions involving arguments of array or
7481pointer types of inconsistent kinds or forms, and enable the detection
7482of out-of-bounds accesses to such parameters by warnings such as
7483@option{-Warray-bounds}.
7484
7485If the first function declaration uses the array form the bound specified
7486in the array is assumed to be the minimum number of elements expected to
7487be provided in calls to the function and the maximum number of elements
7488accessed by it.  Failing to provide arguments of sufficient size or accessing
7489more than the maximum number of elements may be diagnosed by warnings such
7490as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
7491involving array parameters declared using the @code{T[static N]} form.
7492
7493For example, the warning triggers for the following redeclarations because
7494the first one allows an array of any size to be passed to @code{f} while
7495the second one with the keyword @code{static} specifies that the array
7496argument must have at least four elements.
7497
7498@smallexample
7499void f (int[static 4]);
7500void f (int[]);           // warning (inconsistent array form)
7501
7502void g (void)
7503@{
7504  int *p = (int *)malloc (4);
7505  f (p);                  // warning (array too small)
7506  @dots{}
7507@}
7508@end smallexample
7509
7510At level 2 the warning also triggers for redeclarations involving any other
7511inconsistency in array or pointer argument forms denoting array sizes.
7512Pointers and arrays of unspecified bound are considered equivalent and do
7513not trigger a warning.
7514
7515@smallexample
7516void g (int*);
7517void g (int[]);     // no warning
7518void g (int[8]);    // warning (inconsistent array bound)
7519@end smallexample
7520
7521@option{-Warray-parameter=2} is included in @option{-Wall}.  The
7522@option{-Wvla-parameter} option triggers warnings for similar inconsistencies
7523involving Variable Length Array arguments.
7524
7525@item -Wattribute-alias=@var{n}
7526@itemx -Wno-attribute-alias
7527@opindex Wattribute-alias
7528@opindex Wno-attribute-alias
7529Warn about declarations using the @code{alias} and similar attributes whose
7530target is incompatible with the type of the alias.
7531@xref{Function Attributes,,Declaring Attributes of Functions}.
7532
7533@table @gcctabopt
7534@item -Wattribute-alias=1
7535The default warning level of the @option{-Wattribute-alias} option diagnoses
7536incompatibilities between the type of the alias declaration and that of its
7537target.  Such incompatibilities are typically indicative of bugs.
7538
7539@item -Wattribute-alias=2
7540
7541At this level @option{-Wattribute-alias} also diagnoses cases where
7542the attributes of the alias declaration are more restrictive than the
7543attributes applied to its target.  These mismatches can potentially
7544result in incorrect code generation.  In other cases they may be
7545benign and could be resolved simply by adding the missing attribute to
7546the target.  For comparison, see the @option{-Wmissing-attributes}
7547option, which controls diagnostics when the alias declaration is less
7548restrictive than the target, rather than more restrictive.
7549
7550Attributes considered include @code{alloc_align}, @code{alloc_size},
7551@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7552@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7553@code{returns_nonnull}, and @code{returns_twice}.
7554@end table
7555
7556@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
7557This is the default.  You can disable these warnings with either
7558@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
7559
7560@item -Wbool-compare
7561@opindex Wno-bool-compare
7562@opindex Wbool-compare
7563Warn about boolean expression compared with an integer value different from
7564@code{true}/@code{false}.  For instance, the following comparison is
7565always false:
7566@smallexample
7567int n = 5;
7568@dots{}
7569if ((n > 1) == 2) @{ @dots{} @}
7570@end smallexample
7571This warning is enabled by @option{-Wall}.
7572
7573@item -Wbool-operation
7574@opindex Wno-bool-operation
7575@opindex Wbool-operation
7576Warn about suspicious operations on expressions of a boolean type.  For
7577instance, bitwise negation of a boolean is very likely a bug in the program.
7578For C, this warning also warns about incrementing or decrementing a boolean,
7579which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
7580Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
7581
7582This warning is enabled by @option{-Wall}.
7583
7584@item -Wduplicated-branches
7585@opindex Wno-duplicated-branches
7586@opindex Wduplicated-branches
7587Warn when an if-else has identical branches.  This warning detects cases like
7588@smallexample
7589if (p != NULL)
7590  return 0;
7591else
7592  return 0;
7593@end smallexample
7594It doesn't warn when both branches contain just a null statement.  This warning
7595also warn for conditional operators:
7596@smallexample
7597  int i = x ? *p : *p;
7598@end smallexample
7599
7600@item -Wduplicated-cond
7601@opindex Wno-duplicated-cond
7602@opindex Wduplicated-cond
7603Warn about duplicated conditions in an if-else-if chain.  For instance,
7604warn for the following code:
7605@smallexample
7606if (p->q != NULL) @{ @dots{} @}
7607else if (p->q != NULL) @{ @dots{} @}
7608@end smallexample
7609
7610@item -Wframe-address
7611@opindex Wno-frame-address
7612@opindex Wframe-address
7613Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
7614is called with an argument greater than 0.  Such calls may return indeterminate
7615values or crash the program.  The warning is included in @option{-Wall}.
7616
7617@item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
7618@opindex Wno-discarded-qualifiers
7619@opindex Wdiscarded-qualifiers
7620Do not warn if type qualifiers on pointers are being discarded.
7621Typically, the compiler warns if a @code{const char *} variable is
7622passed to a function that takes a @code{char *} parameter.  This option
7623can be used to suppress such a warning.
7624
7625@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
7626@opindex Wno-discarded-array-qualifiers
7627@opindex Wdiscarded-array-qualifiers
7628Do not warn if type qualifiers on arrays which are pointer targets
7629are being discarded.  Typically, the compiler warns if a
7630@code{const int (*)[]} variable is passed to a function that
7631takes a @code{int (*)[]} parameter.  This option can be used to
7632suppress such a warning.
7633
7634@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
7635@opindex Wno-incompatible-pointer-types
7636@opindex Wincompatible-pointer-types
7637Do not warn when there is a conversion between pointers that have incompatible
7638types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
7639which warns for pointer argument passing or assignment with different
7640signedness.
7641
7642@item -Wno-int-conversion @r{(C and Objective-C only)}
7643@opindex Wno-int-conversion
7644@opindex Wint-conversion
7645Do not warn about incompatible integer to pointer and pointer to integer
7646conversions.  This warning is about implicit conversions; for explicit
7647conversions the warnings @option{-Wno-int-to-pointer-cast} and
7648@option{-Wno-pointer-to-int-cast} may be used.
7649
7650@item -Wzero-length-bounds
7651@opindex Wzero-length-bounds
7652@opindex Wzero-length-bounds
7653Warn about accesses to elements of zero-length array members that might
7654overlap other members of the same object.  Declaring interior zero-length
7655arrays is discouraged because accesses to them are undefined.  See
7656@xref{Zero Length}.
7657
7658For example, the first two stores in function @code{bad} are diagnosed
7659because the array elements overlap the subsequent members @code{b} and
7660@code{c}.  The third store is diagnosed by @option{-Warray-bounds}
7661because it is beyond the bounds of the enclosing object.
7662
7663@smallexample
7664struct X @{ int a[0]; int b, c; @};
7665struct X x;
7666
7667void bad (void)
7668@{
7669  x.a[0] = 0;   // -Wzero-length-bounds
7670  x.a[1] = 1;   // -Wzero-length-bounds
7671  x.a[2] = 2;   // -Warray-bounds
7672@}
7673@end smallexample
7674
7675Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
7676
7677@item -Wno-div-by-zero
7678@opindex Wno-div-by-zero
7679@opindex Wdiv-by-zero
7680Do not warn about compile-time integer division by zero.  Floating-point
7681division by zero is not warned about, as it can be a legitimate way of
7682obtaining infinities and NaNs.
7683
7684@item -Wsystem-headers
7685@opindex Wsystem-headers
7686@opindex Wno-system-headers
7687@cindex warnings from system headers
7688@cindex system headers, warnings from
7689Print warning messages for constructs found in system header files.
7690Warnings from system headers are normally suppressed, on the assumption
7691that they usually do not indicate real problems and would only make the
7692compiler output harder to read.  Using this command-line option tells
7693GCC to emit warnings from system headers as if they occurred in user
7694code.  However, note that using @option{-Wall} in conjunction with this
7695option does @emph{not} warn about unknown pragmas in system
7696headers---for that, @option{-Wunknown-pragmas} must also be used.
7697
7698@item -Wtautological-compare
7699@opindex Wtautological-compare
7700@opindex Wno-tautological-compare
7701Warn if a self-comparison always evaluates to true or false.  This
7702warning detects various mistakes such as:
7703@smallexample
7704int i = 1;
7705@dots{}
7706if (i > i) @{ @dots{} @}
7707@end smallexample
7708
7709This warning also warns about bitwise comparisons that always evaluate
7710to true or false, for instance:
7711@smallexample
7712if ((a & 16) == 10) @{ @dots{} @}
7713@end smallexample
7714will always be false.
7715
7716This warning is enabled by @option{-Wall}.
7717
7718@item -Wtrampolines
7719@opindex Wtrampolines
7720@opindex Wno-trampolines
7721Warn about trampolines generated for pointers to nested functions.
7722A trampoline is a small piece of data or code that is created at run
7723time on the stack when the address of a nested function is taken, and is
7724used to call the nested function indirectly.  For some targets, it is
7725made up of data only and thus requires no special treatment.  But, for
7726most targets, it is made up of code and thus requires the stack to be
7727made executable in order for the program to work properly.
7728
7729@item -Wfloat-equal
7730@opindex Wfloat-equal
7731@opindex Wno-float-equal
7732Warn if floating-point values are used in equality comparisons.
7733
7734The idea behind this is that sometimes it is convenient (for the
7735programmer) to consider floating-point values as approximations to
7736infinitely precise real numbers.  If you are doing this, then you need
7737to compute (by analyzing the code, or in some other way) the maximum or
7738likely maximum error that the computation introduces, and allow for it
7739when performing comparisons (and when producing output, but that's a
7740different problem).  In particular, instead of testing for equality, you
7741should check to see whether the two values have ranges that overlap; and
7742this is done with the relational operators, so equality comparisons are
7743probably mistaken.
7744
7745@item -Wtraditional @r{(C and Objective-C only)}
7746@opindex Wtraditional
7747@opindex Wno-traditional
7748Warn about certain constructs that behave differently in traditional and
7749ISO C@.  Also warn about ISO C constructs that have no traditional C
7750equivalent, and/or problematic constructs that should be avoided.
7751
7752@itemize @bullet
7753@item
7754Macro parameters that appear within string literals in the macro body.
7755In traditional C macro replacement takes place within string literals,
7756but in ISO C it does not.
7757
7758@item
7759In traditional C, some preprocessor directives did not exist.
7760Traditional preprocessors only considered a line to be a directive
7761if the @samp{#} appeared in column 1 on the line.  Therefore
7762@option{-Wtraditional} warns about directives that traditional C
7763understands but ignores because the @samp{#} does not appear as the
7764first character on the line.  It also suggests you hide directives like
7765@code{#pragma} not understood by traditional C by indenting them.  Some
7766traditional implementations do not recognize @code{#elif}, so this option
7767suggests avoiding it altogether.
7768
7769@item
7770A function-like macro that appears without arguments.
7771
7772@item
7773The unary plus operator.
7774
7775@item
7776The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
7777constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
7778constants.)  Note, these suffixes appear in macros defined in the system
7779headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
7780Use of these macros in user code might normally lead to spurious
7781warnings, however GCC's integrated preprocessor has enough context to
7782avoid warning in these cases.
7783
7784@item
7785A function declared external in one block and then used after the end of
7786the block.
7787
7788@item
7789A @code{switch} statement has an operand of type @code{long}.
7790
7791@item
7792A non-@code{static} function declaration follows a @code{static} one.
7793This construct is not accepted by some traditional C compilers.
7794
7795@item
7796The ISO type of an integer constant has a different width or
7797signedness from its traditional type.  This warning is only issued if
7798the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
7799typically represent bit patterns, are not warned about.
7800
7801@item
7802Usage of ISO string concatenation is detected.
7803
7804@item
7805Initialization of automatic aggregates.
7806
7807@item
7808Identifier conflicts with labels.  Traditional C lacks a separate
7809namespace for labels.
7810
7811@item
7812Initialization of unions.  If the initializer is zero, the warning is
7813omitted.  This is done under the assumption that the zero initializer in
7814user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7815initializer warnings and relies on default initialization to zero in the
7816traditional C case.
7817
7818@item
7819Conversions by prototypes between fixed/floating-point values and vice
7820versa.  The absence of these prototypes when compiling with traditional
7821C causes serious problems.  This is a subset of the possible
7822conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7823
7824@item
7825Use of ISO C style function definitions.  This warning intentionally is
7826@emph{not} issued for prototype declarations or variadic functions
7827because these ISO C features appear in your code when using
7828libiberty's traditional C compatibility macros, @code{PARAMS} and
7829@code{VPARAMS}.  This warning is also bypassed for nested functions
7830because that feature is already a GCC extension and thus not relevant to
7831traditional C compatibility.
7832@end itemize
7833
7834@item -Wtraditional-conversion @r{(C and Objective-C only)}
7835@opindex Wtraditional-conversion
7836@opindex Wno-traditional-conversion
7837Warn if a prototype causes a type conversion that is different from what
7838would happen to the same argument in the absence of a prototype.  This
7839includes conversions of fixed point to floating and vice versa, and
7840conversions changing the width or signedness of a fixed-point argument
7841except when the same as the default promotion.
7842
7843@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7844@opindex Wdeclaration-after-statement
7845@opindex Wno-declaration-after-statement
7846Warn when a declaration is found after a statement in a block.  This
7847construct, known from C++, was introduced with ISO C99 and is by default
7848allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
7849
7850@item -Wshadow
7851@opindex Wshadow
7852@opindex Wno-shadow
7853Warn whenever a local variable or type declaration shadows another
7854variable, parameter, type, class member (in C++), or instance variable
7855(in Objective-C) or whenever a built-in function is shadowed.  Note
7856that in C++, the compiler warns if a local variable shadows an
7857explicit typedef, but not if it shadows a struct/class/enum.
7858If this warning is enabled, it includes also all instances of
7859local shadowing.  This means that @option{-Wno-shadow=local}
7860and @option{-Wno-shadow=compatible-local} are ignored when
7861@option{-Wshadow} is used.
7862Same as @option{-Wshadow=global}.
7863
7864@item -Wno-shadow-ivar @r{(Objective-C only)}
7865@opindex Wno-shadow-ivar
7866@opindex Wshadow-ivar
7867Do not warn whenever a local variable shadows an instance variable in an
7868Objective-C method.
7869
7870@item -Wshadow=global
7871@opindex Wshadow=global
7872Warn for any shadowing.
7873Same as @option{-Wshadow}.
7874
7875@item -Wshadow=local
7876@opindex Wshadow=local
7877Warn when a local variable shadows another local variable or parameter.
7878
7879@item -Wshadow=compatible-local
7880@opindex Wshadow=compatible-local
7881Warn when a local variable shadows another local variable or parameter
7882whose type is compatible with that of the shadowing variable.  In C++,
7883type compatibility here means the type of the shadowing variable can be
7884converted to that of the shadowed variable.  The creation of this flag
7885(in addition to @option{-Wshadow=local}) is based on the idea that when
7886a local variable shadows another one of incompatible type, it is most
7887likely intentional, not a bug or typo, as shown in the following example:
7888
7889@smallexample
7890@group
7891for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7892@{
7893  for (int i = 0; i < N; ++i)
7894  @{
7895    ...
7896  @}
7897  ...
7898@}
7899@end group
7900@end smallexample
7901
7902Since the two variable @code{i} in the example above have incompatible types,
7903enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7904Because their types are incompatible, if a programmer accidentally uses one
7905in place of the other, type checking is expected to catch that and emit an
7906error or warning.  Use of this flag instead of @option{-Wshadow=local} can
7907possibly reduce the number of warnings triggered by intentional shadowing.
7908Note that this also means that shadowing @code{const char *i} by
7909@code{char *i} does not emit a warning.
7910
7911This warning is also enabled by @option{-Wshadow=local}.
7912
7913@item -Wlarger-than=@var{byte-size}
7914@opindex Wlarger-than=
7915@opindex Wlarger-than-@var{byte-size}
7916Warn whenever an object is defined whose size exceeds @var{byte-size}.
7917@option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7918Warnings controlled by the option can be disabled either by specifying
7919@var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
7920
7921Also warn for calls to bounded functions such as @code{memchr} or
7922@code{strnlen} that specify a bound greater than the largest possible
7923object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
7924can only be disabled by @option{-Wno-larger-than}.
7925
7926@item -Wno-larger-than
7927@opindex Wno-larger-than
7928Disable @option{-Wlarger-than=} warnings.  The option is equivalent
7929to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7930
7931@item -Wframe-larger-than=@var{byte-size}
7932@opindex Wframe-larger-than=
7933@opindex Wno-frame-larger-than
7934Warn if the size of a function frame exceeds @var{byte-size}.
7935The computation done to determine the stack frame size is approximate
7936and not conservative.
7937The actual requirements may be somewhat greater than @var{byte-size}
7938even if you do not get a warning.  In addition, any space allocated
7939via @code{alloca}, variable-length arrays, or related constructs
7940is not included by the compiler when determining
7941whether or not to issue a warning.
7942@option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7943Warnings controlled by the option can be disabled either by specifying
7944@var{byte-size} of @samp{SIZE_MAX} or more or by
7945@option{-Wno-frame-larger-than}.
7946
7947@item -Wno-frame-larger-than
7948@opindex Wno-frame-larger-than
7949Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
7950to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7951
7952@item -Wno-free-nonheap-object
7953@opindex Wno-free-nonheap-object
7954@opindex Wfree-nonheap-object
7955Warn when attempting to deallocate an object that was either not allocated
7956on the heap, or by using a pointer that was not returned from a prior call
7957to the corresponding allocation function.  For example, because the call
7958to @code{stpcpy} returns a pointer to the terminating nul character and
7959not to the begginning of the object, the call to @code{free} below is
7960diagnosed.
7961
7962@smallexample
7963void f (char *p)
7964@{
7965  p = stpcpy (p, "abc");
7966  // ...
7967  free (p);   // warning
7968@}
7969@end smallexample
7970
7971@option{-Wfree-nonheap-object} is enabled by default.
7972
7973@item -Wstack-usage=@var{byte-size}
7974@opindex Wstack-usage
7975@opindex Wno-stack-usage
7976Warn if the stack usage of a function might exceed @var{byte-size}.
7977The computation done to determine the stack usage is conservative.
7978Any space allocated via @code{alloca}, variable-length arrays, or related
7979constructs is included by the compiler when determining whether or not to
7980issue a warning.
7981
7982The message is in keeping with the output of @option{-fstack-usage}.
7983
7984@itemize
7985@item
7986If the stack usage is fully static but exceeds the specified amount, it's:
7987
7988@smallexample
7989  warning: stack usage is 1120 bytes
7990@end smallexample
7991@item
7992If the stack usage is (partly) dynamic but bounded, it's:
7993
7994@smallexample
7995  warning: stack usage might be 1648 bytes
7996@end smallexample
7997@item
7998If the stack usage is (partly) dynamic and not bounded, it's:
7999
8000@smallexample
8001  warning: stack usage might be unbounded
8002@end smallexample
8003@end itemize
8004
8005@option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8006Warnings controlled by the option can be disabled either by specifying
8007@var{byte-size} of @samp{SIZE_MAX} or more or by
8008@option{-Wno-stack-usage}.
8009
8010@item -Wno-stack-usage
8011@opindex Wno-stack-usage
8012Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8013to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8014
8015@item -Wunsafe-loop-optimizations
8016@opindex Wunsafe-loop-optimizations
8017@opindex Wno-unsafe-loop-optimizations
8018Warn if the loop cannot be optimized because the compiler cannot
8019assume anything on the bounds of the loop indices.  With
8020@option{-funsafe-loop-optimizations} warn if the compiler makes
8021such assumptions.
8022
8023@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8024@opindex Wno-pedantic-ms-format
8025@opindex Wpedantic-ms-format
8026When used in combination with @option{-Wformat}
8027and @option{-pedantic} without GNU extensions, this option
8028disables the warnings about non-ISO @code{printf} / @code{scanf} format
8029width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8030which depend on the MS runtime.
8031
8032@item -Wpointer-arith
8033@opindex Wpointer-arith
8034@opindex Wno-pointer-arith
8035Warn about anything that depends on the ``size of'' a function type or
8036of @code{void}.  GNU C assigns these types a size of 1, for
8037convenience in calculations with @code{void *} pointers and pointers
8038to functions.  In C++, warn also when an arithmetic operation involves
8039@code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8040
8041@item -Wno-pointer-compare
8042@opindex Wpointer-compare
8043@opindex Wno-pointer-compare
8044Do not warn if a pointer is compared with a zero character constant.
8045This usually
8046means that the pointer was meant to be dereferenced.  For example:
8047
8048@smallexample
8049const char *p = foo ();
8050if (p == '\0')
8051  return 42;
8052@end smallexample
8053
8054Note that the code above is invalid in C++11.
8055
8056This warning is enabled by default.
8057
8058@item -Wtsan
8059@opindex Wtsan
8060@opindex Wno-tsan
8061Warn about unsupported features in ThreadSanitizer.
8062
8063ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8064can report false positives.
8065
8066This warning is enabled by default.
8067
8068@item -Wtype-limits
8069@opindex Wtype-limits
8070@opindex Wno-type-limits
8071Warn if a comparison is always true or always false due to the limited
8072range of the data type, but do not warn for constant expressions.  For
8073example, warn if an unsigned variable is compared against zero with
8074@code{<} or @code{>=}.  This warning is also enabled by
8075@option{-Wextra}.
8076
8077@item -Wabsolute-value @r{(C and Objective-C only)}
8078@opindex Wabsolute-value
8079@opindex Wno-absolute-value
8080Warn for calls to standard functions that compute the absolute value
8081of an argument when a more appropriate standard function is available.
8082For example, calling @code{abs(3.14)} triggers the warning because the
8083appropriate function to call to compute the absolute value of a double
8084argument is @code{fabs}.  The option also triggers warnings when the
8085argument in a call to such a function has an unsigned type.  This
8086warning can be suppressed with an explicit type cast and it is also
8087enabled by @option{-Wextra}.
8088
8089@include cppwarnopts.texi
8090
8091@item -Wbad-function-cast @r{(C and Objective-C only)}
8092@opindex Wbad-function-cast
8093@opindex Wno-bad-function-cast
8094Warn when a function call is cast to a non-matching type.
8095For example, warn if a call to a function returning an integer type
8096is cast to a pointer type.
8097
8098@item -Wc90-c99-compat @r{(C and Objective-C only)}
8099@opindex Wc90-c99-compat
8100@opindex Wno-c90-c99-compat
8101Warn about features not present in ISO C90, but present in ISO C99.
8102For instance, warn about use of variable length arrays, @code{long long}
8103type, @code{bool} type, compound literals, designated initializers, and so
8104on.  This option is independent of the standards mode.  Warnings are disabled
8105in the expression that follows @code{__extension__}.
8106
8107@item -Wc99-c11-compat @r{(C and Objective-C only)}
8108@opindex Wc99-c11-compat
8109@opindex Wno-c99-c11-compat
8110Warn about features not present in ISO C99, but present in ISO C11.
8111For instance, warn about use of anonymous structures and unions,
8112@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8113@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8114and so on.  This option is independent of the standards mode.  Warnings are
8115disabled in the expression that follows @code{__extension__}.
8116
8117@item -Wc11-c2x-compat @r{(C and Objective-C only)}
8118@opindex Wc11-c2x-compat
8119@opindex Wno-c11-c2x-compat
8120Warn about features not present in ISO C11, but present in ISO C2X.
8121For instance, warn about omitting the string in @code{_Static_assert},
8122use of @samp{[[]]} syntax for attributes, use of decimal
8123floating-point types, and so on.  This option is independent of the
8124standards mode.  Warnings are disabled in the expression that follows
8125@code{__extension__}.
8126
8127@item -Wc++-compat @r{(C and Objective-C only)}
8128@opindex Wc++-compat
8129@opindex Wno-c++-compat
8130Warn about ISO C constructs that are outside of the common subset of
8131ISO C and ISO C++, e.g.@: request for implicit conversion from
8132@code{void *} to a pointer to non-@code{void} type.
8133
8134@item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8135@opindex Wc++11-compat
8136@opindex Wno-c++11-compat
8137Warn about C++ constructs whose meaning differs between ISO C++ 1998
8138and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8139in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
8140enabled by @option{-Wall}.
8141
8142@item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8143@opindex Wc++14-compat
8144@opindex Wno-c++14-compat
8145Warn about C++ constructs whose meaning differs between ISO C++ 2011
8146and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
8147
8148@item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8149@opindex Wc++17-compat
8150@opindex Wno-c++17-compat
8151Warn about C++ constructs whose meaning differs between ISO C++ 2014
8152and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
8153
8154@item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8155@opindex Wc++20-compat
8156@opindex Wno-c++20-compat
8157Warn about C++ constructs whose meaning differs between ISO C++ 2017
8158and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
8159
8160@item -Wcast-qual
8161@opindex Wcast-qual
8162@opindex Wno-cast-qual
8163Warn whenever a pointer is cast so as to remove a type qualifier from
8164the target type.  For example, warn if a @code{const char *} is cast
8165to an ordinary @code{char *}.
8166
8167Also warn when making a cast that introduces a type qualifier in an
8168unsafe way.  For example, casting @code{char **} to @code{const char **}
8169is unsafe, as in this example:
8170
8171@smallexample
8172  /* p is char ** value.  */
8173  const char **q = (const char **) p;
8174  /* Assignment of readonly string to const char * is OK.  */
8175  *q = "string";
8176  /* Now char** pointer points to read-only memory.  */
8177  **p = 'b';
8178@end smallexample
8179
8180@item -Wcast-align
8181@opindex Wcast-align
8182@opindex Wno-cast-align
8183Warn whenever a pointer is cast such that the required alignment of the
8184target is increased.  For example, warn if a @code{char *} is cast to
8185an @code{int *} on machines where integers can only be accessed at
8186two- or four-byte boundaries.
8187
8188@item -Wcast-align=strict
8189@opindex Wcast-align=strict
8190Warn whenever a pointer is cast such that the required alignment of the
8191target is increased.  For example, warn if a @code{char *} is cast to
8192an @code{int *} regardless of the target machine.
8193
8194@item -Wcast-function-type
8195@opindex Wcast-function-type
8196@opindex Wno-cast-function-type
8197Warn when a function pointer is cast to an incompatible function pointer.
8198In a cast involving function types with a variable argument list only
8199the types of initial arguments that are provided are considered.
8200Any parameter of pointer-type matches any other pointer-type.  Any benign
8201differences in integral types are ignored, like @code{int} vs.@: @code{long}
8202on ILP32 targets.  Likewise type qualifiers are ignored.  The function
8203type @code{void (*) (void)} is special and matches everything, which can
8204be used to suppress this warning.
8205In a cast involving pointer to member types this warning warns whenever
8206the type cast is changing the pointer to member type.
8207This warning is enabled by @option{-Wextra}.
8208
8209@item -Wwrite-strings
8210@opindex Wwrite-strings
8211@opindex Wno-write-strings
8212When compiling C, give string constants the type @code{const
8213char[@var{length}]} so that copying the address of one into a
8214non-@code{const} @code{char *} pointer produces a warning.  These
8215warnings help you find at compile time code that can try to write
8216into a string constant, but only if you have been very careful about
8217using @code{const} in declarations and prototypes.  Otherwise, it is
8218just a nuisance. This is why we did not make @option{-Wall} request
8219these warnings.
8220
8221When compiling C++, warn about the deprecated conversion from string
8222literals to @code{char *}.  This warning is enabled by default for C++
8223programs.
8224
8225@item -Wclobbered
8226@opindex Wclobbered
8227@opindex Wno-clobbered
8228Warn for variables that might be changed by @code{longjmp} or
8229@code{vfork}.  This warning is also enabled by @option{-Wextra}.
8230
8231@item -Wconversion
8232@opindex Wconversion
8233@opindex Wno-conversion
8234Warn for implicit conversions that may alter a value. This includes
8235conversions between real and integer, like @code{abs (x)} when
8236@code{x} is @code{double}; conversions between signed and unsigned,
8237like @code{unsigned ui = -1}; and conversions to smaller types, like
8238@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
8239((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
8240changed by the conversion like in @code{abs (2.0)}.  Warnings about
8241conversions between signed and unsigned integers can be disabled by
8242using @option{-Wno-sign-conversion}.
8243
8244For C++, also warn for confusing overload resolution for user-defined
8245conversions; and conversions that never use a type conversion
8246operator: conversions to @code{void}, the same type, a base class or a
8247reference to them. Warnings about conversions between signed and
8248unsigned integers are disabled by default in C++ unless
8249@option{-Wsign-conversion} is explicitly enabled.
8250
8251Warnings about conversion from arithmetic on a small type back to that
8252type are only given with @option{-Warith-conversion}.
8253
8254@item -Wdangling-else
8255@opindex Wdangling-else
8256@opindex Wno-dangling-else
8257Warn about constructions where there may be confusion to which
8258@code{if} statement an @code{else} branch belongs.  Here is an example of
8259such a case:
8260
8261@smallexample
8262@group
8263@{
8264  if (a)
8265    if (b)
8266      foo ();
8267  else
8268    bar ();
8269@}
8270@end group
8271@end smallexample
8272
8273In C/C++, every @code{else} branch belongs to the innermost possible
8274@code{if} statement, which in this example is @code{if (b)}.  This is
8275often not what the programmer expected, as illustrated in the above
8276example by indentation the programmer chose.  When there is the
8277potential for this confusion, GCC issues a warning when this flag
8278is specified.  To eliminate the warning, add explicit braces around
8279the innermost @code{if} statement so there is no way the @code{else}
8280can belong to the enclosing @code{if}.  The resulting code
8281looks like this:
8282
8283@smallexample
8284@group
8285@{
8286  if (a)
8287    @{
8288      if (b)
8289        foo ();
8290      else
8291        bar ();
8292    @}
8293@}
8294@end group
8295@end smallexample
8296
8297This warning is enabled by @option{-Wparentheses}.
8298
8299@item -Wdate-time
8300@opindex Wdate-time
8301@opindex Wno-date-time
8302Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
8303are encountered as they might prevent bit-wise-identical reproducible
8304compilations.
8305
8306@item -Wempty-body
8307@opindex Wempty-body
8308@opindex Wno-empty-body
8309Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
8310while} statement.  This warning is also enabled by @option{-Wextra}.
8311
8312@item -Wno-endif-labels
8313@opindex Wendif-labels
8314@opindex Wno-endif-labels
8315Do not warn about stray tokens after @code{#else} and @code{#endif}.
8316
8317@item -Wenum-compare
8318@opindex Wenum-compare
8319@opindex Wno-enum-compare
8320Warn about a comparison between values of different enumerated types.
8321In C++ enumerated type mismatches in conditional expressions are also
8322diagnosed and the warning is enabled by default.  In C this warning is
8323enabled by @option{-Wall}.
8324
8325@item -Wenum-conversion
8326@opindex Wenum-conversion
8327@opindex Wno-enum-conversion
8328Warn when a value of enumerated type is implicitly converted to a
8329different enumerated type.  This warning is enabled by @option{-Wextra}
8330in C@.
8331
8332@item -Wjump-misses-init @r{(C, Objective-C only)}
8333@opindex Wjump-misses-init
8334@opindex Wno-jump-misses-init
8335Warn if a @code{goto} statement or a @code{switch} statement jumps
8336forward across the initialization of a variable, or jumps backward to a
8337label after the variable has been initialized.  This only warns about
8338variables that are initialized when they are declared.  This warning is
8339only supported for C and Objective-C; in C++ this sort of branch is an
8340error in any case.
8341
8342@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
8343can be disabled with the @option{-Wno-jump-misses-init} option.
8344
8345@item -Wsign-compare
8346@opindex Wsign-compare
8347@opindex Wno-sign-compare
8348@cindex warning for comparison of signed and unsigned values
8349@cindex comparison of signed and unsigned values, warning
8350@cindex signed and unsigned values, comparison warning
8351Warn when a comparison between signed and unsigned values could produce
8352an incorrect result when the signed value is converted to unsigned.
8353In C++, this warning is also enabled by @option{-Wall}.  In C, it is
8354also enabled by @option{-Wextra}.
8355
8356@item -Wsign-conversion
8357@opindex Wsign-conversion
8358@opindex Wno-sign-conversion
8359Warn for implicit conversions that may change the sign of an integer
8360value, like assigning a signed integer expression to an unsigned
8361integer variable. An explicit cast silences the warning. In C, this
8362option is enabled also by @option{-Wconversion}.
8363
8364@item -Wfloat-conversion
8365@opindex Wfloat-conversion
8366@opindex Wno-float-conversion
8367Warn for implicit conversions that reduce the precision of a real value.
8368This includes conversions from real to integer, and from higher precision
8369real to lower precision real values.  This option is also enabled by
8370@option{-Wconversion}.
8371
8372@item -Wno-scalar-storage-order
8373@opindex Wno-scalar-storage-order
8374@opindex Wscalar-storage-order
8375Do not warn on suspicious constructs involving reverse scalar storage order.
8376
8377@item -Wsizeof-array-div
8378@opindex Wsizeof-array-div
8379@opindex Wno-sizeof-array-div
8380Warn about divisions of two sizeof operators when the first one is applied
8381to an array and the divisor does not equal the size of the array element.
8382In such a case, the computation will not yield the number of elements in the
8383array, which is likely what the user intended.  This warning warns e.g. about
8384@smallexample
8385int fn ()
8386@{
8387  int arr[10];
8388  return sizeof (arr) / sizeof (short);
8389@}
8390@end smallexample
8391
8392This warning is enabled by @option{-Wall}.
8393
8394@item -Wsizeof-pointer-div
8395@opindex Wsizeof-pointer-div
8396@opindex Wno-sizeof-pointer-div
8397Warn for suspicious divisions of two sizeof expressions that divide
8398the pointer size by the element size, which is the usual way to compute
8399the array size but won't work out correctly with pointers.  This warning
8400warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
8401not an array, but a pointer.  This warning is enabled by @option{-Wall}.
8402
8403@item -Wsizeof-pointer-memaccess
8404@opindex Wsizeof-pointer-memaccess
8405@opindex Wno-sizeof-pointer-memaccess
8406Warn for suspicious length parameters to certain string and memory built-in
8407functions if the argument uses @code{sizeof}.  This warning triggers for
8408example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
8409an array, but a pointer, and suggests a possible fix, or about
8410@code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
8411also warns about calls to bounded string copy functions like @code{strncat}
8412or @code{strncpy} that specify as the bound a @code{sizeof} expression of
8413the source array.  For example, in the following function the call to
8414@code{strncat} specifies the size of the source string as the bound.  That
8415is almost certainly a mistake and so the call is diagnosed.
8416@smallexample
8417void make_file (const char *name)
8418@{
8419  char path[PATH_MAX];
8420  strncpy (path, name, sizeof path - 1);
8421  strncat (path, ".text", sizeof ".text");
8422  @dots{}
8423@}
8424@end smallexample
8425
8426The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
8427
8428@item -Wno-sizeof-array-argument
8429@opindex Wsizeof-array-argument
8430@opindex Wno-sizeof-array-argument
8431Do not warn when the @code{sizeof} operator is applied to a parameter that is
8432declared as an array in a function definition.  This warning is enabled by
8433default for C and C++ programs.
8434
8435@item -Wmemset-elt-size
8436@opindex Wmemset-elt-size
8437@opindex Wno-memset-elt-size
8438Warn for suspicious calls to the @code{memset} built-in function, if the
8439first argument references an array, and the third argument is a number
8440equal to the number of elements, but not equal to the size of the array
8441in memory.  This indicates that the user has omitted a multiplication by
8442the element size.  This warning is enabled by @option{-Wall}.
8443
8444@item -Wmemset-transposed-args
8445@opindex Wmemset-transposed-args
8446@opindex Wno-memset-transposed-args
8447Warn for suspicious calls to the @code{memset} built-in function where
8448the second argument is not zero and the third argument is zero.  For
8449example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
8450@code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
8451is only emitted if the third argument is a literal zero.  Otherwise, if
8452it is an expression that is folded to zero, or a cast of zero to some
8453type, it is far less likely that the arguments have been mistakenly
8454transposed and no warning is emitted.  This warning is enabled
8455by @option{-Wall}.
8456
8457@item -Waddress
8458@opindex Waddress
8459@opindex Wno-address
8460Warn about suspicious uses of memory addresses. These include using
8461the address of a function in a conditional expression, such as
8462@code{void func(void); if (func)}, and comparisons against the memory
8463address of a string literal, such as @code{if (x == "abc")}.  Such
8464uses typically indicate a programmer error: the address of a function
8465always evaluates to true, so their use in a conditional usually
8466indicate that the programmer forgot the parentheses in a function
8467call; and comparisons against string literals result in unspecified
8468behavior and are not portable in C, so they usually indicate that the
8469programmer intended to use @code{strcmp}.  This warning is enabled by
8470@option{-Wall}.
8471
8472@item -Wno-address-of-packed-member
8473@opindex Waddress-of-packed-member
8474@opindex Wno-address-of-packed-member
8475Do not warn when the address of packed member of struct or union is taken,
8476which usually results in an unaligned pointer value.  This is
8477enabled by default.
8478
8479@item -Wlogical-op
8480@opindex Wlogical-op
8481@opindex Wno-logical-op
8482Warn about suspicious uses of logical operators in expressions.
8483This includes using logical operators in contexts where a
8484bit-wise operator is likely to be expected.  Also warns when
8485the operands of a logical operator are the same:
8486@smallexample
8487extern int a;
8488if (a < 0 && a < 0) @{ @dots{} @}
8489@end smallexample
8490
8491@item -Wlogical-not-parentheses
8492@opindex Wlogical-not-parentheses
8493@opindex Wno-logical-not-parentheses
8494Warn about logical not used on the left hand side operand of a comparison.
8495This option does not warn if the right operand is considered to be a boolean
8496expression.  Its purpose is to detect suspicious code like the following:
8497@smallexample
8498int a;
8499@dots{}
8500if (!a > 1) @{ @dots{} @}
8501@end smallexample
8502
8503It is possible to suppress the warning by wrapping the LHS into
8504parentheses:
8505@smallexample
8506if ((!a) > 1) @{ @dots{} @}
8507@end smallexample
8508
8509This warning is enabled by @option{-Wall}.
8510
8511@item -Waggregate-return
8512@opindex Waggregate-return
8513@opindex Wno-aggregate-return
8514Warn if any functions that return structures or unions are defined or
8515called.  (In languages where you can return an array, this also elicits
8516a warning.)
8517
8518@item -Wno-aggressive-loop-optimizations
8519@opindex Wno-aggressive-loop-optimizations
8520@opindex Waggressive-loop-optimizations
8521Warn if in a loop with constant number of iterations the compiler detects
8522undefined behavior in some statement during one or more of the iterations.
8523
8524@item -Wno-attributes
8525@opindex Wno-attributes
8526@opindex Wattributes
8527Do not warn if an unexpected @code{__attribute__} is used, such as
8528unrecognized attributes, function attributes applied to variables,
8529etc.  This does not stop errors for incorrect use of supported
8530attributes.
8531
8532@item -Wno-builtin-declaration-mismatch
8533@opindex Wno-builtin-declaration-mismatch
8534@opindex Wbuiltin-declaration-mismatch
8535Warn if a built-in function is declared with an incompatible signature
8536or as a non-function, or when a built-in function declared with a type
8537that does not include a prototype is called with arguments whose promoted
8538types do not match those expected by the function.  When @option{-Wextra}
8539is specified, also warn when a built-in function that takes arguments is
8540declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
8541warning is enabled by default.  To avoid the warning include the appropriate
8542header to bring the prototypes of built-in functions into scope.
8543
8544For example, the call to @code{memset} below is diagnosed by the warning
8545because the function expects a value of type @code{size_t} as its argument
8546but the type of @code{32} is @code{int}.  With @option{-Wextra},
8547the declaration of the function is diagnosed as well.
8548@smallexample
8549extern void* memset ();
8550void f (void *d)
8551@{
8552  memset (d, '\0', 32);
8553@}
8554@end smallexample
8555
8556@item -Wno-builtin-macro-redefined
8557@opindex Wno-builtin-macro-redefined
8558@opindex Wbuiltin-macro-redefined
8559Do not warn if certain built-in macros are redefined.  This suppresses
8560warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
8561@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
8562
8563@item -Wstrict-prototypes @r{(C and Objective-C only)}
8564@opindex Wstrict-prototypes
8565@opindex Wno-strict-prototypes
8566Warn if a function is declared or defined without specifying the
8567argument types.  (An old-style function definition is permitted without
8568a warning if preceded by a declaration that specifies the argument
8569types.)
8570
8571@item -Wold-style-declaration @r{(C and Objective-C only)}
8572@opindex Wold-style-declaration
8573@opindex Wno-old-style-declaration
8574Warn for obsolescent usages, according to the C Standard, in a
8575declaration. For example, warn if storage-class specifiers like
8576@code{static} are not the first things in a declaration.  This warning
8577is also enabled by @option{-Wextra}.
8578
8579@item -Wold-style-definition @r{(C and Objective-C only)}
8580@opindex Wold-style-definition
8581@opindex Wno-old-style-definition
8582Warn if an old-style function definition is used.  A warning is given
8583even if there is a previous prototype.  A definition using @samp{()}
8584is not considered an old-style definition in C2X mode, because it is
8585equivalent to @samp{(void)} in that case, but is considered an
8586old-style definition for older standards.
8587
8588@item -Wmissing-parameter-type @r{(C and Objective-C only)}
8589@opindex Wmissing-parameter-type
8590@opindex Wno-missing-parameter-type
8591A function parameter is declared without a type specifier in K&R-style
8592functions:
8593
8594@smallexample
8595void foo(bar) @{ @}
8596@end smallexample
8597
8598This warning is also enabled by @option{-Wextra}.
8599
8600@item -Wmissing-prototypes @r{(C and Objective-C only)}
8601@opindex Wmissing-prototypes
8602@opindex Wno-missing-prototypes
8603Warn if a global function is defined without a previous prototype
8604declaration.  This warning is issued even if the definition itself
8605provides a prototype.  Use this option to detect global functions
8606that do not have a matching prototype declaration in a header file.
8607This option is not valid for C++ because all function declarations
8608provide prototypes and a non-matching declaration declares an
8609overload rather than conflict with an earlier declaration.
8610Use @option{-Wmissing-declarations} to detect missing declarations in C++.
8611
8612@item -Wmissing-declarations
8613@opindex Wmissing-declarations
8614@opindex Wno-missing-declarations
8615Warn if a global function is defined without a previous declaration.
8616Do so even if the definition itself provides a prototype.
8617Use this option to detect global functions that are not declared in
8618header files.  In C, no warnings are issued for functions with previous
8619non-prototype declarations; use @option{-Wmissing-prototypes} to detect
8620missing prototypes.  In C++, no warnings are issued for function templates,
8621or for inline functions, or for functions in anonymous namespaces.
8622
8623@item -Wmissing-field-initializers
8624@opindex Wmissing-field-initializers
8625@opindex Wno-missing-field-initializers
8626@opindex W
8627@opindex Wextra
8628@opindex Wno-extra
8629Warn if a structure's initializer has some fields missing.  For
8630example, the following code causes such a warning, because
8631@code{x.h} is implicitly zero:
8632
8633@smallexample
8634struct s @{ int f, g, h; @};
8635struct s x = @{ 3, 4 @};
8636@end smallexample
8637
8638This option does not warn about designated initializers, so the following
8639modification does not trigger a warning:
8640
8641@smallexample
8642struct s @{ int f, g, h; @};
8643struct s x = @{ .f = 3, .g = 4 @};
8644@end smallexample
8645
8646In C this option does not warn about the universal zero initializer
8647@samp{@{ 0 @}}:
8648
8649@smallexample
8650struct s @{ int f, g, h; @};
8651struct s x = @{ 0 @};
8652@end smallexample
8653
8654Likewise, in C++ this option does not warn about the empty @{ @}
8655initializer, for example:
8656
8657@smallexample
8658struct s @{ int f, g, h; @};
8659s x = @{ @};
8660@end smallexample
8661
8662This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
8663warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
8664
8665@item -Wno-multichar
8666@opindex Wno-multichar
8667@opindex Wmultichar
8668Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
8669Usually they indicate a typo in the user's code, as they have
8670implementation-defined values, and should not be used in portable code.
8671
8672@item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
8673@opindex Wnormalized=
8674@opindex Wnormalized
8675@opindex Wno-normalized
8676@cindex NFC
8677@cindex NFKC
8678@cindex character set, input normalization
8679In ISO C and ISO C++, two identifiers are different if they are
8680different sequences of characters.  However, sometimes when characters
8681outside the basic ASCII character set are used, you can have two
8682different character sequences that look the same.  To avoid confusion,
8683the ISO 10646 standard sets out some @dfn{normalization rules} which
8684when applied ensure that two sequences that look the same are turned into
8685the same sequence.  GCC can warn you if you are using identifiers that
8686have not been normalized; this option controls that warning.
8687
8688There are four levels of warning supported by GCC@.  The default is
8689@option{-Wnormalized=nfc}, which warns about any identifier that is
8690not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
8691recommended form for most uses.  It is equivalent to
8692@option{-Wnormalized}.
8693
8694Unfortunately, there are some characters allowed in identifiers by
8695ISO C and ISO C++ that, when turned into NFC, are not allowed in
8696identifiers.  That is, there's no way to use these symbols in portable
8697ISO C or C++ and have all your identifiers in NFC@.
8698@option{-Wnormalized=id} suppresses the warning for these characters.
8699It is hoped that future versions of the standards involved will correct
8700this, which is why this option is not the default.
8701
8702You can switch the warning off for all characters by writing
8703@option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
8704only do this if you are using some other normalization scheme (like
8705``D''), because otherwise you can easily create bugs that are
8706literally impossible to see.
8707
8708Some characters in ISO 10646 have distinct meanings but look identical
8709in some fonts or display methodologies, especially once formatting has
8710been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
8711LETTER N'', displays just like a regular @code{n} that has been
8712placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
8713normalization scheme to convert all these into a standard form as
8714well, and GCC warns if your code is not in NFKC if you use
8715@option{-Wnormalized=nfkc}.  This warning is comparable to warning
8716about every identifier that contains the letter O because it might be
8717confused with the digit 0, and so is not the default, but may be
8718useful as a local coding convention if the programming environment
8719cannot be fixed to display these characters distinctly.
8720
8721@item -Wno-attribute-warning
8722@opindex Wno-attribute-warning
8723@opindex Wattribute-warning
8724Do not warn about usage of functions (@pxref{Function Attributes})
8725declared with @code{warning} attribute.  By default, this warning is
8726enabled.  @option{-Wno-attribute-warning} can be used to disable the
8727warning or @option{-Wno-error=attribute-warning} can be used to
8728disable the error when compiled with @option{-Werror} flag.
8729
8730@item -Wno-deprecated
8731@opindex Wno-deprecated
8732@opindex Wdeprecated
8733Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
8734
8735@item -Wno-deprecated-declarations
8736@opindex Wno-deprecated-declarations
8737@opindex Wdeprecated-declarations
8738Do not warn about uses of functions (@pxref{Function Attributes}),
8739variables (@pxref{Variable Attributes}), and types (@pxref{Type
8740Attributes}) marked as deprecated by using the @code{deprecated}
8741attribute.
8742
8743@item -Wno-overflow
8744@opindex Wno-overflow
8745@opindex Woverflow
8746Do not warn about compile-time overflow in constant expressions.
8747
8748@item -Wno-odr
8749@opindex Wno-odr
8750@opindex Wodr
8751Warn about One Definition Rule violations during link-time optimization.
8752Enabled by default.
8753
8754@item -Wopenmp-simd
8755@opindex Wopenmp-simd
8756@opindex Wno-openmp-simd
8757Warn if the vectorizer cost model overrides the OpenMP
8758simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
8759option can be used to relax the cost model.
8760
8761@item -Woverride-init @r{(C and Objective-C only)}
8762@opindex Woverride-init
8763@opindex Wno-override-init
8764@opindex W
8765@opindex Wextra
8766@opindex Wno-extra
8767Warn if an initialized field without side effects is overridden when
8768using designated initializers (@pxref{Designated Inits, , Designated
8769Initializers}).
8770
8771This warning is included in @option{-Wextra}.  To get other
8772@option{-Wextra} warnings without this one, use @option{-Wextra
8773-Wno-override-init}.
8774
8775@item -Wno-override-init-side-effects @r{(C and Objective-C only)}
8776@opindex Woverride-init-side-effects
8777@opindex Wno-override-init-side-effects
8778Do not warn if an initialized field with side effects is overridden when
8779using designated initializers (@pxref{Designated Inits, , Designated
8780Initializers}).  This warning is enabled by default.
8781
8782@item -Wpacked
8783@opindex Wpacked
8784@opindex Wno-packed
8785Warn if a structure is given the packed attribute, but the packed
8786attribute has no effect on the layout or size of the structure.
8787Such structures may be mis-aligned for little benefit.  For
8788instance, in this code, the variable @code{f.x} in @code{struct bar}
8789is misaligned even though @code{struct bar} does not itself
8790have the packed attribute:
8791
8792@smallexample
8793@group
8794struct foo @{
8795  int x;
8796  char a, b, c, d;
8797@} __attribute__((packed));
8798struct bar @{
8799  char z;
8800  struct foo f;
8801@};
8802@end group
8803@end smallexample
8804
8805@item -Wnopacked-bitfield-compat
8806@opindex Wpacked-bitfield-compat
8807@opindex Wno-packed-bitfield-compat
8808The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
8809on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
8810the change can lead to differences in the structure layout.  GCC
8811informs you when the offset of such a field has changed in GCC 4.4.
8812For example there is no longer a 4-bit padding between field @code{a}
8813and @code{b} in this structure:
8814
8815@smallexample
8816struct foo
8817@{
8818  char a:4;
8819  char b:8;
8820@} __attribute__ ((packed));
8821@end smallexample
8822
8823This warning is enabled by default.  Use
8824@option{-Wno-packed-bitfield-compat} to disable this warning.
8825
8826@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
8827@opindex Wpacked-not-aligned
8828@opindex Wno-packed-not-aligned
8829Warn if a structure field with explicitly specified alignment in a
8830packed struct or union is misaligned.  For example, a warning will
8831be issued on @code{struct S}, like, @code{warning: alignment 1 of
8832'struct S' is less than 8}, in this code:
8833
8834@smallexample
8835@group
8836struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
8837struct __attribute__ ((packed)) S @{
8838  struct S8 s8;
8839@};
8840@end group
8841@end smallexample
8842
8843This warning is enabled by @option{-Wall}.
8844
8845@item -Wpadded
8846@opindex Wpadded
8847@opindex Wno-padded
8848Warn if padding is included in a structure, either to align an element
8849of the structure or to align the whole structure.  Sometimes when this
8850happens it is possible to rearrange the fields of the structure to
8851reduce the padding and so make the structure smaller.
8852
8853@item -Wredundant-decls
8854@opindex Wredundant-decls
8855@opindex Wno-redundant-decls
8856Warn if anything is declared more than once in the same scope, even in
8857cases where multiple declaration is valid and changes nothing.
8858
8859@item -Wrestrict
8860@opindex Wrestrict
8861@opindex Wno-restrict
8862Warn when an object referenced by a @code{restrict}-qualified parameter
8863(or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8864argument, or when copies between such objects overlap.  For example,
8865the call to the @code{strcpy} function below attempts to truncate the string
8866by replacing its initial characters with the last four.  However, because
8867the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8868the call is diagnosed.
8869
8870@smallexample
8871void foo (void)
8872@{
8873  char a[] = "abcd1234";
8874  strcpy (a, a + 4);
8875  @dots{}
8876@}
8877@end smallexample
8878The @option{-Wrestrict} option detects some instances of simple overlap
8879even without optimization but works best at @option{-O2} and above.  It
8880is included in @option{-Wall}.
8881
8882@item -Wnested-externs @r{(C and Objective-C only)}
8883@opindex Wnested-externs
8884@opindex Wno-nested-externs
8885Warn if an @code{extern} declaration is encountered within a function.
8886
8887@item -Winline
8888@opindex Winline
8889@opindex Wno-inline
8890Warn if a function that is declared as inline cannot be inlined.
8891Even with this option, the compiler does not warn about failures to
8892inline functions declared in system headers.
8893
8894The compiler uses a variety of heuristics to determine whether or not
8895to inline a function.  For example, the compiler takes into account
8896the size of the function being inlined and the amount of inlining
8897that has already been done in the current function.  Therefore,
8898seemingly insignificant changes in the source program can cause the
8899warnings produced by @option{-Winline} to appear or disappear.
8900
8901@item -Wint-in-bool-context
8902@opindex Wint-in-bool-context
8903@opindex Wno-int-in-bool-context
8904Warn for suspicious use of integer values where boolean values are expected,
8905such as conditional expressions (?:) using non-boolean integer constants in
8906boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
8907integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
8908for all kinds of multiplications regardless of the data type.
8909This warning is enabled by @option{-Wall}.
8910
8911@item -Wno-int-to-pointer-cast
8912@opindex Wno-int-to-pointer-cast
8913@opindex Wint-to-pointer-cast
8914Suppress warnings from casts to pointer type of an integer of a
8915different size. In C++, casting to a pointer type of smaller size is
8916an error. @option{Wint-to-pointer-cast} is enabled by default.
8917
8918
8919@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8920@opindex Wno-pointer-to-int-cast
8921@opindex Wpointer-to-int-cast
8922Suppress warnings from casts from a pointer to an integer type of a
8923different size.
8924
8925@item -Winvalid-pch
8926@opindex Winvalid-pch
8927@opindex Wno-invalid-pch
8928Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8929the search path but cannot be used.
8930
8931@item -Wlong-long
8932@opindex Wlong-long
8933@opindex Wno-long-long
8934Warn if @code{long long} type is used.  This is enabled by either
8935@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8936modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
8937
8938@item -Wvariadic-macros
8939@opindex Wvariadic-macros
8940@opindex Wno-variadic-macros
8941Warn if variadic macros are used in ISO C90 mode, or if the GNU
8942alternate syntax is used in ISO C99 mode.  This is enabled by either
8943@option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
8944messages, use @option{-Wno-variadic-macros}.
8945
8946@item -Wno-varargs
8947@opindex Wvarargs
8948@opindex Wno-varargs
8949Do not warn upon questionable usage of the macros used to handle variable
8950arguments like @code{va_start}.  These warnings are enabled by default.
8951
8952@item -Wvector-operation-performance
8953@opindex Wvector-operation-performance
8954@opindex Wno-vector-operation-performance
8955Warn if vector operation is not implemented via SIMD capabilities of the
8956architecture.  Mainly useful for the performance tuning.
8957Vector operation can be implemented @code{piecewise}, which means that the
8958scalar operation is performed on every vector element;
8959@code{in parallel}, which means that the vector operation is implemented
8960using scalars of wider type, which normally is more performance efficient;
8961and @code{as a single scalar}, which means that vector fits into a
8962scalar type.
8963
8964@item -Wvla
8965@opindex Wvla
8966@opindex Wno-vla
8967Warn if a variable-length array is used in the code.
8968@option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8969the variable-length array.
8970
8971@item -Wvla-larger-than=@var{byte-size}
8972@opindex Wvla-larger-than=
8973@opindex Wno-vla-larger-than
8974If this option is used, the compiler warns for declarations of
8975variable-length arrays whose size is either unbounded, or bounded
8976by an argument that allows the array size to exceed @var{byte-size}
8977bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8978works, but with variable-length arrays.
8979
8980Note that GCC may optimize small variable-length arrays of a known
8981value into plain arrays, so this warning may not get triggered for
8982such arrays.
8983
8984@option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8985is typically only effective when @option{-ftree-vrp} is active (default
8986for @option{-O2} and above).
8987
8988See also @option{-Walloca-larger-than=@var{byte-size}}.
8989
8990@item -Wno-vla-larger-than
8991@opindex Wno-vla-larger-than
8992Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
8993to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8994
8995@item -Wvla-parameter
8996@opindex Wno-vla-parameter
8997Warn about redeclarations of functions involving arguments of Variable
8998Length Array types of inconsistent kinds or forms, and enable the detection
8999of out-of-bounds accesses to such parameters by warnings such as
9000@option{-Warray-bounds}.
9001
9002If the first function declaration uses the VLA form the bound specified
9003in the array is assumed to be the minimum number of elements expected to
9004be provided in calls to the function and the maximum number of elements
9005accessed by it.  Failing to provide arguments of sufficient size or
9006accessing more than the maximum number of elements may be diagnosed.
9007
9008For example, the warning triggers for the following redeclarations because
9009the first one allows an array of any size to be passed to @code{f} while
9010the second one specifies that the array argument must have at least @code{n}
9011elements.  In addition, calling @code{f} with the assotiated VLA bound
9012parameter in excess of the actual VLA bound triggers a warning as well.
9013
9014@smallexample
9015void f (int n, int[n]);
9016void f (int, int[]);     // warning: argument 2 previously declared as a VLA
9017
9018void g (int n)
9019@{
9020    if (n > 4)
9021      return;
9022    int a[n];
9023    f (sizeof a, a);     // warning: access to a by f may be out of bounds
9024  @dots{}
9025@}
9026
9027@end smallexample
9028
9029@option{-Wvla-parameter} is included in @option{-Wall}.  The
9030@option{-Warray-parameter} option triggers warnings for similar problems
9031involving ordinary array arguments.
9032
9033@item -Wvolatile-register-var
9034@opindex Wvolatile-register-var
9035@opindex Wno-volatile-register-var
9036Warn if a register variable is declared volatile.  The volatile
9037modifier does not inhibit all optimizations that may eliminate reads
9038and/or writes to register variables.  This warning is enabled by
9039@option{-Wall}.
9040
9041@item -Wdisabled-optimization
9042@opindex Wdisabled-optimization
9043@opindex Wno-disabled-optimization
9044Warn if a requested optimization pass is disabled.  This warning does
9045not generally indicate that there is anything wrong with your code; it
9046merely indicates that GCC's optimizers are unable to handle the code
9047effectively.  Often, the problem is that your code is too big or too
9048complex; GCC refuses to optimize programs when the optimization
9049itself is likely to take inordinate amounts of time.
9050
9051@item -Wpointer-sign @r{(C and Objective-C only)}
9052@opindex Wpointer-sign
9053@opindex Wno-pointer-sign
9054Warn for pointer argument passing or assignment with different signedness.
9055This option is only supported for C and Objective-C@.  It is implied by
9056@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
9057@option{-Wno-pointer-sign}.
9058
9059@item -Wstack-protector
9060@opindex Wstack-protector
9061@opindex Wno-stack-protector
9062This option is only active when @option{-fstack-protector} is active.  It
9063warns about functions that are not protected against stack smashing.
9064
9065@item -Woverlength-strings
9066@opindex Woverlength-strings
9067@opindex Wno-overlength-strings
9068Warn about string constants that are longer than the ``minimum
9069maximum'' length specified in the C standard.  Modern compilers
9070generally allow string constants that are much longer than the
9071standard's minimum limit, but very portable programs should avoid
9072using longer strings.
9073
9074The limit applies @emph{after} string constant concatenation, and does
9075not count the trailing NUL@.  In C90, the limit was 509 characters; in
9076C99, it was raised to 4095.  C++98 does not specify a normative
9077minimum maximum, so we do not diagnose overlength strings in C++@.
9078
9079This option is implied by @option{-Wpedantic}, and can be disabled with
9080@option{-Wno-overlength-strings}.
9081
9082@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
9083@opindex Wunsuffixed-float-constants
9084@opindex Wno-unsuffixed-float-constants
9085
9086Issue a warning for any floating constant that does not have
9087a suffix.  When used together with @option{-Wsystem-headers} it
9088warns about such constants in system header files.  This can be useful
9089when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
9090from the decimal floating-point extension to C99.
9091
9092@item -Wno-lto-type-mismatch
9093@opindex Wlto-type-mismatch
9094@opindex Wno-lto-type-mismatch
9095
9096During the link-time optimization, do not warn about type mismatches in
9097global declarations from different compilation units.
9098Requires @option{-flto} to be enabled.  Enabled by default.
9099
9100@item -Wno-designated-init @r{(C and Objective-C only)}
9101@opindex Wdesignated-init
9102@opindex Wno-designated-init
9103Suppress warnings when a positional initializer is used to initialize
9104a structure that has been marked with the @code{designated_init}
9105attribute.
9106
9107@end table
9108
9109@node Static Analyzer Options
9110@section Options That Control Static Analysis
9111
9112@table @gcctabopt
9113@item -fanalyzer
9114@opindex analyzer
9115@opindex fanalyzer
9116@opindex fno-analyzer
9117This option enables an static analysis of program flow which looks
9118for ``interesting'' interprocedural paths through the
9119code, and issues warnings for problems found on them.
9120
9121This analysis is much more expensive than other GCC warnings.
9122
9123Enabling this option effectively enables the following warnings:
9124
9125@gccoptlist{ @gol
9126-Wanalyzer-double-fclose @gol
9127-Wanalyzer-double-free @gol
9128-Wanalyzer-exposure-through-output-file @gol
9129-Wanalyzer-file-leak @gol
9130-Wanalyzer-free-of-non-heap @gol
9131-Wanalyzer-malloc-leak @gol
9132-Wanalyzer-mismatching-deallocation @gol
9133-Wanalyzer-possible-null-argument @gol
9134-Wanalyzer-possible-null-dereference @gol
9135-Wanalyzer-null-argument @gol
9136-Wanalyzer-null-dereference @gol
9137-Wanalyzer-shift-count-negative @gol
9138-Wanalyzer-shift-count-overflow @gol
9139-Wanalyzer-stale-setjmp-buffer @gol
9140-Wanalyzer-tainted-array-index @gol
9141-Wanalyzer-unsafe-call-within-signal-handler @gol
9142-Wanalyzer-use-after-free @gol
9143-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
9144-Wanalyzer-write-to-const @gol
9145-Wanalyzer-write-to-string-literal @gol
9146}
9147
9148This option is only available if GCC was configured with analyzer
9149support enabled.
9150
9151@item -Wanalyzer-too-complex
9152@opindex Wanalyzer-too-complex
9153@opindex Wno-analyzer-too-complex
9154If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
9155to attempt to explore the control flow and data flow in the program,
9156but these can be defeated by sufficiently complicated code.
9157
9158By default, the analysis silently stops if the code is too
9159complicated for the analyzer to fully explore and it reaches an internal
9160limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
9161
9162@item -Wno-analyzer-double-fclose
9163@opindex Wanalyzer-double-fclose
9164@opindex Wno-analyzer-double-fclose
9165This warning requires @option{-fanalyzer}, which enables it; use
9166@option{-Wno-analyzer-double-fclose} to disable it.
9167
9168This diagnostic warns for paths through the code in which a @code{FILE *}
9169can have @code{fclose} called on it more than once.
9170
9171@item -Wno-analyzer-double-free
9172@opindex Wanalyzer-double-free
9173@opindex Wno-analyzer-double-free
9174This warning requires @option{-fanalyzer}, which enables it; use
9175@option{-Wno-analyzer-double-free} to disable it.
9176
9177This diagnostic warns for paths through the code in which a pointer
9178can have a deallocator called on it more than once, either @code{free},
9179or a deallocator referenced by attribute @code{malloc}.
9180
9181@item -Wno-analyzer-exposure-through-output-file
9182@opindex Wanalyzer-exposure-through-output-file
9183@opindex Wno-analyzer-exposure-through-output-file
9184This warning requires @option{-fanalyzer}, which enables it; use
9185@option{-Wno-analyzer-exposure-through-output-file}
9186to disable it.
9187
9188This diagnostic warns for paths through the code in which a
9189security-sensitive value is written to an output file
9190(such as writing a password to a log file).
9191
9192@item -Wno-analyzer-file-leak
9193@opindex Wanalyzer-file-leak
9194@opindex Wno-analyzer-file-leak
9195This warning requires @option{-fanalyzer}, which enables it; use
9196@option{-Wno-analyzer-file-leak}
9197to disable it.
9198
9199This diagnostic warns for paths through the code in which a
9200@code{<stdio.h>} @code{FILE *} stream object is leaked.
9201
9202@item -Wno-analyzer-free-of-non-heap
9203@opindex Wanalyzer-free-of-non-heap
9204@opindex Wno-analyzer-free-of-non-heap
9205This warning requires @option{-fanalyzer}, which enables it; use
9206@option{-Wno-analyzer-free-of-non-heap}
9207to disable it.
9208
9209This diagnostic warns for paths through the code in which @code{free}
9210is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
9211
9212@item -Wno-analyzer-malloc-leak
9213@opindex Wanalyzer-malloc-leak
9214@opindex Wno-analyzer-malloc-leak
9215This warning requires @option{-fanalyzer}, which enables it; use
9216@option{-Wno-analyzer-malloc-leak}
9217to disable it.
9218
9219This diagnostic warns for paths through the code in which a
9220pointer allocated via an allocator is leaked: either @code{malloc},
9221or a function marked with attribute @code{malloc}.
9222
9223@item -Wno-analyzer-mismatching-deallocation
9224@opindex Wanalyzer-mismatching-deallocation
9225@opindex Wno-analyzer-mismatching-deallocation
9226This warning requires @option{-fanalyzer}, which enables it; use
9227@option{-Wno-analyzer-mismatching-deallocation}
9228to disable it.
9229
9230This diagnostic warns for paths through the code in which the
9231wrong deallocation function is called on a pointer value, based on
9232which function was used to allocate the pointer value.  The diagnostic
9233will warn about mismatches between @code{free}, scalar @code{delete}
9234and vector @code{delete[]}, and those marked as allocator/deallocator
9235pairs using attribute @code{malloc}.
9236
9237@item -Wno-analyzer-possible-null-argument
9238@opindex Wanalyzer-possible-null-argument
9239@opindex Wno-analyzer-possible-null-argument
9240This warning requires @option{-fanalyzer}, which enables it; use
9241@option{-Wno-analyzer-possible-null-argument} to disable it.
9242
9243This diagnostic warns for paths through the code in which a
9244possibly-NULL value is passed to a function argument marked
9245with @code{__attribute__((nonnull))} as requiring a non-NULL
9246value.
9247
9248@item -Wno-analyzer-possible-null-dereference
9249@opindex Wanalyzer-possible-null-dereference
9250@opindex Wno-analyzer-possible-null-dereference
9251This warning requires @option{-fanalyzer}, which enables it; use
9252@option{-Wno-analyzer-possible-null-dereference} to disable it.
9253
9254This diagnostic warns for paths through the code in which a
9255possibly-NULL value is dereferenced.
9256
9257@item -Wno-analyzer-null-argument
9258@opindex Wanalyzer-null-argument
9259@opindex Wno-analyzer-null-argument
9260This warning requires @option{-fanalyzer}, which enables it; use
9261@option{-Wno-analyzer-null-argument} to disable it.
9262
9263This diagnostic warns for paths through the code in which a
9264value known to be NULL is passed to a function argument marked
9265with @code{__attribute__((nonnull))} as requiring a non-NULL
9266value.
9267
9268@item -Wno-analyzer-null-dereference
9269@opindex Wanalyzer-null-dereference
9270@opindex Wno-analyzer-null-dereference
9271This warning requires @option{-fanalyzer}, which enables it; use
9272@option{-Wno-analyzer-null-dereference} to disable it.
9273
9274This diagnostic warns for paths through the code in which a
9275value known to be NULL is dereferenced.
9276
9277@item -Wno-analyzer-shift-count-negative
9278@opindex Wanalyzer-shift-count-negative
9279@opindex Wno-analyzer-shift-count-negative
9280This warning requires @option{-fanalyzer}, which enables it; use
9281@option{-Wno-analyzer-shift-count-negative} to disable it.
9282
9283This diagnostic warns for paths through the code in which a
9284shift is attempted with a negative count.  It is analogous to
9285the @option{-Wshift-count-negative} diagnostic implemented in
9286the C/C++ front ends, but is implemented based on analyzing
9287interprocedural paths, rather than merely parsing the syntax tree.
9288However, the analyzer does not prioritize detection of such paths, so
9289false negatives are more likely relative to other warnings.
9290
9291@item -Wno-analyzer-shift-count-overflow
9292@opindex Wanalyzer-shift-count-overflow
9293@opindex Wno-analyzer-shift-count-overflow
9294This warning requires @option{-fanalyzer}, which enables it; use
9295@option{-Wno-analyzer-shift-count-overflow} to disable it.
9296
9297This diagnostic warns for paths through the code in which a
9298shift is attempted with a count greater than or equal to the
9299precision of the operand's type.  It is analogous to
9300the @option{-Wshift-count-overflow} diagnostic implemented in
9301the C/C++ front ends, but is implemented based on analyzing
9302interprocedural paths, rather than merely parsing the syntax tree.
9303However, the analyzer does not prioritize detection of such paths, so
9304false negatives are more likely relative to other warnings.
9305
9306@item -Wno-analyzer-stale-setjmp-buffer
9307@opindex Wanalyzer-stale-setjmp-buffer
9308@opindex Wno-analyzer-stale-setjmp-buffer
9309This warning requires @option{-fanalyzer}, which enables it; use
9310@option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
9311
9312This diagnostic warns for paths through the code in which
9313@code{longjmp} is called to rewind to a @code{jmp_buf} relating
9314to a @code{setjmp} call in a function that has returned.
9315
9316When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
9317location, it records the stack frame.  The stack frame becomes invalid
9318when the function containing the @code{setjmp} call returns.  Attempting
9319to rewind to it via @code{longjmp} would reference a stack frame that
9320no longer exists, and likely lead to a crash (or worse).
9321
9322@item -Wno-analyzer-tainted-array-index
9323@opindex Wanalyzer-tainted-array-index
9324@opindex Wno-analyzer-tainted-array-index
9325This warning requires both @option{-fanalyzer} and
9326@option{-fanalyzer-checker=taint} to enable it;
9327use @option{-Wno-analyzer-tainted-array-index} to disable it.
9328
9329This diagnostic warns for paths through the code in which a value
9330that could be under an attacker's control is used as the index
9331of an array access without being sanitized.
9332
9333@item -Wno-analyzer-unsafe-call-within-signal-handler
9334@opindex Wanalyzer-unsafe-call-within-signal-handler
9335@opindex Wno-analyzer-unsafe-call-within-signal-handler
9336This warning requires @option{-fanalyzer}, which enables it; use
9337@option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
9338
9339This diagnostic warns for paths through the code in which a
9340function known to be async-signal-unsafe (such as @code{fprintf}) is
9341called from a signal handler.
9342
9343@item -Wno-analyzer-use-after-free
9344@opindex Wanalyzer-use-after-free
9345@opindex Wno-analyzer-use-after-free
9346This warning requires @option{-fanalyzer}, which enables it; use
9347@option{-Wno-analyzer-use-after-free} to disable it.
9348
9349This diagnostic warns for paths through the code in which a
9350pointer is used after a deallocator is called on it: either @code{free},
9351or a deallocator referenced by attribute @code{malloc}.
9352
9353@item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
9354@opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
9355@opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
9356This warning requires @option{-fanalyzer}, which enables it; use
9357@option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
9358to disable it.
9359
9360This diagnostic warns for paths through the code in which a pointer
9361is dereferenced that points to a variable in a stale stack frame.
9362
9363@item -Wno-analyzer-write-to-const
9364@opindex Wanalyzer-write-to-const
9365@opindex Wno-analyzer-write-to-const
9366This warning requires @option{-fanalyzer}, which enables it; use
9367@option{-Wno-analyzer-write-to-const}
9368to disable it.
9369
9370This diagnostic warns for paths through the code in which the analyzer
9371detects an attempt to write through a pointer to a @code{const} object.
9372However, the analyzer does not prioritize detection of such paths, so
9373false negatives are more likely relative to other warnings.
9374
9375@item -Wno-analyzer-write-to-string-literal
9376@opindex Wanalyzer-write-to-string-literal
9377@opindex Wno-analyzer-write-to-string-literal
9378This warning requires @option{-fanalyzer}, which enables it; use
9379@option{-Wno-analyzer-write-to-string-literal}
9380to disable it.
9381
9382This diagnostic warns for paths through the code in which the analyzer
9383detects an attempt to write through a pointer to a string literal.
9384However, the analyzer does not prioritize detection of such paths, so
9385false negatives are more likely relative to other warnings.
9386
9387@end table
9388
9389Pertinent parameters for controlling the exploration are:
9390@option{--param analyzer-bb-explosion-factor=@var{value}},
9391@option{--param analyzer-max-enodes-per-program-point=@var{value}},
9392@option{--param analyzer-max-recursion-depth=@var{value}}, and
9393@option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
9394
9395The following options control the analyzer.
9396
9397@table @gcctabopt
9398
9399@item -fanalyzer-call-summaries
9400@opindex fanalyzer-call-summaries
9401@opindex fno-analyzer-call-summaries
9402Simplify interprocedural analysis by computing the effect of certain calls,
9403rather than exploring all paths through the function from callsite to each
9404possible return.
9405
9406If enabled, call summaries are only used for functions with more than one
9407call site, and that are sufficiently complicated (as per
9408@option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
9409
9410@item -fanalyzer-checker=@var{name}
9411@opindex fanalyzer-checker
9412Restrict the analyzer to run just the named checker, and enable it.
9413
9414Some checkers are disabled by default (even with @option{-fanalyzer}),
9415such as the @code{taint} checker that implements
9416@option{-Wanalyzer-tainted-array-index}, and this option is required
9417to enable them.
9418
9419@item -fno-analyzer-feasibility
9420@opindex fanalyzer-feasibility
9421@opindex fno-analyzer-feasibility
9422This option is intended for analyzer developers.
9423
9424By default the analyzer verifies that there is a feasible control flow path
9425for each diagnostic it emits: that the conditions that hold are not mutually
9426exclusive.  Diagnostics for which no feasible path can be found are rejected.
9427This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
9428debugging issues in this code.
9429
9430@item -fanalyzer-fine-grained
9431@opindex fanalyzer-fine-grained
9432@opindex fno-analyzer-fine-grained
9433This option is intended for analyzer developers.
9434
9435Internally the analyzer builds an ``exploded graph'' that combines
9436control flow graphs with data flow information.
9437
9438By default, an edge in this graph can contain the effects of a run
9439of multiple statements within a basic block.  With
9440@option{-fanalyzer-fine-grained}, each statement gets its own edge.
9441
9442@item -fanalyzer-show-duplicate-count
9443@opindex fanalyzer-show-duplicate-count
9444@opindex fno-analyzer-show-duplicate-count
9445This option is intended for analyzer developers: if multiple diagnostics
9446have been detected as being duplicates of each other, it emits a note when
9447reporting the best diagnostic, giving the number of additional diagnostics
9448that were suppressed by the deduplication logic.
9449
9450@item -fno-analyzer-state-merge
9451@opindex fanalyzer-state-merge
9452@opindex fno-analyzer-state-merge
9453This option is intended for analyzer developers.
9454
9455By default the analyzer attempts to simplify analysis by merging
9456sufficiently similar states at each program point as it builds its
9457``exploded graph''.  With @option{-fno-analyzer-state-merge} this
9458merging can be suppressed, for debugging state-handling issues.
9459
9460@item -fno-analyzer-state-purge
9461@opindex fanalyzer-state-purge
9462@opindex fno-analyzer-state-purge
9463This option is intended for analyzer developers.
9464
9465By default the analyzer attempts to simplify analysis by purging
9466aspects of state at a program point that appear to no longer be relevant
9467e.g. the values of locals that aren't accessed later in the function
9468and which aren't relevant to leak analysis.
9469
9470With @option{-fno-analyzer-state-purge} this purging of state can
9471be suppressed, for debugging state-handling issues.
9472
9473@item -fanalyzer-transitivity
9474@opindex fanalyzer-transitivity
9475@opindex fno-analyzer-transitivity
9476This option enables transitivity of constraints within the analyzer.
9477
9478@item -fanalyzer-verbose-edges
9479This option is intended for analyzer developers.  It enables more
9480verbose, lower-level detail in the descriptions of control flow
9481within diagnostic paths.
9482
9483@item -fanalyzer-verbose-state-changes
9484This option is intended for analyzer developers.  It enables more
9485verbose, lower-level detail in the descriptions of events relating
9486to state machines within diagnostic paths.
9487
9488@item -fanalyzer-verbosity=@var{level}
9489This option controls the complexity of the control flow paths that are
9490emitted for analyzer diagnostics.
9491
9492The @var{level} can be one of:
9493
9494@table @samp
9495@item 0
9496At this level, interprocedural call and return events are displayed,
9497along with the most pertinent state-change events relating to
9498a diagnostic.  For example, for a double-@code{free} diagnostic,
9499both calls to @code{free} will be shown.
9500
9501@item 1
9502As per the previous level, but also show events for the entry
9503to each function.
9504
9505@item 2
9506As per the previous level, but also show events relating to
9507control flow that are significant to triggering the issue
9508(e.g. ``true path taken'' at a conditional).
9509
9510This level is the default.
9511
9512@item 3
9513As per the previous level, but show all control flow events, not
9514just significant ones.
9515
9516@item 4
9517This level is intended for analyzer developers; it adds various
9518other events intended for debugging the analyzer.
9519
9520@end table
9521
9522@item -fdump-analyzer
9523@opindex fdump-analyzer
9524Dump internal details about what the analyzer is doing to
9525@file{@var{file}.analyzer.txt}.
9526This option is overridden by @option{-fdump-analyzer-stderr}.
9527
9528@item -fdump-analyzer-stderr
9529@opindex fdump-analyzer-stderr
9530Dump internal details about what the analyzer is doing to stderr.
9531This option overrides @option{-fdump-analyzer}.
9532
9533@item -fdump-analyzer-callgraph
9534@opindex fdump-analyzer-callgraph
9535Dump a representation of the call graph suitable for viewing with
9536GraphViz to @file{@var{file}.callgraph.dot}.
9537
9538@item -fdump-analyzer-exploded-graph
9539@opindex fdump-analyzer-exploded-graph
9540Dump a representation of the ``exploded graph'' suitable for viewing with
9541GraphViz to @file{@var{file}.eg.dot}.
9542Nodes are color-coded based on state-machine states to emphasize
9543state changes.
9544
9545@item -fdump-analyzer-exploded-nodes
9546@opindex dump-analyzer-exploded-nodes
9547Emit diagnostics showing where nodes in the ``exploded graph'' are
9548in relation to the program source.
9549
9550@item -fdump-analyzer-exploded-nodes-2
9551@opindex dump-analyzer-exploded-nodes-2
9552Dump a textual representation of the ``exploded graph'' to
9553@file{@var{file}.eg.txt}.
9554
9555@item -fdump-analyzer-exploded-nodes-3
9556@opindex dump-analyzer-exploded-nodes-3
9557Dump a textual representation of the ``exploded graph'' to
9558one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
9559This is typically a large number of dump files.
9560
9561@item -fdump-analyzer-feasibility
9562@opindex dump-analyzer-feasibility
9563Dump internal details about the analyzer's search for feasible paths.
9564The details are written in a form suitable for viewing with GraphViz
9565to filenames of the form @file{@var{file}.*.fg.dot} and
9566@file{@var{file}.*.tg.dot}.
9567
9568@item -fdump-analyzer-json
9569@opindex fdump-analyzer-json
9570Dump a compressed JSON representation of analyzer internals to
9571@file{@var{file}.analyzer.json.gz}.  The precise format is subject
9572to change.
9573
9574@item -fdump-analyzer-state-purge
9575@opindex fdump-analyzer-state-purge
9576As per @option{-fdump-analyzer-supergraph}, dump a representation of the
9577``supergraph'' suitable for viewing with GraphViz, but annotate the
9578graph with information on what state will be purged at each node.
9579The graph is written to @file{@var{file}.state-purge.dot}.
9580
9581@item -fdump-analyzer-supergraph
9582@opindex fdump-analyzer-supergraph
9583Dump representations of the ``supergraph'' suitable for viewing with
9584GraphViz to @file{@var{file}.supergraph.dot} and to
9585@file{@var{file}.supergraph-eg.dot}.  These show all of the
9586control flow graphs in the program, with interprocedural edges for
9587calls and returns.  The second dump contains annotations showing nodes
9588in the ``exploded graph'' and diagnostics associated with them.
9589
9590@end table
9591
9592@node Debugging Options
9593@section Options for Debugging Your Program
9594@cindex options, debugging
9595@cindex debugging information options
9596
9597To tell GCC to emit extra information for use by a debugger, in almost
9598all cases you need only to add @option{-g} to your other options.
9599
9600GCC allows you to use @option{-g} with
9601@option{-O}.  The shortcuts taken by optimized code may occasionally
9602be surprising: some variables you declared may not exist
9603at all; flow of control may briefly move where you did not expect it;
9604some statements may not be executed because they compute constant
9605results or their values are already at hand; some statements may
9606execute in different places because they have been moved out of loops.
9607Nevertheless it is possible to debug optimized output.  This makes
9608it reasonable to use the optimizer for programs that might have bugs.
9609
9610If you are not using some other optimization option, consider
9611using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
9612With no @option{-O} option at all, some compiler passes that collect
9613information useful for debugging do not run at all, so that
9614@option{-Og} may result in a better debugging experience.
9615
9616@table @gcctabopt
9617@item -g
9618@opindex g
9619Produce debugging information in the operating system's native format
9620(stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
9621information.
9622
9623On most systems that use stabs format, @option{-g} enables use of extra
9624debugging information that only GDB can use; this extra information
9625makes debugging work better in GDB but probably makes other debuggers
9626crash or
9627refuse to read the program.  If you want to control for certain whether
9628to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
9629@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
9630
9631@item -ggdb
9632@opindex ggdb
9633Produce debugging information for use by GDB@.  This means to use the
9634most expressive format available (DWARF, stabs, or the native format
9635if neither of those are supported), including GDB extensions if at all
9636possible.
9637
9638@item -gdwarf
9639@itemx -gdwarf-@var{version}
9640@opindex gdwarf
9641Produce debugging information in DWARF format (if that is supported).
9642The value of @var{version} may be either 2, 3, 4 or 5; the default
9643version for most targets is 5 (with the exception of VxWorks, TPF and
9644Darwin/Mac OS X, which default to version 2, and AIX, which defaults
9645to version 4).
9646
9647Note that with DWARF Version 2, some ports require and always
9648use some non-conflicting DWARF 3 extensions in the unwind tables.
9649
9650Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
9651for maximum benefit. Version 5 requires GDB 8.0 or higher.
9652
9653GCC no longer supports DWARF Version 1, which is substantially
9654different than Version 2 and later.  For historical reasons, some
9655other DWARF-related options such as
9656@option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
9657in their names, but apply to all currently-supported versions of DWARF.
9658
9659@item -gstabs
9660@opindex gstabs
9661Produce debugging information in stabs format (if that is supported),
9662without GDB extensions.  This is the format used by DBX on most BSD
9663systems.  On MIPS, Alpha and System V Release 4 systems this option
9664produces stabs debugging output that is not understood by DBX@.
9665On System V Release 4 systems this option requires the GNU assembler.
9666
9667@item -gstabs+
9668@opindex gstabs+
9669Produce debugging information in stabs format (if that is supported),
9670using GNU extensions understood only by the GNU debugger (GDB)@.  The
9671use of these extensions is likely to make other debuggers crash or
9672refuse to read the program.
9673
9674@item -gxcoff
9675@opindex gxcoff
9676Produce debugging information in XCOFF format (if that is supported).
9677This is the format used by the DBX debugger on IBM RS/6000 systems.
9678
9679@item -gxcoff+
9680@opindex gxcoff+
9681Produce debugging information in XCOFF format (if that is supported),
9682using GNU extensions understood only by the GNU debugger (GDB)@.  The
9683use of these extensions is likely to make other debuggers crash or
9684refuse to read the program, and may cause assemblers other than the GNU
9685assembler (GAS) to fail with an error.
9686
9687@item -gvms
9688@opindex gvms
9689Produce debugging information in Alpha/VMS debug format (if that is
9690supported).  This is the format used by DEBUG on Alpha/VMS systems.
9691
9692@item -g@var{level}
9693@itemx -ggdb@var{level}
9694@itemx -gstabs@var{level}
9695@itemx -gxcoff@var{level}
9696@itemx -gvms@var{level}
9697Request debugging information and also use @var{level} to specify how
9698much information.  The default level is 2.
9699
9700Level 0 produces no debug information at all.  Thus, @option{-g0} negates
9701@option{-g}.
9702
9703Level 1 produces minimal information, enough for making backtraces in
9704parts of the program that you don't plan to debug.  This includes
9705descriptions of functions and external variables, and line number
9706tables, but no information about local variables.
9707
9708Level 3 includes extra information, such as all the macro definitions
9709present in the program.  Some debuggers support macro expansion when
9710you use @option{-g3}.
9711
9712If you use multiple @option{-g} options, with or without level numbers,
9713the last such option is the one that is effective.
9714
9715@option{-gdwarf} does not accept a concatenated debug level, to avoid
9716confusion with @option{-gdwarf-@var{level}}.
9717Instead use an additional @option{-g@var{level}} option to change the
9718debug level for DWARF.
9719
9720@item -fno-eliminate-unused-debug-symbols
9721@opindex feliminate-unused-debug-symbols
9722@opindex fno-eliminate-unused-debug-symbols
9723By default, no debug information is produced for symbols that are not actually
9724used. Use this option if you want debug information for all symbols.
9725
9726@item -femit-class-debug-always
9727@opindex femit-class-debug-always
9728Instead of emitting debugging information for a C++ class in only one
9729object file, emit it in all object files using the class.  This option
9730should be used only with debuggers that are unable to handle the way GCC
9731normally emits debugging information for classes because using this
9732option increases the size of debugging information by as much as a
9733factor of two.
9734
9735@item -fno-merge-debug-strings
9736@opindex fmerge-debug-strings
9737@opindex fno-merge-debug-strings
9738Direct the linker to not merge together strings in the debugging
9739information that are identical in different object files.  Merging is
9740not supported by all assemblers or linkers.  Merging decreases the size
9741of the debug information in the output file at the cost of increasing
9742link processing time.  Merging is enabled by default.
9743
9744@item -fdebug-prefix-map=@var{old}=@var{new}
9745@opindex fdebug-prefix-map
9746When compiling files residing in directory @file{@var{old}}, record
9747debugging information describing them as if the files resided in
9748directory @file{@var{new}} instead.  This can be used to replace a
9749build-time path with an install-time path in the debug info.  It can
9750also be used to change an absolute path to a relative path by using
9751@file{.} for @var{new}.  This can give more reproducible builds, which
9752are location independent, but may require an extra command to tell GDB
9753where to find the source files. See also @option{-ffile-prefix-map}.
9754
9755@item -fvar-tracking
9756@opindex fvar-tracking
9757Run variable tracking pass.  It computes where variables are stored at each
9758position in code.  Better debugging information is then generated
9759(if the debugging information format supports this information).
9760
9761It is enabled by default when compiling with optimization (@option{-Os},
9762@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
9763the debug info format supports it.
9764
9765@item -fvar-tracking-assignments
9766@opindex fvar-tracking-assignments
9767@opindex fno-var-tracking-assignments
9768Annotate assignments to user variables early in the compilation and
9769attempt to carry the annotations over throughout the compilation all the
9770way to the end, in an attempt to improve debug information while
9771optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
9772
9773It can be enabled even if var-tracking is disabled, in which case
9774annotations are created and maintained, but discarded at the end.
9775By default, this flag is enabled together with @option{-fvar-tracking},
9776except when selective scheduling is enabled.
9777
9778@item -gsplit-dwarf
9779@opindex gsplit-dwarf
9780If DWARF debugging information is enabled, separate as much debugging
9781information as possible into a separate output file with the extension
9782@file{.dwo}.  This option allows the build system to avoid linking files with
9783debug information.  To be useful, this option requires a debugger capable of
9784reading @file{.dwo} files.
9785
9786@item -gdwarf32
9787@itemx -gdwarf64
9788@opindex gdwarf32
9789@opindex gdwarf64
9790If DWARF debugging information is enabled, the @option{-gdwarf32} selects
9791the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
9792DWARF format.  The default is target specific, on most targets it is
9793@option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
9794can't support more than 2GiB of debug information in any of the DWARF
9795debug information sections.  The 64-bit DWARF format allows larger debug
9796information and might not be well supported by all consumers yet.
9797
9798@item -gdescribe-dies
9799@opindex gdescribe-dies
9800Add description attributes to some DWARF DIEs that have no name attribute,
9801such as artificial variables, external references and call site
9802parameter DIEs.
9803
9804@item -gpubnames
9805@opindex gpubnames
9806Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
9807
9808@item -ggnu-pubnames
9809@opindex ggnu-pubnames
9810Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
9811suitable for conversion into a GDB@ index.  This option is only useful
9812with a linker that can produce GDB@ index version 7.
9813
9814@item -fdebug-types-section
9815@opindex fdebug-types-section
9816@opindex fno-debug-types-section
9817When using DWARF Version 4 or higher, type DIEs can be put into
9818their own @code{.debug_types} section instead of making them part of the
9819@code{.debug_info} section.  It is more efficient to put them in a separate
9820comdat section since the linker can then remove duplicates.
9821But not all DWARF consumers support @code{.debug_types} sections yet
9822and on some objects @code{.debug_types} produces larger instead of smaller
9823debugging information.
9824
9825@item -grecord-gcc-switches
9826@itemx -gno-record-gcc-switches
9827@opindex grecord-gcc-switches
9828@opindex gno-record-gcc-switches
9829This switch causes the command-line options used to invoke the
9830compiler that may affect code generation to be appended to the
9831DW_AT_producer attribute in DWARF debugging information.  The options
9832are concatenated with spaces separating them from each other and from
9833the compiler version.
9834It is enabled by default.
9835See also @option{-frecord-gcc-switches} for another
9836way of storing compiler options into the object file.
9837
9838@item -gstrict-dwarf
9839@opindex gstrict-dwarf
9840Disallow using extensions of later DWARF standard version than selected
9841with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
9842DWARF extensions from later standard versions is allowed.
9843
9844@item -gno-strict-dwarf
9845@opindex gno-strict-dwarf
9846Allow using extensions of later DWARF standard version than selected with
9847@option{-gdwarf-@var{version}}.
9848
9849@item -gas-loc-support
9850@opindex gas-loc-support
9851Inform the compiler that the assembler supports @code{.loc} directives.
9852It may then use them for the assembler to generate DWARF2+ line number
9853tables.
9854
9855This is generally desirable, because assembler-generated line-number
9856tables are a lot more compact than those the compiler can generate
9857itself.
9858
9859This option will be enabled by default if, at GCC configure time, the
9860assembler was found to support such directives.
9861
9862@item -gno-as-loc-support
9863@opindex gno-as-loc-support
9864Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
9865line number tables are to be generated.
9866
9867@item -gas-locview-support
9868@opindex gas-locview-support
9869Inform the compiler that the assembler supports @code{view} assignment
9870and reset assertion checking in @code{.loc} directives.
9871
9872This option will be enabled by default if, at GCC configure time, the
9873assembler was found to support them.
9874
9875@item -gno-as-locview-support
9876Force GCC to assign view numbers internally, if
9877@option{-gvariable-location-views} are explicitly requested.
9878
9879@item -gcolumn-info
9880@itemx -gno-column-info
9881@opindex gcolumn-info
9882@opindex gno-column-info
9883Emit location column information into DWARF debugging information, rather
9884than just file and line.
9885This option is enabled by default.
9886
9887@item -gstatement-frontiers
9888@itemx -gno-statement-frontiers
9889@opindex gstatement-frontiers
9890@opindex gno-statement-frontiers
9891This option causes GCC to create markers in the internal representation
9892at the beginning of statements, and to keep them roughly in place
9893throughout compilation, using them to guide the output of @code{is_stmt}
9894markers in the line number table.  This is enabled by default when
9895compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
9896@dots{}), and outputting DWARF 2 debug information at the normal level.
9897
9898@item -gvariable-location-views
9899@itemx -gvariable-location-views=incompat5
9900@itemx -gno-variable-location-views
9901@opindex gvariable-location-views
9902@opindex gvariable-location-views=incompat5
9903@opindex gno-variable-location-views
9904Augment variable location lists with progressive view numbers implied
9905from the line number table.  This enables debug information consumers to
9906inspect state at certain points of the program, even if no instructions
9907associated with the corresponding source locations are present at that
9908point.  If the assembler lacks support for view numbers in line number
9909tables, this will cause the compiler to emit the line number table,
9910which generally makes them somewhat less compact.  The augmented line
9911number tables and location lists are fully backward-compatible, so they
9912can be consumed by debug information consumers that are not aware of
9913these augmentations, but they won't derive any benefit from them either.
9914
9915This is enabled by default when outputting DWARF 2 debug information at
9916the normal level, as long as there is assembler support,
9917@option{-fvar-tracking-assignments} is enabled and
9918@option{-gstrict-dwarf} is not.  When assembler support is not
9919available, this may still be enabled, but it will force GCC to output
9920internal line number tables, and if
9921@option{-ginternal-reset-location-views} is not enabled, that will most
9922certainly lead to silently mismatching location views.
9923
9924There is a proposed representation for view numbers that is not backward
9925compatible with the location list format introduced in DWARF 5, that can
9926be enabled with @option{-gvariable-location-views=incompat5}.  This
9927option may be removed in the future, is only provided as a reference
9928implementation of the proposed representation.  Debug information
9929consumers are not expected to support this extended format, and they
9930would be rendered unable to decode location lists using it.
9931
9932@item -ginternal-reset-location-views
9933@itemx -gno-internal-reset-location-views
9934@opindex ginternal-reset-location-views
9935@opindex gno-internal-reset-location-views
9936Attempt to determine location views that can be omitted from location
9937view lists.  This requires the compiler to have very accurate insn
9938length estimates, which isn't always the case, and it may cause
9939incorrect view lists to be generated silently when using an assembler
9940that does not support location view lists.  The GNU assembler will flag
9941any such error as a @code{view number mismatch}.  This is only enabled
9942on ports that define a reliable estimation function.
9943
9944@item -ginline-points
9945@itemx -gno-inline-points
9946@opindex ginline-points
9947@opindex gno-inline-points
9948Generate extended debug information for inlined functions.  Location
9949view tracking markers are inserted at inlined entry points, so that
9950address and view numbers can be computed and output in debug
9951information.  This can be enabled independently of location views, in
9952which case the view numbers won't be output, but it can only be enabled
9953along with statement frontiers, and it is only enabled by default if
9954location views are enabled.
9955
9956@item -gz@r{[}=@var{type}@r{]}
9957@opindex gz
9958Produce compressed debug sections in DWARF format, if that is supported.
9959If @var{type} is not given, the default type depends on the capabilities
9960of the assembler and linker used.  @var{type} may be one of
9961@samp{none} (don't compress debug sections), @samp{zlib} (use zlib
9962compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
9963compression in traditional GNU format).  If the linker doesn't support
9964writing compressed debug sections, the option is rejected.  Otherwise,
9965if the assembler does not support them, @option{-gz} is silently ignored
9966when producing object files.
9967
9968@item -femit-struct-debug-baseonly
9969@opindex femit-struct-debug-baseonly
9970Emit debug information for struct-like types
9971only when the base name of the compilation source file
9972matches the base name of file in which the struct is defined.
9973
9974This option substantially reduces the size of debugging information,
9975but at significant potential loss in type information to the debugger.
9976See @option{-femit-struct-debug-reduced} for a less aggressive option.
9977See @option{-femit-struct-debug-detailed} for more detailed control.
9978
9979This option works only with DWARF debug output.
9980
9981@item -femit-struct-debug-reduced
9982@opindex femit-struct-debug-reduced
9983Emit debug information for struct-like types
9984only when the base name of the compilation source file
9985matches the base name of file in which the type is defined,
9986unless the struct is a template or defined in a system header.
9987
9988This option significantly reduces the size of debugging information,
9989with some potential loss in type information to the debugger.
9990See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9991See @option{-femit-struct-debug-detailed} for more detailed control.
9992
9993This option works only with DWARF debug output.
9994
9995@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9996@opindex femit-struct-debug-detailed
9997Specify the struct-like types
9998for which the compiler generates debug information.
9999The intent is to reduce duplicate struct debug information
10000between different object files within the same program.
10001
10002This option is a detailed version of
10003@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
10004which serves for most needs.
10005
10006A specification has the syntax@*
10007[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
10008
10009The optional first word limits the specification to
10010structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
10011A struct type is used directly when it is the type of a variable, member.
10012Indirect uses arise through pointers to structs.
10013That is, when use of an incomplete struct is valid, the use is indirect.
10014An example is
10015@samp{struct one direct; struct two * indirect;}.
10016
10017The optional second word limits the specification to
10018ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
10019Generic structs are a bit complicated to explain.
10020For C++, these are non-explicit specializations of template classes,
10021or non-template classes within the above.
10022Other programming languages have generics,
10023but @option{-femit-struct-debug-detailed} does not yet implement them.
10024
10025The third word specifies the source files for those
10026structs for which the compiler should emit debug information.
10027The values @samp{none} and @samp{any} have the normal meaning.
10028The value @samp{base} means that
10029the base of name of the file in which the type declaration appears
10030must match the base of the name of the main compilation file.
10031In practice, this means that when compiling @file{foo.c}, debug information
10032is generated for types declared in that file and @file{foo.h},
10033but not other header files.
10034The value @samp{sys} means those types satisfying @samp{base}
10035or declared in system or compiler headers.
10036
10037You may need to experiment to determine the best settings for your application.
10038
10039The default is @option{-femit-struct-debug-detailed=all}.
10040
10041This option works only with DWARF debug output.
10042
10043@item -fno-dwarf2-cfi-asm
10044@opindex fdwarf2-cfi-asm
10045@opindex fno-dwarf2-cfi-asm
10046Emit DWARF unwind info as compiler generated @code{.eh_frame} section
10047instead of using GAS @code{.cfi_*} directives.
10048
10049@item -fno-eliminate-unused-debug-types
10050@opindex feliminate-unused-debug-types
10051@opindex fno-eliminate-unused-debug-types
10052Normally, when producing DWARF output, GCC avoids producing debug symbol
10053output for types that are nowhere used in the source file being compiled.
10054Sometimes it is useful to have GCC emit debugging
10055information for all types declared in a compilation
10056unit, regardless of whether or not they are actually used
10057in that compilation unit, for example
10058if, in the debugger, you want to cast a value to a type that is
10059not actually used in your program (but is declared).  More often,
10060however, this results in a significant amount of wasted space.
10061@end table
10062
10063@node Optimize Options
10064@section Options That Control Optimization
10065@cindex optimize options
10066@cindex options, optimization
10067
10068These options control various sorts of optimizations.
10069
10070Without any optimization option, the compiler's goal is to reduce the
10071cost of compilation and to make debugging produce the expected
10072results.  Statements are independent: if you stop the program with a
10073breakpoint between statements, you can then assign a new value to any
10074variable or change the program counter to any other statement in the
10075function and get exactly the results you expect from the source
10076code.
10077
10078Turning on optimization flags makes the compiler attempt to improve
10079the performance and/or code size at the expense of compilation time
10080and possibly the ability to debug the program.
10081
10082The compiler performs optimization based on the knowledge it has of the
10083program.  Compiling multiple files at once to a single output file mode allows
10084the compiler to use information gained from all of the files when compiling
10085each of them.
10086
10087Not all optimizations are controlled directly by a flag.  Only
10088optimizations that have a flag are listed in this section.
10089
10090Most optimizations are completely disabled at @option{-O0} or if an
10091@option{-O} level is not set on the command line, even if individual
10092optimization flags are specified.  Similarly, @option{-Og} suppresses
10093many optimization passes.
10094
10095Depending on the target and how GCC was configured, a slightly different
10096set of optimizations may be enabled at each @option{-O} level than
10097those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
10098to find out the exact set of optimizations that are enabled at each level.
10099@xref{Overall Options}, for examples.
10100
10101@table @gcctabopt
10102@item -O
10103@itemx -O1
10104@opindex O
10105@opindex O1
10106Optimize.  Optimizing compilation takes somewhat more time, and a lot
10107more memory for a large function.
10108
10109With @option{-O}, the compiler tries to reduce code size and execution
10110time, without performing any optimizations that take a great deal of
10111compilation time.
10112
10113@c Note that in addition to the default_options_table list in opts.c,
10114@c several optimization flags default to true but control optimization
10115@c passes that are explicitly disabled at -O0.
10116
10117@option{-O} turns on the following optimization flags:
10118
10119@c Please keep the following list alphabetized.
10120@gccoptlist{-fauto-inc-dec @gol
10121-fbranch-count-reg @gol
10122-fcombine-stack-adjustments @gol
10123-fcompare-elim @gol
10124-fcprop-registers @gol
10125-fdce @gol
10126-fdefer-pop @gol
10127-fdelayed-branch @gol
10128-fdse @gol
10129-fforward-propagate @gol
10130-fguess-branch-probability @gol
10131-fif-conversion @gol
10132-fif-conversion2 @gol
10133-finline-functions-called-once @gol
10134-fipa-modref @gol
10135-fipa-profile @gol
10136-fipa-pure-const @gol
10137-fipa-reference @gol
10138-fipa-reference-addressable @gol
10139-fmerge-constants @gol
10140-fmove-loop-invariants @gol
10141-fomit-frame-pointer @gol
10142-freorder-blocks @gol
10143-fshrink-wrap @gol
10144-fshrink-wrap-separate @gol
10145-fsplit-wide-types @gol
10146-fssa-backprop @gol
10147-fssa-phiopt @gol
10148-ftree-bit-ccp @gol
10149-ftree-ccp @gol
10150-ftree-ch @gol
10151-ftree-coalesce-vars @gol
10152-ftree-copy-prop @gol
10153-ftree-dce @gol
10154-ftree-dominator-opts @gol
10155-ftree-dse @gol
10156-ftree-forwprop @gol
10157-ftree-fre @gol
10158-ftree-phiprop @gol
10159-ftree-pta @gol
10160-ftree-scev-cprop @gol
10161-ftree-sink @gol
10162-ftree-slsr @gol
10163-ftree-sra @gol
10164-ftree-ter @gol
10165-funit-at-a-time}
10166
10167@item -O2
10168@opindex O2
10169Optimize even more.  GCC performs nearly all supported optimizations
10170that do not involve a space-speed tradeoff.
10171As compared to @option{-O}, this option increases both compilation time
10172and the performance of the generated code.
10173
10174@option{-O2} turns on all optimization flags specified by @option{-O}.  It
10175also turns on the following optimization flags:
10176
10177@c Please keep the following list alphabetized!
10178@gccoptlist{-falign-functions  -falign-jumps @gol
10179-falign-labels  -falign-loops @gol
10180-fcaller-saves @gol
10181-fcode-hoisting @gol
10182-fcrossjumping @gol
10183-fcse-follow-jumps  -fcse-skip-blocks @gol
10184-fdelete-null-pointer-checks @gol
10185-fdevirtualize  -fdevirtualize-speculatively @gol
10186-fexpensive-optimizations @gol
10187-ffinite-loops @gol
10188-fgcse  -fgcse-lm  @gol
10189-fhoist-adjacent-loads @gol
10190-finline-functions @gol
10191-finline-small-functions @gol
10192-findirect-inlining @gol
10193-fipa-bit-cp  -fipa-cp  -fipa-icf @gol
10194-fipa-ra  -fipa-sra  -fipa-vrp @gol
10195-fisolate-erroneous-paths-dereference @gol
10196-flra-remat @gol
10197-foptimize-sibling-calls @gol
10198-foptimize-strlen @gol
10199-fpartial-inlining @gol
10200-fpeephole2 @gol
10201-freorder-blocks-algorithm=stc @gol
10202-freorder-blocks-and-partition  -freorder-functions @gol
10203-frerun-cse-after-loop  @gol
10204-fschedule-insns  -fschedule-insns2 @gol
10205-fsched-interblock  -fsched-spec @gol
10206-fstore-merging @gol
10207-fstrict-aliasing @gol
10208-fthread-jumps @gol
10209-ftree-builtin-call-dce @gol
10210-ftree-pre @gol
10211-ftree-switch-conversion  -ftree-tail-merge @gol
10212-ftree-vrp}
10213
10214Please note the warning under @option{-fgcse} about
10215invoking @option{-O2} on programs that use computed gotos.
10216
10217@item -O3
10218@opindex O3
10219Optimize yet more.  @option{-O3} turns on all optimizations specified
10220by @option{-O2} and also turns on the following optimization flags:
10221
10222@c Please keep the following list alphabetized!
10223@gccoptlist{-fgcse-after-reload @gol
10224-fipa-cp-clone
10225-floop-interchange @gol
10226-floop-unroll-and-jam @gol
10227-fpeel-loops @gol
10228-fpredictive-commoning @gol
10229-fsplit-loops @gol
10230-fsplit-paths @gol
10231-ftree-loop-distribution @gol
10232-ftree-loop-vectorize @gol
10233-ftree-partial-pre @gol
10234-ftree-slp-vectorize @gol
10235-funswitch-loops @gol
10236-fvect-cost-model @gol
10237-fvect-cost-model=dynamic @gol
10238-fversion-loops-for-strides}
10239
10240@item -O0
10241@opindex O0
10242Reduce compilation time and make debugging produce the expected
10243results.  This is the default.
10244
10245@item -Os
10246@opindex Os
10247Optimize for size.  @option{-Os} enables all @option{-O2} optimizations
10248except those that often increase code size:
10249
10250@gccoptlist{-falign-functions  -falign-jumps @gol
10251-falign-labels  -falign-loops @gol
10252-fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
10253
10254It also enables @option{-finline-functions}, causes the compiler to tune for
10255code size rather than execution speed, and performs further optimizations
10256designed to reduce code size.
10257
10258@item -Ofast
10259@opindex Ofast
10260Disregard strict standards compliance.  @option{-Ofast} enables all
10261@option{-O3} optimizations.  It also enables optimizations that are not
10262valid for all standard-compliant programs.
10263It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
10264and the Fortran-specific @option{-fstack-arrays}, unless
10265@option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
10266
10267@item -Og
10268@opindex Og
10269Optimize debugging experience.  @option{-Og} should be the optimization
10270level of choice for the standard edit-compile-debug cycle, offering
10271a reasonable level of optimization while maintaining fast compilation
10272and a good debugging experience.  It is a better choice than @option{-O0}
10273for producing debuggable code because some compiler passes
10274that collect debug information are disabled at @option{-O0}.
10275
10276Like @option{-O0}, @option{-Og} completely disables a number of
10277optimization passes so that individual options controlling them have
10278no effect.  Otherwise @option{-Og} enables all @option{-O1}
10279optimization flags except for those that may interfere with debugging:
10280
10281@gccoptlist{-fbranch-count-reg  -fdelayed-branch @gol
10282-fdse  -fif-conversion  -fif-conversion2  @gol
10283-finline-functions-called-once @gol
10284-fmove-loop-invariants  -fssa-phiopt @gol
10285-ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
10286
10287@end table
10288
10289If you use multiple @option{-O} options, with or without level numbers,
10290the last such option is the one that is effective.
10291
10292Options of the form @option{-f@var{flag}} specify machine-independent
10293flags.  Most flags have both positive and negative forms; the negative
10294form of @option{-ffoo} is @option{-fno-foo}.  In the table
10295below, only one of the forms is listed---the one you typically
10296use.  You can figure out the other form by either removing @samp{no-}
10297or adding it.
10298
10299The following options control specific optimizations.  They are either
10300activated by @option{-O} options or are related to ones that are.  You
10301can use the following flags in the rare cases when ``fine-tuning'' of
10302optimizations to be performed is desired.
10303
10304@table @gcctabopt
10305@item -fno-defer-pop
10306@opindex fno-defer-pop
10307@opindex fdefer-pop
10308For machines that must pop arguments after a function call, always pop
10309the arguments as soon as each function returns.
10310At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
10311this allows the compiler to let arguments accumulate on the stack for several
10312function calls and pop them all at once.
10313
10314@item -fforward-propagate
10315@opindex fforward-propagate
10316Perform a forward propagation pass on RTL@.  The pass tries to combine two
10317instructions and checks if the result can be simplified.  If loop unrolling
10318is active, two passes are performed and the second is scheduled after
10319loop unrolling.
10320
10321This option is enabled by default at optimization levels @option{-O},
10322@option{-O2}, @option{-O3}, @option{-Os}.
10323
10324@item -ffp-contract=@var{style}
10325@opindex ffp-contract
10326@option{-ffp-contract=off} disables floating-point expression contraction.
10327@option{-ffp-contract=fast} enables floating-point expression contraction
10328such as forming of fused multiply-add operations if the target has
10329native support for them.
10330@option{-ffp-contract=on} enables floating-point expression contraction
10331if allowed by the language standard.  This is currently not implemented
10332and treated equal to @option{-ffp-contract=off}.
10333
10334The default is @option{-ffp-contract=fast}.
10335
10336@item -fomit-frame-pointer
10337@opindex fomit-frame-pointer
10338Omit the frame pointer in functions that don't need one.  This avoids the
10339instructions to save, set up and restore the frame pointer; on many targets
10340it also makes an extra register available.
10341
10342On some targets this flag has no effect because the standard calling sequence
10343always uses a frame pointer, so it cannot be omitted.
10344
10345Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
10346is used in all functions.  Several targets always omit the frame pointer in
10347leaf functions.
10348
10349Enabled by default at @option{-O} and higher.
10350
10351@item -foptimize-sibling-calls
10352@opindex foptimize-sibling-calls
10353Optimize sibling and tail recursive calls.
10354
10355Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10356
10357@item -foptimize-strlen
10358@opindex foptimize-strlen
10359Optimize various standard C string functions (e.g.@: @code{strlen},
10360@code{strchr} or @code{strcpy}) and
10361their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
10362
10363Enabled at levels @option{-O2}, @option{-O3}.
10364
10365@item -fno-inline
10366@opindex fno-inline
10367@opindex finline
10368Do not expand any functions inline apart from those marked with
10369the @code{always_inline} attribute.  This is the default when not
10370optimizing.
10371
10372Single functions can be exempted from inlining by marking them
10373with the @code{noinline} attribute.
10374
10375@item -finline-small-functions
10376@opindex finline-small-functions
10377Integrate functions into their callers when their body is smaller than expected
10378function call code (so overall size of program gets smaller).  The compiler
10379heuristically decides which functions are simple enough to be worth integrating
10380in this way.  This inlining applies to all functions, even those not declared
10381inline.
10382
10383Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10384
10385@item -findirect-inlining
10386@opindex findirect-inlining
10387Inline also indirect calls that are discovered to be known at compile
10388time thanks to previous inlining.  This option has any effect only
10389when inlining itself is turned on by the @option{-finline-functions}
10390or @option{-finline-small-functions} options.
10391
10392Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10393
10394@item -finline-functions
10395@opindex finline-functions
10396Consider all functions for inlining, even if they are not declared inline.
10397The compiler heuristically decides which functions are worth integrating
10398in this way.
10399
10400If all calls to a given function are integrated, and the function is
10401declared @code{static}, then the function is normally not output as
10402assembler code in its own right.
10403
10404Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
10405by @option{-fprofile-use} and @option{-fauto-profile}.
10406
10407@item -finline-functions-called-once
10408@opindex finline-functions-called-once
10409Consider all @code{static} functions called once for inlining into their
10410caller even if they are not marked @code{inline}.  If a call to a given
10411function is integrated, then the function is not output as assembler code
10412in its own right.
10413
10414Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
10415but not @option{-Og}.
10416
10417@item -fearly-inlining
10418@opindex fearly-inlining
10419Inline functions marked by @code{always_inline} and functions whose body seems
10420smaller than the function call overhead early before doing
10421@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
10422makes profiling significantly cheaper and usually inlining faster on programs
10423having large chains of nested wrapper functions.
10424
10425Enabled by default.
10426
10427@item -fipa-sra
10428@opindex fipa-sra
10429Perform interprocedural scalar replacement of aggregates, removal of
10430unused parameters and replacement of parameters passed by reference
10431by parameters passed by value.
10432
10433Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
10434
10435@item -finline-limit=@var{n}
10436@opindex finline-limit
10437By default, GCC limits the size of functions that can be inlined.  This flag
10438allows coarse control of this limit.  @var{n} is the size of functions that
10439can be inlined in number of pseudo instructions.
10440
10441Inlining is actually controlled by a number of parameters, which may be
10442specified individually by using @option{--param @var{name}=@var{value}}.
10443The @option{-finline-limit=@var{n}} option sets some of these parameters
10444as follows:
10445
10446@table @gcctabopt
10447@item max-inline-insns-single
10448is set to @var{n}/2.
10449@item max-inline-insns-auto
10450is set to @var{n}/2.
10451@end table
10452
10453See below for a documentation of the individual
10454parameters controlling inlining and for the defaults of these parameters.
10455
10456@emph{Note:} there may be no value to @option{-finline-limit} that results
10457in default behavior.
10458
10459@emph{Note:} pseudo instruction represents, in this particular context, an
10460abstract measurement of function's size.  In no way does it represent a count
10461of assembly instructions and as such its exact meaning might change from one
10462release to an another.
10463
10464@item -fno-keep-inline-dllexport
10465@opindex fno-keep-inline-dllexport
10466@opindex fkeep-inline-dllexport
10467This is a more fine-grained version of @option{-fkeep-inline-functions},
10468which applies only to functions that are declared using the @code{dllexport}
10469attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
10470Functions}.
10471
10472@item -fkeep-inline-functions
10473@opindex fkeep-inline-functions
10474In C, emit @code{static} functions that are declared @code{inline}
10475into the object file, even if the function has been inlined into all
10476of its callers.  This switch does not affect functions using the
10477@code{extern inline} extension in GNU C90@.  In C++, emit any and all
10478inline functions into the object file.
10479
10480@item -fkeep-static-functions
10481@opindex fkeep-static-functions
10482Emit @code{static} functions into the object file, even if the function
10483is never used.
10484
10485@item -fkeep-static-consts
10486@opindex fkeep-static-consts
10487Emit variables declared @code{static const} when optimization isn't turned
10488on, even if the variables aren't referenced.
10489
10490GCC enables this option by default.  If you want to force the compiler to
10491check if a variable is referenced, regardless of whether or not
10492optimization is turned on, use the @option{-fno-keep-static-consts} option.
10493
10494@item -fmerge-constants
10495@opindex fmerge-constants
10496Attempt to merge identical constants (string constants and floating-point
10497constants) across compilation units.
10498
10499This option is the default for optimized compilation if the assembler and
10500linker support it.  Use @option{-fno-merge-constants} to inhibit this
10501behavior.
10502
10503Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10504
10505@item -fmerge-all-constants
10506@opindex fmerge-all-constants
10507Attempt to merge identical constants and identical variables.
10508
10509This option implies @option{-fmerge-constants}.  In addition to
10510@option{-fmerge-constants} this considers e.g.@: even constant initialized
10511arrays or initialized constant variables with integral or floating-point
10512types.  Languages like C or C++ require each variable, including multiple
10513instances of the same variable in recursive calls, to have distinct locations,
10514so using this option results in non-conforming
10515behavior.
10516
10517@item -fmodulo-sched
10518@opindex fmodulo-sched
10519Perform swing modulo scheduling immediately before the first scheduling
10520pass.  This pass looks at innermost loops and reorders their
10521instructions by overlapping different iterations.
10522
10523@item -fmodulo-sched-allow-regmoves
10524@opindex fmodulo-sched-allow-regmoves
10525Perform more aggressive SMS-based modulo scheduling with register moves
10526allowed.  By setting this flag certain anti-dependences edges are
10527deleted, which triggers the generation of reg-moves based on the
10528life-range analysis.  This option is effective only with
10529@option{-fmodulo-sched} enabled.
10530
10531@item -fno-branch-count-reg
10532@opindex fno-branch-count-reg
10533@opindex fbranch-count-reg
10534Disable the optimization pass that scans for opportunities to use
10535``decrement and branch'' instructions on a count register instead of
10536instruction sequences that decrement a register, compare it against zero, and
10537then branch based upon the result.  This option is only meaningful on
10538architectures that support such instructions, which include x86, PowerPC,
10539IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
10540doesn't remove the decrement and branch instructions from the generated
10541instruction stream introduced by other optimization passes.
10542
10543The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
10544except for @option{-Og}.
10545
10546@item -fno-function-cse
10547@opindex fno-function-cse
10548@opindex ffunction-cse
10549Do not put function addresses in registers; make each instruction that
10550calls a constant function contain the function's address explicitly.
10551
10552This option results in less efficient code, but some strange hacks
10553that alter the assembler output may be confused by the optimizations
10554performed when this option is not used.
10555
10556The default is @option{-ffunction-cse}
10557
10558@item -fno-zero-initialized-in-bss
10559@opindex fno-zero-initialized-in-bss
10560@opindex fzero-initialized-in-bss
10561If the target supports a BSS section, GCC by default puts variables that
10562are initialized to zero into BSS@.  This can save space in the resulting
10563code.
10564
10565This option turns off this behavior because some programs explicitly
10566rely on variables going to the data section---e.g., so that the
10567resulting executable can find the beginning of that section and/or make
10568assumptions based on that.
10569
10570The default is @option{-fzero-initialized-in-bss}.
10571
10572@item -fthread-jumps
10573@opindex fthread-jumps
10574Perform optimizations that check to see if a jump branches to a
10575location where another comparison subsumed by the first is found.  If
10576so, the first branch is redirected to either the destination of the
10577second branch or a point immediately following it, depending on whether
10578the condition is known to be true or false.
10579
10580Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10581
10582@item -fsplit-wide-types
10583@opindex fsplit-wide-types
10584When using a type that occupies multiple registers, such as @code{long
10585long} on a 32-bit system, split the registers apart and allocate them
10586independently.  This normally generates better code for those types,
10587but may make debugging more difficult.
10588
10589Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
10590@option{-Os}.
10591
10592@item -fsplit-wide-types-early
10593@opindex fsplit-wide-types-early
10594Fully split wide types early, instead of very late.
10595This option has no effect unless @option{-fsplit-wide-types} is turned on.
10596
10597This is the default on some targets.
10598
10599@item -fcse-follow-jumps
10600@opindex fcse-follow-jumps
10601In common subexpression elimination (CSE), scan through jump instructions
10602when the target of the jump is not reached by any other path.  For
10603example, when CSE encounters an @code{if} statement with an
10604@code{else} clause, CSE follows the jump when the condition
10605tested is false.
10606
10607Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10608
10609@item -fcse-skip-blocks
10610@opindex fcse-skip-blocks
10611This is similar to @option{-fcse-follow-jumps}, but causes CSE to
10612follow jumps that conditionally skip over blocks.  When CSE
10613encounters a simple @code{if} statement with no else clause,
10614@option{-fcse-skip-blocks} causes CSE to follow the jump around the
10615body of the @code{if}.
10616
10617Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10618
10619@item -frerun-cse-after-loop
10620@opindex frerun-cse-after-loop
10621Re-run common subexpression elimination after loop optimizations are
10622performed.
10623
10624Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10625
10626@item -fgcse
10627@opindex fgcse
10628Perform a global common subexpression elimination pass.
10629This pass also performs global constant and copy propagation.
10630
10631@emph{Note:} When compiling a program using computed gotos, a GCC
10632extension, you may get better run-time performance if you disable
10633the global common subexpression elimination pass by adding
10634@option{-fno-gcse} to the command line.
10635
10636Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10637
10638@item -fgcse-lm
10639@opindex fgcse-lm
10640When @option{-fgcse-lm} is enabled, global common subexpression elimination
10641attempts to move loads that are only killed by stores into themselves.  This
10642allows a loop containing a load/store sequence to be changed to a load outside
10643the loop, and a copy/store within the loop.
10644
10645Enabled by default when @option{-fgcse} is enabled.
10646
10647@item -fgcse-sm
10648@opindex fgcse-sm
10649When @option{-fgcse-sm} is enabled, a store motion pass is run after
10650global common subexpression elimination.  This pass attempts to move
10651stores out of loops.  When used in conjunction with @option{-fgcse-lm},
10652loops containing a load/store sequence can be changed to a load before
10653the loop and a store after the loop.
10654
10655Not enabled at any optimization level.
10656
10657@item -fgcse-las
10658@opindex fgcse-las
10659When @option{-fgcse-las} is enabled, the global common subexpression
10660elimination pass eliminates redundant loads that come after stores to the
10661same memory location (both partial and full redundancies).
10662
10663Not enabled at any optimization level.
10664
10665@item -fgcse-after-reload
10666@opindex fgcse-after-reload
10667When @option{-fgcse-after-reload} is enabled, a redundant load elimination
10668pass is performed after reload.  The purpose of this pass is to clean up
10669redundant spilling.
10670
10671Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10672
10673@item -faggressive-loop-optimizations
10674@opindex faggressive-loop-optimizations
10675This option tells the loop optimizer to use language constraints to
10676derive bounds for the number of iterations of a loop.  This assumes that
10677loop code does not invoke undefined behavior by for example causing signed
10678integer overflows or out-of-bound array accesses.  The bounds for the
10679number of iterations of a loop are used to guide loop unrolling and peeling
10680and loop exit test optimizations.
10681This option is enabled by default.
10682
10683@item -funconstrained-commons
10684@opindex funconstrained-commons
10685This option tells the compiler that variables declared in common blocks
10686(e.g.@: Fortran) may later be overridden with longer trailing arrays. This
10687prevents certain optimizations that depend on knowing the array bounds.
10688
10689@item -fcrossjumping
10690@opindex fcrossjumping
10691Perform cross-jumping transformation.
10692This transformation unifies equivalent code and saves code size.  The
10693resulting code may or may not perform better than without cross-jumping.
10694
10695Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10696
10697@item -fauto-inc-dec
10698@opindex fauto-inc-dec
10699Combine increments or decrements of addresses with memory accesses.
10700This pass is always skipped on architectures that do not have
10701instructions to support this.  Enabled by default at @option{-O} and
10702higher on architectures that support this.
10703
10704@item -fdce
10705@opindex fdce
10706Perform dead code elimination (DCE) on RTL@.
10707Enabled by default at @option{-O} and higher.
10708
10709@item -fdse
10710@opindex fdse
10711Perform dead store elimination (DSE) on RTL@.
10712Enabled by default at @option{-O} and higher.
10713
10714@item -fif-conversion
10715@opindex fif-conversion
10716Attempt to transform conditional jumps into branch-less equivalents.  This
10717includes use of conditional moves, min, max, set flags and abs instructions, and
10718some tricks doable by standard arithmetics.  The use of conditional execution
10719on chips where it is available is controlled by @option{-fif-conversion2}.
10720
10721Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10722not with @option{-Og}.
10723
10724@item -fif-conversion2
10725@opindex fif-conversion2
10726Use conditional execution (where available) to transform conditional jumps into
10727branch-less equivalents.
10728
10729Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
10730not with @option{-Og}.
10731
10732@item -fdeclone-ctor-dtor
10733@opindex fdeclone-ctor-dtor
10734The C++ ABI requires multiple entry points for constructors and
10735destructors: one for a base subobject, one for a complete object, and
10736one for a virtual destructor that calls operator delete afterwards.
10737For a hierarchy with virtual bases, the base and complete variants are
10738clones, which means two copies of the function.  With this option, the
10739base and complete variants are changed to be thunks that call a common
10740implementation.
10741
10742Enabled by @option{-Os}.
10743
10744@item -fdelete-null-pointer-checks
10745@opindex fdelete-null-pointer-checks
10746Assume that programs cannot safely dereference null pointers, and that
10747no code or data element resides at address zero.
10748This option enables simple constant
10749folding optimizations at all optimization levels.  In addition, other
10750optimization passes in GCC use this flag to control global dataflow
10751analyses that eliminate useless checks for null pointers; these assume
10752that a memory access to address zero always results in a trap, so
10753that if a pointer is checked after it has already been dereferenced,
10754it cannot be null.
10755
10756Note however that in some environments this assumption is not true.
10757Use @option{-fno-delete-null-pointer-checks} to disable this optimization
10758for programs that depend on that behavior.
10759
10760This option is enabled by default on most targets.  On Nios II ELF, it
10761defaults to off.  On AVR, CR16, and MSP430, this option is completely disabled.
10762
10763Passes that use the dataflow information
10764are enabled independently at different optimization levels.
10765
10766@item -fdevirtualize
10767@opindex fdevirtualize
10768Attempt to convert calls to virtual functions to direct calls.  This
10769is done both within a procedure and interprocedurally as part of
10770indirect inlining (@option{-findirect-inlining}) and interprocedural constant
10771propagation (@option{-fipa-cp}).
10772Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10773
10774@item -fdevirtualize-speculatively
10775@opindex fdevirtualize-speculatively
10776Attempt to convert calls to virtual functions to speculative direct calls.
10777Based on the analysis of the type inheritance graph, determine for a given call
10778the set of likely targets. If the set is small, preferably of size 1, change
10779the call into a conditional deciding between direct and indirect calls.  The
10780speculative calls enable more optimizations, such as inlining.  When they seem
10781useless after further optimization, they are converted back into original form.
10782
10783@item -fdevirtualize-at-ltrans
10784@opindex fdevirtualize-at-ltrans
10785Stream extra information needed for aggressive devirtualization when running
10786the link-time optimizer in local transformation mode.
10787This option enables more devirtualization but
10788significantly increases the size of streamed data. For this reason it is
10789disabled by default.
10790
10791@item -fexpensive-optimizations
10792@opindex fexpensive-optimizations
10793Perform a number of minor optimizations that are relatively expensive.
10794
10795Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10796
10797@item -free
10798@opindex free
10799Attempt to remove redundant extension instructions.  This is especially
10800helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
10801registers after writing to their lower 32-bit half.
10802
10803Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
10804@option{-O3}, @option{-Os}.
10805
10806@item -fno-lifetime-dse
10807@opindex fno-lifetime-dse
10808@opindex flifetime-dse
10809In C++ the value of an object is only affected by changes within its
10810lifetime: when the constructor begins, the object has an indeterminate
10811value, and any changes during the lifetime of the object are dead when
10812the object is destroyed.  Normally dead store elimination will take
10813advantage of this; if your code relies on the value of the object
10814storage persisting beyond the lifetime of the object, you can use this
10815flag to disable this optimization.  To preserve stores before the
10816constructor starts (e.g.@: because your operator new clears the object
10817storage) but still treat the object as dead after the destructor, you
10818can use @option{-flifetime-dse=1}.  The default behavior can be
10819explicitly selected with @option{-flifetime-dse=2}.
10820@option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
10821
10822@item -flive-range-shrinkage
10823@opindex flive-range-shrinkage
10824Attempt to decrease register pressure through register live range
10825shrinkage.  This is helpful for fast processors with small or moderate
10826size register sets.
10827
10828@item -fira-algorithm=@var{algorithm}
10829@opindex fira-algorithm
10830Use the specified coloring algorithm for the integrated register
10831allocator.  The @var{algorithm} argument can be @samp{priority}, which
10832specifies Chow's priority coloring, or @samp{CB}, which specifies
10833Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
10834for all architectures, but for those targets that do support it, it is
10835the default because it generates better code.
10836
10837@item -fira-region=@var{region}
10838@opindex fira-region
10839Use specified regions for the integrated register allocator.  The
10840@var{region} argument should be one of the following:
10841
10842@table @samp
10843
10844@item all
10845Use all loops as register allocation regions.
10846This can give the best results for machines with a small and/or
10847irregular register set.
10848
10849@item mixed
10850Use all loops except for loops with small register pressure
10851as the regions.  This value usually gives
10852the best results in most cases and for most architectures,
10853and is enabled by default when compiling with optimization for speed
10854(@option{-O}, @option{-O2}, @dots{}).
10855
10856@item one
10857Use all functions as a single region.
10858This typically results in the smallest code size, and is enabled by default for
10859@option{-Os} or @option{-O0}.
10860
10861@end table
10862
10863@item -fira-hoist-pressure
10864@opindex fira-hoist-pressure
10865Use IRA to evaluate register pressure in the code hoisting pass for
10866decisions to hoist expressions.  This option usually results in smaller
10867code, but it can slow the compiler down.
10868
10869This option is enabled at level @option{-Os} for all targets.
10870
10871@item -fira-loop-pressure
10872@opindex fira-loop-pressure
10873Use IRA to evaluate register pressure in loops for decisions to move
10874loop invariants.  This option usually results in generation
10875of faster and smaller code on machines with large register files (>= 32
10876registers), but it can slow the compiler down.
10877
10878This option is enabled at level @option{-O3} for some targets.
10879
10880@item -fno-ira-share-save-slots
10881@opindex fno-ira-share-save-slots
10882@opindex fira-share-save-slots
10883Disable sharing of stack slots used for saving call-used hard
10884registers living through a call.  Each hard register gets a
10885separate stack slot, and as a result function stack frames are
10886larger.
10887
10888@item -fno-ira-share-spill-slots
10889@opindex fno-ira-share-spill-slots
10890@opindex fira-share-spill-slots
10891Disable sharing of stack slots allocated for pseudo-registers.  Each
10892pseudo-register that does not get a hard register gets a separate
10893stack slot, and as a result function stack frames are larger.
10894
10895@item -flra-remat
10896@opindex flra-remat
10897Enable CFG-sensitive rematerialization in LRA.  Instead of loading
10898values of spilled pseudos, LRA tries to rematerialize (recalculate)
10899values if it is profitable.
10900
10901Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10902
10903@item -fdelayed-branch
10904@opindex fdelayed-branch
10905If supported for the target machine, attempt to reorder instructions
10906to exploit instruction slots available after delayed branch
10907instructions.
10908
10909Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
10910but not at @option{-Og}.
10911
10912@item -fschedule-insns
10913@opindex fschedule-insns
10914If supported for the target machine, attempt to reorder instructions to
10915eliminate execution stalls due to required data being unavailable.  This
10916helps machines that have slow floating point or memory load instructions
10917by allowing other instructions to be issued until the result of the load
10918or floating-point instruction is required.
10919
10920Enabled at levels @option{-O2}, @option{-O3}.
10921
10922@item -fschedule-insns2
10923@opindex fschedule-insns2
10924Similar to @option{-fschedule-insns}, but requests an additional pass of
10925instruction scheduling after register allocation has been done.  This is
10926especially useful on machines with a relatively small number of
10927registers and where memory load instructions take more than one cycle.
10928
10929Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10930
10931@item -fno-sched-interblock
10932@opindex fno-sched-interblock
10933@opindex fsched-interblock
10934Disable instruction scheduling across basic blocks, which
10935is normally enabled when scheduling before register allocation, i.e.@:
10936with @option{-fschedule-insns} or at @option{-O2} or higher.
10937
10938@item -fno-sched-spec
10939@opindex fno-sched-spec
10940@opindex fsched-spec
10941Disable speculative motion of non-load instructions, which
10942is normally enabled when scheduling before register allocation, i.e.@:
10943with @option{-fschedule-insns} or at @option{-O2} or higher.
10944
10945@item -fsched-pressure
10946@opindex fsched-pressure
10947Enable register pressure sensitive insn scheduling before register
10948allocation.  This only makes sense when scheduling before register
10949allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
10950@option{-O2} or higher.  Usage of this option can improve the
10951generated code and decrease its size by preventing register pressure
10952increase above the number of available hard registers and subsequent
10953spills in register allocation.
10954
10955@item -fsched-spec-load
10956@opindex fsched-spec-load
10957Allow speculative motion of some load instructions.  This only makes
10958sense when scheduling before register allocation, i.e.@: with
10959@option{-fschedule-insns} or at @option{-O2} or higher.
10960
10961@item -fsched-spec-load-dangerous
10962@opindex fsched-spec-load-dangerous
10963Allow speculative motion of more load instructions.  This only makes
10964sense when scheduling before register allocation, i.e.@: with
10965@option{-fschedule-insns} or at @option{-O2} or higher.
10966
10967@item -fsched-stalled-insns
10968@itemx -fsched-stalled-insns=@var{n}
10969@opindex fsched-stalled-insns
10970Define how many insns (if any) can be moved prematurely from the queue
10971of stalled insns into the ready list during the second scheduling pass.
10972@option{-fno-sched-stalled-insns} means that no insns are moved
10973prematurely, @option{-fsched-stalled-insns=0} means there is no limit
10974on how many queued insns can be moved prematurely.
10975@option{-fsched-stalled-insns} without a value is equivalent to
10976@option{-fsched-stalled-insns=1}.
10977
10978@item -fsched-stalled-insns-dep
10979@itemx -fsched-stalled-insns-dep=@var{n}
10980@opindex fsched-stalled-insns-dep
10981Define how many insn groups (cycles) are examined for a dependency
10982on a stalled insn that is a candidate for premature removal from the queue
10983of stalled insns.  This has an effect only during the second scheduling pass,
10984and only if @option{-fsched-stalled-insns} is used.
10985@option{-fno-sched-stalled-insns-dep} is equivalent to
10986@option{-fsched-stalled-insns-dep=0}.
10987@option{-fsched-stalled-insns-dep} without a value is equivalent to
10988@option{-fsched-stalled-insns-dep=1}.
10989
10990@item -fsched2-use-superblocks
10991@opindex fsched2-use-superblocks
10992When scheduling after register allocation, use superblock scheduling.
10993This allows motion across basic block boundaries,
10994resulting in faster schedules.  This option is experimental, as not all machine
10995descriptions used by GCC model the CPU closely enough to avoid unreliable
10996results from the algorithm.
10997
10998This only makes sense when scheduling after register allocation, i.e.@: with
10999@option{-fschedule-insns2} or at @option{-O2} or higher.
11000
11001@item -fsched-group-heuristic
11002@opindex fsched-group-heuristic
11003Enable the group heuristic in the scheduler.  This heuristic favors
11004the instruction that belongs to a schedule group.  This is enabled
11005by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11006or @option{-fschedule-insns2} or at @option{-O2} or higher.
11007
11008@item -fsched-critical-path-heuristic
11009@opindex fsched-critical-path-heuristic
11010Enable the critical-path heuristic in the scheduler.  This heuristic favors
11011instructions on the critical path.  This is enabled by default when
11012scheduling is enabled, i.e.@: with @option{-fschedule-insns}
11013or @option{-fschedule-insns2} or at @option{-O2} or higher.
11014
11015@item -fsched-spec-insn-heuristic
11016@opindex fsched-spec-insn-heuristic
11017Enable the speculative instruction heuristic in the scheduler.  This
11018heuristic favors speculative instructions with greater dependency weakness.
11019This is enabled by default when scheduling is enabled, i.e.@:
11020with @option{-fschedule-insns} or @option{-fschedule-insns2}
11021or at @option{-O2} or higher.
11022
11023@item -fsched-rank-heuristic
11024@opindex fsched-rank-heuristic
11025Enable the rank heuristic in the scheduler.  This heuristic favors
11026the instruction belonging to a basic block with greater size or frequency.
11027This is enabled by default when scheduling is enabled, i.e.@:
11028with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11029at @option{-O2} or higher.
11030
11031@item -fsched-last-insn-heuristic
11032@opindex fsched-last-insn-heuristic
11033Enable the last-instruction heuristic in the scheduler.  This heuristic
11034favors the instruction that is less dependent on the last instruction
11035scheduled.  This is enabled by default when scheduling is enabled,
11036i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11037at @option{-O2} or higher.
11038
11039@item -fsched-dep-count-heuristic
11040@opindex fsched-dep-count-heuristic
11041Enable the dependent-count heuristic in the scheduler.  This heuristic
11042favors the instruction that has more instructions depending on it.
11043This is enabled by default when scheduling is enabled, i.e.@:
11044with @option{-fschedule-insns} or @option{-fschedule-insns2} or
11045at @option{-O2} or higher.
11046
11047@item -freschedule-modulo-scheduled-loops
11048@opindex freschedule-modulo-scheduled-loops
11049Modulo scheduling is performed before traditional scheduling.  If a loop
11050is modulo scheduled, later scheduling passes may change its schedule.
11051Use this option to control that behavior.
11052
11053@item -fselective-scheduling
11054@opindex fselective-scheduling
11055Schedule instructions using selective scheduling algorithm.  Selective
11056scheduling runs instead of the first scheduler pass.
11057
11058@item -fselective-scheduling2
11059@opindex fselective-scheduling2
11060Schedule instructions using selective scheduling algorithm.  Selective
11061scheduling runs instead of the second scheduler pass.
11062
11063@item -fsel-sched-pipelining
11064@opindex fsel-sched-pipelining
11065Enable software pipelining of innermost loops during selective scheduling.
11066This option has no effect unless one of @option{-fselective-scheduling} or
11067@option{-fselective-scheduling2} is turned on.
11068
11069@item -fsel-sched-pipelining-outer-loops
11070@opindex fsel-sched-pipelining-outer-loops
11071When pipelining loops during selective scheduling, also pipeline outer loops.
11072This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
11073
11074@item -fsemantic-interposition
11075@opindex fsemantic-interposition
11076Some object formats, like ELF, allow interposing of symbols by the
11077dynamic linker.
11078This means that for symbols exported from the DSO, the compiler cannot perform
11079interprocedural propagation, inlining and other optimizations in anticipation
11080that the function or variable in question may change. While this feature is
11081useful, for example, to rewrite memory allocation functions by a debugging
11082implementation, it is expensive in the terms of code quality.
11083With @option{-fno-semantic-interposition} the compiler assumes that
11084if interposition happens for functions the overwriting function will have
11085precisely the same semantics (and side effects).
11086Similarly if interposition happens
11087for variables, the constructor of the variable will be the same. The flag
11088has no effect for functions explicitly declared inline
11089(where it is never allowed for interposition to change semantics)
11090and for symbols explicitly declared weak.
11091
11092@item -fshrink-wrap
11093@opindex fshrink-wrap
11094Emit function prologues only before parts of the function that need it,
11095rather than at the top of the function.  This flag is enabled by default at
11096@option{-O} and higher.
11097
11098@item -fshrink-wrap-separate
11099@opindex fshrink-wrap-separate
11100Shrink-wrap separate parts of the prologue and epilogue separately, so that
11101those parts are only executed when needed.
11102This option is on by default, but has no effect unless @option{-fshrink-wrap}
11103is also turned on and the target supports this.
11104
11105@item -fcaller-saves
11106@opindex fcaller-saves
11107Enable allocation of values to registers that are clobbered by
11108function calls, by emitting extra instructions to save and restore the
11109registers around such calls.  Such allocation is done only when it
11110seems to result in better code.
11111
11112This option is always enabled by default on certain machines, usually
11113those which have no call-preserved registers to use instead.
11114
11115Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11116
11117@item -fcombine-stack-adjustments
11118@opindex fcombine-stack-adjustments
11119Tracks stack adjustments (pushes and pops) and stack memory references
11120and then tries to find ways to combine them.
11121
11122Enabled by default at @option{-O1} and higher.
11123
11124@item -fipa-ra
11125@opindex fipa-ra
11126Use caller save registers for allocation if those registers are not used by
11127any called function.  In that case it is not necessary to save and restore
11128them around calls.  This is only possible if called functions are part of
11129same compilation unit as current function and they are compiled before it.
11130
11131Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
11132is disabled if generated code will be instrumented for profiling
11133(@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
11134exactly (this happens on targets that do not expose prologues
11135and epilogues in RTL).
11136
11137@item -fconserve-stack
11138@opindex fconserve-stack
11139Attempt to minimize stack usage.  The compiler attempts to use less
11140stack space, even if that makes the program slower.  This option
11141implies setting the @option{large-stack-frame} parameter to 100
11142and the @option{large-stack-frame-growth} parameter to 400.
11143
11144@item -ftree-reassoc
11145@opindex ftree-reassoc
11146Perform reassociation on trees.  This flag is enabled by default
11147at @option{-O} and higher.
11148
11149@item -fcode-hoisting
11150@opindex fcode-hoisting
11151Perform code hoisting.  Code hoisting tries to move the
11152evaluation of expressions executed on all paths to the function exit
11153as early as possible.  This is especially useful as a code size
11154optimization, but it often helps for code speed as well.
11155This flag is enabled by default at @option{-O2} and higher.
11156
11157@item -ftree-pre
11158@opindex ftree-pre
11159Perform partial redundancy elimination (PRE) on trees.  This flag is
11160enabled by default at @option{-O2} and @option{-O3}.
11161
11162@item -ftree-partial-pre
11163@opindex ftree-partial-pre
11164Make partial redundancy elimination (PRE) more aggressive.  This flag is
11165enabled by default at @option{-O3}.
11166
11167@item -ftree-forwprop
11168@opindex ftree-forwprop
11169Perform forward propagation on trees.  This flag is enabled by default
11170at @option{-O} and higher.
11171
11172@item -ftree-fre
11173@opindex ftree-fre
11174Perform full redundancy elimination (FRE) on trees.  The difference
11175between FRE and PRE is that FRE only considers expressions
11176that are computed on all paths leading to the redundant computation.
11177This analysis is faster than PRE, though it exposes fewer redundancies.
11178This flag is enabled by default at @option{-O} and higher.
11179
11180@item -ftree-phiprop
11181@opindex ftree-phiprop
11182Perform hoisting of loads from conditional pointers on trees.  This
11183pass is enabled by default at @option{-O} and higher.
11184
11185@item -fhoist-adjacent-loads
11186@opindex fhoist-adjacent-loads
11187Speculatively hoist loads from both branches of an if-then-else if the
11188loads are from adjacent locations in the same structure and the target
11189architecture has a conditional move instruction.  This flag is enabled
11190by default at @option{-O2} and higher.
11191
11192@item -ftree-copy-prop
11193@opindex ftree-copy-prop
11194Perform copy propagation on trees.  This pass eliminates unnecessary
11195copy operations.  This flag is enabled by default at @option{-O} and
11196higher.
11197
11198@item -fipa-pure-const
11199@opindex fipa-pure-const
11200Discover which functions are pure or constant.
11201Enabled by default at @option{-O} and higher.
11202
11203@item -fipa-reference
11204@opindex fipa-reference
11205Discover which static variables do not escape the
11206compilation unit.
11207Enabled by default at @option{-O} and higher.
11208
11209@item -fipa-reference-addressable
11210@opindex fipa-reference-addressable
11211Discover read-only, write-only and non-addressable static variables.
11212Enabled by default at @option{-O} and higher.
11213
11214@item -fipa-stack-alignment
11215@opindex fipa-stack-alignment
11216Reduce stack alignment on call sites if possible.
11217Enabled by default.
11218
11219@item -fipa-pta
11220@opindex fipa-pta
11221Perform interprocedural pointer analysis and interprocedural modification
11222and reference analysis.  This option can cause excessive memory and
11223compile-time usage on large compilation units.  It is not enabled by
11224default at any optimization level.
11225
11226@item -fipa-profile
11227@opindex fipa-profile
11228Perform interprocedural profile propagation.  The functions called only from
11229cold functions are marked as cold. Also functions executed once (such as
11230@code{cold}, @code{noreturn}, static constructors or destructors) are
11231identified. Cold functions and loop less parts of functions executed once are
11232then optimized for size.
11233Enabled by default at @option{-O} and higher.
11234
11235@item -fipa-modref
11236@opindex fipa-modref
11237Perform interprocedural mod/ref analysis.  This optimization analyzes the side
11238effects of functions (memory locations that are modified or referenced) and
11239enables better optimization across the function call boundary.  This flag is
11240enabled by default at @option{-O} and higher.
11241
11242@item -fipa-cp
11243@opindex fipa-cp
11244Perform interprocedural constant propagation.
11245This optimization analyzes the program to determine when values passed
11246to functions are constants and then optimizes accordingly.
11247This optimization can substantially increase performance
11248if the application has constants passed to functions.
11249This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
11250It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11251
11252@item -fipa-cp-clone
11253@opindex fipa-cp-clone
11254Perform function cloning to make interprocedural constant propagation stronger.
11255When enabled, interprocedural constant propagation performs function cloning
11256when externally visible function can be called with constant arguments.
11257Because this optimization can create multiple copies of functions,
11258it may significantly increase code size
11259(see @option{--param ipa-cp-unit-growth=@var{value}}).
11260This flag is enabled by default at @option{-O3}.
11261It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11262
11263@item -fipa-bit-cp
11264@opindex fipa-bit-cp
11265When enabled, perform interprocedural bitwise constant
11266propagation. This flag is enabled by default at @option{-O2} and
11267by @option{-fprofile-use} and @option{-fauto-profile}.
11268It requires that @option{-fipa-cp} is enabled.
11269
11270@item -fipa-vrp
11271@opindex fipa-vrp
11272When enabled, perform interprocedural propagation of value
11273ranges. This flag is enabled by default at @option{-O2}. It requires
11274that @option{-fipa-cp} is enabled.
11275
11276@item -fipa-icf
11277@opindex fipa-icf
11278Perform Identical Code Folding for functions and read-only variables.
11279The optimization reduces code size and may disturb unwind stacks by replacing
11280a function by equivalent one with a different name. The optimization works
11281more effectively with link-time optimization enabled.
11282
11283Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
11284works on different levels and thus the optimizations are not same - there are
11285equivalences that are found only by GCC and equivalences found only by Gold.
11286
11287This flag is enabled by default at @option{-O2} and @option{-Os}.
11288
11289@item -flive-patching=@var{level}
11290@opindex flive-patching
11291Control GCC's optimizations to produce output suitable for live-patching.
11292
11293If the compiler's optimization uses a function's body or information extracted
11294from its body to optimize/change another function, the latter is called an
11295impacted function of the former.  If a function is patched, its impacted
11296functions should be patched too.
11297
11298The impacted functions are determined by the compiler's interprocedural
11299optimizations.  For example, a caller is impacted when inlining a function
11300into its caller,
11301cloning a function and changing its caller to call this new clone,
11302or extracting a function's pureness/constness information to optimize
11303its direct or indirect callers, etc.
11304
11305Usually, the more IPA optimizations enabled, the larger the number of
11306impacted functions for each function.  In order to control the number of
11307impacted functions and more easily compute the list of impacted function,
11308IPA optimizations can be partially enabled at two different levels.
11309
11310The @var{level} argument should be one of the following:
11311
11312@table @samp
11313
11314@item inline-clone
11315
11316Only enable inlining and cloning optimizations, which includes inlining,
11317cloning, interprocedural scalar replacement of aggregates and partial inlining.
11318As a result, when patching a function, all its callers and its clones'
11319callers are impacted, therefore need to be patched as well.
11320
11321@option{-flive-patching=inline-clone} disables the following optimization flags:
11322@gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra @gol
11323-fipa-icf  -fipa-icf-functions  -fipa-icf-variables @gol
11324-fipa-bit-cp  -fipa-vrp  -fipa-pure-const  -fipa-reference-addressable @gol
11325-fipa-stack-alignment -fipa-modref}
11326
11327@item inline-only-static
11328
11329Only enable inlining of static functions.
11330As a result, when patching a static function, all its callers are impacted
11331and so need to be patched as well.
11332
11333In addition to all the flags that @option{-flive-patching=inline-clone}
11334disables,
11335@option{-flive-patching=inline-only-static} disables the following additional
11336optimization flags:
11337@gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
11338
11339@end table
11340
11341When @option{-flive-patching} is specified without any value, the default value
11342is @var{inline-clone}.
11343
11344This flag is disabled by default.
11345
11346Note that @option{-flive-patching} is not supported with link-time optimization
11347(@option{-flto}).
11348
11349@item -fisolate-erroneous-paths-dereference
11350@opindex fisolate-erroneous-paths-dereference
11351Detect paths that trigger erroneous or undefined behavior due to
11352dereferencing a null pointer.  Isolate those paths from the main control
11353flow and turn the statement with erroneous or undefined behavior into a trap.
11354This flag is enabled by default at @option{-O2} and higher and depends on
11355@option{-fdelete-null-pointer-checks} also being enabled.
11356
11357@item -fisolate-erroneous-paths-attribute
11358@opindex fisolate-erroneous-paths-attribute
11359Detect paths that trigger erroneous or undefined behavior due to a null value
11360being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
11361attribute.  Isolate those paths from the main control flow and turn the
11362statement with erroneous or undefined behavior into a trap.  This is not
11363currently enabled, but may be enabled by @option{-O2} in the future.
11364
11365@item -ftree-sink
11366@opindex ftree-sink
11367Perform forward store motion on trees.  This flag is
11368enabled by default at @option{-O} and higher.
11369
11370@item -ftree-bit-ccp
11371@opindex ftree-bit-ccp
11372Perform sparse conditional bit constant propagation on trees and propagate
11373pointer alignment information.
11374This pass only operates on local scalar variables and is enabled by default
11375at @option{-O1} and higher, except for @option{-Og}.
11376It requires that @option{-ftree-ccp} is enabled.
11377
11378@item -ftree-ccp
11379@opindex ftree-ccp
11380Perform sparse conditional constant propagation (CCP) on trees.  This
11381pass only operates on local scalar variables and is enabled by default
11382at @option{-O} and higher.
11383
11384@item -fssa-backprop
11385@opindex fssa-backprop
11386Propagate information about uses of a value up the definition chain
11387in order to simplify the definitions.  For example, this pass strips
11388sign operations if the sign of a value never matters.  The flag is
11389enabled by default at @option{-O} and higher.
11390
11391@item -fssa-phiopt
11392@opindex fssa-phiopt
11393Perform pattern matching on SSA PHI nodes to optimize conditional
11394code.  This pass is enabled by default at @option{-O1} and higher,
11395except for @option{-Og}.
11396
11397@item -ftree-switch-conversion
11398@opindex ftree-switch-conversion
11399Perform conversion of simple initializations in a switch to
11400initializations from a scalar array.  This flag is enabled by default
11401at @option{-O2} and higher.
11402
11403@item -ftree-tail-merge
11404@opindex ftree-tail-merge
11405Look for identical code sequences.  When found, replace one with a jump to the
11406other.  This optimization is known as tail merging or cross jumping.  This flag
11407is enabled by default at @option{-O2} and higher.  The compilation time
11408in this pass can
11409be limited using @option{max-tail-merge-comparisons} parameter and
11410@option{max-tail-merge-iterations} parameter.
11411
11412@item -ftree-dce
11413@opindex ftree-dce
11414Perform dead code elimination (DCE) on trees.  This flag is enabled by
11415default at @option{-O} and higher.
11416
11417@item -ftree-builtin-call-dce
11418@opindex ftree-builtin-call-dce
11419Perform conditional dead code elimination (DCE) for calls to built-in functions
11420that may set @code{errno} but are otherwise free of side effects.  This flag is
11421enabled by default at @option{-O2} and higher if @option{-Os} is not also
11422specified.
11423
11424@item -ffinite-loops
11425@opindex ffinite-loops
11426@opindex fno-finite-loops
11427Assume that a loop with an exit will eventually take the exit and not loop
11428indefinitely.  This allows the compiler to remove loops that otherwise have
11429no side-effects, not considering eventual endless looping as such.
11430
11431This option is enabled by default at @option{-O2} for C++ with -std=c++11
11432or higher.
11433
11434@item -ftree-dominator-opts
11435@opindex ftree-dominator-opts
11436Perform a variety of simple scalar cleanups (constant/copy
11437propagation, redundancy elimination, range propagation and expression
11438simplification) based on a dominator tree traversal.  This also
11439performs jump threading (to reduce jumps to jumps). This flag is
11440enabled by default at @option{-O} and higher.
11441
11442@item -ftree-dse
11443@opindex ftree-dse
11444Perform dead store elimination (DSE) on trees.  A dead store is a store into
11445a memory location that is later overwritten by another store without
11446any intervening loads.  In this case the earlier store can be deleted.  This
11447flag is enabled by default at @option{-O} and higher.
11448
11449@item -ftree-ch
11450@opindex ftree-ch
11451Perform loop header copying on trees.  This is beneficial since it increases
11452effectiveness of code motion optimizations.  It also saves one jump.  This flag
11453is enabled by default at @option{-O} and higher.  It is not enabled
11454for @option{-Os}, since it usually increases code size.
11455
11456@item -ftree-loop-optimize
11457@opindex ftree-loop-optimize
11458Perform loop optimizations on trees.  This flag is enabled by default
11459at @option{-O} and higher.
11460
11461@item -ftree-loop-linear
11462@itemx -floop-strip-mine
11463@itemx -floop-block
11464@opindex ftree-loop-linear
11465@opindex floop-strip-mine
11466@opindex floop-block
11467Perform loop nest optimizations.  Same as
11468@option{-floop-nest-optimize}.  To use this code transformation, GCC has
11469to be configured with @option{--with-isl} to enable the Graphite loop
11470transformation infrastructure.
11471
11472@item -fgraphite-identity
11473@opindex fgraphite-identity
11474Enable the identity transformation for graphite.  For every SCoP we generate
11475the polyhedral representation and transform it back to gimple.  Using
11476@option{-fgraphite-identity} we can check the costs or benefits of the
11477GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
11478are also performed by the code generator isl, like index splitting and
11479dead code elimination in loops.
11480
11481@item -floop-nest-optimize
11482@opindex floop-nest-optimize
11483Enable the isl based loop nest optimizer.  This is a generic loop nest
11484optimizer based on the Pluto optimization algorithms.  It calculates a loop
11485structure optimized for data-locality and parallelism.  This option
11486is experimental.
11487
11488@item -floop-parallelize-all
11489@opindex floop-parallelize-all
11490Use the Graphite data dependence analysis to identify loops that can
11491be parallelized.  Parallelize all the loops that can be analyzed to
11492not contain loop carried dependences without checking that it is
11493profitable to parallelize the loops.
11494
11495@item -ftree-coalesce-vars
11496@opindex ftree-coalesce-vars
11497While transforming the program out of the SSA representation, attempt to
11498reduce copying by coalescing versions of different user-defined
11499variables, instead of just compiler temporaries.  This may severely
11500limit the ability to debug an optimized program compiled with
11501@option{-fno-var-tracking-assignments}.  In the negated form, this flag
11502prevents SSA coalescing of user variables.  This option is enabled by
11503default if optimization is enabled, and it does very little otherwise.
11504
11505@item -ftree-loop-if-convert
11506@opindex ftree-loop-if-convert
11507Attempt to transform conditional jumps in the innermost loops to
11508branch-less equivalents.  The intent is to remove control-flow from
11509the innermost loops in order to improve the ability of the
11510vectorization pass to handle these loops.  This is enabled by default
11511if vectorization is enabled.
11512
11513@item -ftree-loop-distribution
11514@opindex ftree-loop-distribution
11515Perform loop distribution.  This flag can improve cache performance on
11516big loop bodies and allow further loop optimizations, like
11517parallelization or vectorization, to take place.  For example, the loop
11518@smallexample
11519DO I = 1, N
11520  A(I) = B(I) + C
11521  D(I) = E(I) * F
11522ENDDO
11523@end smallexample
11524is transformed to
11525@smallexample
11526DO I = 1, N
11527   A(I) = B(I) + C
11528ENDDO
11529DO I = 1, N
11530   D(I) = E(I) * F
11531ENDDO
11532@end smallexample
11533This flag is enabled by default at @option{-O3}.
11534It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11535
11536@item -ftree-loop-distribute-patterns
11537@opindex ftree-loop-distribute-patterns
11538Perform loop distribution of patterns that can be code generated with
11539calls to a library.  This flag is enabled by default at @option{-O2} and
11540higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
11541
11542This pass distributes the initialization loops and generates a call to
11543memset zero.  For example, the loop
11544@smallexample
11545DO I = 1, N
11546  A(I) = 0
11547  B(I) = A(I) + I
11548ENDDO
11549@end smallexample
11550is transformed to
11551@smallexample
11552DO I = 1, N
11553   A(I) = 0
11554ENDDO
11555DO I = 1, N
11556   B(I) = A(I) + I
11557ENDDO
11558@end smallexample
11559and the initialization loop is transformed into a call to memset zero.
11560This flag is enabled by default at @option{-O3}.
11561It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11562
11563@item -floop-interchange
11564@opindex floop-interchange
11565Perform loop interchange outside of graphite.  This flag can improve cache
11566performance on loop nest and allow further loop optimizations, like
11567vectorization, to take place.  For example, the loop
11568@smallexample
11569for (int i = 0; i < N; i++)
11570  for (int j = 0; j < N; j++)
11571    for (int k = 0; k < N; k++)
11572      c[i][j] = c[i][j] + a[i][k]*b[k][j];
11573@end smallexample
11574is transformed to
11575@smallexample
11576for (int i = 0; i < N; i++)
11577  for (int k = 0; k < N; k++)
11578    for (int j = 0; j < N; j++)
11579      c[i][j] = c[i][j] + a[i][k]*b[k][j];
11580@end smallexample
11581This flag is enabled by default at @option{-O3}.
11582It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11583
11584@item -floop-unroll-and-jam
11585@opindex floop-unroll-and-jam
11586Apply unroll and jam transformations on feasible loops.  In a loop
11587nest this unrolls the outer loop by some factor and fuses the resulting
11588multiple inner loops.  This flag is enabled by default at @option{-O3}.
11589It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11590
11591@item -ftree-loop-im
11592@opindex ftree-loop-im
11593Perform loop invariant motion on trees.  This pass moves only invariants that
11594are hard to handle at RTL level (function calls, operations that expand to
11595nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
11596operands of conditions that are invariant out of the loop, so that we can use
11597just trivial invariantness analysis in loop unswitching.  The pass also includes
11598store motion.
11599
11600@item -ftree-loop-ivcanon
11601@opindex ftree-loop-ivcanon
11602Create a canonical counter for number of iterations in loops for which
11603determining number of iterations requires complicated analysis.  Later
11604optimizations then may determine the number easily.  Useful especially
11605in connection with unrolling.
11606
11607@item -ftree-scev-cprop
11608@opindex ftree-scev-cprop
11609Perform final value replacement.  If a variable is modified in a loop
11610in such a way that its value when exiting the loop can be determined using
11611only its initial value and the number of loop iterations, replace uses of
11612the final value by such a computation, provided it is sufficiently cheap.
11613This reduces data dependencies and may allow further simplifications.
11614Enabled by default at @option{-O} and higher.
11615
11616@item -fivopts
11617@opindex fivopts
11618Perform induction variable optimizations (strength reduction, induction
11619variable merging and induction variable elimination) on trees.
11620
11621@item -ftree-parallelize-loops=n
11622@opindex ftree-parallelize-loops
11623Parallelize loops, i.e., split their iteration space to run in n threads.
11624This is only possible for loops whose iterations are independent
11625and can be arbitrarily reordered.  The optimization is only
11626profitable on multiprocessor machines, for loops that are CPU-intensive,
11627rather than constrained e.g.@: by memory bandwidth.  This option
11628implies @option{-pthread}, and thus is only supported on targets
11629that have support for @option{-pthread}.
11630
11631@item -ftree-pta
11632@opindex ftree-pta
11633Perform function-local points-to analysis on trees.  This flag is
11634enabled by default at @option{-O1} and higher, except for @option{-Og}.
11635
11636@item -ftree-sra
11637@opindex ftree-sra
11638Perform scalar replacement of aggregates.  This pass replaces structure
11639references with scalars to prevent committing structures to memory too
11640early.  This flag is enabled by default at @option{-O1} and higher,
11641except for @option{-Og}.
11642
11643@item -fstore-merging
11644@opindex fstore-merging
11645Perform merging of narrow stores to consecutive memory addresses.  This pass
11646merges contiguous stores of immediate values narrower than a word into fewer
11647wider stores to reduce the number of instructions.  This is enabled by default
11648at @option{-O2} and higher as well as @option{-Os}.
11649
11650@item -ftree-ter
11651@opindex ftree-ter
11652Perform temporary expression replacement during the SSA->normal phase.  Single
11653use/single def temporaries are replaced at their use location with their
11654defining expression.  This results in non-GIMPLE code, but gives the expanders
11655much more complex trees to work on resulting in better RTL generation.  This is
11656enabled by default at @option{-O} and higher.
11657
11658@item -ftree-slsr
11659@opindex ftree-slsr
11660Perform straight-line strength reduction on trees.  This recognizes related
11661expressions involving multiplications and replaces them by less expensive
11662calculations when possible.  This is enabled by default at @option{-O} and
11663higher.
11664
11665@item -ftree-vectorize
11666@opindex ftree-vectorize
11667Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
11668and @option{-ftree-slp-vectorize} if not explicitly specified.
11669
11670@item -ftree-loop-vectorize
11671@opindex ftree-loop-vectorize
11672Perform loop vectorization on trees. This flag is enabled by default at
11673@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11674and @option{-fauto-profile}.
11675
11676@item -ftree-slp-vectorize
11677@opindex ftree-slp-vectorize
11678Perform basic block vectorization on trees. This flag is enabled by default at
11679@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
11680and @option{-fauto-profile}.
11681
11682@item -fvect-cost-model=@var{model}
11683@opindex fvect-cost-model
11684Alter the cost model used for vectorization.  The @var{model} argument
11685should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
11686@samp{very-cheap}.
11687With the @samp{unlimited} model the vectorized code-path is assumed
11688to be profitable while with the @samp{dynamic} model a runtime check
11689guards the vectorized code-path to enable it only for iteration
11690counts that will likely execute faster than when executing the original
11691scalar loop.  The @samp{cheap} model disables vectorization of
11692loops where doing so would be cost prohibitive for example due to
11693required runtime checks for data dependence or alignment but otherwise
11694is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
11695allows vectorization if the vector code would entirely replace the
11696scalar code that is being vectorized.  For example, if each iteration
11697of a vectorized loop would only be able to handle exactly four iterations
11698of the scalar loop, the @samp{very-cheap} model would only allow
11699vectorization if the scalar iteration count is known to be a multiple
11700of four.
11701
11702The default cost model depends on other optimization flags and is
11703either @samp{dynamic} or @samp{cheap}.
11704
11705@item -fsimd-cost-model=@var{model}
11706@opindex fsimd-cost-model
11707Alter the cost model used for vectorization of loops marked with the OpenMP
11708simd directive.  The @var{model} argument should be one of
11709@samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
11710have the same meaning as described in @option{-fvect-cost-model} and by
11711default a cost model defined with @option{-fvect-cost-model} is used.
11712
11713@item -ftree-vrp
11714@opindex ftree-vrp
11715Perform Value Range Propagation on trees.  This is similar to the
11716constant propagation pass, but instead of values, ranges of values are
11717propagated.  This allows the optimizers to remove unnecessary range
11718checks like array bound checks and null pointer checks.  This is
11719enabled by default at @option{-O2} and higher.  Null pointer check
11720elimination is only done if @option{-fdelete-null-pointer-checks} is
11721enabled.
11722
11723@item -fsplit-paths
11724@opindex fsplit-paths
11725Split paths leading to loop backedges.  This can improve dead code
11726elimination and common subexpression elimination.  This is enabled by
11727default at @option{-O3} and above.
11728
11729@item -fsplit-ivs-in-unroller
11730@opindex fsplit-ivs-in-unroller
11731Enables expression of values of induction variables in later iterations
11732of the unrolled loop using the value in the first iteration.  This breaks
11733long dependency chains, thus improving efficiency of the scheduling passes.
11734
11735A combination of @option{-fweb} and CSE is often sufficient to obtain the
11736same effect.  However, that is not reliable in cases where the loop body
11737is more complicated than a single basic block.  It also does not work at all
11738on some architectures due to restrictions in the CSE pass.
11739
11740This optimization is enabled by default.
11741
11742@item -fvariable-expansion-in-unroller
11743@opindex fvariable-expansion-in-unroller
11744With this option, the compiler creates multiple copies of some
11745local variables when unrolling a loop, which can result in superior code.
11746
11747This optimization is enabled by default for PowerPC targets, but disabled
11748by default otherwise.
11749
11750@item -fpartial-inlining
11751@opindex fpartial-inlining
11752Inline parts of functions.  This option has any effect only
11753when inlining itself is turned on by the @option{-finline-functions}
11754or @option{-finline-small-functions} options.
11755
11756Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11757
11758@item -fpredictive-commoning
11759@opindex fpredictive-commoning
11760Perform predictive commoning optimization, i.e., reusing computations
11761(especially memory loads and stores) performed in previous
11762iterations of loops.
11763
11764This option is enabled at level @option{-O3}.
11765It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11766
11767@item -fprefetch-loop-arrays
11768@opindex fprefetch-loop-arrays
11769If supported by the target machine, generate instructions to prefetch
11770memory to improve the performance of loops that access large arrays.
11771
11772This option may generate better or worse code; results are highly
11773dependent on the structure of loops within the source code.
11774
11775Disabled at level @option{-Os}.
11776
11777@item -fno-printf-return-value
11778@opindex fno-printf-return-value
11779@opindex fprintf-return-value
11780Do not substitute constants for known return value of formatted output
11781functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
11782@code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
11783transformation allows GCC to optimize or even eliminate branches based
11784on the known return value of these functions called with arguments that
11785are either constant, or whose values are known to be in a range that
11786makes determining the exact return value possible.  For example, when
11787@option{-fprintf-return-value} is in effect, both the branch and the
11788body of the @code{if} statement (but not the call to @code{snprint})
11789can be optimized away when @code{i} is a 32-bit or smaller integer
11790because the return value is guaranteed to be at most 8.
11791
11792@smallexample
11793char buf[9];
11794if (snprintf (buf, "%08x", i) >= sizeof buf)
11795  @dots{}
11796@end smallexample
11797
11798The @option{-fprintf-return-value} option relies on other optimizations
11799and yields best results with @option{-O2} and above.  It works in tandem
11800with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
11801options.  The @option{-fprintf-return-value} option is enabled by default.
11802
11803@item -fno-peephole
11804@itemx -fno-peephole2
11805@opindex fno-peephole
11806@opindex fpeephole
11807@opindex fno-peephole2
11808@opindex fpeephole2
11809Disable any machine-specific peephole optimizations.  The difference
11810between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
11811are implemented in the compiler; some targets use one, some use the
11812other, a few use both.
11813
11814@option{-fpeephole} is enabled by default.
11815@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11816
11817@item -fno-guess-branch-probability
11818@opindex fno-guess-branch-probability
11819@opindex fguess-branch-probability
11820Do not guess branch probabilities using heuristics.
11821
11822GCC uses heuristics to guess branch probabilities if they are
11823not provided by profiling feedback (@option{-fprofile-arcs}).  These
11824heuristics are based on the control flow graph.  If some branch probabilities
11825are specified by @code{__builtin_expect}, then the heuristics are
11826used to guess branch probabilities for the rest of the control flow graph,
11827taking the @code{__builtin_expect} info into account.  The interactions
11828between the heuristics and @code{__builtin_expect} can be complex, and in
11829some cases, it may be useful to disable the heuristics so that the effects
11830of @code{__builtin_expect} are easier to understand.
11831
11832It is also possible to specify expected probability of the expression
11833with @code{__builtin_expect_with_probability} built-in function.
11834
11835The default is @option{-fguess-branch-probability} at levels
11836@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11837
11838@item -freorder-blocks
11839@opindex freorder-blocks
11840Reorder basic blocks in the compiled function in order to reduce number of
11841taken branches and improve code locality.
11842
11843Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11844
11845@item -freorder-blocks-algorithm=@var{algorithm}
11846@opindex freorder-blocks-algorithm
11847Use the specified algorithm for basic block reordering.  The
11848@var{algorithm} argument can be @samp{simple}, which does not increase
11849code size (except sometimes due to secondary effects like alignment),
11850or @samp{stc}, the ``software trace cache'' algorithm, which tries to
11851put all often executed code together, minimizing the number of branches
11852executed by making extra copies of code.
11853
11854The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
11855@samp{stc} at levels @option{-O2}, @option{-O3}.
11856
11857@item -freorder-blocks-and-partition
11858@opindex freorder-blocks-and-partition
11859In addition to reordering basic blocks in the compiled function, in order
11860to reduce number of taken branches, partitions hot and cold basic blocks
11861into separate sections of the assembly and @file{.o} files, to improve
11862paging and cache locality performance.
11863
11864This optimization is automatically turned off in the presence of
11865exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
11866section attribute and on any architecture that does not support named
11867sections.  When @option{-fsplit-stack} is used this option is not
11868enabled by default (to avoid linker errors), but may be enabled
11869explicitly (if using a working linker).
11870
11871Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
11872
11873@item -freorder-functions
11874@opindex freorder-functions
11875Reorder functions in the object file in order to
11876improve code locality.  This is implemented by using special
11877subsections @code{.text.hot} for most frequently executed functions and
11878@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
11879the linker so object file format must support named sections and linker must
11880place them in a reasonable way.
11881
11882This option isn't effective unless you either provide profile feedback
11883(see @option{-fprofile-arcs} for details) or manually annotate functions with
11884@code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
11885
11886Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11887
11888@item -fstrict-aliasing
11889@opindex fstrict-aliasing
11890Allow the compiler to assume the strictest aliasing rules applicable to
11891the language being compiled.  For C (and C++), this activates
11892optimizations based on the type of expressions.  In particular, an
11893object of one type is assumed never to reside at the same address as an
11894object of a different type, unless the types are almost the same.  For
11895example, an @code{unsigned int} can alias an @code{int}, but not a
11896@code{void*} or a @code{double}.  A character type may alias any other
11897type.
11898
11899@anchor{Type-punning}Pay special attention to code like this:
11900@smallexample
11901union a_union @{
11902  int i;
11903  double d;
11904@};
11905
11906int f() @{
11907  union a_union t;
11908  t.d = 3.0;
11909  return t.i;
11910@}
11911@end smallexample
11912The practice of reading from a different union member than the one most
11913recently written to (called ``type-punning'') is common.  Even with
11914@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
11915is accessed through the union type.  So, the code above works as
11916expected.  @xref{Structures unions enumerations and bit-fields
11917implementation}.  However, this code might not:
11918@smallexample
11919int f() @{
11920  union a_union t;
11921  int* ip;
11922  t.d = 3.0;
11923  ip = &t.i;
11924  return *ip;
11925@}
11926@end smallexample
11927
11928Similarly, access by taking the address, casting the resulting pointer
11929and dereferencing the result has undefined behavior, even if the cast
11930uses a union type, e.g.:
11931@smallexample
11932int f() @{
11933  double d = 3.0;
11934  return ((union a_union *) &d)->i;
11935@}
11936@end smallexample
11937
11938The @option{-fstrict-aliasing} option is enabled at levels
11939@option{-O2}, @option{-O3}, @option{-Os}.
11940
11941@item -falign-functions
11942@itemx -falign-functions=@var{n}
11943@itemx -falign-functions=@var{n}:@var{m}
11944@itemx -falign-functions=@var{n}:@var{m}:@var{n2}
11945@itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
11946@opindex falign-functions
11947Align the start of functions to the next power-of-two greater than or
11948equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
11949least the first @var{m} bytes of the function can be fetched by the CPU
11950without crossing an @var{n}-byte alignment boundary.
11951
11952If @var{m} is not specified, it defaults to @var{n}.
11953
11954Examples: @option{-falign-functions=32} aligns functions to the next
1195532-byte boundary, @option{-falign-functions=24} aligns to the next
1195632-byte boundary only if this can be done by skipping 23 bytes or less,
11957@option{-falign-functions=32:7} aligns to the next
1195832-byte boundary only if this can be done by skipping 6 bytes or less.
11959
11960The second pair of @var{n2}:@var{m2} values allows you to specify
11961a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
11962the next 64-byte boundary if this can be done by skipping 6 bytes or less,
11963otherwise aligns to the next 32-byte boundary if this can be done
11964by skipping 2 bytes or less.
11965If @var{m2} is not specified, it defaults to @var{n2}.
11966
11967Some assemblers only support this flag when @var{n} is a power of two;
11968in that case, it is rounded up.
11969
11970@option{-fno-align-functions} and @option{-falign-functions=1} are
11971equivalent and mean that functions are not aligned.
11972
11973If @var{n} is not specified or is zero, use a machine-dependent default.
11974The maximum allowed @var{n} option value is 65536.
11975
11976Enabled at levels @option{-O2}, @option{-O3}.
11977
11978@item -flimit-function-alignment
11979If this option is enabled, the compiler tries to avoid unnecessarily
11980overaligning functions. It attempts to instruct the assembler to align
11981by the amount specified by @option{-falign-functions}, but not to
11982skip more bytes than the size of the function.
11983
11984@item -falign-labels
11985@itemx -falign-labels=@var{n}
11986@itemx -falign-labels=@var{n}:@var{m}
11987@itemx -falign-labels=@var{n}:@var{m}:@var{n2}
11988@itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
11989@opindex falign-labels
11990Align all branch targets to a power-of-two boundary.
11991
11992Parameters of this option are analogous to the @option{-falign-functions} option.
11993@option{-fno-align-labels} and @option{-falign-labels=1} are
11994equivalent and mean that labels are not aligned.
11995
11996If @option{-falign-loops} or @option{-falign-jumps} are applicable and
11997are greater than this value, then their values are used instead.
11998
11999If @var{n} is not specified or is zero, use a machine-dependent default
12000which is very likely to be @samp{1}, meaning no alignment.
12001The maximum allowed @var{n} option value is 65536.
12002
12003Enabled at levels @option{-O2}, @option{-O3}.
12004
12005@item -falign-loops
12006@itemx -falign-loops=@var{n}
12007@itemx -falign-loops=@var{n}:@var{m}
12008@itemx -falign-loops=@var{n}:@var{m}:@var{n2}
12009@itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
12010@opindex falign-loops
12011Align loops to a power-of-two boundary.  If the loops are executed
12012many times, this makes up for any execution of the dummy padding
12013instructions.
12014
12015If @option{-falign-labels} is greater than this value, then its value
12016is used instead.
12017
12018Parameters of this option are analogous to the @option{-falign-functions} option.
12019@option{-fno-align-loops} and @option{-falign-loops=1} are
12020equivalent and mean that loops are not aligned.
12021The maximum allowed @var{n} option value is 65536.
12022
12023If @var{n} is not specified or is zero, use a machine-dependent default.
12024
12025Enabled at levels @option{-O2}, @option{-O3}.
12026
12027@item -falign-jumps
12028@itemx -falign-jumps=@var{n}
12029@itemx -falign-jumps=@var{n}:@var{m}
12030@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
12031@itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
12032@opindex falign-jumps
12033Align branch targets to a power-of-two boundary, for branch targets
12034where the targets can only be reached by jumping.  In this case,
12035no dummy operations need be executed.
12036
12037If @option{-falign-labels} is greater than this value, then its value
12038is used instead.
12039
12040Parameters of this option are analogous to the @option{-falign-functions} option.
12041@option{-fno-align-jumps} and @option{-falign-jumps=1} are
12042equivalent and mean that loops are not aligned.
12043
12044If @var{n} is not specified or is zero, use a machine-dependent default.
12045The maximum allowed @var{n} option value is 65536.
12046
12047Enabled at levels @option{-O2}, @option{-O3}.
12048
12049@item -fno-allocation-dce
12050@opindex fno-allocation-dce
12051Do not remove unused C++ allocations in dead code elimination.
12052
12053@item -fallow-store-data-races
12054@opindex fallow-store-data-races
12055Allow the compiler to perform optimizations that may introduce new data races
12056on stores, without proving that the variable cannot be concurrently accessed
12057by other threads.  Does not affect optimization of local data.  It is safe to
12058use this option if it is known that global data will not be accessed by
12059multiple threads.
12060
12061Examples of optimizations enabled by @option{-fallow-store-data-races} include
12062hoisting or if-conversions that may cause a value that was already in memory
12063to be re-written with that same value.  Such re-writing is safe in a single
12064threaded context but may be unsafe in a multi-threaded context.  Note that on
12065some processors, if-conversions may be required in order to enable
12066vectorization.
12067
12068Enabled at level @option{-Ofast}.
12069
12070@item -funit-at-a-time
12071@opindex funit-at-a-time
12072This option is left for compatibility reasons. @option{-funit-at-a-time}
12073has no effect, while @option{-fno-unit-at-a-time} implies
12074@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
12075
12076Enabled by default.
12077
12078@item -fno-toplevel-reorder
12079@opindex fno-toplevel-reorder
12080@opindex ftoplevel-reorder
12081Do not reorder top-level functions, variables, and @code{asm}
12082statements.  Output them in the same order that they appear in the
12083input file.  When this option is used, unreferenced static variables
12084are not removed.  This option is intended to support existing code
12085that relies on a particular ordering.  For new code, it is better to
12086use attributes when possible.
12087
12088@option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
12089also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
12090Additionally @option{-fno-toplevel-reorder} implies
12091@option{-fno-section-anchors}.
12092
12093@item -fweb
12094@opindex fweb
12095Constructs webs as commonly used for register allocation purposes and assign
12096each web individual pseudo register.  This allows the register allocation pass
12097to operate on pseudos directly, but also strengthens several other optimization
12098passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
12099however, make debugging impossible, since variables no longer stay in a
12100``home register''.
12101
12102Enabled by default with @option{-funroll-loops}.
12103
12104@item -fwhole-program
12105@opindex fwhole-program
12106Assume that the current compilation unit represents the whole program being
12107compiled.  All public functions and variables with the exception of @code{main}
12108and those merged by attribute @code{externally_visible} become static functions
12109and in effect are optimized more aggressively by interprocedural optimizers.
12110
12111This option should not be used in combination with @option{-flto}.
12112Instead relying on a linker plugin should provide safer and more precise
12113information.
12114
12115@item -flto[=@var{n}]
12116@opindex flto
12117This option runs the standard link-time optimizer.  When invoked
12118with source code, it generates GIMPLE (one of GCC's internal
12119representations) and writes it to special ELF sections in the object
12120file.  When the object files are linked together, all the function
12121bodies are read from these ELF sections and instantiated as if they
12122had been part of the same translation unit.
12123
12124To use the link-time optimizer, @option{-flto} and optimization
12125options should be specified at compile time and during the final link.
12126It is recommended that you compile all the files participating in the
12127same link with the same options and also specify those options at
12128link time.
12129For example:
12130
12131@smallexample
12132gcc -c -O2 -flto foo.c
12133gcc -c -O2 -flto bar.c
12134gcc -o myprog -flto -O2 foo.o bar.o
12135@end smallexample
12136
12137The first two invocations to GCC save a bytecode representation
12138of GIMPLE into special ELF sections inside @file{foo.o} and
12139@file{bar.o}.  The final invocation reads the GIMPLE bytecode from
12140@file{foo.o} and @file{bar.o}, merges the two files into a single
12141internal image, and compiles the result as usual.  Since both
12142@file{foo.o} and @file{bar.o} are merged into a single image, this
12143causes all the interprocedural analyses and optimizations in GCC to
12144work across the two files as if they were a single one.  This means,
12145for example, that the inliner is able to inline functions in
12146@file{bar.o} into functions in @file{foo.o} and vice-versa.
12147
12148Another (simpler) way to enable link-time optimization is:
12149
12150@smallexample
12151gcc -o myprog -flto -O2 foo.c bar.c
12152@end smallexample
12153
12154The above generates bytecode for @file{foo.c} and @file{bar.c},
12155merges them together into a single GIMPLE representation and optimizes
12156them as usual to produce @file{myprog}.
12157
12158The important thing to keep in mind is that to enable link-time
12159optimizations you need to use the GCC driver to perform the link step.
12160GCC automatically performs link-time optimization if any of the
12161objects involved were compiled with the @option{-flto} command-line option.
12162You can always override
12163the automatic decision to do link-time optimization
12164by passing @option{-fno-lto} to the link command.
12165
12166To make whole program optimization effective, it is necessary to make
12167certain whole program assumptions.  The compiler needs to know
12168what functions and variables can be accessed by libraries and runtime
12169outside of the link-time optimized unit.  When supported by the linker,
12170the linker plugin (see @option{-fuse-linker-plugin}) passes information
12171to the compiler about used and externally visible symbols.  When
12172the linker plugin is not available, @option{-fwhole-program} should be
12173used to allow the compiler to make these assumptions, which leads
12174to more aggressive optimization decisions.
12175
12176When a file is compiled with @option{-flto} without
12177@option{-fuse-linker-plugin}, the generated object file is larger than
12178a regular object file because it contains GIMPLE bytecodes and the usual
12179final code (see @option{-ffat-lto-objects}).  This means that
12180object files with LTO information can be linked as normal object
12181files; if @option{-fno-lto} is passed to the linker, no
12182interprocedural optimizations are applied.  Note that when
12183@option{-fno-fat-lto-objects} is enabled the compile stage is faster
12184but you cannot perform a regular, non-LTO link on them.
12185
12186When producing the final binary, GCC only
12187applies link-time optimizations to those files that contain bytecode.
12188Therefore, you can mix and match object files and libraries with
12189GIMPLE bytecodes and final object code.  GCC automatically selects
12190which files to optimize in LTO mode and which files to link without
12191further processing.
12192
12193Generally, options specified at link time override those
12194specified at compile time, although in some cases GCC attempts to infer
12195link-time options from the settings used to compile the input files.
12196
12197If you do not specify an optimization level option @option{-O} at
12198link time, then GCC uses the highest optimization level
12199used when compiling the object files.  Note that it is generally
12200ineffective to specify an optimization level option only at link time and
12201not at compile time, for two reasons.  First, compiling without
12202optimization suppresses compiler passes that gather information
12203needed for effective optimization at link time.  Second, some early
12204optimization passes can be performed only at compile time and
12205not at link time.
12206
12207There are some code generation flags preserved by GCC when
12208generating bytecodes, as they need to be used during the final link.
12209Currently, the following options and their settings are taken from
12210the first object file that explicitly specifies them:
12211@option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
12212@option{-fgnu-tm} and all the @option{-m} target flags.
12213
12214The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
12215@option{-fPIE} are combined based on the following scheme:
12216
12217@smallexample
12218@option{-fPIC} + @option{-fpic} = @option{-fpic}
12219@option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
12220@option{-fpic/-fPIC} + (no option) = (no option)
12221@option{-fPIC} + @option{-fPIE} = @option{-fPIE}
12222@option{-fpic} + @option{-fPIE} = @option{-fpie}
12223@option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
12224@end smallexample
12225
12226Certain ABI-changing flags are required to match in all compilation units,
12227and trying to override this at link time with a conflicting value
12228is ignored.  This includes options such as @option{-freg-struct-return}
12229and @option{-fpcc-struct-return}.
12230
12231Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
12232@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
12233are passed through to the link stage and merged conservatively for
12234conflicting translation units.  Specifically
12235@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
12236precedence; and for example @option{-ffp-contract=off} takes precedence
12237over @option{-ffp-contract=fast}.  You can override them at link time.
12238
12239Diagnostic options such as @option{-Wstringop-overflow} are passed
12240through to the link stage and their setting matches that of the
12241compile-step at function granularity.  Note that this matters only
12242for diagnostics emitted during optimization.  Note that code
12243transforms such as inlining can lead to warnings being enabled
12244or disabled for regions if code not consistent with the setting
12245at compile time.
12246
12247When you need to pass options to the assembler via @option{-Wa} or
12248@option{-Xassembler} make sure to either compile such translation
12249units with @option{-fno-lto} or consistently use the same assembler
12250options on all translation units.  You can alternatively also
12251specify assembler options at LTO link time.
12252
12253To enable debug info generation you need to supply @option{-g} at
12254compile time.  If any of the input files at link time were built
12255with debug info generation enabled the link will enable debug info
12256generation as well.  Any elaborate debug info settings
12257like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
12258at the linker command line and mixing different settings in different
12259translation units is discouraged.
12260
12261If LTO encounters objects with C linkage declared with incompatible
12262types in separate translation units to be linked together (undefined
12263behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
12264issued.  The behavior is still undefined at run time.  Similar
12265diagnostics may be raised for other languages.
12266
12267Another feature of LTO is that it is possible to apply interprocedural
12268optimizations on files written in different languages:
12269
12270@smallexample
12271gcc -c -flto foo.c
12272g++ -c -flto bar.cc
12273gfortran -c -flto baz.f90
12274g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
12275@end smallexample
12276
12277Notice that the final link is done with @command{g++} to get the C++
12278runtime libraries and @option{-lgfortran} is added to get the Fortran
12279runtime libraries.  In general, when mixing languages in LTO mode, you
12280should use the same link command options as when mixing languages in a
12281regular (non-LTO) compilation.
12282
12283If object files containing GIMPLE bytecode are stored in a library archive, say
12284@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
12285are using a linker with plugin support.  To create static libraries suitable
12286for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
12287and @command{ranlib};
12288to show the symbols of object files with GIMPLE bytecode, use
12289@command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
12290and @command{nm} have been compiled with plugin support.  At link time, use the
12291flag @option{-fuse-linker-plugin} to ensure that the library participates in
12292the LTO optimization process:
12293
12294@smallexample
12295gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
12296@end smallexample
12297
12298With the linker plugin enabled, the linker extracts the needed
12299GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
12300to make them part of the aggregated GIMPLE image to be optimized.
12301
12302If you are not using a linker with plugin support and/or do not
12303enable the linker plugin, then the objects inside @file{libfoo.a}
12304are extracted and linked as usual, but they do not participate
12305in the LTO optimization process.  In order to make a static library suitable
12306for both LTO optimization and usual linkage, compile its object files with
12307@option{-flto} @option{-ffat-lto-objects}.
12308
12309Link-time optimizations do not require the presence of the whole program to
12310operate.  If the program does not require any symbols to be exported, it is
12311possible to combine @option{-flto} and @option{-fwhole-program} to allow
12312the interprocedural optimizers to use more aggressive assumptions which may
12313lead to improved optimization opportunities.
12314Use of @option{-fwhole-program} is not needed when linker plugin is
12315active (see @option{-fuse-linker-plugin}).
12316
12317The current implementation of LTO makes no
12318attempt to generate bytecode that is portable between different
12319types of hosts.  The bytecode files are versioned and there is a
12320strict version check, so bytecode files generated in one version of
12321GCC do not work with an older or newer version of GCC.
12322
12323Link-time optimization does not work well with generation of debugging
12324information on systems other than those using a combination of ELF and
12325DWARF.
12326
12327If you specify the optional @var{n}, the optimization and code
12328generation done at link time is executed in parallel using @var{n}
12329parallel jobs by utilizing an installed @command{make} program.  The
12330environment variable @env{MAKE} may be used to override the program
12331used.
12332
12333You can also specify @option{-flto=jobserver} to use GNU make's
12334job server mode to determine the number of parallel jobs. This
12335is useful when the Makefile calling GCC is already executing in parallel.
12336You must prepend a @samp{+} to the command recipe in the parent Makefile
12337for this to work.  This option likely only works if @env{MAKE} is
12338GNU make.  Even without the option value, GCC tries to automatically
12339detect a running GNU make's job server.
12340
12341Use @option{-flto=auto} to use GNU make's job server, if available,
12342or otherwise fall back to autodetection of the number of CPU threads
12343present in your system.
12344
12345@item -flto-partition=@var{alg}
12346@opindex flto-partition
12347Specify the partitioning algorithm used by the link-time optimizer.
12348The value is either @samp{1to1} to specify a partitioning mirroring
12349the original source files or @samp{balanced} to specify partitioning
12350into equally sized chunks (whenever possible) or @samp{max} to create
12351new partition for every symbol where possible.  Specifying @samp{none}
12352as an algorithm disables partitioning and streaming completely.
12353The default value is @samp{balanced}. While @samp{1to1} can be used
12354as an workaround for various code ordering issues, the @samp{max}
12355partitioning is intended for internal testing only.
12356The value @samp{one} specifies that exactly one partition should be
12357used while the value @samp{none} bypasses partitioning and executes
12358the link-time optimization step directly from the WPA phase.
12359
12360@item -flto-compression-level=@var{n}
12361@opindex flto-compression-level
12362This option specifies the level of compression used for intermediate
12363language written to LTO object files, and is only meaningful in
12364conjunction with LTO mode (@option{-flto}).  GCC currently supports two
12365LTO compression algorithms. For zstd, valid values are 0 (no compression)
12366to 19 (maximum compression), while zlib supports values from 0 to 9.
12367Values outside this range are clamped to either minimum or maximum
12368of the supported values.  If the option is not given,
12369a default balanced compression setting is used.
12370
12371@item -fuse-linker-plugin
12372@opindex fuse-linker-plugin
12373Enables the use of a linker plugin during link-time optimization.  This
12374option relies on plugin support in the linker, which is available in gold
12375or in GNU ld 2.21 or newer.
12376
12377This option enables the extraction of object files with GIMPLE bytecode out
12378of library archives. This improves the quality of optimization by exposing
12379more code to the link-time optimizer.  This information specifies what
12380symbols can be accessed externally (by non-LTO object or during dynamic
12381linking).  Resulting code quality improvements on binaries (and shared
12382libraries that use hidden visibility) are similar to @option{-fwhole-program}.
12383See @option{-flto} for a description of the effect of this flag and how to
12384use it.
12385
12386This option is enabled by default when LTO support in GCC is enabled
12387and GCC was configured for use with
12388a linker supporting plugins (GNU ld 2.21 or newer or gold).
12389
12390@item -ffat-lto-objects
12391@opindex ffat-lto-objects
12392Fat LTO objects are object files that contain both the intermediate language
12393and the object code. This makes them usable for both LTO linking and normal
12394linking. This option is effective only when compiling with @option{-flto}
12395and is ignored at link time.
12396
12397@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
12398requires the complete toolchain to be aware of LTO. It requires a linker with
12399linker plugin support for basic functionality.  Additionally,
12400@command{nm}, @command{ar} and @command{ranlib}
12401need to support linker plugins to allow a full-featured build environment
12402(capable of building static libraries etc).  GCC provides the @command{gcc-ar},
12403@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
12404to these tools. With non fat LTO makefiles need to be modified to use them.
12405
12406Note that modern binutils provide plugin auto-load mechanism.
12407Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
12408effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
12409@command{gcc-ranlib}).
12410
12411The default is @option{-fno-fat-lto-objects} on targets with linker plugin
12412support.
12413
12414@item -fcompare-elim
12415@opindex fcompare-elim
12416After register allocation and post-register allocation instruction splitting,
12417identify arithmetic instructions that compute processor flags similar to a
12418comparison operation based on that arithmetic.  If possible, eliminate the
12419explicit comparison operation.
12420
12421This pass only applies to certain targets that cannot explicitly represent
12422the comparison operation before register allocation is complete.
12423
12424Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12425
12426@item -fcprop-registers
12427@opindex fcprop-registers
12428After register allocation and post-register allocation instruction splitting,
12429perform a copy-propagation pass to try to reduce scheduling dependencies
12430and occasionally eliminate the copy.
12431
12432Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
12433
12434@item -fprofile-correction
12435@opindex fprofile-correction
12436Profiles collected using an instrumented binary for multi-threaded programs may
12437be inconsistent due to missed counter updates. When this option is specified,
12438GCC uses heuristics to correct or smooth out such inconsistencies. By
12439default, GCC emits an error message when an inconsistent profile is detected.
12440
12441This option is enabled by @option{-fauto-profile}.
12442
12443@item -fprofile-partial-training
12444@opindex fprofile-partial-training
12445With @code{-fprofile-use} all portions of programs not executed during train
12446run are optimized agressively for size rather than speed.  In some cases it is
12447not practical to train all possible hot paths in the program. (For
12448example, program may contain functions specific for a given hardware and
12449trianing may not cover all hardware configurations program is run on.)  With
12450@code{-fprofile-partial-training} profile feedback will be ignored for all
12451functions not executed during the train run leading them to be optimized as if
12452they were compiled without profile feedback. This leads to better performance
12453when train run is not representative but also leads to significantly bigger
12454code.
12455
12456@item -fprofile-use
12457@itemx -fprofile-use=@var{path}
12458@opindex fprofile-use
12459Enable profile feedback-directed optimizations,
12460and the following optimizations, many of which
12461are generally profitable only with profile feedback available:
12462
12463@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
12464-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
12465-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
12466-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
12467-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
12468-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
12469-fprofile-reorder-functions}
12470
12471Before you can use this option, you must first generate profiling information.
12472@xref{Instrumentation Options}, for information about the
12473@option{-fprofile-generate} option.
12474
12475By default, GCC emits an error message if the feedback profiles do not
12476match the source code.  This error can be turned into a warning by using
12477@option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
12478optimized code.  Additionally, by default, GCC also emits a warning message if
12479the feedback profiles do not exist (see @option{-Wmissing-profile}).
12480
12481If @var{path} is specified, GCC looks at the @var{path} to find
12482the profile feedback data files. See @option{-fprofile-dir}.
12483
12484@item -fauto-profile
12485@itemx -fauto-profile=@var{path}
12486@opindex fauto-profile
12487Enable sampling-based feedback-directed optimizations,
12488and the following optimizations,
12489many of which are generally profitable only with profile feedback available:
12490
12491@gccoptlist{-fbranch-probabilities  -fprofile-values @gol
12492-funroll-loops  -fpeel-loops  -ftracer  -fvpt @gol
12493-finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp @gol
12494-fpredictive-commoning  -fsplit-loops  -funswitch-loops @gol
12495-fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize @gol
12496-fvect-cost-model=dynamic  -ftree-loop-distribute-patterns @gol
12497-fprofile-correction}
12498
12499@var{path} is the name of a file containing AutoFDO profile information.
12500If omitted, it defaults to @file{fbdata.afdo} in the current directory.
12501
12502Producing an AutoFDO profile data file requires running your program
12503with the @command{perf} utility on a supported GNU/Linux target system.
12504For more information, see @uref{https://perf.wiki.kernel.org/}.
12505
12506E.g.
12507@smallexample
12508perf record -e br_inst_retired:near_taken -b -o perf.data \
12509    -- your_program
12510@end smallexample
12511
12512Then use the @command{create_gcov} tool to convert the raw profile data
12513to a format that can be used by GCC.@  You must also supply the
12514unstripped binary for your program to this tool.
12515See @uref{https://github.com/google/autofdo}.
12516
12517E.g.
12518@smallexample
12519create_gcov --binary=your_program.unstripped --profile=perf.data \
12520    --gcov=profile.afdo
12521@end smallexample
12522@end table
12523
12524The following options control compiler behavior regarding floating-point
12525arithmetic.  These options trade off between speed and
12526correctness.  All must be specifically enabled.
12527
12528@table @gcctabopt
12529@item -ffloat-store
12530@opindex ffloat-store
12531Do not store floating-point variables in registers, and inhibit other
12532options that might change whether a floating-point value is taken from a
12533register or memory.
12534
12535@cindex floating-point precision
12536This option prevents undesirable excess precision on machines such as
12537the 68000 where the floating registers (of the 68881) keep more
12538precision than a @code{double} is supposed to have.  Similarly for the
12539x86 architecture.  For most programs, the excess precision does only
12540good, but a few programs rely on the precise definition of IEEE floating
12541point.  Use @option{-ffloat-store} for such programs, after modifying
12542them to store all pertinent intermediate computations into variables.
12543
12544@item -fexcess-precision=@var{style}
12545@opindex fexcess-precision
12546This option allows further control over excess precision on machines
12547where floating-point operations occur in a format with more precision or
12548range than the IEEE standard and interchange floating-point types.  By
12549default, @option{-fexcess-precision=fast} is in effect; this means that
12550operations may be carried out in a wider precision than the types specified
12551in the source if that would result in faster code, and it is unpredictable
12552when rounding to the types specified in the source code takes place.
12553When compiling C, if @option{-fexcess-precision=standard} is specified then
12554excess precision follows the rules specified in ISO C99; in particular,
12555both casts and assignments cause values to be rounded to their
12556semantic types (whereas @option{-ffloat-store} only affects
12557assignments).  This option is enabled by default for C if a strict
12558conformance option such as @option{-std=c99} is used.
12559@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
12560regardless of whether a strict conformance option is used.
12561
12562@opindex mfpmath
12563@option{-fexcess-precision=standard} is not implemented for languages
12564other than C.  On the x86, it has no effect if @option{-mfpmath=sse}
12565or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
12566semantics apply without excess precision, and in the latter, rounding
12567is unpredictable.
12568
12569@item -ffast-math
12570@opindex ffast-math
12571Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
12572@option{-ffinite-math-only}, @option{-fno-rounding-math},
12573@option{-fno-signaling-nans}, @option{-fcx-limited-range} and
12574@option{-fexcess-precision=fast}.
12575
12576This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
12577
12578This option is not turned on by any @option{-O} option besides
12579@option{-Ofast} since it can result in incorrect output for programs
12580that depend on an exact implementation of IEEE or ISO rules/specifications
12581for math functions. It may, however, yield faster code for programs
12582that do not require the guarantees of these specifications.
12583
12584@item -fno-math-errno
12585@opindex fno-math-errno
12586@opindex fmath-errno
12587Do not set @code{errno} after calling math functions that are executed
12588with a single instruction, e.g., @code{sqrt}.  A program that relies on
12589IEEE exceptions for math error handling may want to use this flag
12590for speed while maintaining IEEE arithmetic compatibility.
12591
12592This option is not turned on by any @option{-O} option since
12593it can result in incorrect output for programs that depend on
12594an exact implementation of IEEE or ISO rules/specifications for
12595math functions. It may, however, yield faster code for programs
12596that do not require the guarantees of these specifications.
12597
12598The default is @option{-fmath-errno}.
12599
12600On Darwin systems, the math library never sets @code{errno}.  There is
12601therefore no reason for the compiler to consider the possibility that
12602it might, and @option{-fno-math-errno} is the default.
12603
12604@item -funsafe-math-optimizations
12605@opindex funsafe-math-optimizations
12606
12607Allow optimizations for floating-point arithmetic that (a) assume
12608that arguments and results are valid and (b) may violate IEEE or
12609ANSI standards.  When used at link time, it may include libraries
12610or startup files that change the default FPU control word or other
12611similar optimizations.
12612
12613This option is not turned on by any @option{-O} option since
12614it can result in incorrect output for programs that depend on
12615an exact implementation of IEEE or ISO rules/specifications for
12616math functions. It may, however, yield faster code for programs
12617that do not require the guarantees of these specifications.
12618Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
12619@option{-fassociative-math} and @option{-freciprocal-math}.
12620
12621The default is @option{-fno-unsafe-math-optimizations}.
12622
12623@item -fassociative-math
12624@opindex fassociative-math
12625
12626Allow re-association of operands in series of floating-point operations.
12627This violates the ISO C and C++ language standard by possibly changing
12628computation result.  NOTE: re-ordering may change the sign of zero as
12629well as ignore NaNs and inhibit or create underflow or overflow (and
12630thus cannot be used on code that relies on rounding behavior like
12631@code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
12632and thus may not be used when ordered comparisons are required.
12633This option requires that both @option{-fno-signed-zeros} and
12634@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
12635much sense with @option{-frounding-math}. For Fortran the option
12636is automatically enabled when both @option{-fno-signed-zeros} and
12637@option{-fno-trapping-math} are in effect.
12638
12639The default is @option{-fno-associative-math}.
12640
12641@item -freciprocal-math
12642@opindex freciprocal-math
12643
12644Allow the reciprocal of a value to be used instead of dividing by
12645the value if this enables optimizations.  For example @code{x / y}
12646can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
12647is subject to common subexpression elimination.  Note that this loses
12648precision and increases the number of flops operating on the value.
12649
12650The default is @option{-fno-reciprocal-math}.
12651
12652@item -ffinite-math-only
12653@opindex ffinite-math-only
12654Allow optimizations for floating-point arithmetic that assume
12655that arguments and results are not NaNs or +-Infs.
12656
12657This option is not turned on by any @option{-O} option since
12658it can result in incorrect output for programs that depend on
12659an exact implementation of IEEE or ISO rules/specifications for
12660math functions. It may, however, yield faster code for programs
12661that do not require the guarantees of these specifications.
12662
12663The default is @option{-fno-finite-math-only}.
12664
12665@item -fno-signed-zeros
12666@opindex fno-signed-zeros
12667@opindex fsigned-zeros
12668Allow optimizations for floating-point arithmetic that ignore the
12669signedness of zero.  IEEE arithmetic specifies the behavior of
12670distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
12671of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
12672This option implies that the sign of a zero result isn't significant.
12673
12674The default is @option{-fsigned-zeros}.
12675
12676@item -fno-trapping-math
12677@opindex fno-trapping-math
12678@opindex ftrapping-math
12679Compile code assuming that floating-point operations cannot generate
12680user-visible traps.  These traps include division by zero, overflow,
12681underflow, inexact result and invalid operation.  This option requires
12682that @option{-fno-signaling-nans} be in effect.  Setting this option may
12683allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
12684
12685This option should never be turned on by any @option{-O} option since
12686it can result in incorrect output for programs that depend on
12687an exact implementation of IEEE or ISO rules/specifications for
12688math functions.
12689
12690The default is @option{-ftrapping-math}.
12691
12692@item -frounding-math
12693@opindex frounding-math
12694Disable transformations and optimizations that assume default floating-point
12695rounding behavior.  This is round-to-zero for all floating point
12696to integer conversions, and round-to-nearest for all other arithmetic
12697truncations.  This option should be specified for programs that change
12698the FP rounding mode dynamically, or that may be executed with a
12699non-default rounding mode.  This option disables constant folding of
12700floating-point expressions at compile time (which may be affected by
12701rounding mode) and arithmetic transformations that are unsafe in the
12702presence of sign-dependent rounding modes.
12703
12704The default is @option{-fno-rounding-math}.
12705
12706This option is experimental and does not currently guarantee to
12707disable all GCC optimizations that are affected by rounding mode.
12708Future versions of GCC may provide finer control of this setting
12709using C99's @code{FENV_ACCESS} pragma.  This command-line option
12710will be used to specify the default state for @code{FENV_ACCESS}.
12711
12712@item -fsignaling-nans
12713@opindex fsignaling-nans
12714Compile code assuming that IEEE signaling NaNs may generate user-visible
12715traps during floating-point operations.  Setting this option disables
12716optimizations that may change the number of exceptions visible with
12717signaling NaNs.  This option implies @option{-ftrapping-math}.
12718
12719This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
12720be defined.
12721
12722The default is @option{-fno-signaling-nans}.
12723
12724This option is experimental and does not currently guarantee to
12725disable all GCC optimizations that affect signaling NaN behavior.
12726
12727@item -fno-fp-int-builtin-inexact
12728@opindex fno-fp-int-builtin-inexact
12729@opindex ffp-int-builtin-inexact
12730Do not allow the built-in functions @code{ceil}, @code{floor},
12731@code{round} and @code{trunc}, and their @code{float} and @code{long
12732double} variants, to generate code that raises the ``inexact''
12733floating-point exception for noninteger arguments.  ISO C99 and C11
12734allow these functions to raise the ``inexact'' exception, but ISO/IEC
12735TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
12736ISO C2X, does not allow these functions to do so.
12737
12738The default is @option{-ffp-int-builtin-inexact}, allowing the
12739exception to be raised, unless C2X or a later C standard is selected.
12740This option does nothing unless @option{-ftrapping-math} is in effect.
12741
12742Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
12743generate a call to a library function then the ``inexact'' exception
12744may be raised if the library implementation does not follow TS 18661.
12745
12746@item -fsingle-precision-constant
12747@opindex fsingle-precision-constant
12748Treat floating-point constants as single precision instead of
12749implicitly converting them to double-precision constants.
12750
12751@item -fcx-limited-range
12752@opindex fcx-limited-range
12753When enabled, this option states that a range reduction step is not
12754needed when performing complex division.  Also, there is no checking
12755whether the result of a complex multiplication or division is @code{NaN
12756+ I*NaN}, with an attempt to rescue the situation in that case.  The
12757default is @option{-fno-cx-limited-range}, but is enabled by
12758@option{-ffast-math}.
12759
12760This option controls the default setting of the ISO C99
12761@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
12762all languages.
12763
12764@item -fcx-fortran-rules
12765@opindex fcx-fortran-rules
12766Complex multiplication and division follow Fortran rules.  Range
12767reduction is done as part of complex division, but there is no checking
12768whether the result of a complex multiplication or division is @code{NaN
12769+ I*NaN}, with an attempt to rescue the situation in that case.
12770
12771The default is @option{-fno-cx-fortran-rules}.
12772
12773@end table
12774
12775The following options control optimizations that may improve
12776performance, but are not enabled by any @option{-O} options.  This
12777section includes experimental options that may produce broken code.
12778
12779@table @gcctabopt
12780@item -fbranch-probabilities
12781@opindex fbranch-probabilities
12782After running a program compiled with @option{-fprofile-arcs}
12783(@pxref{Instrumentation Options}),
12784you can compile it a second time using
12785@option{-fbranch-probabilities}, to improve optimizations based on
12786the number of times each branch was taken.  When a program
12787compiled with @option{-fprofile-arcs} exits, it saves arc execution
12788counts to a file called @file{@var{sourcename}.gcda} for each source
12789file.  The information in this data file is very dependent on the
12790structure of the generated code, so you must use the same source code
12791and the same optimization options for both compilations.
12792
12793With @option{-fbranch-probabilities}, GCC puts a
12794@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
12795These can be used to improve optimization.  Currently, they are only
12796used in one place: in @file{reorg.c}, instead of guessing which path a
12797branch is most likely to take, the @samp{REG_BR_PROB} values are used to
12798exactly determine which path is taken more often.
12799
12800Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12801
12802@item -fprofile-values
12803@opindex fprofile-values
12804If combined with @option{-fprofile-arcs}, it adds code so that some
12805data about values of expressions in the program is gathered.
12806
12807With @option{-fbranch-probabilities}, it reads back the data gathered
12808from profiling values of expressions for usage in optimizations.
12809
12810Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
12811@option{-fauto-profile}.
12812
12813@item -fprofile-reorder-functions
12814@opindex fprofile-reorder-functions
12815Function reordering based on profile instrumentation collects
12816first time of execution of a function and orders these functions
12817in ascending order.
12818
12819Enabled with @option{-fprofile-use}.
12820
12821@item -fvpt
12822@opindex fvpt
12823If combined with @option{-fprofile-arcs}, this option instructs the compiler
12824to add code to gather information about values of expressions.
12825
12826With @option{-fbranch-probabilities}, it reads back the data gathered
12827and actually performs the optimizations based on them.
12828Currently the optimizations include specialization of division operations
12829using the knowledge about the value of the denominator.
12830
12831Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
12832
12833@item -frename-registers
12834@opindex frename-registers
12835Attempt to avoid false dependencies in scheduled code by making use
12836of registers left over after register allocation.  This optimization
12837most benefits processors with lots of registers.  Depending on the
12838debug information format adopted by the target, however, it can
12839make debugging impossible, since variables no longer stay in
12840a ``home register''.
12841
12842Enabled by default with @option{-funroll-loops}.
12843
12844@item -fschedule-fusion
12845@opindex fschedule-fusion
12846Performs a target dependent pass over the instruction stream to schedule
12847instructions of same type together because target machine can execute them
12848more efficiently if they are adjacent to each other in the instruction flow.
12849
12850Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12851
12852@item -ftracer
12853@opindex ftracer
12854Perform tail duplication to enlarge superblock size.  This transformation
12855simplifies the control flow of the function allowing other optimizations to do
12856a better job.
12857
12858Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12859
12860@item -funroll-loops
12861@opindex funroll-loops
12862Unroll loops whose number of iterations can be determined at compile time or
12863upon entry to the loop.  @option{-funroll-loops} implies
12864@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
12865It also turns on complete loop peeling (i.e.@: complete removal of loops with
12866a small constant number of iterations).  This option makes code larger, and may
12867or may not make it run faster.
12868
12869Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12870
12871@item -funroll-all-loops
12872@opindex funroll-all-loops
12873Unroll all loops, even if their number of iterations is uncertain when
12874the loop is entered.  This usually makes programs run more slowly.
12875@option{-funroll-all-loops} implies the same options as
12876@option{-funroll-loops}.
12877
12878@item -fpeel-loops
12879@opindex fpeel-loops
12880Peels loops for which there is enough information that they do not
12881roll much (from profile feedback or static analysis).  It also turns on
12882complete loop peeling (i.e.@: complete removal of loops with small constant
12883number of iterations).
12884
12885Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
12886
12887@item -fmove-loop-invariants
12888@opindex fmove-loop-invariants
12889Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
12890at level @option{-O1} and higher, except for @option{-Og}.
12891
12892@item -fsplit-loops
12893@opindex fsplit-loops
12894Split a loop into two if it contains a condition that's always true
12895for one side of the iteration space and false for the other.
12896
12897Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12898
12899@item -funswitch-loops
12900@opindex funswitch-loops
12901Move branches with loop invariant conditions out of the loop, with duplicates
12902of the loop on both branches (modified according to result of the condition).
12903
12904Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12905
12906@item -fversion-loops-for-strides
12907@opindex fversion-loops-for-strides
12908If a loop iterates over an array with a variable stride, create another
12909version of the loop that assumes the stride is always one.  For example:
12910
12911@smallexample
12912for (int i = 0; i < n; ++i)
12913  x[i * stride] = @dots{};
12914@end smallexample
12915
12916becomes:
12917
12918@smallexample
12919if (stride == 1)
12920  for (int i = 0; i < n; ++i)
12921    x[i] = @dots{};
12922else
12923  for (int i = 0; i < n; ++i)
12924    x[i * stride] = @dots{};
12925@end smallexample
12926
12927This is particularly useful for assumed-shape arrays in Fortran where
12928(for example) it allows better vectorization assuming contiguous accesses.
12929This flag is enabled by default at @option{-O3}.
12930It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
12931
12932@item -ffunction-sections
12933@itemx -fdata-sections
12934@opindex ffunction-sections
12935@opindex fdata-sections
12936Place each function or data item into its own section in the output
12937file if the target supports arbitrary sections.  The name of the
12938function or the name of the data item determines the section's name
12939in the output file.
12940
12941Use these options on systems where the linker can perform optimizations to
12942improve locality of reference in the instruction space.  Most systems using the
12943ELF object format have linkers with such optimizations.  On AIX, the linker
12944rearranges sections (CSECTs) based on the call graph.  The performance impact
12945varies.
12946
12947Together with a linker garbage collection (linker @option{--gc-sections}
12948option) these options may lead to smaller statically-linked executables (after
12949stripping).
12950
12951On ELF/DWARF systems these options do not degenerate the quality of the debug
12952information.  There could be issues with other object files/debug info formats.
12953
12954Only use these options when there are significant benefits from doing so.  When
12955you specify these options, the assembler and linker create larger object and
12956executable files and are also slower.  These options affect code generation.
12957They prevent optimizations by the compiler and assembler using relative
12958locations inside a translation unit since the locations are unknown until
12959link time.  An example of such an optimization is relaxing calls to short call
12960instructions.
12961
12962@item -fstdarg-opt
12963@opindex fstdarg-opt
12964Optimize the prologue of variadic argument functions with respect to usage of
12965those arguments.
12966
12967@item -fsection-anchors
12968@opindex fsection-anchors
12969Try to reduce the number of symbolic address calculations by using
12970shared ``anchor'' symbols to address nearby objects.  This transformation
12971can help to reduce the number of GOT entries and GOT accesses on some
12972targets.
12973
12974For example, the implementation of the following function @code{foo}:
12975
12976@smallexample
12977static int a, b, c;
12978int foo (void) @{ return a + b + c; @}
12979@end smallexample
12980
12981@noindent
12982usually calculates the addresses of all three variables, but if you
12983compile it with @option{-fsection-anchors}, it accesses the variables
12984from a common anchor point instead.  The effect is similar to the
12985following pseudocode (which isn't valid C):
12986
12987@smallexample
12988int foo (void)
12989@{
12990  register int *xr = &x;
12991  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12992@}
12993@end smallexample
12994
12995Not all targets support this option.
12996
12997@item -fzero-call-used-regs=@var{choice}
12998@opindex fzero-call-used-regs
12999Zero call-used registers at function return to increase program
13000security by either mitigating Return-Oriented Programming (ROP)
13001attacks or preventing information leakage through registers.
13002
13003The possible values of @var{choice} are the same as for the
13004@code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
13005The default is @samp{skip}.
13006
13007You can control this behavior for a specific function by using the function
13008attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
13009
13010@item --param @var{name}=@var{value}
13011@opindex param
13012In some places, GCC uses various constants to control the amount of
13013optimization that is done.  For example, GCC does not inline functions
13014that contain more than a certain number of instructions.  You can
13015control some of these constants on the command line using the
13016@option{--param} option.
13017
13018The names of specific parameters, and the meaning of the values, are
13019tied to the internals of the compiler, and are subject to change
13020without notice in future releases.
13021
13022In order to get minimal, maximal and default value of a parameter,
13023one can use @option{--help=param -Q} options.
13024
13025In each case, the @var{value} is an integer.  The following choices
13026of @var{name} are recognized for all targets:
13027
13028@table @gcctabopt
13029@item predictable-branch-outcome
13030When branch is predicted to be taken with probability lower than this threshold
13031(in percent), then it is considered well predictable.
13032
13033@item max-rtl-if-conversion-insns
13034RTL if-conversion tries to remove conditional branches around a block and
13035replace them with conditionally executed instructions.  This parameter
13036gives the maximum number of instructions in a block which should be
13037considered for if-conversion.  The compiler will
13038also use other heuristics to decide whether if-conversion is likely to be
13039profitable.
13040
13041@item max-rtl-if-conversion-predictable-cost
13042RTL if-conversion will try to remove conditional branches around a block
13043and replace them with conditionally executed instructions.  These parameters
13044give the maximum permissible cost for the sequence that would be generated
13045by if-conversion depending on whether the branch is statically determined
13046to be predictable or not.  The units for this parameter are the same as
13047those for the GCC internal seq_cost metric.  The compiler will try to
13048provide a reasonable default for this parameter using the BRANCH_COST
13049target macro.
13050
13051@item max-crossjump-edges
13052The maximum number of incoming edges to consider for cross-jumping.
13053The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
13054the number of edges incoming to each block.  Increasing values mean
13055more aggressive optimization, making the compilation time increase with
13056probably small improvement in executable size.
13057
13058@item min-crossjump-insns
13059The minimum number of instructions that must be matched at the end
13060of two blocks before cross-jumping is performed on them.  This
13061value is ignored in the case where all instructions in the block being
13062cross-jumped from are matched.
13063
13064@item max-grow-copy-bb-insns
13065The maximum code size expansion factor when copying basic blocks
13066instead of jumping.  The expansion is relative to a jump instruction.
13067
13068@item max-goto-duplication-insns
13069The maximum number of instructions to duplicate to a block that jumps
13070to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
13071passes, GCC factors computed gotos early in the compilation process,
13072and unfactors them as late as possible.  Only computed jumps at the
13073end of a basic blocks with no more than max-goto-duplication-insns are
13074unfactored.
13075
13076@item max-delay-slot-insn-search
13077The maximum number of instructions to consider when looking for an
13078instruction to fill a delay slot.  If more than this arbitrary number of
13079instructions are searched, the time savings from filling the delay slot
13080are minimal, so stop searching.  Increasing values mean more
13081aggressive optimization, making the compilation time increase with probably
13082small improvement in execution time.
13083
13084@item max-delay-slot-live-search
13085When trying to fill delay slots, the maximum number of instructions to
13086consider when searching for a block with valid live register
13087information.  Increasing this arbitrarily chosen value means more
13088aggressive optimization, increasing the compilation time.  This parameter
13089should be removed when the delay slot code is rewritten to maintain the
13090control-flow graph.
13091
13092@item max-gcse-memory
13093The approximate maximum amount of memory in @code{kB} that can be allocated in
13094order to perform the global common subexpression elimination
13095optimization.  If more memory than specified is required, the
13096optimization is not done.
13097
13098@item max-gcse-insertion-ratio
13099If the ratio of expression insertions to deletions is larger than this value
13100for any expression, then RTL PRE inserts or removes the expression and thus
13101leaves partially redundant computations in the instruction stream.
13102
13103@item max-pending-list-length
13104The maximum number of pending dependencies scheduling allows
13105before flushing the current state and starting over.  Large functions
13106with few branches or calls can create excessively large lists which
13107needlessly consume memory and resources.
13108
13109@item max-modulo-backtrack-attempts
13110The maximum number of backtrack attempts the scheduler should make
13111when modulo scheduling a loop.  Larger values can exponentially increase
13112compilation time.
13113
13114@item max-inline-insns-single
13115Several parameters control the tree inliner used in GCC@.  This number sets the
13116maximum number of instructions (counted in GCC's internal representation) in a
13117single function that the tree inliner considers for inlining.  This only
13118affects functions declared inline and methods implemented in a class
13119declaration (C++).
13120
13121
13122@item max-inline-insns-auto
13123When you use @option{-finline-functions} (included in @option{-O3}),
13124a lot of functions that would otherwise not be considered for inlining
13125by the compiler are investigated.  To those functions, a different
13126(more restrictive) limit compared to functions declared inline can
13127be applied (@option{--param max-inline-insns-auto}).
13128
13129@item max-inline-insns-small
13130This is bound applied to calls which are considered relevant with
13131@option{-finline-small-functions}.
13132
13133@item max-inline-insns-size
13134This is bound applied to calls which are optimized for size. Small growth
13135may be desirable to anticipate optimization oppurtunities exposed by inlining.
13136
13137@item uninlined-function-insns
13138Number of instructions accounted by inliner for function overhead such as
13139function prologue and epilogue.
13140
13141@item uninlined-function-time
13142Extra time accounted by inliner for function overhead such as time needed to
13143execute function prologue and epilogue
13144
13145@item inline-heuristics-hint-percent
13146The scale (in percents) applied to @option{inline-insns-single},
13147@option{inline-insns-single-O2}, @option{inline-insns-auto}
13148when inline heuristics hints that inlining is
13149very profitable (will enable later optimizations).
13150
13151@item uninlined-thunk-insns
13152@item uninlined-thunk-time
13153Same as @option{--param uninlined-function-insns} and
13154@option{--param uninlined-function-time} but applied to function thunks
13155
13156@item inline-min-speedup
13157When estimated performance improvement of caller + callee runtime exceeds this
13158threshold (in percent), the function can be inlined regardless of the limit on
13159@option{--param max-inline-insns-single} and @option{--param
13160max-inline-insns-auto}.
13161
13162@item large-function-insns
13163The limit specifying really large functions.  For functions larger than this
13164limit after inlining, inlining is constrained by
13165@option{--param large-function-growth}.  This parameter is useful primarily
13166to avoid extreme compilation time caused by non-linear algorithms used by the
13167back end.
13168
13169@item large-function-growth
13170Specifies maximal growth of large function caused by inlining in percents.
13171For example, parameter value 100 limits large function growth to 2.0 times
13172the original size.
13173
13174@item large-unit-insns
13175The limit specifying large translation unit.  Growth caused by inlining of
13176units larger than this limit is limited by @option{--param inline-unit-growth}.
13177For small units this might be too tight.
13178For example, consider a unit consisting of function A
13179that is inline and B that just calls A three times.  If B is small relative to
13180A, the growth of unit is 300\% and yet such inlining is very sane.  For very
13181large units consisting of small inlineable functions, however, the overall unit
13182growth limit is needed to avoid exponential explosion of code size.  Thus for
13183smaller units, the size is increased to @option{--param large-unit-insns}
13184before applying @option{--param inline-unit-growth}.
13185
13186@item lazy-modules
13187Maximum number of concurrently open C++ module files when lazy loading.
13188
13189@item inline-unit-growth
13190Specifies maximal overall growth of the compilation unit caused by inlining.
13191For example, parameter value 20 limits unit growth to 1.2 times the original
13192size. Cold functions (either marked cold via an attribute or by profile
13193feedback) are not accounted into the unit size.
13194
13195@item ipa-cp-unit-growth
13196Specifies maximal overall growth of the compilation unit caused by
13197interprocedural constant propagation.  For example, parameter value 10 limits
13198unit growth to 1.1 times the original size.
13199
13200@item ipa-cp-large-unit-insns
13201The size of translation unit that IPA-CP pass considers large.
13202
13203@item large-stack-frame
13204The limit specifying large stack frames.  While inlining the algorithm is trying
13205to not grow past this limit too much.
13206
13207@item large-stack-frame-growth
13208Specifies maximal growth of large stack frames caused by inlining in percents.
13209For example, parameter value 1000 limits large stack frame growth to 11 times
13210the original size.
13211
13212@item max-inline-insns-recursive
13213@itemx max-inline-insns-recursive-auto
13214Specifies the maximum number of instructions an out-of-line copy of a
13215self-recursive inline
13216function can grow into by performing recursive inlining.
13217
13218@option{--param max-inline-insns-recursive} applies to functions
13219declared inline.
13220For functions not declared inline, recursive inlining
13221happens only when @option{-finline-functions} (included in @option{-O3}) is
13222enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
13223
13224@item max-inline-recursive-depth
13225@itemx max-inline-recursive-depth-auto
13226Specifies the maximum recursion depth used for recursive inlining.
13227
13228@option{--param max-inline-recursive-depth} applies to functions
13229declared inline.  For functions not declared inline, recursive inlining
13230happens only when @option{-finline-functions} (included in @option{-O3}) is
13231enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
13232
13233@item min-inline-recursive-probability
13234Recursive inlining is profitable only for function having deep recursion
13235in average and can hurt for function having little recursion depth by
13236increasing the prologue size or complexity of function body to other
13237optimizers.
13238
13239When profile feedback is available (see @option{-fprofile-generate}) the actual
13240recursion depth can be guessed from the probability that function recurses
13241via a given call expression.  This parameter limits inlining only to call
13242expressions whose probability exceeds the given threshold (in percents).
13243
13244@item early-inlining-insns
13245Specify growth that the early inliner can make.  In effect it increases
13246the amount of inlining for code having a large abstraction penalty.
13247
13248@item max-early-inliner-iterations
13249Limit of iterations of the early inliner.  This basically bounds
13250the number of nested indirect calls the early inliner can resolve.
13251Deeper chains are still handled by late inlining.
13252
13253@item comdat-sharing-probability
13254Probability (in percent) that C++ inline function with comdat visibility
13255are shared across multiple compilation units.
13256
13257@item modref-max-bases
13258@item modref-max-refs
13259@item modref-max-accesses
13260Specifies the maximal number of base pointers, references and accesses stored
13261for a single function by mod/ref analysis.
13262
13263@item modref-max-tests
13264Specifies the maxmal number of tests alias oracle can perform to disambiguate
13265memory locations using the mod/ref information.  This parameter ought to be
13266bigger than @option{--param modref-max-bases} and @option{--param
13267modref-max-refs}.
13268
13269@item modref-max-depth
13270Specifies the maximum depth of DFS walk used by modref escape analysis.
13271Setting to 0 disables the analysis completely.
13272
13273@item modref-max-escape-points
13274Specifies the maximum number of escape points tracked by modref per SSA-name.
13275
13276@item profile-func-internal-id
13277A parameter to control whether to use function internal id in profile
13278database lookup. If the value is 0, the compiler uses an id that
13279is based on function assembler name and filename, which makes old profile
13280data more tolerant to source changes such as function reordering etc.
13281
13282@item min-vect-loop-bound
13283The minimum number of iterations under which loops are not vectorized
13284when @option{-ftree-vectorize} is used.  The number of iterations after
13285vectorization needs to be greater than the value specified by this option
13286to allow vectorization.
13287
13288@item gcse-cost-distance-ratio
13289Scaling factor in calculation of maximum distance an expression
13290can be moved by GCSE optimizations.  This is currently supported only in the
13291code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
13292is with simple expressions, i.e., the expressions that have cost
13293less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
13294hoisting of simple expressions.
13295
13296@item gcse-unrestricted-cost
13297Cost, roughly measured as the cost of a single typical machine
13298instruction, at which GCSE optimizations do not constrain
13299the distance an expression can travel.  This is currently
13300supported only in the code hoisting pass.  The lesser the cost,
13301the more aggressive code hoisting is.  Specifying 0
13302allows all expressions to travel unrestricted distances.
13303
13304@item max-hoist-depth
13305The depth of search in the dominator tree for expressions to hoist.
13306This is used to avoid quadratic behavior in hoisting algorithm.
13307The value of 0 does not limit on the search, but may slow down compilation
13308of huge functions.
13309
13310@item max-tail-merge-comparisons
13311The maximum amount of similar bbs to compare a bb with.  This is used to
13312avoid quadratic behavior in tree tail merging.
13313
13314@item max-tail-merge-iterations
13315The maximum amount of iterations of the pass over the function.  This is used to
13316limit compilation time in tree tail merging.
13317
13318@item store-merging-allow-unaligned
13319Allow the store merging pass to introduce unaligned stores if it is legal to
13320do so.
13321
13322@item max-stores-to-merge
13323The maximum number of stores to attempt to merge into wider stores in the store
13324merging pass.
13325
13326@item max-store-chains-to-track
13327The maximum number of store chains to track at the same time in the attempt
13328to merge them into wider stores in the store merging pass.
13329
13330@item max-stores-to-track
13331The maximum number of stores to track at the same time in the attemt to
13332to merge them into wider stores in the store merging pass.
13333
13334@item max-unrolled-insns
13335The maximum number of instructions that a loop may have to be unrolled.
13336If a loop is unrolled, this parameter also determines how many times
13337the loop code is unrolled.
13338
13339@item max-average-unrolled-insns
13340The maximum number of instructions biased by probabilities of their execution
13341that a loop may have to be unrolled.  If a loop is unrolled,
13342this parameter also determines how many times the loop code is unrolled.
13343
13344@item max-unroll-times
13345The maximum number of unrollings of a single loop.
13346
13347@item max-peeled-insns
13348The maximum number of instructions that a loop may have to be peeled.
13349If a loop is peeled, this parameter also determines how many times
13350the loop code is peeled.
13351
13352@item max-peel-times
13353The maximum number of peelings of a single loop.
13354
13355@item max-peel-branches
13356The maximum number of branches on the hot path through the peeled sequence.
13357
13358@item max-completely-peeled-insns
13359The maximum number of insns of a completely peeled loop.
13360
13361@item max-completely-peel-times
13362The maximum number of iterations of a loop to be suitable for complete peeling.
13363
13364@item max-completely-peel-loop-nest-depth
13365The maximum depth of a loop nest suitable for complete peeling.
13366
13367@item max-unswitch-insns
13368The maximum number of insns of an unswitched loop.
13369
13370@item max-unswitch-level
13371The maximum number of branches unswitched in a single loop.
13372
13373@item lim-expensive
13374The minimum cost of an expensive expression in the loop invariant motion.
13375
13376@item min-loop-cond-split-prob
13377When FDO profile information is available, @option{min-loop-cond-split-prob}
13378specifies minimum threshold for probability of semi-invariant condition
13379statement to trigger loop split.
13380
13381@item iv-consider-all-candidates-bound
13382Bound on number of candidates for induction variables, below which
13383all candidates are considered for each use in induction variable
13384optimizations.  If there are more candidates than this,
13385only the most relevant ones are considered to avoid quadratic time complexity.
13386
13387@item iv-max-considered-uses
13388The induction variable optimizations give up on loops that contain more
13389induction variable uses.
13390
13391@item iv-always-prune-cand-set-bound
13392If the number of candidates in the set is smaller than this value,
13393always try to remove unnecessary ivs from the set
13394when adding a new one.
13395
13396@item avg-loop-niter
13397Average number of iterations of a loop.
13398
13399@item dse-max-object-size
13400Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
13401Larger values may result in larger compilation times.
13402
13403@item dse-max-alias-queries-per-store
13404Maximum number of queries into the alias oracle per store.
13405Larger values result in larger compilation times and may result in more
13406removed dead stores.
13407
13408@item scev-max-expr-size
13409Bound on size of expressions used in the scalar evolutions analyzer.
13410Large expressions slow the analyzer.
13411
13412@item scev-max-expr-complexity
13413Bound on the complexity of the expressions in the scalar evolutions analyzer.
13414Complex expressions slow the analyzer.
13415
13416@item max-tree-if-conversion-phi-args
13417Maximum number of arguments in a PHI supported by TREE if conversion
13418unless the loop is marked with simd pragma.
13419
13420@item vect-max-version-for-alignment-checks
13421The maximum number of run-time checks that can be performed when
13422doing loop versioning for alignment in the vectorizer.
13423
13424@item vect-max-version-for-alias-checks
13425The maximum number of run-time checks that can be performed when
13426doing loop versioning for alias in the vectorizer.
13427
13428@item vect-max-peeling-for-alignment
13429The maximum number of loop peels to enhance access alignment
13430for vectorizer. Value -1 means no limit.
13431
13432@item max-iterations-to-track
13433The maximum number of iterations of a loop the brute-force algorithm
13434for analysis of the number of iterations of the loop tries to evaluate.
13435
13436@item hot-bb-count-fraction
13437The denominator n of fraction 1/n of the maximal execution count of a
13438basic block in the entire program that a basic block needs to at least
13439have in order to be considered hot.  The default is 10000, which means
13440that a basic block is considered hot if its execution count is greater
13441than 1/10000 of the maximal execution count.  0 means that it is never
13442considered hot.  Used in non-LTO mode.
13443
13444@item hot-bb-count-ws-permille
13445The number of most executed permilles, ranging from 0 to 1000, of the
13446profiled execution of the entire program to which the execution count
13447of a basic block must be part of in order to be considered hot.  The
13448default is 990, which means that a basic block is considered hot if
13449its execution count contributes to the upper 990 permilles, or 99.0%,
13450of the profiled execution of the entire program.  0 means that it is
13451never considered hot.  Used in LTO mode.
13452
13453@item hot-bb-frequency-fraction
13454The denominator n of fraction 1/n of the execution frequency of the
13455entry block of a function that a basic block of this function needs
13456to at least have in order to be considered hot.  The default is 1000,
13457which means that a basic block is considered hot in a function if it
13458is executed more frequently than 1/1000 of the frequency of the entry
13459block of the function.  0 means that it is never considered hot.
13460
13461@item unlikely-bb-count-fraction
13462The denominator n of fraction 1/n of the number of profiled runs of
13463the entire program below which the execution count of a basic block
13464must be in order for the basic block to be considered unlikely executed.
13465The default is 20, which means that a basic block is considered unlikely
13466executed if it is executed in fewer than 1/20, or 5%, of the runs of
13467the program.  0 means that it is always considered unlikely executed.
13468
13469@item max-predicted-iterations
13470The maximum number of loop iterations we predict statically.  This is useful
13471in cases where a function contains a single loop with known bound and
13472another loop with unknown bound.
13473The known number of iterations is predicted correctly, while
13474the unknown number of iterations average to roughly 10.  This means that the
13475loop without bounds appears artificially cold relative to the other one.
13476
13477@item builtin-expect-probability
13478Control the probability of the expression having the specified value. This
13479parameter takes a percentage (i.e.@: 0 ... 100) as input.
13480
13481@item builtin-string-cmp-inline-length
13482The maximum length of a constant string for a builtin string cmp call
13483eligible for inlining.
13484
13485@item align-threshold
13486
13487Select fraction of the maximal frequency of executions of a basic block in
13488a function to align the basic block.
13489
13490@item align-loop-iterations
13491
13492A loop expected to iterate at least the selected number of iterations is
13493aligned.
13494
13495@item tracer-dynamic-coverage
13496@itemx tracer-dynamic-coverage-feedback
13497
13498This value is used to limit superblock formation once the given percentage of
13499executed instructions is covered.  This limits unnecessary code size
13500expansion.
13501
13502The @option{tracer-dynamic-coverage-feedback} parameter
13503is used only when profile
13504feedback is available.  The real profiles (as opposed to statically estimated
13505ones) are much less balanced allowing the threshold to be larger value.
13506
13507@item tracer-max-code-growth
13508Stop tail duplication once code growth has reached given percentage.  This is
13509a rather artificial limit, as most of the duplicates are eliminated later in
13510cross jumping, so it may be set to much higher values than is the desired code
13511growth.
13512
13513@item tracer-min-branch-ratio
13514
13515Stop reverse growth when the reverse probability of best edge is less than this
13516threshold (in percent).
13517
13518@item tracer-min-branch-probability
13519@itemx tracer-min-branch-probability-feedback
13520
13521Stop forward growth if the best edge has probability lower than this
13522threshold.
13523
13524Similarly to @option{tracer-dynamic-coverage} two parameters are
13525provided.  @option{tracer-min-branch-probability-feedback} is used for
13526compilation with profile feedback and @option{tracer-min-branch-probability}
13527compilation without.  The value for compilation with profile feedback
13528needs to be more conservative (higher) in order to make tracer
13529effective.
13530
13531@item stack-clash-protection-guard-size
13532Specify the size of the operating system provided stack guard as
135332 raised to @var{num} bytes.  Higher values may reduce the
13534number of explicit probes, but a value larger than the operating system
13535provided guard will leave code vulnerable to stack clash style attacks.
13536
13537@item stack-clash-protection-probe-interval
13538Stack clash protection involves probing stack space as it is allocated.  This
13539param controls the maximum distance between probes into the stack as 2 raised
13540to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
13541larger than the operating system provided guard will leave code vulnerable to
13542stack clash style attacks.
13543
13544@item max-cse-path-length
13545
13546The maximum number of basic blocks on path that CSE considers.
13547
13548@item max-cse-insns
13549The maximum number of instructions CSE processes before flushing.
13550
13551@item ggc-min-expand
13552
13553GCC uses a garbage collector to manage its own memory allocation.  This
13554parameter specifies the minimum percentage by which the garbage
13555collector's heap should be allowed to expand between collections.
13556Tuning this may improve compilation speed; it has no effect on code
13557generation.
13558
13559The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
13560RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
13561the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
13562GCC is not able to calculate RAM on a particular platform, the lower
13563bound of 30% is used.  Setting this parameter and
13564@option{ggc-min-heapsize} to zero causes a full collection to occur at
13565every opportunity.  This is extremely slow, but can be useful for
13566debugging.
13567
13568@item ggc-min-heapsize
13569
13570Minimum size of the garbage collector's heap before it begins bothering
13571to collect garbage.  The first collection occurs after the heap expands
13572by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
13573tuning this may improve compilation speed, and has no effect on code
13574generation.
13575
13576The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
13577tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
13578with a lower bound of 4096 (four megabytes) and an upper bound of
13579131072 (128 megabytes).  If GCC is not able to calculate RAM on a
13580particular platform, the lower bound is used.  Setting this parameter
13581very large effectively disables garbage collection.  Setting this
13582parameter and @option{ggc-min-expand} to zero causes a full collection
13583to occur at every opportunity.
13584
13585@item max-reload-search-insns
13586The maximum number of instruction reload should look backward for equivalent
13587register.  Increasing values mean more aggressive optimization, making the
13588compilation time increase with probably slightly better performance.
13589
13590@item max-cselib-memory-locations
13591The maximum number of memory locations cselib should take into account.
13592Increasing values mean more aggressive optimization, making the compilation time
13593increase with probably slightly better performance.
13594
13595@item max-sched-ready-insns
13596The maximum number of instructions ready to be issued the scheduler should
13597consider at any given time during the first scheduling pass.  Increasing
13598values mean more thorough searches, making the compilation time increase
13599with probably little benefit.
13600
13601@item max-sched-region-blocks
13602The maximum number of blocks in a region to be considered for
13603interblock scheduling.
13604
13605@item max-pipeline-region-blocks
13606The maximum number of blocks in a region to be considered for
13607pipelining in the selective scheduler.
13608
13609@item max-sched-region-insns
13610The maximum number of insns in a region to be considered for
13611interblock scheduling.
13612
13613@item max-pipeline-region-insns
13614The maximum number of insns in a region to be considered for
13615pipelining in the selective scheduler.
13616
13617@item min-spec-prob
13618The minimum probability (in percents) of reaching a source block
13619for interblock speculative scheduling.
13620
13621@item max-sched-extend-regions-iters
13622The maximum number of iterations through CFG to extend regions.
13623A value of 0 disables region extensions.
13624
13625@item max-sched-insn-conflict-delay
13626The maximum conflict delay for an insn to be considered for speculative motion.
13627
13628@item sched-spec-prob-cutoff
13629The minimal probability of speculation success (in percents), so that
13630speculative insns are scheduled.
13631
13632@item sched-state-edge-prob-cutoff
13633The minimum probability an edge must have for the scheduler to save its
13634state across it.
13635
13636@item sched-mem-true-dep-cost
13637Minimal distance (in CPU cycles) between store and load targeting same
13638memory locations.
13639
13640@item selsched-max-lookahead
13641The maximum size of the lookahead window of selective scheduling.  It is a
13642depth of search for available instructions.
13643
13644@item selsched-max-sched-times
13645The maximum number of times that an instruction is scheduled during
13646selective scheduling.  This is the limit on the number of iterations
13647through which the instruction may be pipelined.
13648
13649@item selsched-insns-to-rename
13650The maximum number of best instructions in the ready list that are considered
13651for renaming in the selective scheduler.
13652
13653@item sms-min-sc
13654The minimum value of stage count that swing modulo scheduler
13655generates.
13656
13657@item max-last-value-rtl
13658The maximum size measured as number of RTLs that can be recorded in an expression
13659in combiner for a pseudo register as last known value of that register.
13660
13661@item max-combine-insns
13662The maximum number of instructions the RTL combiner tries to combine.
13663
13664@item integer-share-limit
13665Small integer constants can use a shared data structure, reducing the
13666compiler's memory usage and increasing its speed.  This sets the maximum
13667value of a shared integer constant.
13668
13669@item ssp-buffer-size
13670The minimum size of buffers (i.e.@: arrays) that receive stack smashing
13671protection when @option{-fstack-protection} is used.
13672
13673@item min-size-for-stack-sharing
13674The minimum size of variables taking part in stack slot sharing when not
13675optimizing.
13676
13677@item max-jump-thread-duplication-stmts
13678Maximum number of statements allowed in a block that needs to be
13679duplicated when threading jumps.
13680
13681@item max-fields-for-field-sensitive
13682Maximum number of fields in a structure treated in
13683a field sensitive manner during pointer analysis.
13684
13685@item prefetch-latency
13686Estimate on average number of instructions that are executed before
13687prefetch finishes.  The distance prefetched ahead is proportional
13688to this constant.  Increasing this number may also lead to less
13689streams being prefetched (see @option{simultaneous-prefetches}).
13690
13691@item simultaneous-prefetches
13692Maximum number of prefetches that can run at the same time.
13693
13694@item l1-cache-line-size
13695The size of cache line in L1 data cache, in bytes.
13696
13697@item l1-cache-size
13698The size of L1 data cache, in kilobytes.
13699
13700@item l2-cache-size
13701The size of L2 data cache, in kilobytes.
13702
13703@item prefetch-dynamic-strides
13704Whether the loop array prefetch pass should issue software prefetch hints
13705for strides that are non-constant.  In some cases this may be
13706beneficial, though the fact the stride is non-constant may make it
13707hard to predict when there is clear benefit to issuing these hints.
13708
13709Set to 1 if the prefetch hints should be issued for non-constant
13710strides.  Set to 0 if prefetch hints should be issued only for strides that
13711are known to be constant and below @option{prefetch-minimum-stride}.
13712
13713@item prefetch-minimum-stride
13714Minimum constant stride, in bytes, to start using prefetch hints for.  If
13715the stride is less than this threshold, prefetch hints will not be issued.
13716
13717This setting is useful for processors that have hardware prefetchers, in
13718which case there may be conflicts between the hardware prefetchers and
13719the software prefetchers.  If the hardware prefetchers have a maximum
13720stride they can handle, it should be used here to improve the use of
13721software prefetchers.
13722
13723A value of -1 means we don't have a threshold and therefore
13724prefetch hints can be issued for any constant stride.
13725
13726This setting is only useful for strides that are known and constant.
13727
13728@item loop-interchange-max-num-stmts
13729The maximum number of stmts in a loop to be interchanged.
13730
13731@item loop-interchange-stride-ratio
13732The minimum ratio between stride of two loops for interchange to be profitable.
13733
13734@item min-insn-to-prefetch-ratio
13735The minimum ratio between the number of instructions and the
13736number of prefetches to enable prefetching in a loop.
13737
13738@item prefetch-min-insn-to-mem-ratio
13739The minimum ratio between the number of instructions and the
13740number of memory references to enable prefetching in a loop.
13741
13742@item use-canonical-types
13743Whether the compiler should use the ``canonical'' type system.
13744Should always be 1, which uses a more efficient internal
13745mechanism for comparing types in C++ and Objective-C++.  However, if
13746bugs in the canonical type system are causing compilation failures,
13747set this value to 0 to disable canonical types.
13748
13749@item switch-conversion-max-branch-ratio
13750Switch initialization conversion refuses to create arrays that are
13751bigger than @option{switch-conversion-max-branch-ratio} times the number of
13752branches in the switch.
13753
13754@item max-partial-antic-length
13755Maximum length of the partial antic set computed during the tree
13756partial redundancy elimination optimization (@option{-ftree-pre}) when
13757optimizing at @option{-O3} and above.  For some sorts of source code
13758the enhanced partial redundancy elimination optimization can run away,
13759consuming all of the memory available on the host machine.  This
13760parameter sets a limit on the length of the sets that are computed,
13761which prevents the runaway behavior.  Setting a value of 0 for
13762this parameter allows an unlimited set length.
13763
13764@item rpo-vn-max-loop-depth
13765Maximum loop depth that is value-numbered optimistically.
13766When the limit hits the innermost
13767@var{rpo-vn-max-loop-depth} loops and the outermost loop in the
13768loop nest are value-numbered optimistically and the remaining ones not.
13769
13770@item sccvn-max-alias-queries-per-access
13771Maximum number of alias-oracle queries we perform when looking for
13772redundancies for loads and stores.  If this limit is hit the search
13773is aborted and the load or store is not considered redundant.  The
13774number of queries is algorithmically limited to the number of
13775stores on all paths from the load to the function entry.
13776
13777@item ira-max-loops-num
13778IRA uses regional register allocation by default.  If a function
13779contains more loops than the number given by this parameter, only at most
13780the given number of the most frequently-executed loops form regions
13781for regional register allocation.
13782
13783@item ira-max-conflict-table-size
13784Although IRA uses a sophisticated algorithm to compress the conflict
13785table, the table can still require excessive amounts of memory for
13786huge functions.  If the conflict table for a function could be more
13787than the size in MB given by this parameter, the register allocator
13788instead uses a faster, simpler, and lower-quality
13789algorithm that does not require building a pseudo-register conflict table.
13790
13791@item ira-loop-reserved-regs
13792IRA can be used to evaluate more accurate register pressure in loops
13793for decisions to move loop invariants (see @option{-O3}).  The number
13794of available registers reserved for some other purposes is given
13795by this parameter.  Default of the parameter
13796is the best found from numerous experiments.
13797
13798@item lra-inheritance-ebb-probability-cutoff
13799LRA tries to reuse values reloaded in registers in subsequent insns.
13800This optimization is called inheritance.  EBB is used as a region to
13801do this optimization.  The parameter defines a minimal fall-through
13802edge probability in percentage used to add BB to inheritance EBB in
13803LRA.  The default value was chosen
13804from numerous runs of SPEC2000 on x86-64.
13805
13806@item loop-invariant-max-bbs-in-loop
13807Loop invariant motion can be very expensive, both in compilation time and
13808in amount of needed compile-time memory, with very large loops.  Loops
13809with more basic blocks than this parameter won't have loop invariant
13810motion optimization performed on them.
13811
13812@item loop-max-datarefs-for-datadeps
13813Building data dependencies is expensive for very large loops.  This
13814parameter limits the number of data references in loops that are
13815considered for data dependence analysis.  These large loops are no
13816handled by the optimizations using loop data dependencies.
13817
13818@item max-vartrack-size
13819Sets a maximum number of hash table slots to use during variable
13820tracking dataflow analysis of any function.  If this limit is exceeded
13821with variable tracking at assignments enabled, analysis for that
13822function is retried without it, after removing all debug insns from
13823the function.  If the limit is exceeded even without debug insns, var
13824tracking analysis is completely disabled for the function.  Setting
13825the parameter to zero makes it unlimited.
13826
13827@item max-vartrack-expr-depth
13828Sets a maximum number of recursion levels when attempting to map
13829variable names or debug temporaries to value expressions.  This trades
13830compilation time for more complete debug information.  If this is set too
13831low, value expressions that are available and could be represented in
13832debug information may end up not being used; setting this higher may
13833enable the compiler to find more complex debug expressions, but compile
13834time and memory use may grow.
13835
13836@item max-debug-marker-count
13837Sets a threshold on the number of debug markers (e.g.@: begin stmt
13838markers) to avoid complexity explosion at inlining or expanding to RTL.
13839If a function has more such gimple stmts than the set limit, such stmts
13840will be dropped from the inlined copy of a function, and from its RTL
13841expansion.
13842
13843@item min-nondebug-insn-uid
13844Use uids starting at this parameter for nondebug insns.  The range below
13845the parameter is reserved exclusively for debug insns created by
13846@option{-fvar-tracking-assignments}, but debug insns may get
13847(non-overlapping) uids above it if the reserved range is exhausted.
13848
13849@item ipa-sra-ptr-growth-factor
13850IPA-SRA replaces a pointer to an aggregate with one or more new
13851parameters only when their cumulative size is less or equal to
13852@option{ipa-sra-ptr-growth-factor} times the size of the original
13853pointer parameter.
13854
13855@item ipa-sra-max-replacements
13856Maximum pieces of an aggregate that IPA-SRA tracks.  As a
13857consequence, it is also the maximum number of replacements of a formal
13858parameter.
13859
13860@item sra-max-scalarization-size-Ospeed
13861@itemx sra-max-scalarization-size-Osize
13862The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
13863replace scalar parts of aggregates with uses of independent scalar
13864variables.  These parameters control the maximum size, in storage units,
13865of aggregate which is considered for replacement when compiling for
13866speed
13867(@option{sra-max-scalarization-size-Ospeed}) or size
13868(@option{sra-max-scalarization-size-Osize}) respectively.
13869
13870@item sra-max-propagations
13871The maximum number of artificial accesses that Scalar Replacement of
13872Aggregates (SRA) will track, per one local variable, in order to
13873facilitate copy propagation.
13874
13875@item tm-max-aggregate-size
13876When making copies of thread-local variables in a transaction, this
13877parameter specifies the size in bytes after which variables are
13878saved with the logging functions as opposed to save/restore code
13879sequence pairs.  This option only applies when using
13880@option{-fgnu-tm}.
13881
13882@item graphite-max-nb-scop-params
13883To avoid exponential effects in the Graphite loop transforms, the
13884number of parameters in a Static Control Part (SCoP) is bounded.
13885A value of zero can be used to lift
13886the bound.  A variable whose value is unknown at compilation time and
13887defined outside a SCoP is a parameter of the SCoP.
13888
13889@item loop-block-tile-size
13890Loop blocking or strip mining transforms, enabled with
13891@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
13892loop in the loop nest by a given number of iterations.  The strip
13893length can be changed using the @option{loop-block-tile-size}
13894parameter.
13895
13896@item ipa-jump-function-lookups
13897Specifies number of statements visited during jump function offset discovery.
13898
13899@item ipa-cp-value-list-size
13900IPA-CP attempts to track all possible values and types passed to a function's
13901parameter in order to propagate them and perform devirtualization.
13902@option{ipa-cp-value-list-size} is the maximum number of values and types it
13903stores per one formal parameter of a function.
13904
13905@item ipa-cp-eval-threshold
13906IPA-CP calculates its own score of cloning profitability heuristics
13907and performs those cloning opportunities with scores that exceed
13908@option{ipa-cp-eval-threshold}.
13909
13910@item ipa-cp-max-recursive-depth
13911Maximum depth of recursive cloning for self-recursive function.
13912
13913@item ipa-cp-min-recursive-probability
13914Recursive cloning only when the probability of call being executed exceeds
13915the parameter.
13916
13917@item ipa-cp-recursion-penalty
13918Percentage penalty the recursive functions will receive when they
13919are evaluated for cloning.
13920
13921@item ipa-cp-single-call-penalty
13922Percentage penalty functions containing a single call to another
13923function will receive when they are evaluated for cloning.
13924
13925@item ipa-max-agg-items
13926IPA-CP is also capable to propagate a number of scalar values passed
13927in an aggregate. @option{ipa-max-agg-items} controls the maximum
13928number of such values per one parameter.
13929
13930@item ipa-cp-loop-hint-bonus
13931When IPA-CP determines that a cloning candidate would make the number
13932of iterations of a loop known, it adds a bonus of
13933@option{ipa-cp-loop-hint-bonus} to the profitability score of
13934the candidate.
13935
13936@item ipa-max-loop-predicates
13937The maximum number of different predicates IPA will use to describe when
13938loops in a function have known properties.
13939
13940@item ipa-max-aa-steps
13941During its analysis of function bodies, IPA-CP employs alias analysis
13942in order to track values pointed to by function parameters.  In order
13943not spend too much time analyzing huge functions, it gives up and
13944consider all memory clobbered after examining
13945@option{ipa-max-aa-steps} statements modifying memory.
13946
13947@item ipa-max-switch-predicate-bounds
13948Maximal number of boundary endpoints of case ranges of switch statement.
13949For switch exceeding this limit, IPA-CP will not construct cloning cost
13950predicate, which is used to estimate cloning benefit, for default case
13951of the switch statement.
13952
13953@item ipa-max-param-expr-ops
13954IPA-CP will analyze conditional statement that references some function
13955parameter to estimate benefit for cloning upon certain constant value.
13956But if number of operations in a parameter expression exceeds
13957@option{ipa-max-param-expr-ops}, the expression is treated as complicated
13958one, and is not handled by IPA analysis.
13959
13960@item lto-partitions
13961Specify desired number of partitions produced during WHOPR compilation.
13962The number of partitions should exceed the number of CPUs used for compilation.
13963
13964@item lto-min-partition
13965Size of minimal partition for WHOPR (in estimated instructions).
13966This prevents expenses of splitting very small programs into too many
13967partitions.
13968
13969@item lto-max-partition
13970Size of max partition for WHOPR (in estimated instructions).
13971to provide an upper bound for individual size of partition.
13972Meant to be used only with balanced partitioning.
13973
13974@item lto-max-streaming-parallelism
13975Maximal number of parallel processes used for LTO streaming.
13976
13977@item cxx-max-namespaces-for-diagnostic-help
13978The maximum number of namespaces to consult for suggestions when C++
13979name lookup fails for an identifier.
13980
13981@item sink-frequency-threshold
13982The maximum relative execution frequency (in percents) of the target block
13983relative to a statement's original block to allow statement sinking of a
13984statement.  Larger numbers result in more aggressive statement sinking.
13985A small positive adjustment is applied for
13986statements with memory operands as those are even more profitable so sink.
13987
13988@item max-stores-to-sink
13989The maximum number of conditional store pairs that can be sunk.  Set to 0
13990if either vectorization (@option{-ftree-vectorize}) or if-conversion
13991(@option{-ftree-loop-if-convert}) is disabled.
13992
13993@item case-values-threshold
13994The smallest number of different values for which it is best to use a
13995jump-table instead of a tree of conditional branches.  If the value is
139960, use the default for the machine.
13997
13998@item jump-table-max-growth-ratio-for-size
13999The maximum code size growth ratio when expanding
14000into a jump table (in percent).  The parameter is used when
14001optimizing for size.
14002
14003@item jump-table-max-growth-ratio-for-speed
14004The maximum code size growth ratio when expanding
14005into a jump table (in percent).  The parameter is used when
14006optimizing for speed.
14007
14008@item tree-reassoc-width
14009Set the maximum number of instructions executed in parallel in
14010reassociated tree. This parameter overrides target dependent
14011heuristics used by default if has non zero value.
14012
14013@item sched-pressure-algorithm
14014Choose between the two available implementations of
14015@option{-fsched-pressure}.  Algorithm 1 is the original implementation
14016and is the more likely to prevent instructions from being reordered.
14017Algorithm 2 was designed to be a compromise between the relatively
14018conservative approach taken by algorithm 1 and the rather aggressive
14019approach taken by the default scheduler.  It relies more heavily on
14020having a regular register file and accurate register pressure classes.
14021See @file{haifa-sched.c} in the GCC sources for more details.
14022
14023The default choice depends on the target.
14024
14025@item max-slsr-cand-scan
14026Set the maximum number of existing candidates that are considered when
14027seeking a basis for a new straight-line strength reduction candidate.
14028
14029@item asan-globals
14030Enable buffer overflow detection for global objects.  This kind
14031of protection is enabled by default if you are using
14032@option{-fsanitize=address} option.
14033To disable global objects protection use @option{--param asan-globals=0}.
14034
14035@item asan-stack
14036Enable buffer overflow detection for stack objects.  This kind of
14037protection is enabled by default when using @option{-fsanitize=address}.
14038To disable stack protection use @option{--param asan-stack=0} option.
14039
14040@item asan-instrument-reads
14041Enable buffer overflow detection for memory reads.  This kind of
14042protection is enabled by default when using @option{-fsanitize=address}.
14043To disable memory reads protection use
14044@option{--param asan-instrument-reads=0}.
14045
14046@item asan-instrument-writes
14047Enable buffer overflow detection for memory writes.  This kind of
14048protection is enabled by default when using @option{-fsanitize=address}.
14049To disable memory writes protection use
14050@option{--param asan-instrument-writes=0} option.
14051
14052@item asan-memintrin
14053Enable detection for built-in functions.  This kind of protection
14054is enabled by default when using @option{-fsanitize=address}.
14055To disable built-in functions protection use
14056@option{--param asan-memintrin=0}.
14057
14058@item asan-use-after-return
14059Enable detection of use-after-return.  This kind of protection
14060is enabled by default when using the @option{-fsanitize=address} option.
14061To disable it use @option{--param asan-use-after-return=0}.
14062
14063Note: By default the check is disabled at run time.  To enable it,
14064add @code{detect_stack_use_after_return=1} to the environment variable
14065@env{ASAN_OPTIONS}.
14066
14067@item asan-instrumentation-with-call-threshold
14068If number of memory accesses in function being instrumented
14069is greater or equal to this number, use callbacks instead of inline checks.
14070E.g. to disable inline code use
14071@option{--param asan-instrumentation-with-call-threshold=0}.
14072
14073@item hwasan-instrument-stack
14074Enable hwasan instrumentation of statically sized stack-allocated variables.
14075This kind of instrumentation is enabled by default when using
14076@option{-fsanitize=hwaddress} and disabled by default when using
14077@option{-fsanitize=kernel-hwaddress}.
14078To disable stack instrumentation use
14079@option{--param hwasan-instrument-stack=0}, and to enable it use
14080@option{--param hwasan-instrument-stack=1}.
14081
14082@item hwasan-random-frame-tag
14083When using stack instrumentation, decide tags for stack variables using a
14084deterministic sequence beginning at a random tag for each frame.  With this
14085parameter unset tags are chosen using the same sequence but beginning from 1.
14086This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
14087for @option{-fsanitize=kernel-hwaddress}.
14088To disable it use @option{--param hwasan-random-frame-tag=0}.
14089
14090@item hwasan-instrument-allocas
14091Enable hwasan instrumentation of dynamically sized stack-allocated variables.
14092This kind of instrumentation is enabled by default when using
14093@option{-fsanitize=hwaddress} and disabled by default when using
14094@option{-fsanitize=kernel-hwaddress}.
14095To disable instrumentation of such variables use
14096@option{--param hwasan-instrument-allocas=0}, and to enable it use
14097@option{--param hwasan-instrument-allocas=1}.
14098
14099@item hwasan-instrument-reads
14100Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
14101default for both @option{-fsanitize=hwaddress} and
14102@option{-fsanitize=kernel-hwaddress}.
14103To disable checking memory reads use
14104@option{--param hwasan-instrument-reads=0}.
14105
14106@item hwasan-instrument-writes
14107Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
14108default for both @option{-fsanitize=hwaddress} and
14109@option{-fsanitize=kernel-hwaddress}.
14110To disable checking memory writes use
14111@option{--param hwasan-instrument-writes=0}.
14112
14113@item hwasan-instrument-mem-intrinsics
14114Enable hwasan instrumentation of builtin functions.  Instrumentation of these
14115builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
14116and @option{-fsanitize=kernel-hwaddress}.
14117To disable instrumentation of builtin functions use
14118@option{--param hwasan-instrument-mem-intrinsics=0}.
14119
14120@item use-after-scope-direct-emission-threshold
14121If the size of a local variable in bytes is smaller or equal to this
14122number, directly poison (or unpoison) shadow memory instead of using
14123run-time callbacks.
14124
14125@item tsan-distinguish-volatile
14126Emit special instrumentation for accesses to volatiles.
14127
14128@item tsan-instrument-func-entry-exit
14129Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
14130
14131@item max-fsm-thread-path-insns
14132Maximum number of instructions to copy when duplicating blocks on a
14133finite state automaton jump thread path.
14134
14135@item max-fsm-thread-length
14136Maximum number of basic blocks on a finite state automaton jump thread
14137path.
14138
14139@item max-fsm-thread-paths
14140Maximum number of new jump thread paths to create for a finite state
14141automaton.
14142
14143@item parloops-chunk-size
14144Chunk size of omp schedule for loops parallelized by parloops.
14145
14146@item parloops-schedule
14147Schedule type of omp schedule for loops parallelized by parloops (static,
14148dynamic, guided, auto, runtime).
14149
14150@item parloops-min-per-thread
14151The minimum number of iterations per thread of an innermost parallelized
14152loop for which the parallelized variant is preferred over the single threaded
14153one.  Note that for a parallelized loop nest the
14154minimum number of iterations of the outermost loop per thread is two.
14155
14156@item max-ssa-name-query-depth
14157Maximum depth of recursion when querying properties of SSA names in things
14158like fold routines.  One level of recursion corresponds to following a
14159use-def chain.
14160
14161@item max-speculative-devirt-maydefs
14162The maximum number of may-defs we analyze when looking for a must-def
14163specifying the dynamic type of an object that invokes a virtual call
14164we may be able to devirtualize speculatively.
14165
14166@item max-vrp-switch-assertions
14167The maximum number of assertions to add along the default edge of a switch
14168statement during VRP.
14169
14170@item evrp-mode
14171Specifies the mode Early VRP should operate in.
14172
14173@item unroll-jam-min-percent
14174The minimum percentage of memory references that must be optimized
14175away for the unroll-and-jam transformation to be considered profitable.
14176
14177@item unroll-jam-max-unroll
14178The maximum number of times the outer loop should be unrolled by
14179the unroll-and-jam transformation.
14180
14181@item max-rtl-if-conversion-unpredictable-cost
14182Maximum permissible cost for the sequence that would be generated
14183by the RTL if-conversion pass for a branch that is considered unpredictable.
14184
14185@item max-variable-expansions-in-unroller
14186If @option{-fvariable-expansion-in-unroller} is used, the maximum number
14187of times that an individual variable will be expanded during loop unrolling.
14188
14189@item tracer-min-branch-probability-feedback
14190Stop forward growth if the probability of best edge is less than
14191this threshold (in percent). Used when profile feedback is available.
14192
14193@item partial-inlining-entry-probability
14194Maximum probability of the entry BB of split region
14195(in percent relative to entry BB of the function)
14196to make partial inlining happen.
14197
14198@item max-tracked-strlens
14199Maximum number of strings for which strlen optimization pass will
14200track string lengths.
14201
14202@item gcse-after-reload-partial-fraction
14203The threshold ratio for performing partial redundancy
14204elimination after reload.
14205
14206@item gcse-after-reload-critical-fraction
14207The threshold ratio of critical edges execution count that
14208permit performing redundancy elimination after reload.
14209
14210@item max-loop-header-insns
14211The maximum number of insns in loop header duplicated
14212by the copy loop headers pass.
14213
14214@item vect-epilogues-nomask
14215Enable loop epilogue vectorization using smaller vector size.
14216
14217@item vect-partial-vector-usage
14218Controls when the loop vectorizer considers using partial vector loads
14219and stores as an alternative to falling back to scalar code.  0 stops
14220the vectorizer from ever using partial vector loads and stores.  1 allows
14221partial vector loads and stores if vectorization removes the need for the
14222code to iterate.  2 allows partial vector loads and stores in all loops.
14223The parameter only has an effect on targets that support partial
14224vector loads and stores.
14225
14226@item avoid-fma-max-bits
14227Maximum number of bits for which we avoid creating FMAs.
14228
14229@item sms-loop-average-count-threshold
14230A threshold on the average loop count considered by the swing modulo scheduler.
14231
14232@item sms-dfa-history
14233The number of cycles the swing modulo scheduler considers when checking
14234conflicts using DFA.
14235
14236@item max-inline-insns-recursive-auto
14237The maximum number of instructions non-inline function
14238can grow to via recursive inlining.
14239
14240@item graphite-allow-codegen-errors
14241Whether codegen errors should be ICEs when @option{-fchecking}.
14242
14243@item sms-max-ii-factor
14244A factor for tuning the upper bound that swing modulo scheduler
14245uses for scheduling a loop.
14246
14247@item lra-max-considered-reload-pseudos
14248The max number of reload pseudos which are considered during
14249spilling a non-reload pseudo.
14250
14251@item max-pow-sqrt-depth
14252Maximum depth of sqrt chains to use when synthesizing exponentiation
14253by a real constant.
14254
14255@item max-dse-active-local-stores
14256Maximum number of active local stores in RTL dead store elimination.
14257
14258@item asan-instrument-allocas
14259Enable asan allocas/VLAs protection.
14260
14261@item max-iterations-computation-cost
14262Bound on the cost of an expression to compute the number of iterations.
14263
14264@item max-isl-operations
14265Maximum number of isl operations, 0 means unlimited.
14266
14267@item graphite-max-arrays-per-scop
14268Maximum number of arrays per scop.
14269
14270@item max-vartrack-reverse-op-size
14271Max. size of loc list for which reverse ops should be added.
14272
14273@item tracer-dynamic-coverage-feedback
14274The percentage of function, weighted by execution frequency,
14275that must be covered by trace formation.
14276Used when profile feedback is available.
14277
14278@item max-inline-recursive-depth-auto
14279The maximum depth of recursive inlining for non-inline functions.
14280
14281@item fsm-scale-path-stmts
14282Scale factor to apply to the number of statements in a threading path
14283when comparing to the number of (scaled) blocks.
14284
14285@item fsm-maximum-phi-arguments
14286Maximum number of arguments a PHI may have before the FSM threader
14287will not try to thread through its block.
14288
14289@item uninit-control-dep-attempts
14290Maximum number of nested calls to search for control dependencies
14291during uninitialized variable analysis.
14292
14293@item sra-max-scalarization-size-Osize
14294Maximum size, in storage units, of an aggregate
14295which should be considered for scalarization when compiling for size.
14296
14297@item fsm-scale-path-blocks
14298Scale factor to apply to the number of blocks in a threading path
14299when comparing to the number of (scaled) statements.
14300
14301@item sched-autopref-queue-depth
14302Hardware autoprefetcher scheduler model control flag.
14303Number of lookahead cycles the model looks into; at '
14304' only enable instruction sorting heuristic.
14305
14306@item loop-versioning-max-inner-insns
14307The maximum number of instructions that an inner loop can have
14308before the loop versioning pass considers it too big to copy.
14309
14310@item loop-versioning-max-outer-insns
14311The maximum number of instructions that an outer loop can have
14312before the loop versioning pass considers it too big to copy,
14313discounting any instructions in inner loops that directly benefit
14314from versioning.
14315
14316@item ssa-name-def-chain-limit
14317The maximum number of SSA_NAME assignments to follow in determining
14318a property of a variable such as its value.  This limits the number
14319of iterations or recursive calls GCC performs when optimizing certain
14320statements or when determining their validity prior to issuing
14321diagnostics.
14322
14323@item store-merging-max-size
14324Maximum size of a single store merging region in bytes.
14325
14326@item hash-table-verification-limit
14327The number of elements for which hash table verification is done
14328for each searched element.
14329
14330@item max-find-base-term-values
14331Maximum number of VALUEs handled during a single find_base_term call.
14332
14333@item analyzer-max-enodes-per-program-point
14334The maximum number of exploded nodes per program point within
14335the analyzer, before terminating analysis of that point.
14336
14337@item analyzer-max-constraints
14338The maximum number of constraints per state.
14339
14340@item analyzer-min-snodes-for-call-summary
14341The minimum number of supernodes within a function for the
14342analyzer to consider summarizing its effects at call sites.
14343
14344@item analyzer-max-enodes-for-full-dump
14345The maximum depth of exploded nodes that should appear in a dot dump
14346before switching to a less verbose format.
14347
14348@item analyzer-max-recursion-depth
14349The maximum number of times a callsite can appear in a call stack
14350within the analyzer, before terminating analysis of a call that would
14351recurse deeper.
14352
14353@item analyzer-max-svalue-depth
14354The maximum depth of a symbolic value, before approximating
14355the value as unknown.
14356
14357@item analyzer-max-infeasible-edges
14358The maximum number of infeasible edges to reject before declaring
14359a diagnostic as infeasible.
14360
14361@item gimple-fe-computed-hot-bb-threshold
14362The number of executions of a basic block which is considered hot.
14363The parameter is used only in GIMPLE FE.
14364
14365@item analyzer-bb-explosion-factor
14366The maximum number of 'after supernode' exploded nodes within the analyzer
14367per supernode, before terminating analysis.
14368
14369@item ranger-logical-depth
14370Maximum depth of logical expression evaluation ranger will look through
14371when evaluating outgoing edge ranges.
14372
14373@item openacc-kernels
14374Specify mode of OpenACC `kernels' constructs handling.
14375With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
14376constructs are decomposed into parts, a sequence of compute
14377constructs, each then handled individually.
14378This is work in progress.
14379With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
14380constructs are handled by the @samp{parloops} pass, en bloc.
14381This is the current default.
14382
14383@end table
14384
14385The following choices of @var{name} are available on AArch64 targets:
14386
14387@table @gcctabopt
14388@item aarch64-sve-compare-costs
14389When vectorizing for SVE, consider using ``unpacked'' vectors for
14390smaller elements and use the cost model to pick the cheapest approach.
14391Also use the cost model to choose between SVE and Advanced SIMD vectorization.
14392
14393Using unpacked vectors includes storing smaller elements in larger
14394containers and accessing elements with extending loads and truncating
14395stores.
14396
14397@item aarch64-float-recp-precision
14398The number of Newton iterations for calculating the reciprocal for float type.
14399The precision of division is proportional to this param when division
14400approximation is enabled.  The default value is 1.
14401
14402@item aarch64-double-recp-precision
14403The number of Newton iterations for calculating the reciprocal for double type.
14404The precision of division is propotional to this param when division
14405approximation is enabled.  The default value is 2.
14406
14407@item aarch64-autovec-preference
14408Force an ISA selection strategy for auto-vectorization.  Accepts values from
144090 to 4, inclusive.
14410@table @samp
14411@item 0
14412Use the default heuristics.
14413@item 1
14414Use only Advanced SIMD for auto-vectorization.
14415@item 2
14416Use only SVE for auto-vectorization.
14417@item 3
14418Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
14419deemed equal.
14420@item 4
14421Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
14422@end table
14423The default value is 0.
14424
14425@item aarch64-loop-vect-issue-rate-niters
14426The tuning for some AArch64 CPUs tries to take both latencies and issue
14427rates into account when deciding whether a loop should be vectorized
14428using SVE, vectorized using Advanced SIMD, or not vectorized at all.
14429If this parameter is set to @var{n}, GCC will not use this heuristic
14430for loops that are known to execute in fewer than @var{n} Advanced
14431SIMD iterations.
14432
14433@end table
14434
14435@end table
14436
14437@node Instrumentation Options
14438@section Program Instrumentation Options
14439@cindex instrumentation options
14440@cindex program instrumentation options
14441@cindex run-time error checking options
14442@cindex profiling options
14443@cindex options, program instrumentation
14444@cindex options, run-time error checking
14445@cindex options, profiling
14446
14447GCC supports a number of command-line options that control adding
14448run-time instrumentation to the code it normally generates.
14449For example, one purpose of instrumentation is collect profiling
14450statistics for use in finding program hot spots, code coverage
14451analysis, or profile-guided optimizations.
14452Another class of program instrumentation is adding run-time checking
14453to detect programming errors like invalid pointer
14454dereferences or out-of-bounds array accesses, as well as deliberately
14455hostile attacks such as stack smashing or C++ vtable hijacking.
14456There is also a general hook which can be used to implement other
14457forms of tracing or function-level instrumentation for debug or
14458program analysis purposes.
14459
14460@table @gcctabopt
14461@cindex @command{prof}
14462@cindex @command{gprof}
14463@item -p
14464@itemx -pg
14465@opindex p
14466@opindex pg
14467Generate extra code to write profile information suitable for the
14468analysis program @command{prof} (for @option{-p}) or @command{gprof}
14469(for @option{-pg}).  You must use this option when compiling
14470the source files you want data about, and you must also use it when
14471linking.
14472
14473You can use the function attribute @code{no_instrument_function} to
14474suppress profiling of individual functions when compiling with these options.
14475@xref{Common Function Attributes}.
14476
14477@item -fprofile-arcs
14478@opindex fprofile-arcs
14479Add code so that program flow @dfn{arcs} are instrumented.  During
14480execution the program records how many times each branch and call is
14481executed and how many times it is taken or returns.  On targets that support
14482constructors with priority support, profiling properly handles constructors,
14483destructors and C++ constructors (and destructors) of classes which are used
14484as a type of a global variable.
14485
14486When the compiled
14487program exits it saves this data to a file called
14488@file{@var{auxname}.gcda} for each source file.  The data may be used for
14489profile-directed optimizations (@option{-fbranch-probabilities}), or for
14490test coverage analysis (@option{-ftest-coverage}).  Each object file's
14491@var{auxname} is generated from the name of the output file, if
14492explicitly specified and it is not the final executable, otherwise it is
14493the basename of the source file.  In both cases any suffix is removed
14494(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
14495@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
14496@xref{Cross-profiling}.
14497
14498@cindex @command{gcov}
14499@item --coverage
14500@opindex coverage
14501
14502This option is used to compile and link code instrumented for coverage
14503analysis.  The option is a synonym for @option{-fprofile-arcs}
14504@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
14505linking).  See the documentation for those options for more details.
14506
14507@itemize
14508
14509@item
14510Compile the source files with @option{-fprofile-arcs} plus optimization
14511and code generation options.  For test coverage analysis, use the
14512additional @option{-ftest-coverage} option.  You do not need to profile
14513every source file in a program.
14514
14515@item
14516Compile the source files additionally with @option{-fprofile-abs-path}
14517to create absolute path names in the @file{.gcno} files.  This allows
14518@command{gcov} to find the correct sources in projects where compilations
14519occur with different working directories.
14520
14521@item
14522Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
14523(the latter implies the former).
14524
14525@item
14526Run the program on a representative workload to generate the arc profile
14527information.  This may be repeated any number of times.  You can run
14528concurrent instances of your program, and provided that the file system
14529supports locking, the data files will be correctly updated.  Unless
14530a strict ISO C dialect option is in effect, @code{fork} calls are
14531detected and correctly handled without double counting.
14532
14533@item
14534For profile-directed optimizations, compile the source files again with
14535the same optimization and code generation options plus
14536@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
14537Control Optimization}).
14538
14539@item
14540For test coverage analysis, use @command{gcov} to produce human readable
14541information from the @file{.gcno} and @file{.gcda} files.  Refer to the
14542@command{gcov} documentation for further information.
14543
14544@end itemize
14545
14546With @option{-fprofile-arcs}, for each function of your program GCC
14547creates a program flow graph, then finds a spanning tree for the graph.
14548Only arcs that are not on the spanning tree have to be instrumented: the
14549compiler adds code to count the number of times that these arcs are
14550executed.  When an arc is the only exit or only entrance to a block, the
14551instrumentation code can be added to the block; otherwise, a new basic
14552block must be created to hold the instrumentation code.
14553
14554@need 2000
14555@item -ftest-coverage
14556@opindex ftest-coverage
14557Produce a notes file that the @command{gcov} code-coverage utility
14558(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
14559show program coverage.  Each source file's note file is called
14560@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
14561above for a description of @var{auxname} and instructions on how to
14562generate test coverage data.  Coverage data matches the source files
14563more closely if you do not optimize.
14564
14565@item -fprofile-abs-path
14566@opindex fprofile-abs-path
14567Automatically convert relative source file names to absolute path names
14568in the @file{.gcno} files.  This allows @command{gcov} to find the correct
14569sources in projects where compilations occur with different working
14570directories.
14571
14572@item -fprofile-dir=@var{path}
14573@opindex fprofile-dir
14574
14575Set the directory to search for the profile data files in to @var{path}.
14576This option affects only the profile data generated by
14577@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
14578and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
14579and its related options.  Both absolute and relative paths can be used.
14580By default, GCC uses the current directory as @var{path}, thus the
14581profile data file appears in the same directory as the object file.
14582In order to prevent the file name clashing, if the object file name is
14583not an absolute path, we mangle the absolute path of the
14584@file{@var{sourcename}.gcda} file and use it as the file name of a
14585@file{.gcda} file.  See similar option @option{-fprofile-note}.
14586
14587When an executable is run in a massive parallel environment, it is recommended
14588to save profile to different folders.  That can be done with variables
14589in @var{path} that are exported during run-time:
14590
14591@table @gcctabopt
14592
14593@item %p
14594process ID.
14595
14596@item %q@{VAR@}
14597value of environment variable @var{VAR}
14598
14599@end table
14600
14601@item -fprofile-generate
14602@itemx -fprofile-generate=@var{path}
14603@opindex fprofile-generate
14604
14605Enable options usually used for instrumenting application to produce
14606profile useful for later recompilation with profile feedback based
14607optimization.  You must use @option{-fprofile-generate} both when
14608compiling and when linking your program.
14609
14610The following options are enabled:
14611@option{-fprofile-arcs}, @option{-fprofile-values},
14612@option{-finline-functions}, and @option{-fipa-bit-cp}.
14613
14614If @var{path} is specified, GCC looks at the @var{path} to find
14615the profile feedback data files. See @option{-fprofile-dir}.
14616
14617To optimize the program based on the collected profile information, use
14618@option{-fprofile-use}.  @xref{Optimize Options}, for more information.
14619
14620@item -fprofile-info-section
14621@itemx -fprofile-info-section=@var{name}
14622@opindex fprofile-info-section
14623
14624Register the profile information in the specified section instead of using a
14625constructor/destructor.  The section name is @var{name} if it is specified,
14626otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
14627profile information generated by @option{-fprofile-arcs} or
14628@option{-ftest-coverage} is placed in the specified section for each
14629translation unit.  This option disables the profile information registration
14630through a constructor and it disables the profile information processing
14631through a destructor.  This option is not intended to be used in hosted
14632environments such as GNU/Linux.  It targets systems with limited resources
14633which do not support constructors and destructors.  The linker could collect
14634the input sections in a continuous memory block and define start and end
14635symbols.  The runtime support could dump the profiling information registered
14636in this linker set during program termination to a serial line for example.  A
14637GNU linker script example which defines a linker output section follows:
14638
14639@smallexample
14640  .gcov_info      :
14641  @{
14642    PROVIDE (__gcov_info_start = .);
14643    KEEP (*(.gcov_info))
14644    PROVIDE (__gcov_info_end = .);
14645  @}
14646@end smallexample
14647
14648@item -fprofile-note=@var{path}
14649@opindex fprofile-note
14650
14651If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
14652location.  If you combine the option with multiple source files,
14653the @file{.gcno} file will be overwritten.
14654
14655@item -fprofile-prefix-path=@var{path}
14656@opindex fprofile-prefix-path
14657
14658This option can be used in combination with
14659@option{profile-generate=}@var{profile_dir} and
14660@option{profile-use=}@var{profile_dir} to inform GCC where is the base
14661directory of built source tree.  By default @var{profile_dir} will contain
14662files with mangled absolute paths of all object files in the built project.
14663This is not desirable when directory used to build the instrumented binary
14664differs from the directory used to build the binary optimized with profile
14665feedback because the profile data will not be found during the optimized build.
14666In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
14667pointing to the base directory of the build can be used to strip the irrelevant
14668part of the path and keep all file names relative to the main build directory.
14669
14670@item -fprofile-update=@var{method}
14671@opindex fprofile-update
14672
14673Alter the update method for an application instrumented for profile
14674feedback based optimization.  The @var{method} argument should be one of
14675@samp{single}, @samp{atomic} or @samp{prefer-atomic}.
14676The first one is useful for single-threaded applications,
14677while the second one prevents profile corruption by emitting thread-safe code.
14678
14679@strong{Warning:} When an application does not properly join all threads
14680(or creates an detached thread), a profile file can be still corrupted.
14681
14682Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
14683when supported by a target, or to @samp{single} otherwise.  The GCC driver
14684automatically selects @samp{prefer-atomic} when @option{-pthread}
14685is present in the command line.
14686
14687@item -fprofile-filter-files=@var{regex}
14688@opindex fprofile-filter-files
14689
14690Instrument only functions from files whose name matches
14691any of the regular expressions (separated by semi-colons).
14692
14693For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
14694only @file{main.c} and all C files starting with 'module'.
14695
14696@item -fprofile-exclude-files=@var{regex}
14697@opindex fprofile-exclude-files
14698
14699Instrument only functions from files whose name does not match
14700any of the regular expressions (separated by semi-colons).
14701
14702For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
14703of all files that are located in the @file{/usr/} folder.
14704
14705@item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
14706@opindex fprofile-reproducible
14707Control level of reproducibility of profile gathered by
14708@code{-fprofile-generate}.  This makes it possible to rebuild program
14709with same outcome which is useful, for example, for distribution
14710packages.
14711
14712With @option{-fprofile-reproducible=serial} the profile gathered by
14713@option{-fprofile-generate} is reproducible provided the trained program
14714behaves the same at each invocation of the train run, it is not
14715multi-threaded and profile data streaming is always done in the same
14716order.  Note that profile streaming happens at the end of program run but
14717also before @code{fork} function is invoked.
14718
14719Note that it is quite common that execution counts of some part of
14720programs depends, for example, on length of temporary file names or
14721memory space randomization (that may affect hash-table collision rate).
14722Such non-reproducible part of programs may be annotated by
14723@code{no_instrument_function} function attribute. @command{gcov-dump} with
14724@option{-l} can be used to dump gathered data and verify that they are
14725indeed reproducible.
14726
14727With @option{-fprofile-reproducible=parallel-runs} collected profile
14728stays reproducible regardless the order of streaming of the data into
14729gcda files.  This setting makes it possible to run multiple instances of
14730instrumented program in parallel (such as with @code{make -j}). This
14731reduces quality of gathered data, in particular of indirect call
14732profiling.
14733
14734@item -fsanitize=address
14735@opindex fsanitize=address
14736Enable AddressSanitizer, a fast memory error detector.
14737Memory access instructions are instrumented to detect
14738out-of-bounds and use-after-free bugs.
14739The option enables @option{-fsanitize-address-use-after-scope}.
14740See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
14741more details.  The run-time behavior can be influenced using the
14742@env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
14743the available options are shown at startup of the instrumented program.  See
14744@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
14745for a list of supported options.
14746The option cannot be combined with @option{-fsanitize=thread} or
14747@option{-fsanitize=hwaddress}.  Note that the only target
14748@option{-fsanitize=hwaddress} is currently supported on is AArch64.
14749
14750@item -fsanitize=kernel-address
14751@opindex fsanitize=kernel-address
14752Enable AddressSanitizer for Linux kernel.
14753See @uref{https://github.com/google/kasan} for more details.
14754
14755@item -fsanitize=hwaddress
14756@opindex fsanitize=hwaddress
14757Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
14758ignore the top byte of a pointer to allow the detection of memory errors with
14759a low memory overhead.
14760Memory access instructions are instrumented to detect out-of-bounds and
14761use-after-free bugs.
14762The option enables @option{-fsanitize-address-use-after-scope}.
14763See
14764@uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
14765for more details.  The run-time behavior can be influenced using the
14766@env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
14767the available options are shown at startup of the instrumented program.
14768The option cannot be combined with @option{-fsanitize=thread} or
14769@option{-fsanitize=address}, and is currently only available on AArch64.
14770
14771@item -fsanitize=kernel-hwaddress
14772@opindex fsanitize=kernel-hwaddress
14773Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
14774Similar to @option{-fsanitize=kernel-address} but using an alternate
14775instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
14776instrumentation differences necessary for compiling the Linux kernel.
14777These differences are to avoid hwasan library initialization calls and to
14778account for the stack pointer having a different value in its top byte.
14779
14780@emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
14781Instrumenting the stack and alloca calls are not on by default but are still
14782possible by specifying the command-line options
14783@option{--param hwasan-instrument-stack=1} and
14784@option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
14785tag is not implemented for kernel instrumentation.
14786
14787@item -fsanitize=pointer-compare
14788@opindex fsanitize=pointer-compare
14789Instrument comparison operation (<, <=, >, >=) with pointer operands.
14790The option must be combined with either @option{-fsanitize=kernel-address} or
14791@option{-fsanitize=address}
14792The option cannot be combined with @option{-fsanitize=thread}.
14793Note: By default the check is disabled at run time.  To enable it,
14794add @code{detect_invalid_pointer_pairs=2} to the environment variable
14795@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
14796invalid operation only when both pointers are non-null.
14797
14798@item -fsanitize=pointer-subtract
14799@opindex fsanitize=pointer-subtract
14800Instrument subtraction with pointer operands.
14801The option must be combined with either @option{-fsanitize=kernel-address} or
14802@option{-fsanitize=address}
14803The option cannot be combined with @option{-fsanitize=thread}.
14804Note: By default the check is disabled at run time.  To enable it,
14805add @code{detect_invalid_pointer_pairs=2} to the environment variable
14806@env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
14807invalid operation only when both pointers are non-null.
14808
14809@item -fsanitize=thread
14810@opindex fsanitize=thread
14811Enable ThreadSanitizer, a fast data race detector.
14812Memory access instructions are instrumented to detect
14813data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
14814details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
14815environment variable; see
14816@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
14817supported options.
14818The option cannot be combined with @option{-fsanitize=address},
14819@option{-fsanitize=leak}.
14820
14821Note that sanitized atomic builtins cannot throw exceptions when
14822operating on invalid memory addresses with non-call exceptions
14823(@option{-fnon-call-exceptions}).
14824
14825@item -fsanitize=leak
14826@opindex fsanitize=leak
14827Enable LeakSanitizer, a memory leak detector.
14828This option only matters for linking of executables and
14829the executable is linked against a library that overrides @code{malloc}
14830and other allocator functions.  See
14831@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
14832details.  The run-time behavior can be influenced using the
14833@env{LSAN_OPTIONS} environment variable.
14834The option cannot be combined with @option{-fsanitize=thread}.
14835
14836@item -fsanitize=undefined
14837@opindex fsanitize=undefined
14838Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
14839Various computations are instrumented to detect undefined behavior
14840at runtime.  Current suboptions are:
14841
14842@table @gcctabopt
14843
14844@item -fsanitize=shift
14845@opindex fsanitize=shift
14846This option enables checking that the result of a shift operation is
14847not undefined.  Note that what exactly is considered undefined differs
14848slightly between C and C++, as well as between ISO C90 and C99, etc.
14849This option has two suboptions, @option{-fsanitize=shift-base} and
14850@option{-fsanitize=shift-exponent}.
14851
14852@item -fsanitize=shift-exponent
14853@opindex fsanitize=shift-exponent
14854This option enables checking that the second argument of a shift operation
14855is not negative and is smaller than the precision of the promoted first
14856argument.
14857
14858@item -fsanitize=shift-base
14859@opindex fsanitize=shift-base
14860If the second argument of a shift operation is within range, check that the
14861result of a shift operation is not undefined.  Note that what exactly is
14862considered undefined differs slightly between C and C++, as well as between
14863ISO C90 and C99, etc.
14864
14865@item -fsanitize=integer-divide-by-zero
14866@opindex fsanitize=integer-divide-by-zero
14867Detect integer division by zero as well as @code{INT_MIN / -1} division.
14868
14869@item -fsanitize=unreachable
14870@opindex fsanitize=unreachable
14871With this option, the compiler turns the @code{__builtin_unreachable}
14872call into a diagnostics message call instead.  When reaching the
14873@code{__builtin_unreachable} call, the behavior is undefined.
14874
14875@item -fsanitize=vla-bound
14876@opindex fsanitize=vla-bound
14877This option instructs the compiler to check that the size of a variable
14878length array is positive.
14879
14880@item -fsanitize=null
14881@opindex fsanitize=null
14882This option enables pointer checking.  Particularly, the application
14883built with this option turned on will issue an error message when it
14884tries to dereference a NULL pointer, or if a reference (possibly an
14885rvalue reference) is bound to a NULL pointer, or if a method is invoked
14886on an object pointed by a NULL pointer.
14887
14888@item -fsanitize=return
14889@opindex fsanitize=return
14890This option enables return statement checking.  Programs
14891built with this option turned on will issue an error message
14892when the end of a non-void function is reached without actually
14893returning a value.  This option works in C++ only.
14894
14895@item -fsanitize=signed-integer-overflow
14896@opindex fsanitize=signed-integer-overflow
14897This option enables signed integer overflow checking.  We check that
14898the result of @code{+}, @code{*}, and both unary and binary @code{-}
14899does not overflow in the signed arithmetics.  Note, integer promotion
14900rules must be taken into account.  That is, the following is not an
14901overflow:
14902@smallexample
14903signed char a = SCHAR_MAX;
14904a++;
14905@end smallexample
14906
14907@item -fsanitize=bounds
14908@opindex fsanitize=bounds
14909This option enables instrumentation of array bounds.  Various out of bounds
14910accesses are detected.  Flexible array members, flexible array member-like
14911arrays, and initializers of variables with static storage are not instrumented.
14912
14913@item -fsanitize=bounds-strict
14914@opindex fsanitize=bounds-strict
14915This option enables strict instrumentation of array bounds.  Most out of bounds
14916accesses are detected, including flexible array members and flexible array
14917member-like arrays.  Initializers of variables with static storage are not
14918instrumented.
14919
14920@item -fsanitize=alignment
14921@opindex fsanitize=alignment
14922
14923This option enables checking of alignment of pointers when they are
14924dereferenced, or when a reference is bound to insufficiently aligned target,
14925or when a method or constructor is invoked on insufficiently aligned object.
14926
14927@item -fsanitize=object-size
14928@opindex fsanitize=object-size
14929This option enables instrumentation of memory references using the
14930@code{__builtin_object_size} function.  Various out of bounds pointer
14931accesses are detected.
14932
14933@item -fsanitize=float-divide-by-zero
14934@opindex fsanitize=float-divide-by-zero
14935Detect floating-point division by zero.  Unlike other similar options,
14936@option{-fsanitize=float-divide-by-zero} is not enabled by
14937@option{-fsanitize=undefined}, since floating-point division by zero can
14938be a legitimate way of obtaining infinities and NaNs.
14939
14940@item -fsanitize=float-cast-overflow
14941@opindex fsanitize=float-cast-overflow
14942This option enables floating-point type to integer conversion checking.
14943We check that the result of the conversion does not overflow.
14944Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
14945not enabled by @option{-fsanitize=undefined}.
14946This option does not work well with @code{FE_INVALID} exceptions enabled.
14947
14948@item -fsanitize=nonnull-attribute
14949@opindex fsanitize=nonnull-attribute
14950
14951This option enables instrumentation of calls, checking whether null values
14952are not passed to arguments marked as requiring a non-null value by the
14953@code{nonnull} function attribute.
14954
14955@item -fsanitize=returns-nonnull-attribute
14956@opindex fsanitize=returns-nonnull-attribute
14957
14958This option enables instrumentation of return statements in functions
14959marked with @code{returns_nonnull} function attribute, to detect returning
14960of null values from such functions.
14961
14962@item -fsanitize=bool
14963@opindex fsanitize=bool
14964
14965This option enables instrumentation of loads from bool.  If a value other
14966than 0/1 is loaded, a run-time error is issued.
14967
14968@item -fsanitize=enum
14969@opindex fsanitize=enum
14970
14971This option enables instrumentation of loads from an enum type.  If
14972a value outside the range of values for the enum type is loaded,
14973a run-time error is issued.
14974
14975@item -fsanitize=vptr
14976@opindex fsanitize=vptr
14977
14978This option enables instrumentation of C++ member function calls, member
14979accesses and some conversions between pointers to base and derived classes,
14980to verify the referenced object has the correct dynamic type.
14981
14982@item -fsanitize=pointer-overflow
14983@opindex fsanitize=pointer-overflow
14984
14985This option enables instrumentation of pointer arithmetics.  If the pointer
14986arithmetics overflows, a run-time error is issued.
14987
14988@item -fsanitize=builtin
14989@opindex fsanitize=builtin
14990
14991This option enables instrumentation of arguments to selected builtin
14992functions.  If an invalid value is passed to such arguments, a run-time
14993error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
14994or @code{__builtin_clz} invokes undefined behavior and is diagnosed
14995by this option.
14996
14997@end table
14998
14999While @option{-ftrapv} causes traps for signed overflows to be emitted,
15000@option{-fsanitize=undefined} gives a diagnostic message.
15001This currently works only for the C family of languages.
15002
15003@item -fno-sanitize=all
15004@opindex fno-sanitize=all
15005
15006This option disables all previously enabled sanitizers.
15007@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
15008together.
15009
15010@item -fasan-shadow-offset=@var{number}
15011@opindex fasan-shadow-offset
15012This option forces GCC to use custom shadow offset in AddressSanitizer checks.
15013It is useful for experimenting with different shadow memory layouts in
15014Kernel AddressSanitizer.
15015
15016@item -fsanitize-sections=@var{s1},@var{s2},...
15017@opindex fsanitize-sections
15018Sanitize global variables in selected user-defined sections.  @var{si} may
15019contain wildcards.
15020
15021@item -fsanitize-recover@r{[}=@var{opts}@r{]}
15022@opindex fsanitize-recover
15023@opindex fno-sanitize-recover
15024@option{-fsanitize-recover=} controls error recovery mode for sanitizers
15025mentioned in comma-separated list of @var{opts}.  Enabling this option
15026for a sanitizer component causes it to attempt to continue
15027running the program as if no error happened.  This means multiple
15028runtime errors can be reported in a single program run, and the exit
15029code of the program may indicate success even when errors
15030have been reported.  The @option{-fno-sanitize-recover=} option
15031can be used to alter
15032this behavior: only the first detected error is reported
15033and program then exits with a non-zero exit code.
15034
15035Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
15036except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
15037@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
15038@option{-fsanitize=bounds-strict},
15039@option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
15040For these sanitizers error recovery is turned on by default,
15041except @option{-fsanitize=address}, for which this feature is experimental.
15042@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
15043accepted, the former enables recovery for all sanitizers that support it,
15044the latter disables recovery for all sanitizers that support it.
15045
15046Even if a recovery mode is turned on the compiler side, it needs to be also
15047enabled on the runtime library side, otherwise the failures are still fatal.
15048The runtime library defaults to @code{halt_on_error=0} for
15049ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
15050AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
15051setting the @code{halt_on_error} flag in the corresponding environment variable.
15052
15053Syntax without an explicit @var{opts} parameter is deprecated.  It is
15054equivalent to specifying an @var{opts} list of:
15055
15056@smallexample
15057undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
15058@end smallexample
15059
15060@item -fsanitize-address-use-after-scope
15061@opindex fsanitize-address-use-after-scope
15062Enable sanitization of local variables to detect use-after-scope bugs.
15063The option sets @option{-fstack-reuse} to @samp{none}.
15064
15065@item -fsanitize-undefined-trap-on-error
15066@opindex fsanitize-undefined-trap-on-error
15067The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
15068report undefined behavior using @code{__builtin_trap} rather than
15069a @code{libubsan} library routine.  The advantage of this is that the
15070@code{libubsan} library is not needed and is not linked in, so this
15071is usable even in freestanding environments.
15072
15073@item -fsanitize-coverage=trace-pc
15074@opindex fsanitize-coverage=trace-pc
15075Enable coverage-guided fuzzing code instrumentation.
15076Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
15077
15078@item -fsanitize-coverage=trace-cmp
15079@opindex fsanitize-coverage=trace-cmp
15080Enable dataflow guided fuzzing code instrumentation.
15081Inserts a call to @code{__sanitizer_cov_trace_cmp1},
15082@code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
15083@code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
15084variable or @code{__sanitizer_cov_trace_const_cmp1},
15085@code{__sanitizer_cov_trace_const_cmp2},
15086@code{__sanitizer_cov_trace_const_cmp4} or
15087@code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
15088operand constant, @code{__sanitizer_cov_trace_cmpf} or
15089@code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
15090@code{__sanitizer_cov_trace_switch} for switch statements.
15091
15092@item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
15093@opindex fcf-protection
15094Enable code instrumentation of control-flow transfers to increase
15095program security by checking that target addresses of control-flow
15096transfer instructions (such as indirect function call, function return,
15097indirect jump) are valid.  This prevents diverting the flow of control
15098to an unexpected target.  This is intended to protect against such
15099threats as Return-oriented Programming (ROP), and similarly
15100call/jmp-oriented programming (COP/JOP).
15101
15102The value @code{branch} tells the compiler to implement checking of
15103validity of control-flow transfer at the point of indirect branch
15104instructions, i.e.@: call/jmp instructions.  The value @code{return}
15105implements checking of validity at the point of returning from a
15106function.  The value @code{full} is an alias for specifying both
15107@code{branch} and @code{return}. The value @code{none} turns off
15108instrumentation.
15109
15110The value @code{check} is used for the final link with link-time
15111optimization (LTO).  An error is issued if LTO object files are
15112compiled with different @option{-fcf-protection} values.  The
15113value @code{check} is ignored at the compile time.
15114
15115The macro @code{__CET__} is defined when @option{-fcf-protection} is
15116used.  The first bit of @code{__CET__} is set to 1 for the value
15117@code{branch} and the second bit of @code{__CET__} is set to 1 for
15118the @code{return}.
15119
15120You can also use the @code{nocf_check} attribute to identify
15121which functions and calls should be skipped from instrumentation
15122(@pxref{Function Attributes}).
15123
15124Currently the x86 GNU/Linux target provides an implementation based
15125on Intel Control-flow Enforcement Technology (CET).
15126
15127@item -fstack-protector
15128@opindex fstack-protector
15129Emit extra code to check for buffer overflows, such as stack smashing
15130attacks.  This is done by adding a guard variable to functions with
15131vulnerable objects.  This includes functions that call @code{alloca}, and
15132functions with buffers larger than or equal to 8 bytes.  The guards are
15133initialized when a function is entered and then checked when the function
15134exits.  If a guard check fails, an error message is printed and the program
15135exits.  Only variables that are actually allocated on the stack are
15136considered, optimized away variables or variables allocated in registers
15137don't count.
15138
15139@item -fstack-protector-all
15140@opindex fstack-protector-all
15141Like @option{-fstack-protector} except that all functions are protected.
15142
15143@item -fstack-protector-strong
15144@opindex fstack-protector-strong
15145Like @option{-fstack-protector} but includes additional functions to
15146be protected --- those that have local array definitions, or have
15147references to local frame addresses.  Only variables that are actually
15148allocated on the stack are considered, optimized away variables or variables
15149allocated in registers don't count.
15150
15151@item -fstack-protector-explicit
15152@opindex fstack-protector-explicit
15153Like @option{-fstack-protector} but only protects those functions which
15154have the @code{stack_protect} attribute.
15155
15156@item -fstack-check
15157@opindex fstack-check
15158Generate code to verify that you do not go beyond the boundary of the
15159stack.  You should specify this flag if you are running in an
15160environment with multiple threads, but you only rarely need to specify it in
15161a single-threaded environment since stack overflow is automatically
15162detected on nearly all systems if there is only one stack.
15163
15164Note that this switch does not actually cause checking to be done; the
15165operating system or the language runtime must do that.  The switch causes
15166generation of code to ensure that they see the stack being extended.
15167
15168You can additionally specify a string parameter: @samp{no} means no
15169checking, @samp{generic} means force the use of old-style checking,
15170@samp{specific} means use the best checking method and is equivalent
15171to bare @option{-fstack-check}.
15172
15173Old-style checking is a generic mechanism that requires no specific
15174target support in the compiler but comes with the following drawbacks:
15175
15176@enumerate
15177@item
15178Modified allocation strategy for large objects: they are always
15179allocated dynamically if their size exceeds a fixed threshold.  Note this
15180may change the semantics of some code.
15181
15182@item
15183Fixed limit on the size of the static frame of functions: when it is
15184topped by a particular function, stack checking is not reliable and
15185a warning is issued by the compiler.
15186
15187@item
15188Inefficiency: because of both the modified allocation strategy and the
15189generic implementation, code performance is hampered.
15190@end enumerate
15191
15192Note that old-style stack checking is also the fallback method for
15193@samp{specific} if no target support has been added in the compiler.
15194
15195@samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
15196and stack overflows.  @samp{specific} is an excellent choice when compiling
15197Ada code.  It is not generally sufficient to protect against stack-clash
15198attacks.  To protect against those you want @samp{-fstack-clash-protection}.
15199
15200@item -fstack-clash-protection
15201@opindex fstack-clash-protection
15202Generate code to prevent stack clash style attacks.  When this option is
15203enabled, the compiler will only allocate one page of stack space at a time
15204and each page is accessed immediately after allocation.  Thus, it prevents
15205allocations from jumping over any stack guard page provided by the
15206operating system.
15207
15208Most targets do not fully support stack clash protection.  However, on
15209those targets @option{-fstack-clash-protection} will protect dynamic stack
15210allocations.  @option{-fstack-clash-protection} may also provide limited
15211protection for static stack allocations if the target supports
15212@option{-fstack-check=specific}.
15213
15214@item -fstack-limit-register=@var{reg}
15215@itemx -fstack-limit-symbol=@var{sym}
15216@itemx -fno-stack-limit
15217@opindex fstack-limit-register
15218@opindex fstack-limit-symbol
15219@opindex fno-stack-limit
15220Generate code to ensure that the stack does not grow beyond a certain value,
15221either the value of a register or the address of a symbol.  If a larger
15222stack is required, a signal is raised at run time.  For most targets,
15223the signal is raised before the stack overruns the boundary, so
15224it is possible to catch the signal without taking special precautions.
15225
15226For instance, if the stack starts at absolute address @samp{0x80000000}
15227and grows downwards, you can use the flags
15228@option{-fstack-limit-symbol=__stack_limit} and
15229@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
15230of 128KB@.  Note that this may only work with the GNU linker.
15231
15232You can locally override stack limit checking by using the
15233@code{no_stack_limit} function attribute (@pxref{Function Attributes}).
15234
15235@item -fsplit-stack
15236@opindex fsplit-stack
15237Generate code to automatically split the stack before it overflows.
15238The resulting program has a discontiguous stack which can only
15239overflow if the program is unable to allocate any more memory.  This
15240is most useful when running threaded programs, as it is no longer
15241necessary to calculate a good stack size to use for each thread.  This
15242is currently only implemented for the x86 targets running
15243GNU/Linux.
15244
15245When code compiled with @option{-fsplit-stack} calls code compiled
15246without @option{-fsplit-stack}, there may not be much stack space
15247available for the latter code to run.  If compiling all code,
15248including library code, with @option{-fsplit-stack} is not an option,
15249then the linker can fix up these calls so that the code compiled
15250without @option{-fsplit-stack} always has a large stack.  Support for
15251this is implemented in the gold linker in GNU binutils release 2.21
15252and later.
15253
15254@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
15255@opindex fvtable-verify
15256This option is only available when compiling C++ code.
15257It turns on (or off, if using @option{-fvtable-verify=none}) the security
15258feature that verifies at run time, for every virtual call, that
15259the vtable pointer through which the call is made is valid for the type of
15260the object, and has not been corrupted or overwritten.  If an invalid vtable
15261pointer is detected at run time, an error is reported and execution of the
15262program is immediately halted.
15263
15264This option causes run-time data structures to be built at program startup,
15265which are used for verifying the vtable pointers.
15266The options @samp{std} and @samp{preinit}
15267control the timing of when these data structures are built.  In both cases the
15268data structures are built before execution reaches @code{main}.  Using
15269@option{-fvtable-verify=std} causes the data structures to be built after
15270shared libraries have been loaded and initialized.
15271@option{-fvtable-verify=preinit} causes them to be built before shared
15272libraries have been loaded and initialized.
15273
15274If this option appears multiple times in the command line with different
15275values specified, @samp{none} takes highest priority over both @samp{std} and
15276@samp{preinit}; @samp{preinit} takes priority over @samp{std}.
15277
15278@item -fvtv-debug
15279@opindex fvtv-debug
15280When used in conjunction with @option{-fvtable-verify=std} or
15281@option{-fvtable-verify=preinit}, causes debug versions of the
15282runtime functions for the vtable verification feature to be called.
15283This flag also causes the compiler to log information about which
15284vtable pointers it finds for each class.
15285This information is written to a file named @file{vtv_set_ptr_data.log}
15286in the directory named by the environment variable @env{VTV_LOGS_DIR}
15287if that is defined or the current working directory otherwise.
15288
15289Note:  This feature @emph{appends} data to the log file. If you want a fresh log
15290file, be sure to delete any existing one.
15291
15292@item -fvtv-counts
15293@opindex fvtv-counts
15294This is a debugging flag.  When used in conjunction with
15295@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
15296causes the compiler to keep track of the total number of virtual calls
15297it encounters and the number of verifications it inserts.  It also
15298counts the number of calls to certain run-time library functions
15299that it inserts and logs this information for each compilation unit.
15300The compiler writes this information to a file named
15301@file{vtv_count_data.log} in the directory named by the environment
15302variable @env{VTV_LOGS_DIR} if that is defined or the current working
15303directory otherwise.  It also counts the size of the vtable pointer sets
15304for each class, and writes this information to @file{vtv_class_set_sizes.log}
15305in the same directory.
15306
15307Note:  This feature @emph{appends} data to the log files.  To get fresh log
15308files, be sure to delete any existing ones.
15309
15310@item -finstrument-functions
15311@opindex finstrument-functions
15312Generate instrumentation calls for entry and exit to functions.  Just
15313after function entry and just before function exit, the following
15314profiling functions are called with the address of the current
15315function and its call site.  (On some platforms,
15316@code{__builtin_return_address} does not work beyond the current
15317function, so the call site information may not be available to the
15318profiling functions otherwise.)
15319
15320@smallexample
15321void __cyg_profile_func_enter (void *this_fn,
15322                               void *call_site);
15323void __cyg_profile_func_exit  (void *this_fn,
15324                               void *call_site);
15325@end smallexample
15326
15327The first argument is the address of the start of the current function,
15328which may be looked up exactly in the symbol table.
15329
15330This instrumentation is also done for functions expanded inline in other
15331functions.  The profiling calls indicate where, conceptually, the
15332inline function is entered and exited.  This means that addressable
15333versions of such functions must be available.  If all your uses of a
15334function are expanded inline, this may mean an additional expansion of
15335code size.  If you use @code{extern inline} in your C code, an
15336addressable version of such functions must be provided.  (This is
15337normally the case anyway, but if you get lucky and the optimizer always
15338expands the functions inline, you might have gotten away without
15339providing static copies.)
15340
15341A function may be given the attribute @code{no_instrument_function}, in
15342which case this instrumentation is not done.  This can be used, for
15343example, for the profiling functions listed above, high-priority
15344interrupt routines, and any functions from which the profiling functions
15345cannot safely be called (perhaps signal handlers, if the profiling
15346routines generate output or allocate memory).
15347@xref{Common Function Attributes}.
15348
15349@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
15350@opindex finstrument-functions-exclude-file-list
15351
15352Set the list of functions that are excluded from instrumentation (see
15353the description of @option{-finstrument-functions}).  If the file that
15354contains a function definition matches with one of @var{file}, then
15355that function is not instrumented.  The match is done on substrings:
15356if the @var{file} parameter is a substring of the file name, it is
15357considered to be a match.
15358
15359For example:
15360
15361@smallexample
15362-finstrument-functions-exclude-file-list=/bits/stl,include/sys
15363@end smallexample
15364
15365@noindent
15366excludes any inline function defined in files whose pathnames
15367contain @file{/bits/stl} or @file{include/sys}.
15368
15369If, for some reason, you want to include letter @samp{,} in one of
15370@var{sym}, write @samp{\,}. For example,
15371@option{-finstrument-functions-exclude-file-list='\,\,tmp'}
15372(note the single quote surrounding the option).
15373
15374@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
15375@opindex finstrument-functions-exclude-function-list
15376
15377This is similar to @option{-finstrument-functions-exclude-file-list},
15378but this option sets the list of function names to be excluded from
15379instrumentation.  The function name to be matched is its user-visible
15380name, such as @code{vector<int> blah(const vector<int> &)}, not the
15381internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
15382match is done on substrings: if the @var{sym} parameter is a substring
15383of the function name, it is considered to be a match.  For C99 and C++
15384extended identifiers, the function name must be given in UTF-8, not
15385using universal character names.
15386
15387@item -fpatchable-function-entry=@var{N}[,@var{M}]
15388@opindex fpatchable-function-entry
15389Generate @var{N} NOPs right at the beginning
15390of each function, with the function entry point before the @var{M}th NOP.
15391If @var{M} is omitted, it defaults to @code{0} so the
15392function entry points to the address just at the first NOP.
15393The NOP instructions reserve extra space which can be used to patch in
15394any desired instrumentation at run time, provided that the code segment
15395is writable.  The amount of space is controllable indirectly via
15396the number of NOPs; the NOP instruction used corresponds to the instruction
15397emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
15398is target-specific and may also depend on the architecture variant and/or
15399other compilation options.
15400
15401For run-time identification, the starting addresses of these areas,
15402which correspond to their respective function entries minus @var{M},
15403are additionally collected in the @code{__patchable_function_entries}
15404section of the resulting binary.
15405
15406Note that the value of @code{__attribute__ ((patchable_function_entry
15407(N,M)))} takes precedence over command-line option
15408@option{-fpatchable-function-entry=N,M}.  This can be used to increase
15409the area size or to remove it completely on a single function.
15410If @code{N=0}, no pad location is recorded.
15411
15412The NOP instructions are inserted at---and maybe before, depending on
15413@var{M}---the function entry address, even before the prologue.
15414
15415The maximum value of @var{N} and @var{M} is 65535.
15416@end table
15417
15418
15419@node Preprocessor Options
15420@section Options Controlling the Preprocessor
15421@cindex preprocessor options
15422@cindex options, preprocessor
15423
15424These options control the C preprocessor, which is run on each C source
15425file before actual compilation.
15426
15427If you use the @option{-E} option, nothing is done except preprocessing.
15428Some of these options make sense only together with @option{-E} because
15429they cause the preprocessor output to be unsuitable for actual
15430compilation.
15431
15432In addition to the options listed here, there are a number of options
15433to control search paths for include files documented in
15434@ref{Directory Options}.
15435Options to control preprocessor diagnostics are listed in
15436@ref{Warning Options}.
15437
15438@table @gcctabopt
15439@include cppopts.texi
15440
15441@item -Wp,@var{option}
15442@opindex Wp
15443You can use @option{-Wp,@var{option}} to bypass the compiler driver
15444and pass @var{option} directly through to the preprocessor.  If
15445@var{option} contains commas, it is split into multiple options at the
15446commas.  However, many options are modified, translated or interpreted
15447by the compiler driver before being passed to the preprocessor, and
15448@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
15449interface is undocumented and subject to change, so whenever possible
15450you should avoid using @option{-Wp} and let the driver handle the
15451options instead.
15452
15453@item -Xpreprocessor @var{option}
15454@opindex Xpreprocessor
15455Pass @var{option} as an option to the preprocessor.  You can use this to
15456supply system-specific preprocessor options that GCC does not
15457recognize.
15458
15459If you want to pass an option that takes an argument, you must use
15460@option{-Xpreprocessor} twice, once for the option and once for the argument.
15461
15462@item -no-integrated-cpp
15463@opindex no-integrated-cpp
15464Perform preprocessing as a separate pass before compilation.
15465By default, GCC performs preprocessing as an integrated part of
15466input tokenization and parsing.
15467If this option is provided, the appropriate language front end
15468(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
15469and Objective-C, respectively) is instead invoked twice,
15470once for preprocessing only and once for actual compilation
15471of the preprocessed input.
15472This option may be useful in conjunction with the @option{-B} or
15473@option{-wrapper} options to specify an alternate preprocessor or
15474perform additional processing of the program source between
15475normal preprocessing and compilation.
15476
15477@item -flarge-source-files
15478@opindex flarge-source-files
15479Adjust GCC to expect large source files, at the expense of slower
15480compilation and higher memory usage.
15481
15482Specifically, GCC normally tracks both column numbers and line numbers
15483within source files and it normally prints both of these numbers in
15484diagnostics.  However, once it has processed a certain number of source
15485lines, it stops tracking column numbers and only tracks line numbers.
15486This means that diagnostics for later lines do not include column numbers.
15487It also means that options like @option{-Wmisleading-indentation} cease to work
15488at that point, although the compiler prints a note if this happens.
15489Passing @option{-flarge-source-files} significantly increases the number
15490of source lines that GCC can process before it stops tracking columns.
15491
15492@end table
15493
15494@node Assembler Options
15495@section Passing Options to the Assembler
15496
15497@c prevent bad page break with this line
15498You can pass options to the assembler.
15499
15500@table @gcctabopt
15501@item -Wa,@var{option}
15502@opindex Wa
15503Pass @var{option} as an option to the assembler.  If @var{option}
15504contains commas, it is split into multiple options at the commas.
15505
15506@item -Xassembler @var{option}
15507@opindex Xassembler
15508Pass @var{option} as an option to the assembler.  You can use this to
15509supply system-specific assembler options that GCC does not
15510recognize.
15511
15512If you want to pass an option that takes an argument, you must use
15513@option{-Xassembler} twice, once for the option and once for the argument.
15514
15515@end table
15516
15517@node Link Options
15518@section Options for Linking
15519@cindex link options
15520@cindex options, linking
15521
15522These options come into play when the compiler links object files into
15523an executable output file.  They are meaningless if the compiler is
15524not doing a link step.
15525
15526@table @gcctabopt
15527@cindex file names
15528@item @var{object-file-name}
15529A file name that does not end in a special recognized suffix is
15530considered to name an object file or library.  (Object files are
15531distinguished from libraries by the linker according to the file
15532contents.)  If linking is done, these object files are used as input
15533to the linker.
15534
15535@item -c
15536@itemx -S
15537@itemx -E
15538@opindex c
15539@opindex S
15540@opindex E
15541If any of these options is used, then the linker is not run, and
15542object file names should not be used as arguments.  @xref{Overall
15543Options}.
15544
15545@item -flinker-output=@var{type}
15546@opindex flinker-output
15547This option controls code generation of the link-time optimizer.  By
15548default the linker output is automatically determined by the linker
15549plugin.  For debugging the compiler and if incremental linking with a
15550non-LTO object file is desired, it may be useful to control the type
15551manually.
15552
15553If @var{type} is @samp{exec}, code generation produces a static
15554binary. In this case @option{-fpic} and @option{-fpie} are both
15555disabled.
15556
15557If @var{type} is @samp{dyn}, code generation produces a shared
15558library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
15559but not enabled automatically.  This allows to build shared libraries
15560without position-independent code on architectures where this is
15561possible, i.e.@: on x86.
15562
15563If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
15564executable. This results in similar optimizations as @samp{exec}
15565except that @option{-fpie} is not disabled if specified at compilation
15566time.
15567
15568If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
15569done.  The sections containing intermediate code for link-time optimization are
15570merged, pre-optimized, and output to the resulting object file. In addition, if
15571@option{-ffat-lto-objects} is specified, binary code is produced for future
15572non-LTO linking. The object file produced by incremental linking is smaller
15573than a static library produced from the same object files.  At link time the
15574result of incremental linking also loads faster than a static
15575library assuming that the majority of objects in the library are used.
15576
15577Finally @samp{nolto-rel} configures the compiler for incremental linking where
15578code generation is forced, a final binary is produced, and the intermediate
15579code for later link-time optimization is stripped. When multiple object files
15580are linked together the resulting code is better optimized than with
15581link-time optimizations disabled (for example, cross-module inlining
15582happens), but most of benefits of whole program optimizations are lost.
15583
15584During the incremental link (by @option{-r}) the linker plugin defaults to
15585@option{rel}. With current interfaces to GNU Binutils it is however not
15586possible to incrementally link LTO objects and non-LTO objects into a single
15587mixed object file.  If any of object files in incremental link cannot
15588be used for link-time optimization, the linker plugin issues a warning and
15589uses @samp{nolto-rel}. To maintain whole program optimization, it is
15590recommended to link such objects into static library instead. Alternatively it
15591is possible to use H.J. Lu's binutils with support for mixed objects.
15592
15593@item -fuse-ld=bfd
15594@opindex fuse-ld=bfd
15595Use the @command{bfd} linker instead of the default linker.
15596
15597@item -fuse-ld=gold
15598@opindex fuse-ld=gold
15599Use the @command{gold} linker instead of the default linker.
15600
15601@item -fuse-ld=lld
15602@opindex fuse-ld=lld
15603Use the LLVM @command{lld} linker instead of the default linker.
15604
15605@cindex Libraries
15606@item -l@var{library}
15607@itemx -l @var{library}
15608@opindex l
15609Search the library named @var{library} when linking.  (The second
15610alternative with the library as a separate argument is only for
15611POSIX compliance and is not recommended.)
15612
15613The @option{-l} option is passed directly to the linker by GCC.  Refer
15614to your linker documentation for exact details.  The general
15615description below applies to the GNU linker.
15616
15617The linker searches a standard list of directories for the library.
15618The directories searched include several standard system directories
15619plus any that you specify with @option{-L}.
15620
15621Static libraries are archives of object files, and have file names
15622like @file{lib@var{library}.a}.  Some targets also support shared
15623libraries, which typically have names like @file{lib@var{library}.so}.
15624If both static and shared libraries are found, the linker gives
15625preference to linking with the shared library unless the
15626@option{-static} option is used.
15627
15628It makes a difference where in the command you write this option; the
15629linker searches and processes libraries and object files in the order they
15630are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
15631after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
15632to functions in @samp{z}, those functions may not be loaded.
15633
15634@item -lobjc
15635@opindex lobjc
15636You need this special case of the @option{-l} option in order to
15637link an Objective-C or Objective-C++ program.
15638
15639@item -nostartfiles
15640@opindex nostartfiles
15641Do not use the standard system startup files when linking.
15642The standard system libraries are used normally, unless @option{-nostdlib},
15643@option{-nolibc}, or @option{-nodefaultlibs} is used.
15644
15645@item -nodefaultlibs
15646@opindex nodefaultlibs
15647Do not use the standard system libraries when linking.
15648Only the libraries you specify are passed to the linker, and options
15649specifying linkage of the system libraries, such as @option{-static-libgcc}
15650or @option{-shared-libgcc}, are ignored.
15651The standard startup files are used normally, unless @option{-nostartfiles}
15652is used.
15653
15654The compiler may generate calls to @code{memcmp},
15655@code{memset}, @code{memcpy} and @code{memmove}.
15656These entries are usually resolved by entries in
15657libc.  These entry points should be supplied through some other
15658mechanism when this option is specified.
15659
15660@item -nolibc
15661@opindex nolibc
15662Do not use the C library or system libraries tightly coupled with it when
15663linking.  Still link with the startup files, @file{libgcc} or toolchain
15664provided language support libraries such as @file{libgnat}, @file{libgfortran}
15665or @file{libstdc++} unless options preventing their inclusion are used as
15666well.  This typically removes @option{-lc} from the link command line, as well
15667as system libraries that normally go with it and become meaningless when
15668absence of a C library is assumed, for example @option{-lpthread} or
15669@option{-lm} in some configurations.  This is intended for bare-board
15670targets when there is indeed no C library available.
15671
15672@item -nostdlib
15673@opindex nostdlib
15674Do not use the standard system startup files or libraries when linking.
15675No startup files and only the libraries you specify are passed to
15676the linker, and options specifying linkage of the system libraries, such as
15677@option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
15678
15679The compiler may generate calls to @code{memcmp}, @code{memset},
15680@code{memcpy} and @code{memmove}.
15681These entries are usually resolved by entries in
15682libc.  These entry points should be supplied through some other
15683mechanism when this option is specified.
15684
15685@cindex @option{-lgcc}, use with @option{-nostdlib}
15686@cindex @option{-nostdlib} and unresolved references
15687@cindex unresolved references and @option{-nostdlib}
15688@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
15689@cindex @option{-nodefaultlibs} and unresolved references
15690@cindex unresolved references and @option{-nodefaultlibs}
15691One of the standard libraries bypassed by @option{-nostdlib} and
15692@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
15693which GCC uses to overcome shortcomings of particular machines, or special
15694needs for some languages.
15695(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
15696Collection (GCC) Internals},
15697for more discussion of @file{libgcc.a}.)
15698In most cases, you need @file{libgcc.a} even when you want to avoid
15699other standard libraries.  In other words, when you specify @option{-nostdlib}
15700or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
15701This ensures that you have no unresolved references to internal GCC
15702library subroutines.
15703(An example of such an internal subroutine is @code{__main}, used to ensure C++
15704constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
15705GNU Compiler Collection (GCC) Internals}.)
15706
15707@item -e @var{entry}
15708@itemx --entry=@var{entry}
15709@opindex e
15710@opindex entry
15711
15712Specify that the program entry point is @var{entry}.  The argument is
15713interpreted by the linker; the GNU linker accepts either a symbol name
15714or an address.
15715
15716@item -pie
15717@opindex pie
15718Produce a dynamically linked position independent executable on targets
15719that support it.  For predictable results, you must also specify the same
15720set of options used for compilation (@option{-fpie}, @option{-fPIE},
15721or model suboptions) when you specify this linker option.
15722
15723@item -no-pie
15724@opindex no-pie
15725Don't produce a dynamically linked position independent executable.
15726
15727@item -static-pie
15728@opindex static-pie
15729Produce a static position independent executable on targets that support
15730it.  A static position independent executable is similar to a static
15731executable, but can be loaded at any address without a dynamic linker.
15732For predictable results, you must also specify the same set of options
15733used for compilation (@option{-fpie}, @option{-fPIE}, or model
15734suboptions) when you specify this linker option.
15735
15736@item -pthread
15737@opindex pthread
15738Link with the POSIX threads library.  This option is supported on
15739GNU/Linux targets, most other Unix derivatives, and also on
15740x86 Cygwin and MinGW targets.  On some targets this option also sets
15741flags for the preprocessor, so it should be used consistently for both
15742compilation and linking.
15743
15744@item -r
15745@opindex r
15746Produce a relocatable object as output.  This is also known as partial
15747linking.
15748
15749@item -rdynamic
15750@opindex rdynamic
15751Pass the flag @option{-export-dynamic} to the ELF linker, on targets
15752that support it. This instructs the linker to add all symbols, not
15753only used ones, to the dynamic symbol table. This option is needed
15754for some uses of @code{dlopen} or to allow obtaining backtraces
15755from within a program.
15756
15757@item -s
15758@opindex s
15759Remove all symbol table and relocation information from the executable.
15760
15761@item -static
15762@opindex static
15763On systems that support dynamic linking, this overrides @option{-pie}
15764and prevents linking with the shared libraries.  On other systems, this
15765option has no effect.
15766
15767@item -shared
15768@opindex shared
15769Produce a shared object which can then be linked with other objects to
15770form an executable.  Not all systems support this option.  For predictable
15771results, you must also specify the same set of options used for compilation
15772(@option{-fpic}, @option{-fPIC}, or model suboptions) when
15773you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
15774needs to build supplementary stub code for constructors to work.  On
15775multi-libbed systems, @samp{gcc -shared} must select the correct support
15776libraries to link against.  Failing to supply the correct flags may lead
15777to subtle defects.  Supplying them in cases where they are not necessary
15778is innocuous.}
15779
15780@item -shared-libgcc
15781@itemx -static-libgcc
15782@opindex shared-libgcc
15783@opindex static-libgcc
15784On systems that provide @file{libgcc} as a shared library, these options
15785force the use of either the shared or static version, respectively.
15786If no shared version of @file{libgcc} was built when the compiler was
15787configured, these options have no effect.
15788
15789There are several situations in which an application should use the
15790shared @file{libgcc} instead of the static version.  The most common
15791of these is when the application wishes to throw and catch exceptions
15792across different shared libraries.  In that case, each of the libraries
15793as well as the application itself should use the shared @file{libgcc}.
15794
15795Therefore, the G++ driver automatically adds @option{-shared-libgcc}
15796whenever you build a shared library or a main executable, because C++
15797programs typically use exceptions, so this is the right thing to do.
15798
15799If, instead, you use the GCC driver to create shared libraries, you may
15800find that they are not always linked with the shared @file{libgcc}.
15801If GCC finds, at its configuration time, that you have a non-GNU linker
15802or a GNU linker that does not support option @option{--eh-frame-hdr},
15803it links the shared version of @file{libgcc} into shared libraries
15804by default.  Otherwise, it takes advantage of the linker and optimizes
15805away the linking with the shared version of @file{libgcc}, linking with
15806the static version of libgcc by default.  This allows exceptions to
15807propagate through such shared libraries, without incurring relocation
15808costs at library load time.
15809
15810However, if a library or main executable is supposed to throw or catch
15811exceptions, you must link it using the G++ driver, or using the option
15812@option{-shared-libgcc}, such that it is linked with the shared
15813@file{libgcc}.
15814
15815@item -static-libasan
15816@opindex static-libasan
15817When the @option{-fsanitize=address} option is used to link a program,
15818the GCC driver automatically links against @option{libasan}.  If
15819@file{libasan} is available as a shared library, and the @option{-static}
15820option is not used, then this links against the shared version of
15821@file{libasan}.  The @option{-static-libasan} option directs the GCC
15822driver to link @file{libasan} statically, without necessarily linking
15823other libraries statically.
15824
15825@item -static-libtsan
15826@opindex static-libtsan
15827When the @option{-fsanitize=thread} option is used to link a program,
15828the GCC driver automatically links against @option{libtsan}.  If
15829@file{libtsan} is available as a shared library, and the @option{-static}
15830option is not used, then this links against the shared version of
15831@file{libtsan}.  The @option{-static-libtsan} option directs the GCC
15832driver to link @file{libtsan} statically, without necessarily linking
15833other libraries statically.
15834
15835@item -static-liblsan
15836@opindex static-liblsan
15837When the @option{-fsanitize=leak} option is used to link a program,
15838the GCC driver automatically links against @option{liblsan}.  If
15839@file{liblsan} is available as a shared library, and the @option{-static}
15840option is not used, then this links against the shared version of
15841@file{liblsan}.  The @option{-static-liblsan} option directs the GCC
15842driver to link @file{liblsan} statically, without necessarily linking
15843other libraries statically.
15844
15845@item -static-libubsan
15846@opindex static-libubsan
15847When the @option{-fsanitize=undefined} option is used to link a program,
15848the GCC driver automatically links against @option{libubsan}.  If
15849@file{libubsan} is available as a shared library, and the @option{-static}
15850option is not used, then this links against the shared version of
15851@file{libubsan}.  The @option{-static-libubsan} option directs the GCC
15852driver to link @file{libubsan} statically, without necessarily linking
15853other libraries statically.
15854
15855@item -static-libstdc++
15856@opindex static-libstdc++
15857When the @command{g++} program is used to link a C++ program, it
15858normally automatically links against @option{libstdc++}.  If
15859@file{libstdc++} is available as a shared library, and the
15860@option{-static} option is not used, then this links against the
15861shared version of @file{libstdc++}.  That is normally fine.  However, it
15862is sometimes useful to freeze the version of @file{libstdc++} used by
15863the program without going all the way to a fully static link.  The
15864@option{-static-libstdc++} option directs the @command{g++} driver to
15865link @file{libstdc++} statically, without necessarily linking other
15866libraries statically.
15867
15868@item -symbolic
15869@opindex symbolic
15870Bind references to global symbols when building a shared object.  Warn
15871about any unresolved references (unless overridden by the link editor
15872option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
15873this option.
15874
15875@item -T @var{script}
15876@opindex T
15877@cindex linker script
15878Use @var{script} as the linker script.  This option is supported by most
15879systems using the GNU linker.  On some targets, such as bare-board
15880targets without an operating system, the @option{-T} option may be required
15881when linking to avoid references to undefined symbols.
15882
15883@item -Xlinker @var{option}
15884@opindex Xlinker
15885Pass @var{option} as an option to the linker.  You can use this to
15886supply system-specific linker options that GCC does not recognize.
15887
15888If you want to pass an option that takes a separate argument, you must use
15889@option{-Xlinker} twice, once for the option and once for the argument.
15890For example, to pass @option{-assert definitions}, you must write
15891@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
15892@option{-Xlinker "-assert definitions"}, because this passes the entire
15893string as a single argument, which is not what the linker expects.
15894
15895When using the GNU linker, it is usually more convenient to pass
15896arguments to linker options using the @option{@var{option}=@var{value}}
15897syntax than as separate arguments.  For example, you can specify
15898@option{-Xlinker -Map=output.map} rather than
15899@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
15900this syntax for command-line options.
15901
15902@item -Wl,@var{option}
15903@opindex Wl
15904Pass @var{option} as an option to the linker.  If @var{option} contains
15905commas, it is split into multiple options at the commas.  You can use this
15906syntax to pass an argument to the option.
15907For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
15908linker.  When using the GNU linker, you can also get the same effect with
15909@option{-Wl,-Map=output.map}.
15910
15911@item -u @var{symbol}
15912@opindex u
15913Pretend the symbol @var{symbol} is undefined, to force linking of
15914library modules to define it.  You can use @option{-u} multiple times with
15915different symbols to force loading of additional library modules.
15916
15917@item -z @var{keyword}
15918@opindex z
15919@option{-z} is passed directly on to the linker along with the keyword
15920@var{keyword}. See the section in the documentation of your linker for
15921permitted values and their meanings.
15922@end table
15923
15924@node Directory Options
15925@section Options for Directory Search
15926@cindex directory options
15927@cindex options, directory search
15928@cindex search path
15929
15930These options specify directories to search for header files, for
15931libraries and for parts of the compiler:
15932
15933@table @gcctabopt
15934@include cppdiropts.texi
15935
15936@item -iplugindir=@var{dir}
15937@opindex iplugindir=
15938Set the directory to search for plugins that are passed
15939by @option{-fplugin=@var{name}} instead of
15940@option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
15941to be used by the user, but only passed by the driver.
15942
15943@item -L@var{dir}
15944@opindex L
15945Add directory @var{dir} to the list of directories to be searched
15946for @option{-l}.
15947
15948@item -B@var{prefix}
15949@opindex B
15950This option specifies where to find the executables, libraries,
15951include files, and data files of the compiler itself.
15952
15953The compiler driver program runs one or more of the subprograms
15954@command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
15955@var{prefix} as a prefix for each program it tries to run, both with and
15956without @samp{@var{machine}/@var{version}/} for the corresponding target
15957machine and compiler version.
15958
15959For each subprogram to be run, the compiler driver first tries the
15960@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
15961is not specified, the driver tries two standard prefixes,
15962@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
15963those results in a file name that is found, the unmodified program
15964name is searched for using the directories specified in your
15965@env{PATH} environment variable.
15966
15967The compiler checks to see if the path provided by @option{-B}
15968refers to a directory, and if necessary it adds a directory
15969separator character at the end of the path.
15970
15971@option{-B} prefixes that effectively specify directory names also apply
15972to libraries in the linker, because the compiler translates these
15973options into @option{-L} options for the linker.  They also apply to
15974include files in the preprocessor, because the compiler translates these
15975options into @option{-isystem} options for the preprocessor.  In this case,
15976the compiler appends @samp{include} to the prefix.
15977
15978The runtime support file @file{libgcc.a} can also be searched for using
15979the @option{-B} prefix, if needed.  If it is not found there, the two
15980standard prefixes above are tried, and that is all.  The file is left
15981out of the link if it is not found by those means.
15982
15983Another way to specify a prefix much like the @option{-B} prefix is to use
15984the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
15985Variables}.
15986
15987As a special kludge, if the path provided by @option{-B} is
15988@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
159899, then it is replaced by @file{[dir/]include}.  This is to help
15990with boot-strapping the compiler.
15991
15992@item -no-canonical-prefixes
15993@opindex no-canonical-prefixes
15994Do not expand any symbolic links, resolve references to @samp{/../}
15995or @samp{/./}, or make the path absolute when generating a relative
15996prefix.
15997
15998@item --sysroot=@var{dir}
15999@opindex sysroot
16000Use @var{dir} as the logical root directory for headers and libraries.
16001For example, if the compiler normally searches for headers in
16002@file{/usr/include} and libraries in @file{/usr/lib}, it instead
16003searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
16004
16005If you use both this option and the @option{-isysroot} option, then
16006the @option{--sysroot} option applies to libraries, but the
16007@option{-isysroot} option applies to header files.
16008
16009The GNU linker (beginning with version 2.16) has the necessary support
16010for this option.  If your linker does not support this option, the
16011header file aspect of @option{--sysroot} still works, but the
16012library aspect does not.
16013
16014@item --no-sysroot-suffix
16015@opindex no-sysroot-suffix
16016For some targets, a suffix is added to the root directory specified
16017with @option{--sysroot}, depending on the other options used, so that
16018headers may for example be found in
16019@file{@var{dir}/@var{suffix}/usr/include} instead of
16020@file{@var{dir}/usr/include}.  This option disables the addition of
16021such a suffix.
16022
16023@end table
16024
16025@node Code Gen Options
16026@section Options for Code Generation Conventions
16027@cindex code generation conventions
16028@cindex options, code generation
16029@cindex run-time options
16030
16031These machine-independent options control the interface conventions
16032used in code generation.
16033
16034Most of them have both positive and negative forms; the negative form
16035of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
16036one of the forms is listed---the one that is not the default.  You
16037can figure out the other form by either removing @samp{no-} or adding
16038it.
16039
16040@table @gcctabopt
16041@item -fstack-reuse=@var{reuse-level}
16042@opindex fstack_reuse
16043This option controls stack space reuse for user declared local/auto variables
16044and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
16045@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
16046local variables and temporaries, @samp{named_vars} enables the reuse only for
16047user defined local variables with names, and @samp{none} disables stack reuse
16048completely. The default value is @samp{all}. The option is needed when the
16049program extends the lifetime of a scoped local variable or a compiler generated
16050temporary beyond the end point defined by the language.  When a lifetime of
16051a variable ends, and if the variable lives in memory, the optimizing compiler
16052has the freedom to reuse its stack space with other temporaries or scoped
16053local variables whose live range does not overlap with it. Legacy code extending
16054local lifetime is likely to break with the stack reuse optimization.
16055
16056For example,
16057
16058@smallexample
16059   int *p;
16060   @{
16061     int local1;
16062
16063     p = &local1;
16064     local1 = 10;
16065     ....
16066   @}
16067   @{
16068      int local2;
16069      local2 = 20;
16070      ...
16071   @}
16072
16073   if (*p == 10)  // out of scope use of local1
16074     @{
16075
16076     @}
16077@end smallexample
16078
16079Another example:
16080@smallexample
16081
16082   struct A
16083   @{
16084       A(int k) : i(k), j(k) @{ @}
16085       int i;
16086       int j;
16087   @};
16088
16089   A *ap;
16090
16091   void foo(const A& ar)
16092   @{
16093      ap = &ar;
16094   @}
16095
16096   void bar()
16097   @{
16098      foo(A(10)); // temp object's lifetime ends when foo returns
16099
16100      @{
16101        A a(20);
16102        ....
16103      @}
16104      ap->i+= 10;  // ap references out of scope temp whose space
16105                   // is reused with a. What is the value of ap->i?
16106   @}
16107
16108@end smallexample
16109
16110The lifetime of a compiler generated temporary is well defined by the C++
16111standard. When a lifetime of a temporary ends, and if the temporary lives
16112in memory, the optimizing compiler has the freedom to reuse its stack
16113space with other temporaries or scoped local variables whose live range
16114does not overlap with it. However some of the legacy code relies on
16115the behavior of older compilers in which temporaries' stack space is
16116not reused, the aggressive stack reuse can lead to runtime errors. This
16117option is used to control the temporary stack reuse optimization.
16118
16119@item -ftrapv
16120@opindex ftrapv
16121This option generates traps for signed overflow on addition, subtraction,
16122multiplication operations.
16123The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16124@option{-ftrapv} @option{-fwrapv} on the command-line results in
16125@option{-fwrapv} being effective.  Note that only active options override, so
16126using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16127results in @option{-ftrapv} being effective.
16128
16129@item -fwrapv
16130@opindex fwrapv
16131This option instructs the compiler to assume that signed arithmetic
16132overflow of addition, subtraction and multiplication wraps around
16133using twos-complement representation.  This flag enables some optimizations
16134and disables others.
16135The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
16136@option{-ftrapv} @option{-fwrapv} on the command-line results in
16137@option{-fwrapv} being effective.  Note that only active options override, so
16138using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
16139results in @option{-ftrapv} being effective.
16140
16141@item -fwrapv-pointer
16142@opindex fwrapv-pointer
16143This option instructs the compiler to assume that pointer arithmetic
16144overflow on addition and subtraction wraps around using twos-complement
16145representation.  This flag disables some optimizations which assume
16146pointer overflow is invalid.
16147
16148@item -fstrict-overflow
16149@opindex fstrict-overflow
16150This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
16151negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
16152
16153@item -fexceptions
16154@opindex fexceptions
16155Enable exception handling.  Generates extra code needed to propagate
16156exceptions.  For some targets, this implies GCC generates frame
16157unwind information for all functions, which can produce significant data
16158size overhead, although it does not affect execution.  If you do not
16159specify this option, GCC enables it by default for languages like
16160C++ that normally require exception handling, and disables it for
16161languages like C that do not normally require it.  However, you may need
16162to enable this option when compiling C code that needs to interoperate
16163properly with exception handlers written in C++.  You may also wish to
16164disable this option if you are compiling older C++ programs that don't
16165use exception handling.
16166
16167@item -fnon-call-exceptions
16168@opindex fnon-call-exceptions
16169Generate code that allows trapping instructions to throw exceptions.
16170Note that this requires platform-specific runtime support that does
16171not exist everywhere.  Moreover, it only allows @emph{trapping}
16172instructions to throw exceptions, i.e.@: memory references or floating-point
16173instructions.  It does not allow exceptions to be thrown from
16174arbitrary signal handlers such as @code{SIGALRM}.
16175
16176@item -fdelete-dead-exceptions
16177@opindex fdelete-dead-exceptions
16178Consider that instructions that may throw exceptions but don't otherwise
16179contribute to the execution of the program can be optimized away.
16180This option is enabled by default for the Ada compiler, as permitted by
16181the Ada language specification.
16182Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
16183
16184@item -funwind-tables
16185@opindex funwind-tables
16186Similar to @option{-fexceptions}, except that it just generates any needed
16187static data, but does not affect the generated code in any other way.
16188You normally do not need to enable this option; instead, a language processor
16189that needs this handling enables it on your behalf.
16190
16191@item -fasynchronous-unwind-tables
16192@opindex fasynchronous-unwind-tables
16193Generate unwind table in DWARF format, if supported by target machine.  The
16194table is exact at each instruction boundary, so it can be used for stack
16195unwinding from asynchronous events (such as debugger or garbage collector).
16196
16197@item -fno-gnu-unique
16198@opindex fno-gnu-unique
16199@opindex fgnu-unique
16200On systems with recent GNU assembler and C library, the C++ compiler
16201uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
16202of template static data members and static local variables in inline
16203functions are unique even in the presence of @code{RTLD_LOCAL}; this
16204is necessary to avoid problems with a library used by two different
16205@code{RTLD_LOCAL} plugins depending on a definition in one of them and
16206therefore disagreeing with the other one about the binding of the
16207symbol.  But this causes @code{dlclose} to be ignored for affected
16208DSOs; if your program relies on reinitialization of a DSO via
16209@code{dlclose} and @code{dlopen}, you can use
16210@option{-fno-gnu-unique}.
16211
16212@item -fpcc-struct-return
16213@opindex fpcc-struct-return
16214Return ``short'' @code{struct} and @code{union} values in memory like
16215longer ones, rather than in registers.  This convention is less
16216efficient, but it has the advantage of allowing intercallability between
16217GCC-compiled files and files compiled with other compilers, particularly
16218the Portable C Compiler (pcc).
16219
16220The precise convention for returning structures in memory depends
16221on the target configuration macros.
16222
16223Short structures and unions are those whose size and alignment match
16224that of some integer type.
16225
16226@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
16227switch is not binary compatible with code compiled with the
16228@option{-freg-struct-return} switch.
16229Use it to conform to a non-default application binary interface.
16230
16231@item -freg-struct-return
16232@opindex freg-struct-return
16233Return @code{struct} and @code{union} values in registers when possible.
16234This is more efficient for small structures than
16235@option{-fpcc-struct-return}.
16236
16237If you specify neither @option{-fpcc-struct-return} nor
16238@option{-freg-struct-return}, GCC defaults to whichever convention is
16239standard for the target.  If there is no standard convention, GCC
16240defaults to @option{-fpcc-struct-return}, except on targets where GCC is
16241the principal compiler.  In those cases, we can choose the standard, and
16242we chose the more efficient register return alternative.
16243
16244@strong{Warning:} code compiled with the @option{-freg-struct-return}
16245switch is not binary compatible with code compiled with the
16246@option{-fpcc-struct-return} switch.
16247Use it to conform to a non-default application binary interface.
16248
16249@item -fshort-enums
16250@opindex fshort-enums
16251Allocate to an @code{enum} type only as many bytes as it needs for the
16252declared range of possible values.  Specifically, the @code{enum} type
16253is equivalent to the smallest integer type that has enough room.
16254
16255@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
16256code that is not binary compatible with code generated without that switch.
16257Use it to conform to a non-default application binary interface.
16258
16259@item -fshort-wchar
16260@opindex fshort-wchar
16261Override the underlying type for @code{wchar_t} to be @code{short
16262unsigned int} instead of the default for the target.  This option is
16263useful for building programs to run under WINE@.
16264
16265@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
16266code that is not binary compatible with code generated without that switch.
16267Use it to conform to a non-default application binary interface.
16268
16269@item -fcommon
16270@opindex fcommon
16271@opindex fno-common
16272@cindex tentative definitions
16273In C code, this option controls the placement of global variables
16274defined without an initializer, known as @dfn{tentative definitions}
16275in the C standard.  Tentative definitions are distinct from declarations
16276of a variable with the @code{extern} keyword, which do not allocate storage.
16277
16278The default is @option{-fno-common}, which specifies that the compiler places
16279uninitialized global variables in the BSS section of the object file.
16280This inhibits the merging of tentative definitions by the linker so you get a
16281multiple-definition error if the same variable is accidentally defined in more
16282than one compilation unit.
16283
16284The @option{-fcommon} places uninitialized global variables in a common block.
16285This allows the linker to resolve all tentative definitions of the same variable
16286in different compilation units to the same object, or to a non-tentative
16287definition.  This behavior is inconsistent with C++, and on many targets implies
16288a speed and code size penalty on global variable references.  It is mainly
16289useful to enable legacy code to link without errors.
16290
16291@item -fno-ident
16292@opindex fno-ident
16293@opindex fident
16294Ignore the @code{#ident} directive.
16295
16296@item -finhibit-size-directive
16297@opindex finhibit-size-directive
16298Don't output a @code{.size} assembler directive, or anything else that
16299would cause trouble if the function is split in the middle, and the
16300two halves are placed at locations far apart in memory.  This option is
16301used when compiling @file{crtstuff.c}; you should not need to use it
16302for anything else.
16303
16304@item -fverbose-asm
16305@opindex fverbose-asm
16306Put extra commentary information in the generated assembly code to
16307make it more readable.  This option is generally only of use to those
16308who actually need to read the generated assembly code (perhaps while
16309debugging the compiler itself).
16310
16311@option{-fno-verbose-asm}, the default, causes the
16312extra information to be omitted and is useful when comparing two assembler
16313files.
16314
16315The added comments include:
16316
16317@itemize @bullet
16318
16319@item
16320information on the compiler version and command-line options,
16321
16322@item
16323the source code lines associated with the assembly instructions,
16324in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16325
16326@item
16327hints on which high-level expressions correspond to
16328the various assembly instruction operands.
16329
16330@end itemize
16331
16332For example, given this C source file:
16333
16334@smallexample
16335int test (int n)
16336@{
16337  int i;
16338  int total = 0;
16339
16340  for (i = 0; i < n; i++)
16341    total += i * i;
16342
16343  return total;
16344@}
16345@end smallexample
16346
16347compiling to (x86_64) assembly via @option{-S} and emitting the result
16348direct to stdout via @option{-o} @option{-}
16349
16350@smallexample
16351gcc -S test.c -fverbose-asm -Os -o -
16352@end smallexample
16353
16354gives output similar to this:
16355
16356@smallexample
16357	.file	"test.c"
16358# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16359  [...snip...]
16360# options passed:
16361  [...snip...]
16362
16363	.text
16364	.globl	test
16365	.type	test, @@function
16366test:
16367.LFB0:
16368	.cfi_startproc
16369# test.c:4:   int total = 0;
16370	xorl	%eax, %eax	# <retval>
16371# test.c:6:   for (i = 0; i < n; i++)
16372	xorl	%edx, %edx	# i
16373.L2:
16374# test.c:6:   for (i = 0; i < n; i++)
16375	cmpl	%edi, %edx	# n, i
16376	jge	.L5	#,
16377# test.c:7:     total += i * i;
16378	movl	%edx, %ecx	# i, tmp92
16379	imull	%edx, %ecx	# i, tmp92
16380# test.c:6:   for (i = 0; i < n; i++)
16381	incl	%edx	# i
16382# test.c:7:     total += i * i;
16383	addl	%ecx, %eax	# tmp92, <retval>
16384	jmp	.L2	#
16385.L5:
16386# test.c:10: @}
16387	ret
16388	.cfi_endproc
16389.LFE0:
16390	.size	test, .-test
16391	.ident	"GCC: (GNU) 7.0.0 20160809 (experimental)"
16392	.section	.note.GNU-stack,"",@@progbits
16393@end smallexample
16394
16395The comments are intended for humans rather than machines and hence the
16396precise format of the comments is subject to change.
16397
16398@item -frecord-gcc-switches
16399@opindex frecord-gcc-switches
16400This switch causes the command line used to invoke the
16401compiler to be recorded into the object file that is being created.
16402This switch is only implemented on some targets and the exact format
16403of the recording is target and binary file format dependent, but it
16404usually takes the form of a section containing ASCII text.  This
16405switch is related to the @option{-fverbose-asm} switch, but that
16406switch only records information in the assembler output file as
16407comments, so it never reaches the object file.
16408See also @option{-grecord-gcc-switches} for another
16409way of storing compiler options into the object file.
16410
16411@item -fpic
16412@opindex fpic
16413@cindex global offset table
16414@cindex PIC
16415Generate position-independent code (PIC) suitable for use in a shared
16416library, if supported for the target machine.  Such code accesses all
16417constant addresses through a global offset table (GOT)@.  The dynamic
16418loader resolves the GOT entries when the program starts (the dynamic
16419loader is not part of GCC; it is part of the operating system).  If
16420the GOT size for the linked executable exceeds a machine-specific
16421maximum size, you get an error message from the linker indicating that
16422@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
16423instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
16424on the m68k and RS/6000.  The x86 has no such limit.)
16425
16426Position-independent code requires special support, and therefore works
16427only on certain machines.  For the x86, GCC supports PIC for System V
16428but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
16429position-independent.
16430
16431When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16432are defined to 1.
16433
16434@item -fPIC
16435@opindex fPIC
16436If supported for the target machine, emit position-independent code,
16437suitable for dynamic linking and avoiding any limit on the size of the
16438global offset table.  This option makes a difference on AArch64, m68k,
16439PowerPC and SPARC@.
16440
16441Position-independent code requires special support, and therefore works
16442only on certain machines.
16443
16444When this flag is set, the macros @code{__pic__} and @code{__PIC__}
16445are defined to 2.
16446
16447@item -fpie
16448@itemx -fPIE
16449@opindex fpie
16450@opindex fPIE
16451These options are similar to @option{-fpic} and @option{-fPIC}, but the
16452generated position-independent code can be only linked into executables.
16453Usually these options are used to compile code that will be linked using
16454the @option{-pie} GCC option.
16455
16456@option{-fpie} and @option{-fPIE} both define the macros
16457@code{__pie__} and @code{__PIE__}.  The macros have the value 1
16458for @option{-fpie} and 2 for @option{-fPIE}.
16459
16460@item -fno-plt
16461@opindex fno-plt
16462@opindex fplt
16463Do not use the PLT for external function calls in position-independent code.
16464Instead, load the callee address at call sites from the GOT and branch to it.
16465This leads to more efficient code by eliminating PLT stubs and exposing
16466GOT loads to optimizations.  On architectures such as 32-bit x86 where
16467PLT stubs expect the GOT pointer in a specific register, this gives more
16468register allocation freedom to the compiler.
16469Lazy binding requires use of the PLT;
16470with @option{-fno-plt} all external symbols are resolved at load time.
16471
16472Alternatively, the function attribute @code{noplt} can be used to avoid calls
16473through the PLT for specific external functions.
16474
16475In position-dependent code, a few targets also convert calls to
16476functions that are marked to not use the PLT to use the GOT instead.
16477
16478@item -fno-jump-tables
16479@opindex fno-jump-tables
16480@opindex fjump-tables
16481Do not use jump tables for switch statements even where it would be
16482more efficient than other code generation strategies.  This option is
16483of use in conjunction with @option{-fpic} or @option{-fPIC} for
16484building code that forms part of a dynamic linker and cannot
16485reference the address of a jump table.  On some targets, jump tables
16486do not require a GOT and this option is not needed.
16487
16488@item -fno-bit-tests
16489@opindex fno-bit-tests
16490@opindex fbit-tests
16491Do not use bit tests for switch statements even where it would be
16492more efficient than other code generation strategies.
16493
16494@item -ffixed-@var{reg}
16495@opindex ffixed
16496Treat the register named @var{reg} as a fixed register; generated code
16497should never refer to it (except perhaps as a stack pointer, frame
16498pointer or in some other fixed role).
16499
16500@var{reg} must be the name of a register.  The register names accepted
16501are machine-specific and are defined in the @code{REGISTER_NAMES}
16502macro in the machine description macro file.
16503
16504This flag does not have a negative form, because it specifies a
16505three-way choice.
16506
16507@item -fcall-used-@var{reg}
16508@opindex fcall-used
16509Treat the register named @var{reg} as an allocable register that is
16510clobbered by function calls.  It may be allocated for temporaries or
16511variables that do not live across a call.  Functions compiled this way
16512do not save and restore the register @var{reg}.
16513
16514It is an error to use this flag with the frame pointer or stack pointer.
16515Use of this flag for other registers that have fixed pervasive roles in
16516the machine's execution model produces disastrous results.
16517
16518This flag does not have a negative form, because it specifies a
16519three-way choice.
16520
16521@item -fcall-saved-@var{reg}
16522@opindex fcall-saved
16523Treat the register named @var{reg} as an allocable register saved by
16524functions.  It may be allocated even for temporaries or variables that
16525live across a call.  Functions compiled this way save and restore
16526the register @var{reg} if they use it.
16527
16528It is an error to use this flag with the frame pointer or stack pointer.
16529Use of this flag for other registers that have fixed pervasive roles in
16530the machine's execution model produces disastrous results.
16531
16532A different sort of disaster results from the use of this flag for
16533a register in which function values may be returned.
16534
16535This flag does not have a negative form, because it specifies a
16536three-way choice.
16537
16538@item -fpack-struct[=@var{n}]
16539@opindex fpack-struct
16540Without a value specified, pack all structure members together without
16541holes.  When a value is specified (which must be a small power of two), pack
16542structure members according to this value, representing the maximum
16543alignment (that is, objects with default alignment requirements larger than
16544this are output potentially unaligned at the next fitting location.
16545
16546@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
16547code that is not binary compatible with code generated without that switch.
16548Additionally, it makes the code suboptimal.
16549Use it to conform to a non-default application binary interface.
16550
16551@item -fleading-underscore
16552@opindex fleading-underscore
16553This option and its counterpart, @option{-fno-leading-underscore}, forcibly
16554change the way C symbols are represented in the object file.  One use
16555is to help link with legacy assembly code.
16556
16557@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
16558generate code that is not binary compatible with code generated without that
16559switch.  Use it to conform to a non-default application binary interface.
16560Not all targets provide complete support for this switch.
16561
16562@item -ftls-model=@var{model}
16563@opindex ftls-model
16564Alter the thread-local storage model to be used (@pxref{Thread-Local}).
16565The @var{model} argument should be one of @samp{global-dynamic},
16566@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
16567Note that the choice is subject to optimization: the compiler may use
16568a more efficient model for symbols not visible outside of the translation
16569unit, or if @option{-fpic} is not given on the command line.
16570
16571The default without @option{-fpic} is @samp{initial-exec}; with
16572@option{-fpic} the default is @samp{global-dynamic}.
16573
16574@item -ftrampolines
16575@opindex ftrampolines
16576For targets that normally need trampolines for nested functions, always
16577generate them instead of using descriptors.  Otherwise, for targets that
16578do not need them, like for example HP-PA or IA-64, do nothing.
16579
16580A trampoline is a small piece of code that is created at run time on the
16581stack when the address of a nested function is taken, and is used to call
16582the nested function indirectly.  Therefore, it requires the stack to be
16583made executable in order for the program to work properly.
16584
16585@option{-fno-trampolines} is enabled by default on a language by language
16586basis to let the compiler avoid generating them, if it computes that this
16587is safe, and replace them with descriptors.  Descriptors are made up of data
16588only, but the generated code must be prepared to deal with them.  As of this
16589writing, @option{-fno-trampolines} is enabled by default only for Ada.
16590
16591Moreover, code compiled with @option{-ftrampolines} and code compiled with
16592@option{-fno-trampolines} are not binary compatible if nested functions are
16593present.  This option must therefore be used on a program-wide basis and be
16594manipulated with extreme care.
16595
16596@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
16597@opindex fvisibility
16598Set the default ELF image symbol visibility to the specified option---all
16599symbols are marked with this unless overridden within the code.
16600Using this feature can very substantially improve linking and
16601load times of shared object libraries, produce more optimized
16602code, provide near-perfect API export and prevent symbol clashes.
16603It is @strong{strongly} recommended that you use this in any shared objects
16604you distribute.
16605
16606Despite the nomenclature, @samp{default} always means public; i.e.,
16607available to be linked against from outside the shared object.
16608@samp{protected} and @samp{internal} are pretty useless in real-world
16609usage so the only other commonly used option is @samp{hidden}.
16610The default if @option{-fvisibility} isn't specified is
16611@samp{default}, i.e., make every symbol public.
16612
16613A good explanation of the benefits offered by ensuring ELF
16614symbols have the correct visibility is given by ``How To Write
16615Shared Libraries'' by Ulrich Drepper (which can be found at
16616@w{@uref{https://www.akkadia.org/drepper/}})---however a superior
16617solution made possible by this option to marking things hidden when
16618the default is public is to make the default hidden and mark things
16619public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
16620and @code{__attribute__ ((visibility("default")))} instead of
16621@code{__declspec(dllexport)} you get almost identical semantics with
16622identical syntax.  This is a great boon to those working with
16623cross-platform projects.
16624
16625For those adding visibility support to existing code, you may find
16626@code{#pragma GCC visibility} of use.  This works by you enclosing
16627the declarations you wish to set visibility for with (for example)
16628@code{#pragma GCC visibility push(hidden)} and
16629@code{#pragma GCC visibility pop}.
16630Bear in mind that symbol visibility should be viewed @strong{as
16631part of the API interface contract} and thus all new code should
16632always specify visibility when it is not the default; i.e., declarations
16633only for use within the local DSO should @strong{always} be marked explicitly
16634as hidden as so to avoid PLT indirection overheads---making this
16635abundantly clear also aids readability and self-documentation of the code.
16636Note that due to ISO C++ specification requirements, @code{operator new} and
16637@code{operator delete} must always be of default visibility.
16638
16639Be aware that headers from outside your project, in particular system
16640headers and headers from any other library you use, may not be
16641expecting to be compiled with visibility other than the default.  You
16642may need to explicitly say @code{#pragma GCC visibility push(default)}
16643before including any such headers.
16644
16645@code{extern} declarations are not affected by @option{-fvisibility}, so
16646a lot of code can be recompiled with @option{-fvisibility=hidden} with
16647no modifications.  However, this means that calls to @code{extern}
16648functions with no explicit visibility use the PLT, so it is more
16649effective to use @code{__attribute ((visibility))} and/or
16650@code{#pragma GCC visibility} to tell the compiler which @code{extern}
16651declarations should be treated as hidden.
16652
16653Note that @option{-fvisibility} does affect C++ vague linkage
16654entities. This means that, for instance, an exception class that is
16655be thrown between DSOs must be explicitly marked with default
16656visibility so that the @samp{type_info} nodes are unified between
16657the DSOs.
16658
16659An overview of these techniques, their benefits and how to use them
16660is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
16661
16662@item -fstrict-volatile-bitfields
16663@opindex fstrict-volatile-bitfields
16664This option should be used if accesses to volatile bit-fields (or other
16665structure fields, although the compiler usually honors those types
16666anyway) should use a single access of the width of the
16667field's type, aligned to a natural alignment if possible.  For
16668example, targets with memory-mapped peripheral registers might require
16669all such accesses to be 16 bits wide; with this flag you can
16670declare all peripheral bit-fields as @code{unsigned short} (assuming short
16671is 16 bits on these targets) to force GCC to use 16-bit accesses
16672instead of, perhaps, a more efficient 32-bit access.
16673
16674If this option is disabled, the compiler uses the most efficient
16675instruction.  In the previous example, that might be a 32-bit load
16676instruction, even though that accesses bytes that do not contain
16677any portion of the bit-field, or memory-mapped registers unrelated to
16678the one being updated.
16679
16680In some cases, such as when the @code{packed} attribute is applied to a
16681structure field, it may not be possible to access the field with a single
16682read or write that is correctly aligned for the target machine.  In this
16683case GCC falls back to generating multiple accesses rather than code that
16684will fault or truncate the result at run time.
16685
16686Note:  Due to restrictions of the C/C++11 memory model, write accesses are
16687not allowed to touch non bit-field members.  It is therefore recommended
16688to define all bits of the field's type as bit-field members.
16689
16690The default value of this option is determined by the application binary
16691interface for the target processor.
16692
16693@item -fsync-libcalls
16694@opindex fsync-libcalls
16695This option controls whether any out-of-line instance of the @code{__sync}
16696family of functions may be used to implement the C++11 @code{__atomic}
16697family of functions.
16698
16699The default value of this option is enabled, thus the only useful form
16700of the option is @option{-fno-sync-libcalls}.  This option is used in
16701the implementation of the @file{libatomic} runtime library.
16702
16703@end table
16704
16705@node Developer Options
16706@section GCC Developer Options
16707@cindex developer options
16708@cindex debugging GCC
16709@cindex debug dump options
16710@cindex dump options
16711@cindex compilation statistics
16712
16713This section describes command-line options that are primarily of
16714interest to GCC developers, including options to support compiler
16715testing and investigation of compiler bugs and compile-time
16716performance problems.  This includes options that produce debug dumps
16717at various points in the compilation; that print statistics such as
16718memory use and execution time; and that print information about GCC's
16719configuration, such as where it searches for libraries.  You should
16720rarely need to use any of these options for ordinary compilation and
16721linking tasks.
16722
16723Many developer options that cause GCC to dump output to a file take an
16724optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
16725or @samp{-} to dump to standard output, and @samp{stderr} for standard
16726error.
16727
16728If @samp{=@var{filename}} is omitted, a default dump file name is
16729constructed by concatenating the base dump file name, a pass number,
16730phase letter, and pass name.  The base dump file name is the name of
16731output file produced by the compiler if explicitly specified and not
16732an executable; otherwise it is the source file name.
16733The pass number is determined by the order passes are registered with
16734the compiler's pass manager.
16735This is generally the same as the order of execution, but passes
16736registered by plugins, target-specific passes, or passes that are
16737otherwise registered late are numbered higher than the pass named
16738@samp{final}, even if they are executed earlier.  The phase letter is
16739one of @samp{i} (inter-procedural analysis), @samp{l}
16740(language-specific), @samp{r} (RTL), or @samp{t} (tree).
16741The files are created in the directory of the output file.
16742
16743@table @gcctabopt
16744
16745@item -fcallgraph-info
16746@itemx -fcallgraph-info=@var{MARKERS}
16747@opindex fcallgraph-info
16748Makes the compiler output callgraph information for the program, on a
16749per-object-file basis.  The information is generated in the common VCG
16750format.  It can be decorated with additional, per-node and/or per-edge
16751information, if a list of comma-separated markers is additionally
16752specified.  When the @code{su} marker is specified, the callgraph is
16753decorated with stack usage information; it is equivalent to
16754@option{-fstack-usage}.  When the @code{da} marker is specified, the
16755callgraph is decorated with information about dynamically allocated
16756objects.
16757
16758When compiling with @option{-flto}, no callgraph information is output
16759along with the object file.  At LTO link time, @option{-fcallgraph-info}
16760may generate multiple callgraph information files next to intermediate
16761LTO output files.
16762
16763@item -d@var{letters}
16764@itemx -fdump-rtl-@var{pass}
16765@itemx -fdump-rtl-@var{pass}=@var{filename}
16766@opindex d
16767@opindex fdump-rtl-@var{pass}
16768Says to make debugging dumps during compilation at times specified by
16769@var{letters}.  This is used for debugging the RTL-based passes of the
16770compiler.
16771
16772Some @option{-d@var{letters}} switches have different meaning when
16773@option{-E} is used for preprocessing.  @xref{Preprocessor Options},
16774for information about preprocessor-specific dump options.
16775
16776Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
16777@option{-d} option @var{letters}.  Here are the possible
16778letters for use in @var{pass} and @var{letters}, and their meanings:
16779
16780@table @gcctabopt
16781
16782@item -fdump-rtl-alignments
16783@opindex fdump-rtl-alignments
16784Dump after branch alignments have been computed.
16785
16786@item -fdump-rtl-asmcons
16787@opindex fdump-rtl-asmcons
16788Dump after fixing rtl statements that have unsatisfied in/out constraints.
16789
16790@item -fdump-rtl-auto_inc_dec
16791@opindex fdump-rtl-auto_inc_dec
16792Dump after auto-inc-dec discovery.  This pass is only run on
16793architectures that have auto inc or auto dec instructions.
16794
16795@item -fdump-rtl-barriers
16796@opindex fdump-rtl-barriers
16797Dump after cleaning up the barrier instructions.
16798
16799@item -fdump-rtl-bbpart
16800@opindex fdump-rtl-bbpart
16801Dump after partitioning hot and cold basic blocks.
16802
16803@item -fdump-rtl-bbro
16804@opindex fdump-rtl-bbro
16805Dump after block reordering.
16806
16807@item -fdump-rtl-btl1
16808@itemx -fdump-rtl-btl2
16809@opindex fdump-rtl-btl2
16810@opindex fdump-rtl-btl2
16811@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
16812after the two branch
16813target load optimization passes.
16814
16815@item -fdump-rtl-bypass
16816@opindex fdump-rtl-bypass
16817Dump after jump bypassing and control flow optimizations.
16818
16819@item -fdump-rtl-combine
16820@opindex fdump-rtl-combine
16821Dump after the RTL instruction combination pass.
16822
16823@item -fdump-rtl-compgotos
16824@opindex fdump-rtl-compgotos
16825Dump after duplicating the computed gotos.
16826
16827@item -fdump-rtl-ce1
16828@itemx -fdump-rtl-ce2
16829@itemx -fdump-rtl-ce3
16830@opindex fdump-rtl-ce1
16831@opindex fdump-rtl-ce2
16832@opindex fdump-rtl-ce3
16833@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
16834@option{-fdump-rtl-ce3} enable dumping after the three
16835if conversion passes.
16836
16837@item -fdump-rtl-cprop_hardreg
16838@opindex fdump-rtl-cprop_hardreg
16839Dump after hard register copy propagation.
16840
16841@item -fdump-rtl-csa
16842@opindex fdump-rtl-csa
16843Dump after combining stack adjustments.
16844
16845@item -fdump-rtl-cse1
16846@itemx -fdump-rtl-cse2
16847@opindex fdump-rtl-cse1
16848@opindex fdump-rtl-cse2
16849@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
16850the two common subexpression elimination passes.
16851
16852@item -fdump-rtl-dce
16853@opindex fdump-rtl-dce
16854Dump after the standalone dead code elimination passes.
16855
16856@item -fdump-rtl-dbr
16857@opindex fdump-rtl-dbr
16858Dump after delayed branch scheduling.
16859
16860@item -fdump-rtl-dce1
16861@itemx -fdump-rtl-dce2
16862@opindex fdump-rtl-dce1
16863@opindex fdump-rtl-dce2
16864@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
16865the two dead store elimination passes.
16866
16867@item -fdump-rtl-eh
16868@opindex fdump-rtl-eh
16869Dump after finalization of EH handling code.
16870
16871@item -fdump-rtl-eh_ranges
16872@opindex fdump-rtl-eh_ranges
16873Dump after conversion of EH handling range regions.
16874
16875@item -fdump-rtl-expand
16876@opindex fdump-rtl-expand
16877Dump after RTL generation.
16878
16879@item -fdump-rtl-fwprop1
16880@itemx -fdump-rtl-fwprop2
16881@opindex fdump-rtl-fwprop1
16882@opindex fdump-rtl-fwprop2
16883@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
16884dumping after the two forward propagation passes.
16885
16886@item -fdump-rtl-gcse1
16887@itemx -fdump-rtl-gcse2
16888@opindex fdump-rtl-gcse1
16889@opindex fdump-rtl-gcse2
16890@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
16891after global common subexpression elimination.
16892
16893@item -fdump-rtl-init-regs
16894@opindex fdump-rtl-init-regs
16895Dump after the initialization of the registers.
16896
16897@item -fdump-rtl-initvals
16898@opindex fdump-rtl-initvals
16899Dump after the computation of the initial value sets.
16900
16901@item -fdump-rtl-into_cfglayout
16902@opindex fdump-rtl-into_cfglayout
16903Dump after converting to cfglayout mode.
16904
16905@item -fdump-rtl-ira
16906@opindex fdump-rtl-ira
16907Dump after iterated register allocation.
16908
16909@item -fdump-rtl-jump
16910@opindex fdump-rtl-jump
16911Dump after the second jump optimization.
16912
16913@item -fdump-rtl-loop2
16914@opindex fdump-rtl-loop2
16915@option{-fdump-rtl-loop2} enables dumping after the rtl
16916loop optimization passes.
16917
16918@item -fdump-rtl-mach
16919@opindex fdump-rtl-mach
16920Dump after performing the machine dependent reorganization pass, if that
16921pass exists.
16922
16923@item -fdump-rtl-mode_sw
16924@opindex fdump-rtl-mode_sw
16925Dump after removing redundant mode switches.
16926
16927@item -fdump-rtl-rnreg
16928@opindex fdump-rtl-rnreg
16929Dump after register renumbering.
16930
16931@item -fdump-rtl-outof_cfglayout
16932@opindex fdump-rtl-outof_cfglayout
16933Dump after converting from cfglayout mode.
16934
16935@item -fdump-rtl-peephole2
16936@opindex fdump-rtl-peephole2
16937Dump after the peephole pass.
16938
16939@item -fdump-rtl-postreload
16940@opindex fdump-rtl-postreload
16941Dump after post-reload optimizations.
16942
16943@item -fdump-rtl-pro_and_epilogue
16944@opindex fdump-rtl-pro_and_epilogue
16945Dump after generating the function prologues and epilogues.
16946
16947@item -fdump-rtl-sched1
16948@itemx -fdump-rtl-sched2
16949@opindex fdump-rtl-sched1
16950@opindex fdump-rtl-sched2
16951@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
16952after the basic block scheduling passes.
16953
16954@item -fdump-rtl-ree
16955@opindex fdump-rtl-ree
16956Dump after sign/zero extension elimination.
16957
16958@item -fdump-rtl-seqabstr
16959@opindex fdump-rtl-seqabstr
16960Dump after common sequence discovery.
16961
16962@item -fdump-rtl-shorten
16963@opindex fdump-rtl-shorten
16964Dump after shortening branches.
16965
16966@item -fdump-rtl-sibling
16967@opindex fdump-rtl-sibling
16968Dump after sibling call optimizations.
16969
16970@item -fdump-rtl-split1
16971@itemx -fdump-rtl-split2
16972@itemx -fdump-rtl-split3
16973@itemx -fdump-rtl-split4
16974@itemx -fdump-rtl-split5
16975@opindex fdump-rtl-split1
16976@opindex fdump-rtl-split2
16977@opindex fdump-rtl-split3
16978@opindex fdump-rtl-split4
16979@opindex fdump-rtl-split5
16980These options enable dumping after five rounds of
16981instruction splitting.
16982
16983@item -fdump-rtl-sms
16984@opindex fdump-rtl-sms
16985Dump after modulo scheduling.  This pass is only run on some
16986architectures.
16987
16988@item -fdump-rtl-stack
16989@opindex fdump-rtl-stack
16990Dump after conversion from GCC's ``flat register file'' registers to the
16991x87's stack-like registers.  This pass is only run on x86 variants.
16992
16993@item -fdump-rtl-subreg1
16994@itemx -fdump-rtl-subreg2
16995@opindex fdump-rtl-subreg1
16996@opindex fdump-rtl-subreg2
16997@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
16998the two subreg expansion passes.
16999
17000@item -fdump-rtl-unshare
17001@opindex fdump-rtl-unshare
17002Dump after all rtl has been unshared.
17003
17004@item -fdump-rtl-vartrack
17005@opindex fdump-rtl-vartrack
17006Dump after variable tracking.
17007
17008@item -fdump-rtl-vregs
17009@opindex fdump-rtl-vregs
17010Dump after converting virtual registers to hard registers.
17011
17012@item -fdump-rtl-web
17013@opindex fdump-rtl-web
17014Dump after live range splitting.
17015
17016@item -fdump-rtl-regclass
17017@itemx -fdump-rtl-subregs_of_mode_init
17018@itemx -fdump-rtl-subregs_of_mode_finish
17019@itemx -fdump-rtl-dfinit
17020@itemx -fdump-rtl-dfinish
17021@opindex fdump-rtl-regclass
17022@opindex fdump-rtl-subregs_of_mode_init
17023@opindex fdump-rtl-subregs_of_mode_finish
17024@opindex fdump-rtl-dfinit
17025@opindex fdump-rtl-dfinish
17026These dumps are defined but always produce empty files.
17027
17028@item -da
17029@itemx -fdump-rtl-all
17030@opindex da
17031@opindex fdump-rtl-all
17032Produce all the dumps listed above.
17033
17034@item -dA
17035@opindex dA
17036Annotate the assembler output with miscellaneous debugging information.
17037
17038@item -dD
17039@opindex dD
17040Dump all macro definitions, at the end of preprocessing, in addition to
17041normal output.
17042
17043@item -dH
17044@opindex dH
17045Produce a core dump whenever an error occurs.
17046
17047@item -dp
17048@opindex dp
17049Annotate the assembler output with a comment indicating which
17050pattern and alternative is used.  The length and cost of each instruction are
17051also printed.
17052
17053@item -dP
17054@opindex dP
17055Dump the RTL in the assembler output as a comment before each instruction.
17056Also turns on @option{-dp} annotation.
17057
17058@item -dx
17059@opindex dx
17060Just generate RTL for a function instead of compiling it.  Usually used
17061with @option{-fdump-rtl-expand}.
17062@end table
17063
17064@item -fdump-debug
17065@opindex fdump-debug
17066Dump debugging information generated during the debug
17067generation phase.
17068
17069@item -fdump-earlydebug
17070@opindex fdump-earlydebug
17071Dump debugging information generated during the early debug
17072generation phase.
17073
17074@item -fdump-noaddr
17075@opindex fdump-noaddr
17076When doing debugging dumps, suppress address output.  This makes it more
17077feasible to use diff on debugging dumps for compiler invocations with
17078different compiler binaries and/or different
17079text / bss / data / heap / stack / dso start locations.
17080
17081@item -freport-bug
17082@opindex freport-bug
17083Collect and dump debug information into a temporary file if an
17084internal compiler error (ICE) occurs.
17085
17086@item -fdump-unnumbered
17087@opindex fdump-unnumbered
17088When doing debugging dumps, suppress instruction numbers and address output.
17089This makes it more feasible to use diff on debugging dumps for compiler
17090invocations with different options, in particular with and without
17091@option{-g}.
17092
17093@item -fdump-unnumbered-links
17094@opindex fdump-unnumbered-links
17095When doing debugging dumps (see @option{-d} option above), suppress
17096instruction numbers for the links to the previous and next instructions
17097in a sequence.
17098
17099@item -fdump-ipa-@var{switch}
17100@itemx -fdump-ipa-@var{switch}-@var{options}
17101@opindex fdump-ipa
17102Control the dumping at various stages of inter-procedural analysis
17103language tree to a file.  The file name is generated by appending a
17104switch specific suffix to the source file name, and the file is created
17105in the same directory as the output file.  The following dumps are
17106possible:
17107
17108@table @samp
17109@item all
17110Enables all inter-procedural analysis dumps.
17111
17112@item cgraph
17113Dumps information about call-graph optimization, unused function removal,
17114and inlining decisions.
17115
17116@item inline
17117Dump after function inlining.
17118
17119@end table
17120
17121Additionally, the options @option{-optimized}, @option{-missed},
17122@option{-note}, and @option{-all} can be provided, with the same meaning
17123as for @option{-fopt-info}, defaulting to @option{-optimized}.
17124
17125For example, @option{-fdump-ipa-inline-optimized-missed} will emit
17126information on callsites that were inlined, along with callsites
17127that were not inlined.
17128
17129By default, the dump will contain messages about successful
17130optimizations (equivalent to @option{-optimized}) together with
17131low-level details about the analysis.
17132
17133@item -fdump-lang
17134@opindex fdump-lang
17135Dump language-specific information.  The file name is made by appending
17136@file{.lang} to the source file name.
17137
17138@item -fdump-lang-all
17139@itemx -fdump-lang-@var{switch}
17140@itemx -fdump-lang-@var{switch}-@var{options}
17141@itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
17142@opindex fdump-lang-all
17143@opindex fdump-lang
17144Control the dumping of language-specific information.  The @var{options}
17145and @var{filename} portions behave as described in the
17146@option{-fdump-tree} option.  The following @var{switch} values are
17147accepted:
17148
17149@table @samp
17150@item all
17151
17152Enable all language-specific dumps.
17153
17154@item class
17155Dump class hierarchy information.  Virtual table information is emitted
17156unless '@option{slim}' is specified.  This option is applicable to C++ only.
17157
17158@item module
17159Dump module information.  Options @option{lineno} (locations),
17160@option{graph} (reachability), @option{blocks} (clusters),
17161@option{uid} (serialization), @option{alias} (mergeable),
17162@option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
17163(macros) may provide additional information.  This option is
17164applicable to C++ only.
17165
17166@item raw
17167Dump the raw internal tree data.  This option is applicable to C++ only.
17168
17169@end table
17170
17171@item -fdump-passes
17172@opindex fdump-passes
17173Print on @file{stderr} the list of optimization passes that are turned
17174on and off by the current command-line options.
17175
17176@item -fdump-statistics-@var{option}
17177@opindex fdump-statistics
17178Enable and control dumping of pass statistics in a separate file.  The
17179file name is generated by appending a suffix ending in
17180@samp{.statistics} to the source file name, and the file is created in
17181the same directory as the output file.  If the @samp{-@var{option}}
17182form is used, @samp{-stats} causes counters to be summed over the
17183whole compilation unit while @samp{-details} dumps every event as
17184the passes generate them.  The default with no option is to sum
17185counters for each function compiled.
17186
17187@item -fdump-tree-all
17188@itemx -fdump-tree-@var{switch}
17189@itemx -fdump-tree-@var{switch}-@var{options}
17190@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
17191@opindex fdump-tree-all
17192@opindex fdump-tree
17193Control the dumping at various stages of processing the intermediate
17194language tree to a file.  If the @samp{-@var{options}}
17195form is used, @var{options} is a list of @samp{-} separated options
17196which control the details of the dump.  Not all options are applicable
17197to all dumps; those that are not meaningful are ignored.  The
17198following options are available
17199
17200@table @samp
17201@item address
17202Print the address of each node.  Usually this is not meaningful as it
17203changes according to the environment and source file.  Its primary use
17204is for tying up a dump file with a debug environment.
17205@item asmname
17206If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
17207in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
17208use working backward from mangled names in the assembly file.
17209@item slim
17210When dumping front-end intermediate representations, inhibit dumping
17211of members of a scope or body of a function merely because that scope
17212has been reached.  Only dump such items when they are directly reachable
17213by some other path.
17214
17215When dumping pretty-printed trees, this option inhibits dumping the
17216bodies of control structures.
17217
17218When dumping RTL, print the RTL in slim (condensed) form instead of
17219the default LISP-like representation.
17220@item raw
17221Print a raw representation of the tree.  By default, trees are
17222pretty-printed into a C-like representation.
17223@item details
17224Enable more detailed dumps (not honored by every dump option). Also
17225include information from the optimization passes.
17226@item stats
17227Enable dumping various statistics about the pass (not honored by every dump
17228option).
17229@item blocks
17230Enable showing basic block boundaries (disabled in raw dumps).
17231@item graph
17232For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
17233dump a representation of the control flow graph suitable for viewing with
17234GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
17235the file is pretty-printed as a subgraph, so that GraphViz can render them
17236all in a single plot.
17237
17238This option currently only works for RTL dumps, and the RTL is always
17239dumped in slim form.
17240@item vops
17241Enable showing virtual operands for every statement.
17242@item lineno
17243Enable showing line numbers for statements.
17244@item uid
17245Enable showing the unique ID (@code{DECL_UID}) for each variable.
17246@item verbose
17247Enable showing the tree dump for each statement.
17248@item eh
17249Enable showing the EH region number holding each statement.
17250@item scev
17251Enable showing scalar evolution analysis details.
17252@item optimized
17253Enable showing optimization information (only available in certain
17254passes).
17255@item missed
17256Enable showing missed optimization information (only available in certain
17257passes).
17258@item note
17259Enable other detailed optimization information (only available in
17260certain passes).
17261@item all
17262Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
17263and @option{lineno}.
17264@item optall
17265Turn on all optimization options, i.e., @option{optimized},
17266@option{missed}, and @option{note}.
17267@end table
17268
17269To determine what tree dumps are available or find the dump for a pass
17270of interest follow the steps below.
17271
17272@enumerate
17273@item
17274Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
17275look for a code that corresponds to the pass you are interested in.
17276For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
17277@code{tree-vrp2} correspond to the three Value Range Propagation passes.
17278The number at the end distinguishes distinct invocations of the same pass.
17279@item
17280To enable the creation of the dump file, append the pass code to
17281the @option{-fdump-} option prefix and invoke GCC with it.  For example,
17282to enable the dump from the Early Value Range Propagation pass, invoke
17283GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
17284specify the name of the dump file.  If you don't specify one, GCC
17285creates as described below.
17286@item
17287Find the pass dump in a file whose name is composed of three components
17288separated by a period: the name of the source file GCC was invoked to
17289compile, a numeric suffix indicating the pass number followed by the
17290letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
17291and finally the pass code.  For example, the Early VRP pass dump might
17292be in a file named @file{myfile.c.038t.evrp} in the current working
17293directory.  Note that the numeric codes are not stable and may change
17294from one version of GCC to another.
17295@end enumerate
17296
17297@item -fopt-info
17298@itemx -fopt-info-@var{options}
17299@itemx -fopt-info-@var{options}=@var{filename}
17300@opindex fopt-info
17301Controls optimization dumps from various optimization passes. If the
17302@samp{-@var{options}} form is used, @var{options} is a list of
17303@samp{-} separated option keywords to select the dump details and
17304optimizations.
17305
17306The @var{options} can be divided into three groups:
17307@enumerate
17308@item
17309options describing what kinds of messages should be emitted,
17310@item
17311options describing the verbosity of the dump, and
17312@item
17313options describing which optimizations should be included.
17314@end enumerate
17315The options from each group can be freely mixed as they are
17316non-overlapping. However, in case of any conflicts,
17317the later options override the earlier options on the command
17318line.
17319
17320The following options control which kinds of messages should be emitted:
17321
17322@table @samp
17323@item optimized
17324Print information when an optimization is successfully applied. It is
17325up to a pass to decide which information is relevant. For example, the
17326vectorizer passes print the source location of loops which are
17327successfully vectorized.
17328@item missed
17329Print information about missed optimizations. Individual passes
17330control which information to include in the output.
17331@item note
17332Print verbose information about optimizations, such as certain
17333transformations, more detailed messages about decisions etc.
17334@item all
17335Print detailed optimization information. This includes
17336@samp{optimized}, @samp{missed}, and @samp{note}.
17337@end table
17338
17339The following option controls the dump verbosity:
17340
17341@table @samp
17342@item internals
17343By default, only ``high-level'' messages are emitted. This option enables
17344additional, more detailed, messages, which are likely to only be of interest
17345to GCC developers.
17346@end table
17347
17348One or more of the following option keywords can be used to describe a
17349group of optimizations:
17350
17351@table @samp
17352@item ipa
17353Enable dumps from all interprocedural optimizations.
17354@item loop
17355Enable dumps from all loop optimizations.
17356@item inline
17357Enable dumps from all inlining optimizations.
17358@item omp
17359Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
17360@item vec
17361Enable dumps from all vectorization optimizations.
17362@item optall
17363Enable dumps from all optimizations. This is a superset of
17364the optimization groups listed above.
17365@end table
17366
17367If @var{options} is
17368omitted, it defaults to @samp{optimized-optall}, which means to dump messages
17369about successful optimizations from all the passes, omitting messages
17370that are treated as ``internals''.
17371
17372If the @var{filename} is provided, then the dumps from all the
17373applicable optimizations are concatenated into the @var{filename}.
17374Otherwise the dump is output onto @file{stderr}. Though multiple
17375@option{-fopt-info} options are accepted, only one of them can include
17376a @var{filename}. If other filenames are provided then all but the
17377first such option are ignored.
17378
17379Note that the output @var{filename} is overwritten
17380in case of multiple translation units. If a combined output from
17381multiple translation units is desired, @file{stderr} should be used
17382instead.
17383
17384In the following example, the optimization info is output to
17385@file{stderr}:
17386
17387@smallexample
17388gcc -O3 -fopt-info
17389@end smallexample
17390
17391This example:
17392@smallexample
17393gcc -O3 -fopt-info-missed=missed.all
17394@end smallexample
17395
17396@noindent
17397outputs missed optimization report from all the passes into
17398@file{missed.all}, and this one:
17399
17400@smallexample
17401gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17402@end smallexample
17403
17404@noindent
17405prints information about missed optimization opportunities from
17406vectorization passes on @file{stderr}.
17407Note that @option{-fopt-info-vec-missed} is equivalent to
17408@option{-fopt-info-missed-vec}.  The order of the optimization group
17409names and message types listed after @option{-fopt-info} does not matter.
17410
17411As another example,
17412@smallexample
17413gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17414@end smallexample
17415
17416@noindent
17417outputs information about missed optimizations as well as
17418optimized locations from all the inlining passes into
17419@file{inline.txt}.
17420
17421Finally, consider:
17422
17423@smallexample
17424gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17425@end smallexample
17426
17427@noindent
17428Here the two output filenames @file{vec.miss} and @file{loop.opt} are
17429in conflict since only one output file is allowed. In this case, only
17430the first option takes effect and the subsequent options are
17431ignored. Thus only @file{vec.miss} is produced which contains
17432dumps from the vectorizer about missed opportunities.
17433
17434@item -fsave-optimization-record
17435@opindex fsave-optimization-record
17436Write a SRCFILE.opt-record.json.gz file detailing what optimizations
17437were performed, for those optimizations that support @option{-fopt-info}.
17438
17439This option is experimental and the format of the data within the
17440compressed JSON file is subject to change.
17441
17442It is roughly equivalent to a machine-readable version of
17443@option{-fopt-info-all}, as a collection of messages with source file,
17444line number and column number, with the following additional data for
17445each message:
17446
17447@itemize @bullet
17448
17449@item
17450the execution count of the code being optimized, along with metadata about
17451whether this was from actual profile data, or just an estimate, allowing
17452consumers to prioritize messages by code hotness,
17453
17454@item
17455the function name of the code being optimized, where applicable,
17456
17457@item
17458the ``inlining chain'' for the code being optimized, so that when
17459a function is inlined into several different places (which might
17460themselves be inlined), the reader can distinguish between the copies,
17461
17462@item
17463objects identifying those parts of the message that refer to expressions,
17464statements or symbol-table nodes, which of these categories they are, and,
17465when available, their source code location,
17466
17467@item
17468the GCC pass that emitted the message, and
17469
17470@item
17471the location in GCC's own code from which the message was emitted
17472
17473@end itemize
17474
17475Additionally, some messages are logically nested within other
17476messages, reflecting implementation details of the optimization
17477passes.
17478
17479@item -fsched-verbose=@var{n}
17480@opindex fsched-verbose
17481On targets that use instruction scheduling, this option controls the
17482amount of debugging output the scheduler prints to the dump files.
17483
17484For @var{n} greater than zero, @option{-fsched-verbose} outputs the
17485same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
17486For @var{n} greater than one, it also output basic block probabilities,
17487detailed ready list information and unit/insn info.  For @var{n} greater
17488than two, it includes RTL at abort point, control-flow and regions info.
17489And for @var{n} over four, @option{-fsched-verbose} also includes
17490dependence info.
17491
17492
17493
17494@item -fenable-@var{kind}-@var{pass}
17495@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
17496@opindex fdisable-
17497@opindex fenable-
17498
17499This is a set of options that are used to explicitly disable/enable
17500optimization passes.  These options are intended for use for debugging GCC.
17501Compiler users should use regular options for enabling/disabling
17502passes instead.
17503
17504@table @gcctabopt
17505
17506@item -fdisable-ipa-@var{pass}
17507Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
17508statically invoked in the compiler multiple times, the pass name should be
17509appended with a sequential number starting from 1.
17510
17511@item -fdisable-rtl-@var{pass}
17512@itemx -fdisable-rtl-@var{pass}=@var{range-list}
17513Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
17514statically invoked in the compiler multiple times, the pass name should be
17515appended with a sequential number starting from 1.  @var{range-list} is a
17516comma-separated list of function ranges or assembler names.  Each range is a number
17517pair separated by a colon.  The range is inclusive in both ends.  If the range
17518is trivial, the number pair can be simplified as a single number.  If the
17519function's call graph node's @var{uid} falls within one of the specified ranges,
17520the @var{pass} is disabled for that function.  The @var{uid} is shown in the
17521function header of a dump file, and the pass names can be dumped by using
17522option @option{-fdump-passes}.
17523
17524@item -fdisable-tree-@var{pass}
17525@itemx -fdisable-tree-@var{pass}=@var{range-list}
17526Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
17527option arguments.
17528
17529@item -fenable-ipa-@var{pass}
17530Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
17531statically invoked in the compiler multiple times, the pass name should be
17532appended with a sequential number starting from 1.
17533
17534@item -fenable-rtl-@var{pass}
17535@itemx -fenable-rtl-@var{pass}=@var{range-list}
17536Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
17537description and examples.
17538
17539@item -fenable-tree-@var{pass}
17540@itemx -fenable-tree-@var{pass}=@var{range-list}
17541Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
17542of option arguments.
17543
17544@end table
17545
17546Here are some examples showing uses of these options.
17547
17548@smallexample
17549
17550# disable ccp1 for all functions
17551   -fdisable-tree-ccp1
17552# disable complete unroll for function whose cgraph node uid is 1
17553   -fenable-tree-cunroll=1
17554# disable gcse2 for functions at the following ranges [1,1],
17555# [300,400], and [400,1000]
17556# disable gcse2 for functions foo and foo2
17557   -fdisable-rtl-gcse2=foo,foo2
17558# disable early inlining
17559   -fdisable-tree-einline
17560# disable ipa inlining
17561   -fdisable-ipa-inline
17562# enable tree full unroll
17563   -fenable-tree-unroll
17564
17565@end smallexample
17566
17567@item -fchecking
17568@itemx -fchecking=@var{n}
17569@opindex fchecking
17570@opindex fno-checking
17571Enable internal consistency checking.  The default depends on
17572the compiler configuration.  @option{-fchecking=2} enables further
17573internal consistency checking that might affect code generation.
17574
17575@item -frandom-seed=@var{string}
17576@opindex frandom-seed
17577This option provides a seed that GCC uses in place of
17578random numbers in generating certain symbol names
17579that have to be different in every compiled file.  It is also used to
17580place unique stamps in coverage data files and the object files that
17581produce them.  You can use the @option{-frandom-seed} option to produce
17582reproducibly identical object files.
17583
17584The @var{string} can either be a number (decimal, octal or hex) or an
17585arbitrary string (in which case it's converted to a number by
17586computing CRC32).
17587
17588The @var{string} should be different for every file you compile.
17589
17590@item -save-temps
17591@opindex save-temps
17592Store the usual ``temporary'' intermediate files permanently; name them
17593as auxiliary output files, as specified described under
17594@option{-dumpbase} and @option{-dumpdir}.
17595
17596When used in combination with the @option{-x} command-line option,
17597@option{-save-temps} is sensible enough to avoid overwriting an
17598input source file with the same extension as an intermediate file.
17599The corresponding intermediate file may be obtained by renaming the
17600source file before using @option{-save-temps}.
17601
17602@item -save-temps=cwd
17603@opindex save-temps=cwd
17604Equivalent to @option{-save-temps -dumpdir ./}.
17605
17606@item -save-temps=obj
17607@opindex save-temps=obj
17608Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
17609@file{outdir/} is the directory of the output file specified after the
17610@option{-o} option, including any directory separators.  If the
17611@option{-o} option is not used, the @option{-save-temps=obj} switch
17612behaves like @option{-save-temps=cwd}.
17613
17614@item -time@r{[}=@var{file}@r{]}
17615@opindex time
17616Report the CPU time taken by each subprocess in the compilation
17617sequence.  For C source files, this is the compiler proper and assembler
17618(plus the linker if linking is done).
17619
17620Without the specification of an output file, the output looks like this:
17621
17622@smallexample
17623# cc1 0.12 0.01
17624# as 0.00 0.01
17625@end smallexample
17626
17627The first number on each line is the ``user time'', that is time spent
17628executing the program itself.  The second number is ``system time'',
17629time spent executing operating system routines on behalf of the program.
17630Both numbers are in seconds.
17631
17632With the specification of an output file, the output is appended to the
17633named file, and it looks like this:
17634
17635@smallexample
176360.12 0.01 cc1 @var{options}
176370.00 0.01 as @var{options}
17638@end smallexample
17639
17640The ``user time'' and the ``system time'' are moved before the program
17641name, and the options passed to the program are displayed, so that one
17642can later tell what file was being compiled, and with which options.
17643
17644@item -fdump-final-insns@r{[}=@var{file}@r{]}
17645@opindex fdump-final-insns
17646Dump the final internal representation (RTL) to @var{file}.  If the
17647optional argument is omitted (or if @var{file} is @code{.}), the name
17648of the dump file is determined by appending @code{.gkd} to the
17649dump base name, see @option{-dumpbase}.
17650
17651@item -fcompare-debug@r{[}=@var{opts}@r{]}
17652@opindex fcompare-debug
17653@opindex fno-compare-debug
17654If no error occurs during compilation, run the compiler a second time,
17655adding @var{opts} and @option{-fcompare-debug-second} to the arguments
17656passed to the second compilation.  Dump the final internal
17657representation in both compilations, and print an error if they differ.
17658
17659If the equal sign is omitted, the default @option{-gtoggle} is used.
17660
17661The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
17662and nonzero, implicitly enables @option{-fcompare-debug}.  If
17663@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
17664then it is used for @var{opts}, otherwise the default @option{-gtoggle}
17665is used.
17666
17667@option{-fcompare-debug=}, with the equal sign but without @var{opts},
17668is equivalent to @option{-fno-compare-debug}, which disables the dumping
17669of the final representation and the second compilation, preventing even
17670@env{GCC_COMPARE_DEBUG} from taking effect.
17671
17672To verify full coverage during @option{-fcompare-debug} testing, set
17673@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
17674which GCC rejects as an invalid option in any actual compilation
17675(rather than preprocessing, assembly or linking).  To get just a
17676warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
17677not overridden} will do.
17678
17679@item -fcompare-debug-second
17680@opindex fcompare-debug-second
17681This option is implicitly passed to the compiler for the second
17682compilation requested by @option{-fcompare-debug}, along with options to
17683silence warnings, and omitting other options that would cause the compiler
17684to produce output to files or to standard output as a side effect.  Dump
17685files and preserved temporary files are renamed so as to contain the
17686@code{.gk} additional extension during the second compilation, to avoid
17687overwriting those generated by the first.
17688
17689When this option is passed to the compiler driver, it causes the
17690@emph{first} compilation to be skipped, which makes it useful for little
17691other than debugging the compiler proper.
17692
17693@item -gtoggle
17694@opindex gtoggle
17695Turn off generation of debug info, if leaving out this option
17696generates it, or turn it on at level 2 otherwise.  The position of this
17697argument in the command line does not matter; it takes effect after all
17698other options are processed, and it does so only once, no matter how
17699many times it is given.  This is mainly intended to be used with
17700@option{-fcompare-debug}.
17701
17702@item -fvar-tracking-assignments-toggle
17703@opindex fvar-tracking-assignments-toggle
17704@opindex fno-var-tracking-assignments-toggle
17705Toggle @option{-fvar-tracking-assignments}, in the same way that
17706@option{-gtoggle} toggles @option{-g}.
17707
17708@item -Q
17709@opindex Q
17710Makes the compiler print out each function name as it is compiled, and
17711print some statistics about each pass when it finishes.
17712
17713@item -ftime-report
17714@opindex ftime-report
17715Makes the compiler print some statistics about the time consumed by each
17716pass when it finishes.
17717
17718@item -ftime-report-details
17719@opindex ftime-report-details
17720Record the time consumed by infrastructure parts separately for each pass.
17721
17722@item -fira-verbose=@var{n}
17723@opindex fira-verbose
17724Control the verbosity of the dump file for the integrated register allocator.
17725The default value is 5.  If the value @var{n} is greater or equal to 10,
17726the dump output is sent to stderr using the same format as @var{n} minus 10.
17727
17728@item -flto-report
17729@opindex flto-report
17730Prints a report with internal details on the workings of the link-time
17731optimizer.  The contents of this report vary from version to version.
17732It is meant to be useful to GCC developers when processing object
17733files in LTO mode (via @option{-flto}).
17734
17735Disabled by default.
17736
17737@item -flto-report-wpa
17738@opindex flto-report-wpa
17739Like @option{-flto-report}, but only print for the WPA phase of link-time
17740optimization.
17741
17742@item -fmem-report
17743@opindex fmem-report
17744Makes the compiler print some statistics about permanent memory
17745allocation when it finishes.
17746
17747@item -fmem-report-wpa
17748@opindex fmem-report-wpa
17749Makes the compiler print some statistics about permanent memory
17750allocation for the WPA phase only.
17751
17752@item -fpre-ipa-mem-report
17753@opindex fpre-ipa-mem-report
17754@item -fpost-ipa-mem-report
17755@opindex fpost-ipa-mem-report
17756Makes the compiler print some statistics about permanent memory
17757allocation before or after interprocedural optimization.
17758
17759@item -fprofile-report
17760@opindex fprofile-report
17761Makes the compiler print some statistics about consistency of the
17762(estimated) profile and effect of individual passes.
17763
17764@item -fstack-usage
17765@opindex fstack-usage
17766Makes the compiler output stack usage information for the program, on a
17767per-function basis.  The filename for the dump is made by appending
17768@file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
17769the output file, if explicitly specified and it is not an executable,
17770otherwise it is the basename of the source file.  An entry is made up
17771of three fields:
17772
17773@itemize
17774@item
17775The name of the function.
17776@item
17777A number of bytes.
17778@item
17779One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
17780@end itemize
17781
17782The qualifier @code{static} means that the function manipulates the stack
17783statically: a fixed number of bytes are allocated for the frame on function
17784entry and released on function exit; no stack adjustments are otherwise made
17785in the function.  The second field is this fixed number of bytes.
17786
17787The qualifier @code{dynamic} means that the function manipulates the stack
17788dynamically: in addition to the static allocation described above, stack
17789adjustments are made in the body of the function, for example to push/pop
17790arguments around function calls.  If the qualifier @code{bounded} is also
17791present, the amount of these adjustments is bounded at compile time and
17792the second field is an upper bound of the total amount of stack used by
17793the function.  If it is not present, the amount of these adjustments is
17794not bounded at compile time and the second field only represents the
17795bounded part.
17796
17797@item -fstats
17798@opindex fstats
17799Emit statistics about front-end processing at the end of the compilation.
17800This option is supported only by the C++ front end, and
17801the information is generally only useful to the G++ development team.
17802
17803@item -fdbg-cnt-list
17804@opindex fdbg-cnt-list
17805Print the name and the counter upper bound for all debug counters.
17806
17807
17808@item -fdbg-cnt=@var{counter-value-list}
17809@opindex fdbg-cnt
17810Set the internal debug counter lower and upper bound.  @var{counter-value-list}
17811is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
17812[:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
17813the name of the counter and list of closed intervals.
17814The @var{lower_bound} is optional and is zero
17815initialized if not set.
17816For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
17817@code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
17818eleventh invocation.
17819For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
17820
17821@item -print-file-name=@var{library}
17822@opindex print-file-name
17823Print the full absolute name of the library file @var{library} that
17824would be used when linking---and don't do anything else.  With this
17825option, GCC does not compile or link anything; it just prints the
17826file name.
17827
17828@item -print-multi-directory
17829@opindex print-multi-directory
17830Print the directory name corresponding to the multilib selected by any
17831other switches present in the command line.  This directory is supposed
17832to exist in @env{GCC_EXEC_PREFIX}.
17833
17834@item -print-multi-lib
17835@opindex print-multi-lib
17836Print the mapping from multilib directory names to compiler switches
17837that enable them.  The directory name is separated from the switches by
17838@samp{;}, and each switch starts with an @samp{@@} instead of the
17839@samp{-}, without spaces between multiple switches.  This is supposed to
17840ease shell processing.
17841
17842@item -print-multi-os-directory
17843@opindex print-multi-os-directory
17844Print the path to OS libraries for the selected
17845multilib, relative to some @file{lib} subdirectory.  If OS libraries are
17846present in the @file{lib} subdirectory and no multilibs are used, this is
17847usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
17848sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
17849@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
17850subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
17851
17852@item -print-multiarch
17853@opindex print-multiarch
17854Print the path to OS libraries for the selected multiarch,
17855relative to some @file{lib} subdirectory.
17856
17857@item -print-prog-name=@var{program}
17858@opindex print-prog-name
17859Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
17860
17861@item -print-libgcc-file-name
17862@opindex print-libgcc-file-name
17863Same as @option{-print-file-name=libgcc.a}.
17864
17865This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
17866but you do want to link with @file{libgcc.a}.  You can do:
17867
17868@smallexample
17869gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
17870@end smallexample
17871
17872@item -print-search-dirs
17873@opindex print-search-dirs
17874Print the name of the configured installation directory and a list of
17875program and library directories @command{gcc} searches---and don't do anything else.
17876
17877This is useful when @command{gcc} prints the error message
17878@samp{installation problem, cannot exec cpp0: No such file or directory}.
17879To resolve this you either need to put @file{cpp0} and the other compiler
17880components where @command{gcc} expects to find them, or you can set the environment
17881variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
17882Don't forget the trailing @samp{/}.
17883@xref{Environment Variables}.
17884
17885@item -print-sysroot
17886@opindex print-sysroot
17887Print the target sysroot directory that is used during
17888compilation.  This is the target sysroot specified either at configure
17889time or using the @option{--sysroot} option, possibly with an extra
17890suffix that depends on compilation options.  If no target sysroot is
17891specified, the option prints nothing.
17892
17893@item -print-sysroot-headers-suffix
17894@opindex print-sysroot-headers-suffix
17895Print the suffix added to the target sysroot when searching for
17896headers, or give an error if the compiler is not configured with such
17897a suffix---and don't do anything else.
17898
17899@item -dumpmachine
17900@opindex dumpmachine
17901Print the compiler's target machine (for example,
17902@samp{i686-pc-linux-gnu})---and don't do anything else.
17903
17904@item -dumpversion
17905@opindex dumpversion
17906Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
17907anything else.  This is the compiler version used in filesystem paths and
17908specs. Depending on how the compiler has been configured it can be just
17909a single number (major version), two numbers separated by a dot (major and
17910minor version) or three numbers separated by dots (major, minor and patchlevel
17911version).
17912
17913@item -dumpfullversion
17914@opindex dumpfullversion
17915Print the full compiler version---and don't do anything else. The output is
17916always three numbers separated by dots, major, minor and patchlevel version.
17917
17918@item -dumpspecs
17919@opindex dumpspecs
17920Print the compiler's built-in specs---and don't do anything else.  (This
17921is used when GCC itself is being built.)  @xref{Spec Files}.
17922@end table
17923
17924@node Submodel Options
17925@section Machine-Dependent Options
17926@cindex submodel options
17927@cindex specifying hardware config
17928@cindex hardware models and configurations, specifying
17929@cindex target-dependent options
17930@cindex machine-dependent options
17931
17932Each target machine supported by GCC can have its own options---for
17933example, to allow you to compile for a particular processor variant or
17934ABI, or to control optimizations specific to that machine.  By
17935convention, the names of machine-specific options start with
17936@samp{-m}.
17937
17938Some configurations of the compiler also support additional target-specific
17939options, usually for compatibility with other compilers on the same
17940platform.
17941
17942@c This list is ordered alphanumerically by subsection name.
17943@c It should be the same order and spelling as these options are listed
17944@c in Machine Dependent Options
17945
17946@menu
17947* AArch64 Options::
17948* Adapteva Epiphany Options::
17949* AMD GCN Options::
17950* ARC Options::
17951* ARM Options::
17952* AVR Options::
17953* Blackfin Options::
17954* C6X Options::
17955* CRIS Options::
17956* CR16 Options::
17957* C-SKY Options::
17958* Darwin Options::
17959* DEC Alpha Options::
17960* eBPF Options::
17961* FR30 Options::
17962* FT32 Options::
17963* FRV Options::
17964* GNU/Linux Options::
17965* H8/300 Options::
17966* HPPA Options::
17967* IA-64 Options::
17968* LM32 Options::
17969* M32C Options::
17970* M32R/D Options::
17971* M680x0 Options::
17972* MCore Options::
17973* MeP Options::
17974* MicroBlaze Options::
17975* MIPS Options::
17976* MMIX Options::
17977* MN10300 Options::
17978* Moxie Options::
17979* MSP430 Options::
17980* NDS32 Options::
17981* Nios II Options::
17982* Nvidia PTX Options::
17983* OpenRISC Options::
17984* PDP-11 Options::
17985* picoChip Options::
17986* PowerPC Options::
17987* PRU Options::
17988* RISC-V Options::
17989* RL78 Options::
17990* RS/6000 and PowerPC Options::
17991* RX Options::
17992* S/390 and zSeries Options::
17993* Score Options::
17994* SH Options::
17995* Solaris 2 Options::
17996* SPARC Options::
17997* System V Options::
17998* TILE-Gx Options::
17999* TILEPro Options::
18000* V850 Options::
18001* VAX Options::
18002* Visium Options::
18003* VMS Options::
18004* VxWorks Options::
18005* x86 Options::
18006* x86 Windows Options::
18007* Xstormy16 Options::
18008* Xtensa Options::
18009* zSeries Options::
18010@end menu
18011
18012@node AArch64 Options
18013@subsection AArch64 Options
18014@cindex AArch64 Options
18015
18016These options are defined for AArch64 implementations:
18017
18018@table @gcctabopt
18019
18020@item -mabi=@var{name}
18021@opindex mabi
18022Generate code for the specified data model.  Permissible values
18023are @samp{ilp32} for SysV-like data model where int, long int and pointers
18024are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
18025but long int and pointers are 64 bits.
18026
18027The default depends on the specific target configuration.  Note that
18028the LP64 and ILP32 ABIs are not link-compatible; you must compile your
18029entire program with the same ABI, and link with a compatible set of libraries.
18030
18031@item -mbig-endian
18032@opindex mbig-endian
18033Generate big-endian code.  This is the default when GCC is configured for an
18034@samp{aarch64_be-*-*} target.
18035
18036@item -mgeneral-regs-only
18037@opindex mgeneral-regs-only
18038Generate code which uses only the general-purpose registers.  This will prevent
18039the compiler from using floating-point and Advanced SIMD registers but will not
18040impose any restrictions on the assembler.
18041
18042@item -mlittle-endian
18043@opindex mlittle-endian
18044Generate little-endian code.  This is the default when GCC is configured for an
18045@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
18046
18047@item -mcmodel=tiny
18048@opindex mcmodel=tiny
18049Generate code for the tiny code model.  The program and its statically defined
18050symbols must be within 1MB of each other.  Programs can be statically or
18051dynamically linked.
18052
18053@item -mcmodel=small
18054@opindex mcmodel=small
18055Generate code for the small code model.  The program and its statically defined
18056symbols must be within 4GB of each other.  Programs can be statically or
18057dynamically linked.  This is the default code model.
18058
18059@item -mcmodel=large
18060@opindex mcmodel=large
18061Generate code for the large code model.  This makes no assumptions about
18062addresses and sizes of sections.  Programs can be statically linked only.  The
18063@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
18064@option{-fpic} and @option{-fPIC}.
18065
18066@item -mstrict-align
18067@itemx -mno-strict-align
18068@opindex mstrict-align
18069@opindex mno-strict-align
18070Avoid or allow generating memory accesses that may not be aligned on a natural
18071object boundary as described in the architecture specification.
18072
18073@item -momit-leaf-frame-pointer
18074@itemx -mno-omit-leaf-frame-pointer
18075@opindex momit-leaf-frame-pointer
18076@opindex mno-omit-leaf-frame-pointer
18077Omit or keep the frame pointer in leaf functions.  The former behavior is the
18078default.
18079
18080@item -mstack-protector-guard=@var{guard}
18081@itemx -mstack-protector-guard-reg=@var{reg}
18082@itemx -mstack-protector-guard-offset=@var{offset}
18083@opindex mstack-protector-guard
18084@opindex mstack-protector-guard-reg
18085@opindex mstack-protector-guard-offset
18086Generate stack protection code using canary at @var{guard}.  Supported
18087locations are @samp{global} for a global canary or @samp{sysreg} for a
18088canary in an appropriate system register.
18089
18090With the latter choice the options
18091@option{-mstack-protector-guard-reg=@var{reg}} and
18092@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
18093which system register to use as base register for reading the canary,
18094and from what offset from that base register. There is no default
18095register or offset as this is entirely for use within the Linux
18096kernel.
18097
18098@item -mtls-dialect=desc
18099@opindex mtls-dialect=desc
18100Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
18101of TLS variables.  This is the default.
18102
18103@item -mtls-dialect=traditional
18104@opindex mtls-dialect=traditional
18105Use traditional TLS as the thread-local storage mechanism for dynamic accesses
18106of TLS variables.
18107
18108@item -mtls-size=@var{size}
18109@opindex mtls-size
18110Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
18111This option requires binutils 2.26 or newer.
18112
18113@item -mfix-cortex-a53-835769
18114@itemx -mno-fix-cortex-a53-835769
18115@opindex mfix-cortex-a53-835769
18116@opindex mno-fix-cortex-a53-835769
18117Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
18118This involves inserting a NOP instruction between memory instructions and
1811964-bit integer multiply-accumulate instructions.
18120
18121@item -mfix-cortex-a53-843419
18122@itemx -mno-fix-cortex-a53-843419
18123@opindex mfix-cortex-a53-843419
18124@opindex mno-fix-cortex-a53-843419
18125Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
18126This erratum workaround is made at link time and this will only pass the
18127corresponding flag to the linker.
18128
18129@item -mlow-precision-recip-sqrt
18130@itemx -mno-low-precision-recip-sqrt
18131@opindex mlow-precision-recip-sqrt
18132@opindex mno-low-precision-recip-sqrt
18133Enable or disable the reciprocal square root approximation.
18134This option only has an effect if @option{-ffast-math} or
18135@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
18136precision of reciprocal square root results to about 16 bits for
18137single precision and to 32 bits for double precision.
18138
18139@item -mlow-precision-sqrt
18140@itemx -mno-low-precision-sqrt
18141@opindex mlow-precision-sqrt
18142@opindex mno-low-precision-sqrt
18143Enable or disable the square root approximation.
18144This option only has an effect if @option{-ffast-math} or
18145@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
18146precision of square root results to about 16 bits for
18147single precision and to 32 bits for double precision.
18148If enabled, it implies @option{-mlow-precision-recip-sqrt}.
18149
18150@item -mlow-precision-div
18151@itemx -mno-low-precision-div
18152@opindex mlow-precision-div
18153@opindex mno-low-precision-div
18154Enable or disable the division approximation.
18155This option only has an effect if @option{-ffast-math} or
18156@option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
18157precision of division results to about 16 bits for
18158single precision and to 32 bits for double precision.
18159
18160@item -mtrack-speculation
18161@itemx -mno-track-speculation
18162Enable or disable generation of additional code to track speculative
18163execution through conditional branches.  The tracking state can then
18164be used by the compiler when expanding calls to
18165@code{__builtin_speculation_safe_copy} to permit a more efficient code
18166sequence to be generated.
18167
18168@item -moutline-atomics
18169@itemx -mno-outline-atomics
18170Enable or disable calls to out-of-line helpers to implement atomic operations.
18171These helpers will, at runtime, determine if the LSE instructions from
18172ARMv8.1-A can be used; if not, they will use the load/store-exclusive
18173instructions that are present in the base ARMv8.0 ISA.
18174
18175This option is only applicable when compiling for the base ARMv8.0
18176instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
18177or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
18178used directly.  The same applies when using @option{-mcpu=} when the
18179selected cpu supports the @samp{lse} feature.
18180This option is on by default.
18181
18182@item -march=@var{name}
18183@opindex march
18184Specify the name of the target architecture and, optionally, one or
18185more feature modifiers.  This option has the form
18186@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
18187
18188The table below summarizes the permissible values for @var{arch}
18189and the features that they enable by default:
18190
18191@multitable @columnfractions 0.20 0.20 0.60
18192@headitem @var{arch} value @tab Architecture @tab Includes by default
18193@item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
18194@item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
18195@item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
18196@item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
18197@item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
18198@item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
18199@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
18200@item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
18201@end multitable
18202
18203The value @samp{native} is available on native AArch64 GNU/Linux and
18204causes the compiler to pick the architecture of the host system.  This
18205option has no effect if the compiler is unable to recognize the
18206architecture of the host system,
18207
18208The permissible values for @var{feature} are listed in the sub-section
18209on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18210Feature Modifiers}.  Where conflicting feature modifiers are
18211specified, the right-most feature is used.
18212
18213GCC uses @var{name} to determine what kind of instructions it can emit
18214when generating assembly code.  If @option{-march} is specified
18215without either of @option{-mtune} or @option{-mcpu} also being
18216specified, the code is tuned to perform well across a range of target
18217processors implementing the target architecture.
18218
18219@item -mtune=@var{name}
18220@opindex mtune
18221Specify the name of the target processor for which GCC should tune the
18222performance of the code.  Permissible values for this option are:
18223@samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18224@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18225@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18226@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
18227@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
18228@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
18229@samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
18230@samp{neoverse-n2}, @samp{neoverse-v1}, @samp{qdf24xx},
18231@samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
18232@samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
18233@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
18234@samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
18235@samp{octeontx2f95mm},
18236@samp{a64fx},
18237@samp{thunderx}, @samp{thunderxt88},
18238@samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
18239@samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
18240@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18241@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18242@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
18243@samp{cortex-r82}, @samp{cortex-x1}, @samp{native}.
18244
18245The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18246@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
18247@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
18248should tune for a big.LITTLE system.
18249
18250The value @samp{neoverse-512tvb} specifies that GCC should tune
18251for Neoverse cores that (a) implement SVE and (b) have a total vector
18252bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
18253tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
18254instructions a cycle and that can execute an equivalent number of SVE
18255arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
18256This is more general than tuning for a specific core like Neoverse V1
18257but is more specific than the default tuning described below.
18258
18259Additionally on native AArch64 GNU/Linux systems the value
18260@samp{native} tunes performance to the host system.  This option has no effect
18261if the compiler is unable to recognize the processor of the host system.
18262
18263Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
18264are specified, the code is tuned to perform well across a range
18265of target processors.
18266
18267This option cannot be suffixed by feature modifiers.
18268
18269@item -mcpu=@var{name}
18270@opindex mcpu
18271Specify the name of the target processor, optionally suffixed by one
18272or more feature modifiers.  This option has the form
18273@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
18274the permissible values for @var{cpu} are the same as those available
18275for @option{-mtune}.  The permissible values for @var{feature} are
18276documented in the sub-section on
18277@ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
18278Feature Modifiers}.  Where conflicting feature modifiers are
18279specified, the right-most feature is used.
18280
18281GCC uses @var{name} to determine what kind of instructions it can emit when
18282generating assembly code (as if by @option{-march}) and to determine
18283the target processor for which to tune for performance (as if
18284by @option{-mtune}).  Where this option is used in conjunction
18285with @option{-march} or @option{-mtune}, those options take precedence
18286over the appropriate part of this option.
18287
18288@option{-mcpu=neoverse-512tvb} is special in that it does not refer
18289to a specific core, but instead refers to all Neoverse cores that
18290(a) implement SVE and (b) have a total vector bandwidth of 512 bits
18291a cycle.  Unless overridden by @option{-march},
18292@option{-mcpu=neoverse-512tvb} generates code that can run on a
18293Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
18294these properties.  Unless overridden by @option{-mtune},
18295@option{-mcpu=neoverse-512tvb} tunes code in the same way as for
18296@option{-mtune=neoverse-512tvb}.
18297
18298@item -moverride=@var{string}
18299@opindex moverride
18300Override tuning decisions made by the back-end in response to a
18301@option{-mtune=} switch.  The syntax, semantics, and accepted values
18302for @var{string} in this option are not guaranteed to be consistent
18303across releases.
18304
18305This option is only intended to be useful when developing GCC.
18306
18307@item -mverbose-cost-dump
18308@opindex mverbose-cost-dump
18309Enable verbose cost model dumping in the debug dump files.  This option is
18310provided for use in debugging the compiler.
18311
18312@item -mpc-relative-literal-loads
18313@itemx -mno-pc-relative-literal-loads
18314@opindex mpc-relative-literal-loads
18315@opindex mno-pc-relative-literal-loads
18316Enable or disable PC-relative literal loads.  With this option literal pools are
18317accessed using a single instruction and emitted after each function.  This
18318limits the maximum size of functions to 1MB.  This is enabled by default for
18319@option{-mcmodel=tiny}.
18320
18321@item -msign-return-address=@var{scope}
18322@opindex msign-return-address
18323Select the function scope on which return address signing will be applied.
18324Permissible values are @samp{none}, which disables return address signing,
18325@samp{non-leaf}, which enables pointer signing for functions which are not leaf
18326functions, and @samp{all}, which enables pointer signing for all functions.  The
18327default value is @samp{none}. This option has been deprecated by
18328-mbranch-protection.
18329
18330@item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
18331@opindex mbranch-protection
18332Select the branch protection features to use.
18333@samp{none} is the default and turns off all types of branch protection.
18334@samp{standard} turns on all types of branch protection features.  If a feature
18335has additional tuning options, then @samp{standard} sets it to its standard
18336level.
18337@samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
18338level: signing functions that save the return address to memory (non-leaf
18339functions will practically always do this) using the a-key.  The optional
18340argument @samp{leaf} can be used to extend the signing to include leaf
18341functions.  The optional argument @samp{b-key} can be used to sign the functions
18342with the B-key instead of the A-key.
18343@samp{bti} turns on branch target identification mechanism.
18344
18345@item -mharden-sls=@var{opts}
18346@opindex mharden-sls
18347Enable compiler hardening against straight line speculation (SLS).
18348@var{opts} is a comma-separated list of the following options:
18349@table @samp
18350@item retbr
18351@item blr
18352@end table
18353In addition, @samp{-mharden-sls=all} enables all SLS hardening while
18354@samp{-mharden-sls=none} disables all SLS hardening.
18355
18356@item -msve-vector-bits=@var{bits}
18357@opindex msve-vector-bits
18358Specify the number of bits in an SVE vector register.  This option only has
18359an effect when SVE is enabled.
18360
18361GCC supports two forms of SVE code generation: ``vector-length
18362agnostic'' output that works with any size of vector register and
18363``vector-length specific'' output that allows GCC to make assumptions
18364about the vector length when it is useful for optimization reasons.
18365The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
18366@samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
18367Specifying @samp{scalable} selects vector-length agnostic
18368output.  At present @samp{-msve-vector-bits=128} also generates vector-length
18369agnostic output for big-endian targets.  All other values generate
18370vector-length specific code.  The behavior of these values may change
18371in future releases and no value except @samp{scalable} should be
18372relied on for producing code that is portable across different
18373hardware SVE vector lengths.
18374
18375The default is @samp{-msve-vector-bits=scalable}, which produces
18376vector-length agnostic code.
18377@end table
18378
18379@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
18380@anchor{aarch64-feature-modifiers}
18381@cindex @option{-march} feature modifiers
18382@cindex @option{-mcpu} feature modifiers
18383Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
18384the following and their inverses @option{no@var{feature}}:
18385
18386@table @samp
18387@item crc
18388Enable CRC extension.  This is on by default for
18389@option{-march=armv8.1-a}.
18390@item crypto
18391Enable Crypto extension.  This also enables Advanced SIMD and floating-point
18392instructions.
18393@item fp
18394Enable floating-point instructions.  This is on by default for all possible
18395values for options @option{-march} and @option{-mcpu}.
18396@item simd
18397Enable Advanced SIMD instructions.  This also enables floating-point
18398instructions.  This is on by default for all possible values for options
18399@option{-march} and @option{-mcpu}.
18400@item sve
18401Enable Scalable Vector Extension instructions.  This also enables Advanced
18402SIMD and floating-point instructions.
18403@item lse
18404Enable Large System Extension instructions.  This is on by default for
18405@option{-march=armv8.1-a}.
18406@item rdma
18407Enable Round Double Multiply Accumulate instructions.  This is on by default
18408for @option{-march=armv8.1-a}.
18409@item fp16
18410Enable FP16 extension.  This also enables floating-point instructions.
18411@item fp16fml
18412Enable FP16 fmla extension.  This also enables FP16 extensions and
18413floating-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.
18414
18415@item rcpc
18416Enable the RcPc extension.  This does not change code generation from GCC,
18417but is passed on to the assembler, enabling inline asm statements to use
18418instructions from the RcPc extension.
18419@item dotprod
18420Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
18421@item aes
18422Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
18423SIMD instructions.
18424@item sha2
18425Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
18426@item sha3
18427Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
18428instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
18429@item sm4
18430Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
18431Use of this option with architectures prior to Armv8.2-A is not supported.
18432@item profile
18433Enable the Statistical Profiling extension.  This option is only to enable the
18434extension at the assembler level and does not affect code generation.
18435@item rng
18436Enable the Armv8.5-a Random Number instructions.  This option is only to
18437enable the extension at the assembler level and does not affect code
18438generation.
18439@item memtag
18440Enable the Armv8.5-a Memory Tagging Extensions.
18441Use of this option with architectures prior to Armv8.5-A is not supported.
18442@item sb
18443Enable the Armv8-a Speculation Barrier instruction.  This option is only to
18444enable the extension at the assembler level and does not affect code
18445generation.  This option is enabled by default for @option{-march=armv8.5-a}.
18446@item ssbs
18447Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
18448is only to enable the extension at the assembler level and does not affect code
18449generation.  This option is enabled by default for @option{-march=armv8.5-a}.
18450@item predres
18451Enable the Armv8-a Execution and Data Prediction Restriction instructions.
18452This option is only to enable the extension at the assembler level and does
18453not affect code generation.  This option is enabled by default for
18454@option{-march=armv8.5-a}.
18455@item sve2
18456Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
18457instructions.
18458@item sve2-bitperm
18459Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
18460@item sve2-sm4
18461Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
18462@item sve2-aes
18463Enable SVE2 aes instructions.  This also enables SVE2 instructions.
18464@item sve2-sha3
18465Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
18466@item tme
18467Enable the Transactional Memory Extension.
18468@item i8mm
18469Enable 8-bit Integer Matrix Multiply instructions.  This also enables
18470Advanced SIMD and floating-point instructions.  This option is enabled by
18471default for @option{-march=armv8.6-a}.  Use of this option with architectures
18472prior to Armv8.2-A is not supported.
18473@item f32mm
18474Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
18475SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
18476not supported.
18477@item f64mm
18478Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
18479SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
18480not supported.
18481@item bf16
18482Enable brain half-precision floating-point instructions.  This also enables
18483Advanced SIMD and floating-point instructions.  This option is enabled by
18484default for @option{-march=armv8.6-a}.  Use of this option with architectures
18485prior to Armv8.2-A is not supported.
18486@item flagm
18487Enable the Flag Manipulation instructions Extension.
18488@item pauth
18489Enable the Pointer Authentication Extension.
18490
18491@end table
18492
18493Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
18494which implies @option{fp}.
18495Conversely, @option{nofp} implies @option{nosimd}, which implies
18496@option{nocrypto}, @option{noaes} and @option{nosha2}.
18497
18498@node Adapteva Epiphany Options
18499@subsection Adapteva Epiphany Options
18500
18501These @samp{-m} options are defined for Adapteva Epiphany:
18502
18503@table @gcctabopt
18504@item -mhalf-reg-file
18505@opindex mhalf-reg-file
18506Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
18507That allows code to run on hardware variants that lack these registers.
18508
18509@item -mprefer-short-insn-regs
18510@opindex mprefer-short-insn-regs
18511Preferentially allocate registers that allow short instruction generation.
18512This can result in increased instruction count, so this may either reduce or
18513increase overall code size.
18514
18515@item -mbranch-cost=@var{num}
18516@opindex mbranch-cost
18517Set the cost of branches to roughly @var{num} ``simple'' instructions.
18518This cost is only a heuristic and is not guaranteed to produce
18519consistent results across releases.
18520
18521@item -mcmove
18522@opindex mcmove
18523Enable the generation of conditional moves.
18524
18525@item -mnops=@var{num}
18526@opindex mnops
18527Emit @var{num} NOPs before every other generated instruction.
18528
18529@item -mno-soft-cmpsf
18530@opindex mno-soft-cmpsf
18531@opindex msoft-cmpsf
18532For single-precision floating-point comparisons, emit an @code{fsub} instruction
18533and test the flags.  This is faster than a software comparison, but can
18534get incorrect results in the presence of NaNs, or when two different small
18535numbers are compared such that their difference is calculated as zero.
18536The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
18537software comparisons.
18538
18539@item -mstack-offset=@var{num}
18540@opindex mstack-offset
18541Set the offset between the top of the stack and the stack pointer.
18542E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
18543can be used by leaf functions without stack allocation.
18544Values other than @samp{8} or @samp{16} are untested and unlikely to work.
18545Note also that this option changes the ABI; compiling a program with a
18546different stack offset than the libraries have been compiled with
18547generally does not work.
18548This option can be useful if you want to evaluate if a different stack
18549offset would give you better code, but to actually use a different stack
18550offset to build working programs, it is recommended to configure the
18551toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
18552
18553@item -mno-round-nearest
18554@opindex mno-round-nearest
18555@opindex mround-nearest
18556Make the scheduler assume that the rounding mode has been set to
18557truncating.  The default is @option{-mround-nearest}.
18558
18559@item -mlong-calls
18560@opindex mlong-calls
18561If not otherwise specified by an attribute, assume all calls might be beyond
18562the offset range of the @code{b} / @code{bl} instructions, and therefore load the
18563function address into a register before performing a (otherwise direct) call.
18564This is the default.
18565
18566@item -mshort-calls
18567@opindex short-calls
18568If not otherwise specified by an attribute, assume all direct calls are
18569in the range of the @code{b} / @code{bl} instructions, so use these instructions
18570for direct calls.  The default is @option{-mlong-calls}.
18571
18572@item -msmall16
18573@opindex msmall16
18574Assume addresses can be loaded as 16-bit unsigned values.  This does not
18575apply to function addresses for which @option{-mlong-calls} semantics
18576are in effect.
18577
18578@item -mfp-mode=@var{mode}
18579@opindex mfp-mode
18580Set the prevailing mode of the floating-point unit.
18581This determines the floating-point mode that is provided and expected
18582at function call and return time.  Making this mode match the mode you
18583predominantly need at function start can make your programs smaller and
18584faster by avoiding unnecessary mode switches.
18585
18586@var{mode} can be set to one the following values:
18587
18588@table @samp
18589@item caller
18590Any mode at function entry is valid, and retained or restored when
18591the function returns, and when it calls other functions.
18592This mode is useful for compiling libraries or other compilation units
18593you might want to incorporate into different programs with different
18594prevailing FPU modes, and the convenience of being able to use a single
18595object file outweighs the size and speed overhead for any extra
18596mode switching that might be needed, compared with what would be needed
18597with a more specific choice of prevailing FPU mode.
18598
18599@item truncate
18600This is the mode used for floating-point calculations with
18601truncating (i.e.@: round towards zero) rounding mode.  That includes
18602conversion from floating point to integer.
18603
18604@item round-nearest
18605This is the mode used for floating-point calculations with
18606round-to-nearest-or-even rounding mode.
18607
18608@item int
18609This is the mode used to perform integer calculations in the FPU, e.g.@:
18610integer multiply, or integer multiply-and-accumulate.
18611@end table
18612
18613The default is @option{-mfp-mode=caller}
18614
18615@item -mno-split-lohi
18616@itemx -mno-postinc
18617@itemx -mno-postmodify
18618@opindex mno-split-lohi
18619@opindex msplit-lohi
18620@opindex mno-postinc
18621@opindex mpostinc
18622@opindex mno-postmodify
18623@opindex mpostmodify
18624Code generation tweaks that disable, respectively, splitting of 32-bit
18625loads, generation of post-increment addresses, and generation of
18626post-modify addresses.  The defaults are @option{msplit-lohi},
18627@option{-mpost-inc}, and @option{-mpost-modify}.
18628
18629@item -mnovect-double
18630@opindex mno-vect-double
18631@opindex mvect-double
18632Change the preferred SIMD mode to SImode.  The default is
18633@option{-mvect-double}, which uses DImode as preferred SIMD mode.
18634
18635@item -max-vect-align=@var{num}
18636@opindex max-vect-align
18637The maximum alignment for SIMD vector mode types.
18638@var{num} may be 4 or 8.  The default is 8.
18639Note that this is an ABI change, even though many library function
18640interfaces are unaffected if they don't use SIMD vector modes
18641in places that affect size and/or alignment of relevant types.
18642
18643@item -msplit-vecmove-early
18644@opindex msplit-vecmove-early
18645Split vector moves into single word moves before reload.  In theory this
18646can give better register allocation, but so far the reverse seems to be
18647generally the case.
18648
18649@item -m1reg-@var{reg}
18650@opindex m1reg-
18651Specify a register to hold the constant @minus{}1, which makes loading small negative
18652constants and certain bitmasks faster.
18653Allowable values for @var{reg} are @samp{r43} and @samp{r63},
18654which specify use of that register as a fixed register,
18655and @samp{none}, which means that no register is used for this
18656purpose.  The default is @option{-m1reg-none}.
18657
18658@end table
18659
18660@node AMD GCN Options
18661@subsection AMD GCN Options
18662@cindex AMD GCN Options
18663
18664These options are defined specifically for the AMD GCN port.
18665
18666@table @gcctabopt
18667
18668@item -march=@var{gpu}
18669@opindex march
18670@itemx -mtune=@var{gpu}
18671@opindex mtune
18672Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
18673are
18674
18675@table @samp
18676@opindex fiji
18677@item fiji
18678Compile for GCN3 Fiji devices (gfx803).
18679
18680@item gfx900
18681Compile for GCN5 Vega 10 devices (gfx900).
18682
18683@item gfx906
18684Compile for GCN5 Vega 20 devices (gfx906).
18685
18686@end table
18687
18688@item -mstack-size=@var{bytes}
18689@opindex mstack-size
18690Specify how many @var{bytes} of stack space will be requested for each GPU
18691thread (wave-front).  Beware that there may be many threads and limited memory
18692available.  The size of the stack allocation may also have an impact on
18693run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
186941MB otherwise.
18695
18696@end table
18697
18698@node ARC Options
18699@subsection ARC Options
18700@cindex ARC options
18701
18702The following options control the architecture variant for which code
18703is being compiled:
18704
18705@c architecture variants
18706@table @gcctabopt
18707
18708@item -mbarrel-shifter
18709@opindex mbarrel-shifter
18710Generate instructions supported by barrel shifter.  This is the default
18711unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
18712
18713@item -mjli-always
18714@opindex mjli-alawys
18715Force to call a function using jli_s instruction.  This option is
18716valid only for ARCv2 architecture.
18717
18718@item -mcpu=@var{cpu}
18719@opindex mcpu
18720Set architecture type, register usage, and instruction scheduling
18721parameters for @var{cpu}.  There are also shortcut alias options
18722available for backward compatibility and convenience.  Supported
18723values for @var{cpu} are
18724
18725@table @samp
18726@opindex mA6
18727@opindex mARC600
18728@item arc600
18729Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
18730
18731@item arc601
18732@opindex mARC601
18733Compile for ARC601.  Alias: @option{-mARC601}.
18734
18735@item arc700
18736@opindex mA7
18737@opindex mARC700
18738Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
18739This is the default when configured with @option{--with-cpu=arc700}@.
18740
18741@item arcem
18742Compile for ARC EM.
18743
18744@item archs
18745Compile for ARC HS.
18746
18747@item em
18748Compile for ARC EM CPU with no hardware extensions.
18749
18750@item em4
18751Compile for ARC EM4 CPU.
18752
18753@item em4_dmips
18754Compile for ARC EM4 DMIPS CPU.
18755
18756@item em4_fpus
18757Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
18758extension.
18759
18760@item em4_fpuda
18761Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
18762double assist instructions.
18763
18764@item hs
18765Compile for ARC HS CPU with no hardware extensions except the atomic
18766instructions.
18767
18768@item hs34
18769Compile for ARC HS34 CPU.
18770
18771@item hs38
18772Compile for ARC HS38 CPU.
18773
18774@item hs38_linux
18775Compile for ARC HS38 CPU with all hardware extensions on.
18776
18777@item arc600_norm
18778Compile for ARC 600 CPU with @code{norm} instructions enabled.
18779
18780@item arc600_mul32x16
18781Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
18782instructions enabled.
18783
18784@item arc600_mul64
18785Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
18786instructions enabled.
18787
18788@item arc601_norm
18789Compile for ARC 601 CPU with @code{norm} instructions enabled.
18790
18791@item arc601_mul32x16
18792Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
18793instructions enabled.
18794
18795@item arc601_mul64
18796Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
18797instructions enabled.
18798
18799@item nps400
18800Compile for ARC 700 on NPS400 chip.
18801
18802@item em_mini
18803Compile for ARC EM minimalist configuration featuring reduced register
18804set.
18805
18806@end table
18807
18808@item -mdpfp
18809@opindex mdpfp
18810@itemx -mdpfp-compact
18811@opindex mdpfp-compact
18812Generate double-precision FPX instructions, tuned for the compact
18813implementation.
18814
18815@item -mdpfp-fast
18816@opindex mdpfp-fast
18817Generate double-precision FPX instructions, tuned for the fast
18818implementation.
18819
18820@item -mno-dpfp-lrsr
18821@opindex mno-dpfp-lrsr
18822Disable @code{lr} and @code{sr} instructions from using FPX extension
18823aux registers.
18824
18825@item -mea
18826@opindex mea
18827Generate extended arithmetic instructions.  Currently only
18828@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
18829supported.  Only valid for @option{-mcpu=ARC700}.
18830
18831@item -mno-mpy
18832@opindex mno-mpy
18833@opindex mmpy
18834Do not generate @code{mpy}-family instructions for ARC700.  This option is
18835deprecated.
18836
18837@item -mmul32x16
18838@opindex mmul32x16
18839Generate 32x16-bit multiply and multiply-accumulate instructions.
18840
18841@item -mmul64
18842@opindex mmul64
18843Generate @code{mul64} and @code{mulu64} instructions.
18844Only valid for @option{-mcpu=ARC600}.
18845
18846@item -mnorm
18847@opindex mnorm
18848Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
18849is in effect.
18850
18851@item -mspfp
18852@opindex mspfp
18853@itemx -mspfp-compact
18854@opindex mspfp-compact
18855Generate single-precision FPX instructions, tuned for the compact
18856implementation.
18857
18858@item -mspfp-fast
18859@opindex mspfp-fast
18860Generate single-precision FPX instructions, tuned for the fast
18861implementation.
18862
18863@item -msimd
18864@opindex msimd
18865Enable generation of ARC SIMD instructions via target-specific
18866builtins.  Only valid for @option{-mcpu=ARC700}.
18867
18868@item -msoft-float
18869@opindex msoft-float
18870This option ignored; it is provided for compatibility purposes only.
18871Software floating-point code is emitted by default, and this default
18872can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
18873@option{-mspfp-fast} for single precision, and @option{-mdpfp},
18874@option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
18875
18876@item -mswap
18877@opindex mswap
18878Generate @code{swap} instructions.
18879
18880@item -matomic
18881@opindex matomic
18882This enables use of the locked load/store conditional extension to implement
18883atomic memory built-in functions.  Not available for ARC 6xx or ARC
18884EM cores.
18885
18886@item -mdiv-rem
18887@opindex mdiv-rem
18888Enable @code{div} and @code{rem} instructions for ARCv2 cores.
18889
18890@item -mcode-density
18891@opindex mcode-density
18892Enable code density instructions for ARC EM.
18893This option is on by default for ARC HS.
18894
18895@item -mll64
18896@opindex mll64
18897Enable double load/store operations for ARC HS cores.
18898
18899@item -mtp-regno=@var{regno}
18900@opindex mtp-regno
18901Specify thread pointer register number.
18902
18903@item -mmpy-option=@var{multo}
18904@opindex mmpy-option
18905Compile ARCv2 code with a multiplier design option.  You can specify
18906the option using either a string or numeric value for @var{multo}.
18907@samp{wlh1} is the default value.  The recognized values are:
18908
18909@table @samp
18910@item 0
18911@itemx none
18912No multiplier available.
18913
18914@item 1
18915@itemx w
1891616x16 multiplier, fully pipelined.
18917The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
18918
18919@item 2
18920@itemx wlh1
1892132x32 multiplier, fully
18922pipelined (1 stage).  The following instructions are additionally
18923enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18924
18925@item 3
18926@itemx wlh2
1892732x32 multiplier, fully pipelined
18928(2 stages).  The following instructions are additionally enabled: @code{mpy},
18929@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18930
18931@item 4
18932@itemx wlh3
18933Two 16x16 multipliers, blocking,
18934sequential.  The following instructions are additionally enabled: @code{mpy},
18935@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18936
18937@item 5
18938@itemx wlh4
18939One 16x16 multiplier, blocking,
18940sequential.  The following instructions are additionally enabled: @code{mpy},
18941@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18942
18943@item 6
18944@itemx wlh5
18945One 32x4 multiplier, blocking,
18946sequential.  The following instructions are additionally enabled: @code{mpy},
18947@code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
18948
18949@item 7
18950@itemx plus_dmpy
18951ARC HS SIMD support.
18952
18953@item 8
18954@itemx plus_macd
18955ARC HS SIMD support.
18956
18957@item 9
18958@itemx plus_qmacw
18959ARC HS SIMD support.
18960
18961@end table
18962
18963This option is only available for ARCv2 cores@.
18964
18965@item -mfpu=@var{fpu}
18966@opindex mfpu
18967Enables support for specific floating-point hardware extensions for ARCv2
18968cores.  Supported values for @var{fpu} are:
18969
18970@table @samp
18971
18972@item fpus
18973Enables support for single-precision floating-point hardware
18974extensions@.
18975
18976@item fpud
18977Enables support for double-precision floating-point hardware
18978extensions.  The single-precision floating-point extension is also
18979enabled.  Not available for ARC EM@.
18980
18981@item fpuda
18982Enables support for double-precision floating-point hardware
18983extensions using double-precision assist instructions.  The single-precision
18984floating-point extension is also enabled.  This option is
18985only available for ARC EM@.
18986
18987@item fpuda_div
18988Enables support for double-precision floating-point hardware
18989extensions using double-precision assist instructions.
18990The single-precision floating-point, square-root, and divide
18991extensions are also enabled.  This option is
18992only available for ARC EM@.
18993
18994@item fpuda_fma
18995Enables support for double-precision floating-point hardware
18996extensions using double-precision assist instructions.
18997The single-precision floating-point and fused multiply and add
18998hardware extensions are also enabled.  This option is
18999only available for ARC EM@.
19000
19001@item fpuda_all
19002Enables support for double-precision floating-point hardware
19003extensions using double-precision assist instructions.
19004All single-precision floating-point hardware extensions are also
19005enabled.  This option is only available for ARC EM@.
19006
19007@item fpus_div
19008Enables support for single-precision floating-point, square-root and divide
19009hardware extensions@.
19010
19011@item fpud_div
19012Enables support for double-precision floating-point, square-root and divide
19013hardware extensions.  This option
19014includes option @samp{fpus_div}. Not available for ARC EM@.
19015
19016@item fpus_fma
19017Enables support for single-precision floating-point and
19018fused multiply and add hardware extensions@.
19019
19020@item fpud_fma
19021Enables support for double-precision floating-point and
19022fused multiply and add hardware extensions.  This option
19023includes option @samp{fpus_fma}.  Not available for ARC EM@.
19024
19025@item fpus_all
19026Enables support for all single-precision floating-point hardware
19027extensions@.
19028
19029@item fpud_all
19030Enables support for all single- and double-precision floating-point
19031hardware extensions.  Not available for ARC EM@.
19032
19033@end table
19034
19035@item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
19036@opindex mirq-ctrl-saved
19037Specifies general-purposes registers that the processor automatically
19038saves/restores on interrupt entry and exit.  @var{register-range} is
19039specified as two registers separated by a dash.  The register range
19040always starts with @code{r0}, the upper limit is @code{fp} register.
19041@var{blink} and @var{lp_count} are optional.  This option is only
19042valid for ARC EM and ARC HS cores.
19043
19044@item -mrgf-banked-regs=@var{number}
19045@opindex mrgf-banked-regs
19046Specifies the number of registers replicated in second register bank
19047on entry to fast interrupt.  Fast interrupts are interrupts with the
19048highest priority level P0.  These interrupts save only PC and STATUS32
19049registers to avoid memory transactions during interrupt entry and exit
19050sequences.  Use this option when you are using fast interrupts in an
19051ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
19052
19053@item -mlpc-width=@var{width}
19054@opindex mlpc-width
19055Specify the width of the @code{lp_count} register.  Valid values for
19056@var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
19057fixed to 32 bits.  If the width is less than 32, the compiler does not
19058attempt to transform loops in your program to use the zero-delay loop
19059mechanism unless it is known that the @code{lp_count} register can
19060hold the required loop-counter value.  Depending on the width
19061specified, the compiler and run-time library might continue to use the
19062loop mechanism for various needs.  This option defines macro
19063@code{__ARC_LPC_WIDTH__} with the value of @var{width}.
19064
19065@item -mrf16
19066@opindex mrf16
19067This option instructs the compiler to generate code for a 16-entry
19068register file.  This option defines the @code{__ARC_RF16__}
19069preprocessor macro.
19070
19071@item -mbranch-index
19072@opindex mbranch-index
19073Enable use of @code{bi} or @code{bih} instructions to implement jump
19074tables.
19075
19076@end table
19077
19078The following options are passed through to the assembler, and also
19079define preprocessor macro symbols.
19080
19081@c Flags used by the assembler, but for which we define preprocessor
19082@c macro symbols as well.
19083@table @gcctabopt
19084@item -mdsp-packa
19085@opindex mdsp-packa
19086Passed down to the assembler to enable the DSP Pack A extensions.
19087Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
19088deprecated.
19089
19090@item -mdvbf
19091@opindex mdvbf
19092Passed down to the assembler to enable the dual Viterbi butterfly
19093extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
19094option is deprecated.
19095
19096@c ARC700 4.10 extension instruction
19097@item -mlock
19098@opindex mlock
19099Passed down to the assembler to enable the locked load/store
19100conditional extension.  Also sets the preprocessor symbol
19101@code{__Xlock}.
19102
19103@item -mmac-d16
19104@opindex mmac-d16
19105Passed down to the assembler.  Also sets the preprocessor symbol
19106@code{__Xxmac_d16}.  This option is deprecated.
19107
19108@item -mmac-24
19109@opindex mmac-24
19110Passed down to the assembler.  Also sets the preprocessor symbol
19111@code{__Xxmac_24}.  This option is deprecated.
19112
19113@c ARC700 4.10 extension instruction
19114@item -mrtsc
19115@opindex mrtsc
19116Passed down to the assembler to enable the 64-bit time-stamp counter
19117extension instruction.  Also sets the preprocessor symbol
19118@code{__Xrtsc}.  This option is deprecated.
19119
19120@c ARC700 4.10 extension instruction
19121@item -mswape
19122@opindex mswape
19123Passed down to the assembler to enable the swap byte ordering
19124extension instruction.  Also sets the preprocessor symbol
19125@code{__Xswape}.
19126
19127@item -mtelephony
19128@opindex mtelephony
19129Passed down to the assembler to enable dual- and single-operand
19130instructions for telephony.  Also sets the preprocessor symbol
19131@code{__Xtelephony}.  This option is deprecated.
19132
19133@item -mxy
19134@opindex mxy
19135Passed down to the assembler to enable the XY memory extension.  Also
19136sets the preprocessor symbol @code{__Xxy}.
19137
19138@end table
19139
19140The following options control how the assembly code is annotated:
19141
19142@c Assembly annotation options
19143@table @gcctabopt
19144@item -misize
19145@opindex misize
19146Annotate assembler instructions with estimated addresses.
19147
19148@item -mannotate-align
19149@opindex mannotate-align
19150Explain what alignment considerations lead to the decision to make an
19151instruction short or long.
19152
19153@end table
19154
19155The following options are passed through to the linker:
19156
19157@c options passed through to the linker
19158@table @gcctabopt
19159@item -marclinux
19160@opindex marclinux
19161Passed through to the linker, to specify use of the @code{arclinux} emulation.
19162This option is enabled by default in tool chains built for
19163@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
19164when profiling is not requested.
19165
19166@item -marclinux_prof
19167@opindex marclinux_prof
19168Passed through to the linker, to specify use of the
19169@code{arclinux_prof} emulation.  This option is enabled by default in
19170tool chains built for @w{@code{arc-linux-uclibc}} and
19171@w{@code{arceb-linux-uclibc}} targets when profiling is requested.
19172
19173@end table
19174
19175The following options control the semantics of generated code:
19176
19177@c semantically relevant code generation options
19178@table @gcctabopt
19179@item -mlong-calls
19180@opindex mlong-calls
19181Generate calls as register indirect calls, thus providing access
19182to the full 32-bit address range.
19183
19184@item -mmedium-calls
19185@opindex mmedium-calls
19186Don't use less than 25-bit addressing range for calls, which is the
19187offset available for an unconditional branch-and-link
19188instruction.  Conditional execution of function calls is suppressed, to
19189allow use of the 25-bit range, rather than the 21-bit range with
19190conditional branch-and-link.  This is the default for tool chains built
19191for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
19192
19193@item -G @var{num}
19194@opindex G
19195Put definitions of externally-visible data in a small data section if
19196that data is no bigger than @var{num} bytes.  The default value of
19197@var{num} is 4 for any ARC configuration, or 8 when we have double
19198load/store operations.
19199
19200@item -mno-sdata
19201@opindex mno-sdata
19202@opindex msdata
19203Do not generate sdata references.  This is the default for tool chains
19204built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
19205targets.
19206
19207@item -mvolatile-cache
19208@opindex mvolatile-cache
19209Use ordinarily cached memory accesses for volatile references.  This is the
19210default.
19211
19212@item -mno-volatile-cache
19213@opindex mno-volatile-cache
19214@opindex mvolatile-cache
19215Enable cache bypass for volatile references.
19216
19217@end table
19218
19219The following options fine tune code generation:
19220@c code generation tuning options
19221@table @gcctabopt
19222@item -malign-call
19223@opindex malign-call
19224Do alignment optimizations for call instructions.
19225
19226@item -mauto-modify-reg
19227@opindex mauto-modify-reg
19228Enable the use of pre/post modify with register displacement.
19229
19230@item -mbbit-peephole
19231@opindex mbbit-peephole
19232Enable bbit peephole2.
19233
19234@item -mno-brcc
19235@opindex mno-brcc
19236This option disables a target-specific pass in @file{arc_reorg} to
19237generate compare-and-branch (@code{br@var{cc}}) instructions.
19238It has no effect on
19239generation of these instructions driven by the combiner pass.
19240
19241@item -mcase-vector-pcrel
19242@opindex mcase-vector-pcrel
19243Use PC-relative switch case tables to enable case table shortening.
19244This is the default for @option{-Os}.
19245
19246@item -mcompact-casesi
19247@opindex mcompact-casesi
19248Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
19249and only available for ARCv1 cores.  This option is deprecated.
19250
19251@item -mno-cond-exec
19252@opindex mno-cond-exec
19253Disable the ARCompact-specific pass to generate conditional
19254execution instructions.
19255
19256Due to delay slot scheduling and interactions between operand numbers,
19257literal sizes, instruction lengths, and the support for conditional execution,
19258the target-independent pass to generate conditional execution is often lacking,
19259so the ARC port has kept a special pass around that tries to find more
19260conditional execution generation opportunities after register allocation,
19261branch shortening, and delay slot scheduling have been done.  This pass
19262generally, but not always, improves performance and code size, at the cost of
19263extra compilation time, which is why there is an option to switch it off.
19264If you have a problem with call instructions exceeding their allowable
19265offset range because they are conditionalized, you should consider using
19266@option{-mmedium-calls} instead.
19267
19268@item -mearly-cbranchsi
19269@opindex mearly-cbranchsi
19270Enable pre-reload use of the @code{cbranchsi} pattern.
19271
19272@item -mexpand-adddi
19273@opindex mexpand-adddi
19274Expand @code{adddi3} and @code{subdi3} at RTL generation time into
19275@code{add.f}, @code{adc} etc.  This option is deprecated.
19276
19277@item -mindexed-loads
19278@opindex mindexed-loads
19279Enable the use of indexed loads.  This can be problematic because some
19280optimizers then assume that indexed stores exist, which is not
19281the case.
19282
19283@item -mlra
19284@opindex mlra
19285Enable Local Register Allocation.  This is still experimental for ARC,
19286so by default the compiler uses standard reload
19287(i.e.@: @option{-mno-lra}).
19288
19289@item -mlra-priority-none
19290@opindex mlra-priority-none
19291Don't indicate any priority for target registers.
19292
19293@item -mlra-priority-compact
19294@opindex mlra-priority-compact
19295Indicate target register priority for r0..r3 / r12..r15.
19296
19297@item -mlra-priority-noncompact
19298@opindex mlra-priority-noncompact
19299Reduce target register priority for r0..r3 / r12..r15.
19300
19301@item -mmillicode
19302@opindex mmillicode
19303When optimizing for size (using @option{-Os}), prologues and epilogues
19304that have to save or restore a large number of registers are often
19305shortened by using call to a special function in libgcc; this is
19306referred to as a @emph{millicode} call.  As these calls can pose
19307performance issues, and/or cause linking issues when linking in a
19308nonstandard way, this option is provided to turn on or off millicode
19309call generation.
19310
19311@item -mcode-density-frame
19312@opindex mcode-density-frame
19313This option enable the compiler to emit @code{enter} and @code{leave}
19314instructions.  These instructions are only valid for CPUs with
19315code-density feature.
19316
19317@item -mmixed-code
19318@opindex mmixed-code
19319Tweak register allocation to help 16-bit instruction generation.
19320This generally has the effect of decreasing the average instruction size
19321while increasing the instruction count.
19322
19323@item -mq-class
19324@opindex mq-class
19325Ths option is deprecated.  Enable @samp{q} instruction alternatives.
19326This is the default for @option{-Os}.
19327
19328@item -mRcq
19329@opindex mRcq
19330Enable @samp{Rcq} constraint handling.
19331Most short code generation depends on this.
19332This is the default.
19333
19334@item -mRcw
19335@opindex mRcw
19336Enable @samp{Rcw} constraint handling.
19337Most ccfsm condexec mostly depends on this.
19338This is the default.
19339
19340@item -msize-level=@var{level}
19341@opindex msize-level
19342Fine-tune size optimization with regards to instruction lengths and alignment.
19343The recognized values for @var{level} are:
19344@table @samp
19345@item 0
19346No size optimization.  This level is deprecated and treated like @samp{1}.
19347
19348@item 1
19349Short instructions are used opportunistically.
19350
19351@item 2
19352In addition, alignment of loops and of code after barriers are dropped.
19353
19354@item 3
19355In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
19356
19357@end table
19358
19359This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
19360the behavior when this is not set is equivalent to level @samp{1}.
19361
19362@item -mtune=@var{cpu}
19363@opindex mtune
19364Set instruction scheduling parameters for @var{cpu}, overriding any implied
19365by @option{-mcpu=}.
19366
19367Supported values for @var{cpu} are
19368
19369@table @samp
19370@item ARC600
19371Tune for ARC600 CPU.
19372
19373@item ARC601
19374Tune for ARC601 CPU.
19375
19376@item ARC700
19377Tune for ARC700 CPU with standard multiplier block.
19378
19379@item ARC700-xmac
19380Tune for ARC700 CPU with XMAC block.
19381
19382@item ARC725D
19383Tune for ARC725D CPU.
19384
19385@item ARC750D
19386Tune for ARC750D CPU.
19387
19388@end table
19389
19390@item -mmultcost=@var{num}
19391@opindex mmultcost
19392Cost to assume for a multiply instruction, with @samp{4} being equal to a
19393normal instruction.
19394
19395@item -munalign-prob-threshold=@var{probability}
19396@opindex munalign-prob-threshold
19397Set probability threshold for unaligning branches.
19398When tuning for @samp{ARC700} and optimizing for speed, branches without
19399filled delay slot are preferably emitted unaligned and long, unless
19400profiling indicates that the probability for the branch to be taken
19401is below @var{probability}.  @xref{Cross-profiling}.
19402The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
19403
19404@end table
19405
19406The following options are maintained for backward compatibility, but
19407are now deprecated and will be removed in a future release:
19408
19409@c Deprecated options
19410@table @gcctabopt
19411
19412@item -margonaut
19413@opindex margonaut
19414Obsolete FPX.
19415
19416@item -mbig-endian
19417@opindex mbig-endian
19418@itemx -EB
19419@opindex EB
19420Compile code for big-endian targets.  Use of these options is now
19421deprecated.  Big-endian code is supported by configuring GCC to build
19422@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
19423for which big endian is the default.
19424
19425@item -mlittle-endian
19426@opindex mlittle-endian
19427@itemx -EL
19428@opindex EL
19429Compile code for little-endian targets.  Use of these options is now
19430deprecated.  Little-endian code is supported by configuring GCC to build
19431@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
19432for which little endian is the default.
19433
19434@item -mbarrel_shifter
19435@opindex mbarrel_shifter
19436Replaced by @option{-mbarrel-shifter}.
19437
19438@item -mdpfp_compact
19439@opindex mdpfp_compact
19440Replaced by @option{-mdpfp-compact}.
19441
19442@item -mdpfp_fast
19443@opindex mdpfp_fast
19444Replaced by @option{-mdpfp-fast}.
19445
19446@item -mdsp_packa
19447@opindex mdsp_packa
19448Replaced by @option{-mdsp-packa}.
19449
19450@item -mEA
19451@opindex mEA
19452Replaced by @option{-mea}.
19453
19454@item -mmac_24
19455@opindex mmac_24
19456Replaced by @option{-mmac-24}.
19457
19458@item -mmac_d16
19459@opindex mmac_d16
19460Replaced by @option{-mmac-d16}.
19461
19462@item -mspfp_compact
19463@opindex mspfp_compact
19464Replaced by @option{-mspfp-compact}.
19465
19466@item -mspfp_fast
19467@opindex mspfp_fast
19468Replaced by @option{-mspfp-fast}.
19469
19470@item -mtune=@var{cpu}
19471@opindex mtune
19472Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
19473@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
19474@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
19475
19476@item -multcost=@var{num}
19477@opindex multcost
19478Replaced by @option{-mmultcost}.
19479
19480@end table
19481
19482@node ARM Options
19483@subsection ARM Options
19484@cindex ARM options
19485
19486These @samp{-m} options are defined for the ARM port:
19487
19488@table @gcctabopt
19489@item -mabi=@var{name}
19490@opindex mabi
19491Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
19492@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
19493
19494@item -mapcs-frame
19495@opindex mapcs-frame
19496Generate a stack frame that is compliant with the ARM Procedure Call
19497Standard for all functions, even if this is not strictly necessary for
19498correct execution of the code.  Specifying @option{-fomit-frame-pointer}
19499with this option causes the stack frames not to be generated for
19500leaf functions.  The default is @option{-mno-apcs-frame}.
19501This option is deprecated.
19502
19503@item -mapcs
19504@opindex mapcs
19505This is a synonym for @option{-mapcs-frame} and is deprecated.
19506
19507@ignore
19508@c not currently implemented
19509@item -mapcs-stack-check
19510@opindex mapcs-stack-check
19511Generate code to check the amount of stack space available upon entry to
19512every function (that actually uses some stack space).  If there is
19513insufficient space available then either the function
19514@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
19515called, depending upon the amount of stack space required.  The runtime
19516system is required to provide these functions.  The default is
19517@option{-mno-apcs-stack-check}, since this produces smaller code.
19518
19519@c not currently implemented
19520@item -mapcs-reentrant
19521@opindex mapcs-reentrant
19522Generate reentrant, position-independent code.  The default is
19523@option{-mno-apcs-reentrant}.
19524@end ignore
19525
19526@item -mthumb-interwork
19527@opindex mthumb-interwork
19528Generate code that supports calling between the ARM and Thumb
19529instruction sets.  Without this option, on pre-v5 architectures, the
19530two instruction sets cannot be reliably used inside one program.  The
19531default is @option{-mno-thumb-interwork}, since slightly larger code
19532is generated when @option{-mthumb-interwork} is specified.  In AAPCS
19533configurations this option is meaningless.
19534
19535@item -mno-sched-prolog
19536@opindex mno-sched-prolog
19537@opindex msched-prolog
19538Prevent the reordering of instructions in the function prologue, or the
19539merging of those instruction with the instructions in the function's
19540body.  This means that all functions start with a recognizable set
19541of instructions (or in fact one of a choice from a small set of
19542different function prologues), and this information can be used to
19543locate the start of functions inside an executable piece of code.  The
19544default is @option{-msched-prolog}.
19545
19546@item -mfloat-abi=@var{name}
19547@opindex mfloat-abi
19548Specifies which floating-point ABI to use.  Permissible values
19549are: @samp{soft}, @samp{softfp} and @samp{hard}.
19550
19551Specifying @samp{soft} causes GCC to generate output containing
19552library calls for floating-point operations.
19553@samp{softfp} allows the generation of code using hardware floating-point
19554instructions, but still uses the soft-float calling conventions.
19555@samp{hard} allows generation of floating-point instructions
19556and uses FPU-specific calling conventions.
19557
19558The default depends on the specific target configuration.  Note that
19559the hard-float and soft-float ABIs are not link-compatible; you must
19560compile your entire program with the same ABI, and link with a
19561compatible set of libraries.
19562
19563@item -mgeneral-regs-only
19564@opindex mgeneral-regs-only
19565Generate code which uses only the general-purpose registers.  This will prevent
19566the compiler from using floating-point and Advanced SIMD registers but will not
19567impose any restrictions on the assembler.
19568
19569@item -mlittle-endian
19570@opindex mlittle-endian
19571Generate code for a processor running in little-endian mode.  This is
19572the default for all standard configurations.
19573
19574@item -mbig-endian
19575@opindex mbig-endian
19576Generate code for a processor running in big-endian mode; the default is
19577to compile code for a little-endian processor.
19578
19579@item -mbe8
19580@itemx -mbe32
19581@opindex mbe8
19582When linking a big-endian image select between BE8 and BE32 formats.
19583The option has no effect for little-endian images and is ignored.  The
19584default is dependent on the selected target architecture.  For ARMv6
19585and later architectures the default is BE8, for older architectures
19586the default is BE32.  BE32 format has been deprecated by ARM.
19587
19588@item -march=@var{name}@r{[}+extension@dots{}@r{]}
19589@opindex march
19590This specifies the name of the target ARM architecture.  GCC uses this
19591name to determine what kind of instructions it can emit when generating
19592assembly code.  This option can be used in conjunction with or instead
19593of the @option{-mcpu=} option.
19594
19595Permissible names are:
19596@samp{armv4t},
19597@samp{armv5t}, @samp{armv5te},
19598@samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
19599@samp{armv6z}, @samp{armv6zk},
19600@samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
19601@samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
19602@samp{armv8.4-a},
19603@samp{armv8.5-a},
19604@samp{armv8.6-a},
19605@samp{armv7-r},
19606@samp{armv8-r},
19607@samp{armv6-m}, @samp{armv6s-m},
19608@samp{armv7-m}, @samp{armv7e-m},
19609@samp{armv8-m.base}, @samp{armv8-m.main},
19610@samp{armv8.1-m.main},
19611@samp{iwmmxt} and @samp{iwmmxt2}.
19612
19613Additionally, the following architectures, which lack support for the
19614Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
19615
19616Many of the architectures support extensions.  These can be added by
19617appending @samp{+@var{extension}} to the architecture name.  Extension
19618options are processed in order and capabilities accumulate.  An extension
19619will also enable any necessary base extensions
19620upon which it depends.  For example, the @samp{+crypto} extension
19621will always enable the @samp{+simd} extension.  The exception to the
19622additive construction is for extensions that are prefixed with
19623@samp{+no@dots{}}: these extensions disable the specified option and
19624any other extensions that may depend on the presence of that
19625extension.
19626
19627For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
19628writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
19629entirely disabled by the @samp{+nofp} option that follows it.
19630
19631Most extension names are generically named, but have an effect that is
19632dependent upon the architecture to which it is applied.  For example,
19633the @samp{+simd} option can be applied to both @samp{armv7-a} and
19634@samp{armv8-a} architectures, but will enable the original ARMv7-A
19635Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
19636variant for @samp{armv8-a}.
19637
19638The table below lists the supported extensions for each architecture.
19639Architectures not mentioned do not support any extensions.
19640
19641@table @samp
19642@item armv5te
19643@itemx armv6
19644@itemx armv6j
19645@itemx armv6k
19646@itemx armv6kz
19647@itemx armv6t2
19648@itemx armv6z
19649@itemx armv6zk
19650@table @samp
19651@item +fp
19652The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
19653used as an alias for this extension.
19654
19655@item +nofp
19656Disable the floating-point instructions.
19657@end table
19658
19659@item armv7
19660The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
19661@table @samp
19662@item +fp
19663The VFPv3 floating-point instructions, with 16 double-precision
19664registers.  The extension @samp{+vfpv3-d16} can be used as an alias
19665for this extension.  Note that floating-point is not supported by the
19666base ARMv7-M architecture, but is compatible with both the ARMv7-A and
19667ARMv7-R architectures.
19668
19669@item +nofp
19670Disable the floating-point instructions.
19671@end table
19672
19673@item armv7-a
19674@table @samp
19675@item +mp
19676The multiprocessing extension.
19677
19678@item +sec
19679The security extension.
19680
19681@item +fp
19682The VFPv3 floating-point instructions, with 16 double-precision
19683registers.  The extension @samp{+vfpv3-d16} can be used as an alias
19684for this extension.
19685
19686@item +simd
19687The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
19688The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
19689for this extension.
19690
19691@item +vfpv3
19692The VFPv3 floating-point instructions, with 32 double-precision
19693registers.
19694
19695@item +vfpv3-d16-fp16
19696The VFPv3 floating-point instructions, with 16 double-precision
19697registers and the half-precision floating-point conversion operations.
19698
19699@item +vfpv3-fp16
19700The VFPv3 floating-point instructions, with 32 double-precision
19701registers and the half-precision floating-point conversion operations.
19702
19703@item +vfpv4-d16
19704The VFPv4 floating-point instructions, with 16 double-precision
19705registers.
19706
19707@item +vfpv4
19708The VFPv4 floating-point instructions, with 32 double-precision
19709registers.
19710
19711@item +neon-fp16
19712The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
19713the half-precision floating-point conversion operations.
19714
19715@item +neon-vfpv4
19716The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
19717
19718@item +nosimd
19719Disable the Advanced SIMD instructions (does not disable floating point).
19720
19721@item +nofp
19722Disable the floating-point and Advanced SIMD instructions.
19723@end table
19724
19725@item armv7ve
19726The extended version of the ARMv7-A architecture with support for
19727virtualization.
19728@table @samp
19729@item +fp
19730The VFPv4 floating-point instructions, with 16 double-precision registers.
19731The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
19732
19733@item +simd
19734The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
19735extension @samp{+neon-vfpv4} can be used as an alias for this extension.
19736
19737@item +vfpv3-d16
19738The VFPv3 floating-point instructions, with 16 double-precision
19739registers.
19740
19741@item +vfpv3
19742The VFPv3 floating-point instructions, with 32 double-precision
19743registers.
19744
19745@item +vfpv3-d16-fp16
19746The VFPv3 floating-point instructions, with 16 double-precision
19747registers and the half-precision floating-point conversion operations.
19748
19749@item +vfpv3-fp16
19750The VFPv3 floating-point instructions, with 32 double-precision
19751registers and the half-precision floating-point conversion operations.
19752
19753@item +vfpv4-d16
19754The VFPv4 floating-point instructions, with 16 double-precision
19755registers.
19756
19757@item +vfpv4
19758The VFPv4 floating-point instructions, with 32 double-precision
19759registers.
19760
19761@item +neon
19762The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
19763The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
19764
19765@item +neon-fp16
19766The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
19767the half-precision floating-point conversion operations.
19768
19769@item +nosimd
19770Disable the Advanced SIMD instructions (does not disable floating point).
19771
19772@item +nofp
19773Disable the floating-point and Advanced SIMD instructions.
19774@end table
19775
19776@item armv8-a
19777@table @samp
19778@item +crc
19779The Cyclic Redundancy Check (CRC) instructions.
19780@item +simd
19781The ARMv8-A Advanced SIMD and floating-point instructions.
19782@item +crypto
19783The cryptographic instructions.
19784@item +nocrypto
19785Disable the cryptographic instructions.
19786@item +nofp
19787Disable the floating-point, Advanced SIMD and cryptographic instructions.
19788@item +sb
19789Speculation Barrier Instruction.
19790@item +predres
19791Execution and Data Prediction Restriction Instructions.
19792@end table
19793
19794@item armv8.1-a
19795@table @samp
19796@item +simd
19797The ARMv8.1-A Advanced SIMD and floating-point instructions.
19798
19799@item +crypto
19800The cryptographic instructions.  This also enables the Advanced SIMD and
19801floating-point instructions.
19802
19803@item +nocrypto
19804Disable the cryptographic instructions.
19805
19806@item +nofp
19807Disable the floating-point, Advanced SIMD and cryptographic instructions.
19808
19809@item +sb
19810Speculation Barrier Instruction.
19811
19812@item +predres
19813Execution and Data Prediction Restriction Instructions.
19814@end table
19815
19816@item armv8.2-a
19817@itemx armv8.3-a
19818@table @samp
19819@item +fp16
19820The half-precision floating-point data processing instructions.
19821This also enables the Advanced SIMD and floating-point instructions.
19822
19823@item +fp16fml
19824The half-precision floating-point fmla extension.  This also enables
19825the half-precision floating-point extension and Advanced SIMD and
19826floating-point instructions.
19827
19828@item +simd
19829The ARMv8.1-A Advanced SIMD and floating-point instructions.
19830
19831@item +crypto
19832The cryptographic instructions.  This also enables the Advanced SIMD and
19833floating-point instructions.
19834
19835@item +dotprod
19836Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
19837
19838@item +nocrypto
19839Disable the cryptographic extension.
19840
19841@item +nofp
19842Disable the floating-point, Advanced SIMD and cryptographic instructions.
19843
19844@item +sb
19845Speculation Barrier Instruction.
19846
19847@item +predres
19848Execution and Data Prediction Restriction Instructions.
19849
19850@item +i8mm
198518-bit Integer Matrix Multiply instructions.
19852This also enables Advanced SIMD and floating-point instructions.
19853
19854@item +bf16
19855Brain half-precision floating-point instructions.
19856This also enables Advanced SIMD and floating-point instructions.
19857@end table
19858
19859@item armv8.4-a
19860@table @samp
19861@item +fp16
19862The half-precision floating-point data processing instructions.
19863This also enables the Advanced SIMD and floating-point instructions as well
19864as the Dot Product extension and the half-precision floating-point fmla
19865extension.
19866
19867@item +simd
19868The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
19869Dot Product extension.
19870
19871@item +crypto
19872The cryptographic instructions.  This also enables the Advanced SIMD and
19873floating-point instructions as well as the Dot Product extension.
19874
19875@item +nocrypto
19876Disable the cryptographic extension.
19877
19878@item +nofp
19879Disable the floating-point, Advanced SIMD and cryptographic instructions.
19880
19881@item +sb
19882Speculation Barrier Instruction.
19883
19884@item +predres
19885Execution and Data Prediction Restriction Instructions.
19886
19887@item +i8mm
198888-bit Integer Matrix Multiply instructions.
19889This also enables Advanced SIMD and floating-point instructions.
19890
19891@item +bf16
19892Brain half-precision floating-point instructions.
19893This also enables Advanced SIMD and floating-point instructions.
19894@end table
19895
19896@item armv8.5-a
19897@table @samp
19898@item +fp16
19899The half-precision floating-point data processing instructions.
19900This also enables the Advanced SIMD and floating-point instructions as well
19901as the Dot Product extension and the half-precision floating-point fmla
19902extension.
19903
19904@item +simd
19905The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
19906Dot Product extension.
19907
19908@item +crypto
19909The cryptographic instructions.  This also enables the Advanced SIMD and
19910floating-point instructions as well as the Dot Product extension.
19911
19912@item +nocrypto
19913Disable the cryptographic extension.
19914
19915@item +nofp
19916Disable the floating-point, Advanced SIMD and cryptographic instructions.
19917
19918@item +i8mm
199198-bit Integer Matrix Multiply instructions.
19920This also enables Advanced SIMD and floating-point instructions.
19921
19922@item +bf16
19923Brain half-precision floating-point instructions.
19924This also enables Advanced SIMD and floating-point instructions.
19925@end table
19926
19927@item armv8.6-a
19928@table @samp
19929@item +fp16
19930The half-precision floating-point data processing instructions.
19931This also enables the Advanced SIMD and floating-point instructions as well
19932as the Dot Product extension and the half-precision floating-point fmla
19933extension.
19934
19935@item +simd
19936The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
19937Dot Product extension.
19938
19939@item +crypto
19940The cryptographic instructions.  This also enables the Advanced SIMD and
19941floating-point instructions as well as the Dot Product extension.
19942
19943@item +nocrypto
19944Disable the cryptographic extension.
19945
19946@item +nofp
19947Disable the floating-point, Advanced SIMD and cryptographic instructions.
19948
19949@item +i8mm
199508-bit Integer Matrix Multiply instructions.
19951This also enables Advanced SIMD and floating-point instructions.
19952
19953@item +bf16
19954Brain half-precision floating-point instructions.
19955This also enables Advanced SIMD and floating-point instructions.
19956@end table
19957
19958@item armv7-r
19959@table @samp
19960@item +fp.sp
19961The single-precision VFPv3 floating-point instructions.  The extension
19962@samp{+vfpv3xd} can be used as an alias for this extension.
19963
19964@item +fp
19965The VFPv3 floating-point instructions with 16 double-precision registers.
19966The extension +vfpv3-d16 can be used as an alias for this extension.
19967
19968@item +vfpv3xd-d16-fp16
19969The single-precision VFPv3 floating-point instructions with 16 double-precision
19970registers and the half-precision floating-point conversion operations.
19971
19972@item +vfpv3-d16-fp16
19973The VFPv3 floating-point instructions with 16 double-precision
19974registers and the half-precision floating-point conversion operations.
19975
19976@item +nofp
19977Disable the floating-point extension.
19978
19979@item +idiv
19980The ARM-state integer division instructions.
19981
19982@item +noidiv
19983Disable the ARM-state integer division extension.
19984@end table
19985
19986@item armv7e-m
19987@table @samp
19988@item +fp
19989The single-precision VFPv4 floating-point instructions.
19990
19991@item +fpv5
19992The single-precision FPv5 floating-point instructions.
19993
19994@item +fp.dp
19995The single- and double-precision FPv5 floating-point instructions.
19996
19997@item +nofp
19998Disable the floating-point extensions.
19999@end table
20000
20001@item  armv8.1-m.main
20002@table @samp
20003
20004@item +dsp
20005The DSP instructions.
20006
20007@item +mve
20008The M-Profile Vector Extension (MVE) integer instructions.
20009
20010@item +mve.fp
20011The M-Profile Vector Extension (MVE) integer and single precision
20012floating-point instructions.
20013
20014@item +fp
20015The single-precision floating-point instructions.
20016
20017@item +fp.dp
20018The single- and double-precision floating-point instructions.
20019
20020@item +nofp
20021Disable the floating-point extension.
20022
20023@item +cdecp0, +cdecp1, ... , +cdecp7
20024Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20025to the numbers given in the options in the range 0 to 7.
20026@end table
20027
20028@item  armv8-m.main
20029@table @samp
20030@item +dsp
20031The DSP instructions.
20032
20033@item +nodsp
20034Disable the DSP extension.
20035
20036@item +fp
20037The single-precision floating-point instructions.
20038
20039@item +fp.dp
20040The single- and double-precision floating-point instructions.
20041
20042@item +nofp
20043Disable the floating-point extension.
20044
20045@item +cdecp0, +cdecp1, ... , +cdecp7
20046Enable the Custom Datapath Extension (CDE) on selected coprocessors according
20047to the numbers given in the options in the range 0 to 7.
20048@end table
20049
20050@item armv8-r
20051@table @samp
20052@item +crc
20053The Cyclic Redundancy Check (CRC) instructions.
20054@item +fp.sp
20055The single-precision FPv5 floating-point instructions.
20056@item +simd
20057The ARMv8-A Advanced SIMD and floating-point instructions.
20058@item +crypto
20059The cryptographic instructions.
20060@item +nocrypto
20061Disable the cryptographic instructions.
20062@item +nofp
20063Disable the floating-point, Advanced SIMD and cryptographic instructions.
20064@end table
20065
20066@end table
20067
20068@option{-march=native} causes the compiler to auto-detect the architecture
20069of the build computer.  At present, this feature is only supported on
20070GNU/Linux, and not all architectures are recognized.  If the auto-detect
20071is unsuccessful the option has no effect.
20072
20073@item -mtune=@var{name}
20074@opindex mtune
20075This option specifies the name of the target ARM processor for
20076which GCC should tune the performance of the code.
20077For some ARM implementations better performance can be obtained by using
20078this option.
20079Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
20080@samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
20081@samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
20082@samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
20083@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
20084@samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
20085@samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
20086@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
20087@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
20088@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
20089@samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
20090@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20091@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20092@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20093@samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20094@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
20095@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
20096@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
20097@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
20098@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
20099@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
20100@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
20101@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
20102@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
20103@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
20104
20105Additionally, this option can specify that GCC should tune the performance
20106of the code for a big.LITTLE system.  Permissible names are:
20107@samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
20108@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20109@samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
20110@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
20111
20112@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
20113performance for a blend of processors within architecture @var{arch}.
20114The aim is to generate code that run well on the current most popular
20115processors, balancing between optimizations that benefit some CPUs in the
20116range, and avoiding performance pitfalls of other CPUs.  The effects of
20117this option may change in future GCC versions as CPU models come and go.
20118
20119@option{-mtune} permits the same extension options as @option{-mcpu}, but
20120the extension options do not affect the tuning of the generated code.
20121
20122@option{-mtune=native} causes the compiler to auto-detect the CPU
20123of the build computer.  At present, this feature is only supported on
20124GNU/Linux, and not all architectures are recognized.  If the auto-detect is
20125unsuccessful the option has no effect.
20126
20127@item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
20128@opindex mcpu
20129This specifies the name of the target ARM processor.  GCC uses this name
20130to derive the name of the target ARM architecture (as if specified
20131by @option{-march}) and the ARM processor type for which to tune for
20132performance (as if specified by @option{-mtune}).  Where this option
20133is used in conjunction with @option{-march} or @option{-mtune},
20134those options take precedence over the appropriate part of this option.
20135
20136Many of the supported CPUs implement optional architectural
20137extensions.  Where this is so the architectural extensions are
20138normally enabled by default.  If implementations that lack the
20139extension exist, then the extension syntax can be used to disable
20140those extensions that have been omitted.  For floating-point and
20141Advanced SIMD (Neon) instructions, the settings of the options
20142@option{-mfloat-abi} and @option{-mfpu} must also be considered:
20143floating-point and Advanced SIMD instructions will only be used if
20144@option{-mfloat-abi} is not set to @samp{soft}; and any setting of
20145@option{-mfpu} other than @samp{auto} will override the available
20146floating-point and SIMD extension instructions.
20147
20148For example, @samp{cortex-a9} can be found in three major
20149configurations: integer only, with just a floating-point unit or with
20150floating-point and Advanced SIMD.  The default is to enable all the
20151instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
20152be used to disable just the SIMD or both the SIMD and floating-point
20153instructions respectively.
20154
20155Permissible names for this option are the same as those for
20156@option{-mtune}.
20157
20158The following extension options are common to the listed CPUs:
20159
20160@table @samp
20161@item +nodsp
20162Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
20163
20164@item  +nofp
20165Disables the floating-point instructions on @samp{arm9e},
20166@samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
20167@samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
20168@samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
20169@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
20170Disables the floating-point and SIMD instructions on
20171@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
20172@samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
20173@samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
20174@samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
20175@samp{cortex-a53} and @samp{cortex-a55}.
20176
20177@item +nofp.dp
20178Disables the double-precision component of the floating-point instructions
20179on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
20180@samp{cortex-m7}.
20181
20182@item +nosimd
20183Disables the SIMD (but not floating-point) instructions on
20184@samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
20185and @samp{cortex-a9}.
20186
20187@item +crypto
20188Enables the cryptographic instructions on @samp{cortex-a32},
20189@samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
20190@samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
20191@samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20192@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
20193@samp{cortex-a75.cortex-a55}.
20194@end table
20195
20196Additionally the @samp{generic-armv7-a} pseudo target defaults to
20197VFPv3 with 16 double-precision registers.  It supports the following
20198extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
20199@samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
20200@samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
20201@samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
20202the extensions to @option{-march=armv7-a}.
20203
20204@option{-mcpu=generic-@var{arch}} is also permissible, and is
20205equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
20206See @option{-mtune} for more information.
20207
20208@option{-mcpu=native} causes the compiler to auto-detect the CPU
20209of the build computer.  At present, this feature is only supported on
20210GNU/Linux, and not all architectures are recognized.  If the auto-detect
20211is unsuccessful the option has no effect.
20212
20213@item -mfpu=@var{name}
20214@opindex mfpu
20215This specifies what floating-point hardware (or hardware emulation) is
20216available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
20217@samp{vfpv3},
20218@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
20219@samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
20220@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
20221@samp{fpv5-d16}, @samp{fpv5-sp-d16},
20222@samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
20223Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
20224is an alias for @samp{vfpv2}.
20225
20226The setting @samp{auto} is the default and is special.  It causes the
20227compiler to select the floating-point and Advanced SIMD instructions
20228based on the settings of @option{-mcpu} and @option{-march}.
20229
20230If the selected floating-point hardware includes the NEON extension
20231(e.g.@: @option{-mfpu=neon}), note that floating-point
20232operations are not generated by GCC's auto-vectorization pass unless
20233@option{-funsafe-math-optimizations} is also specified.  This is
20234because NEON hardware does not fully implement the IEEE 754 standard for
20235floating-point arithmetic (in particular denormal values are treated as
20236zero), so the use of NEON instructions may lead to a loss of precision.
20237
20238You 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}).
20239
20240@item -mfp16-format=@var{name}
20241@opindex mfp16-format
20242Specify the format of the @code{__fp16} half-precision floating-point type.
20243Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
20244the default is @samp{none}, in which case the @code{__fp16} type is not
20245defined.  @xref{Half-Precision}, for more information.
20246
20247@item -mstructure-size-boundary=@var{n}
20248@opindex mstructure-size-boundary
20249The sizes of all structures and unions are rounded up to a multiple
20250of the number of bits set by this option.  Permissible values are 8, 32
20251and 64.  The default value varies for different toolchains.  For the COFF
20252targeted toolchain the default value is 8.  A value of 64 is only allowed
20253if the underlying ABI supports it.
20254
20255Specifying a larger number can produce faster, more efficient code, but
20256can also increase the size of the program.  Different values are potentially
20257incompatible.  Code compiled with one value cannot necessarily expect to
20258work with code or libraries compiled with another value, if they exchange
20259information using structures or unions.
20260
20261This option is deprecated.
20262
20263@item -mabort-on-noreturn
20264@opindex mabort-on-noreturn
20265Generate a call to the function @code{abort} at the end of a
20266@code{noreturn} function.  It is executed if the function tries to
20267return.
20268
20269@item -mlong-calls
20270@itemx -mno-long-calls
20271@opindex mlong-calls
20272@opindex mno-long-calls
20273Tells the compiler to perform function calls by first loading the
20274address of the function into a register and then performing a subroutine
20275call on this register.  This switch is needed if the target function
20276lies outside of the 64-megabyte addressing range of the offset-based
20277version of subroutine call instruction.
20278
20279Even if this switch is enabled, not all function calls are turned
20280into long calls.  The heuristic is that static functions, functions
20281that have the @code{short_call} attribute, functions that are inside
20282the scope of a @code{#pragma no_long_calls} directive, and functions whose
20283definitions have already been compiled within the current compilation
20284unit are not turned into long calls.  The exceptions to this rule are
20285that weak function definitions, functions with the @code{long_call}
20286attribute or the @code{section} attribute, and functions that are within
20287the scope of a @code{#pragma long_calls} directive are always
20288turned into long calls.
20289
20290This feature is not enabled by default.  Specifying
20291@option{-mno-long-calls} restores the default behavior, as does
20292placing the function calls within the scope of a @code{#pragma
20293long_calls_off} directive.  Note these switches have no effect on how
20294the compiler generates code to handle function calls via function
20295pointers.
20296
20297@item -msingle-pic-base
20298@opindex msingle-pic-base
20299Treat the register used for PIC addressing as read-only, rather than
20300loading it in the prologue for each function.  The runtime system is
20301responsible for initializing this register with an appropriate value
20302before execution begins.
20303
20304@item -mpic-register=@var{reg}
20305@opindex mpic-register
20306Specify the register to be used for PIC addressing.
20307For standard PIC base case, the default is any suitable register
20308determined by compiler.  For single PIC base case, the default is
20309@samp{R9} if target is EABI based or stack-checking is enabled,
20310otherwise the default is @samp{R10}.
20311
20312@item -mpic-data-is-text-relative
20313@opindex mpic-data-is-text-relative
20314Assume that the displacement between the text and data segments is fixed
20315at static link time.  This permits using PC-relative addressing
20316operations to access data known to be in the data segment.  For
20317non-VxWorks RTP targets, this option is enabled by default.  When
20318disabled on such targets, it will enable @option{-msingle-pic-base} by
20319default.
20320
20321@item -mpoke-function-name
20322@opindex mpoke-function-name
20323Write the name of each function into the text section, directly
20324preceding the function prologue.  The generated code is similar to this:
20325
20326@smallexample
20327     t0
20328         .ascii "arm_poke_function_name", 0
20329         .align
20330     t1
20331         .word 0xff000000 + (t1 - t0)
20332     arm_poke_function_name
20333         mov     ip, sp
20334         stmfd   sp!, @{fp, ip, lr, pc@}
20335         sub     fp, ip, #4
20336@end smallexample
20337
20338When performing a stack backtrace, code can inspect the value of
20339@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
20340location @code{pc - 12} and the top 8 bits are set, then we know that
20341there is a function name embedded immediately preceding this location
20342and has length @code{((pc[-3]) & 0xff000000)}.
20343
20344@item -mthumb
20345@itemx -marm
20346@opindex marm
20347@opindex mthumb
20348
20349Select between generating code that executes in ARM and Thumb
20350states.  The default for most configurations is to generate code
20351that executes in ARM state, but the default can be changed by
20352configuring GCC with the @option{--with-mode=}@var{state}
20353configure option.
20354
20355You can also override the ARM and Thumb mode for each function
20356by using the @code{target("thumb")} and @code{target("arm")} function attributes
20357(@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
20358
20359@item -mflip-thumb
20360@opindex mflip-thumb
20361Switch ARM/Thumb modes on alternating functions.
20362This option is provided for regression testing of mixed Thumb/ARM code
20363generation, and is not intended for ordinary use in compiling code.
20364
20365@item -mtpcs-frame
20366@opindex mtpcs-frame
20367Generate a stack frame that is compliant with the Thumb Procedure Call
20368Standard for all non-leaf functions.  (A leaf function is one that does
20369not call any other functions.)  The default is @option{-mno-tpcs-frame}.
20370
20371@item -mtpcs-leaf-frame
20372@opindex mtpcs-leaf-frame
20373Generate a stack frame that is compliant with the Thumb Procedure Call
20374Standard for all leaf functions.  (A leaf function is one that does
20375not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
20376
20377@item -mcallee-super-interworking
20378@opindex mcallee-super-interworking
20379Gives all externally visible functions in the file being compiled an ARM
20380instruction set header which switches to Thumb mode before executing the
20381rest of the function.  This allows these functions to be called from
20382non-interworking code.  This option is not valid in AAPCS configurations
20383because interworking is enabled by default.
20384
20385@item -mcaller-super-interworking
20386@opindex mcaller-super-interworking
20387Allows calls via function pointers (including virtual functions) to
20388execute correctly regardless of whether the target code has been
20389compiled for interworking or not.  There is a small overhead in the cost
20390of executing a function pointer if this option is enabled.  This option
20391is not valid in AAPCS configurations because interworking is enabled
20392by default.
20393
20394@item -mtp=@var{name}
20395@opindex mtp
20396Specify the access model for the thread local storage pointer.  The valid
20397models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
20398@samp{cp15}, which fetches the thread pointer from @code{cp15} directly
20399(supported in the arm6k architecture), and @samp{auto}, which uses the
20400best available method for the selected processor.  The default setting is
20401@samp{auto}.
20402
20403@item -mtls-dialect=@var{dialect}
20404@opindex mtls-dialect
20405Specify the dialect to use for accessing thread local storage.  Two
20406@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
20407@samp{gnu} dialect selects the original GNU scheme for supporting
20408local and global dynamic TLS models.  The @samp{gnu2} dialect
20409selects the GNU descriptor scheme, which provides better performance
20410for shared libraries.  The GNU descriptor scheme is compatible with
20411the original scheme, but does require new assembler, linker and
20412library support.  Initial and local exec TLS models are unaffected by
20413this option and always use the original scheme.
20414
20415@item -mword-relocations
20416@opindex mword-relocations
20417Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
20418This is enabled by default on targets (uClinux, SymbianOS) where the runtime
20419loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
20420is specified. This option conflicts with @option{-mslow-flash-data}.
20421
20422@item -mfix-cortex-m3-ldrd
20423@opindex mfix-cortex-m3-ldrd
20424Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
20425with overlapping destination and base registers are used.  This option avoids
20426generating these instructions.  This option is enabled by default when
20427@option{-mcpu=cortex-m3} is specified.
20428
20429@item -munaligned-access
20430@itemx -mno-unaligned-access
20431@opindex munaligned-access
20432@opindex mno-unaligned-access
20433Enables (or disables) reading and writing of 16- and 32- bit values
20434from addresses that are not 16- or 32- bit aligned.  By default
20435unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
20436ARMv8-M Baseline architectures, and enabled for all other
20437architectures.  If unaligned access is not enabled then words in packed
20438data structures are accessed a byte at a time.
20439
20440The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
20441generated object file to either true or false, depending upon the
20442setting of this option.  If unaligned access is enabled then the
20443preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
20444defined.
20445
20446@item -mneon-for-64bits
20447@opindex mneon-for-64bits
20448This option is deprecated and has no effect.
20449
20450@item -mslow-flash-data
20451@opindex mslow-flash-data
20452Assume loading data from flash is slower than fetching instruction.
20453Therefore literal load is minimized for better performance.
20454This option is only supported when compiling for ARMv7 M-profile and
20455off by default. It conflicts with @option{-mword-relocations}.
20456
20457@item -masm-syntax-unified
20458@opindex masm-syntax-unified
20459Assume inline assembler is using unified asm syntax.  The default is
20460currently off which implies divided syntax.  This option has no impact
20461on Thumb2. However, this may change in future releases of GCC.
20462Divided syntax should be considered deprecated.
20463
20464@item -mrestrict-it
20465@opindex mrestrict-it
20466Restricts generation of IT blocks to conform to the rules of ARMv8-A.
20467IT blocks can only contain a single 16-bit instruction from a select
20468set of instructions. This option is on by default for ARMv8-A Thumb mode.
20469
20470@item -mprint-tune-info
20471@opindex mprint-tune-info
20472Print CPU tuning information as comment in assembler file.  This is
20473an option used only for regression testing of the compiler and not
20474intended for ordinary use in compiling code.  This option is disabled
20475by default.
20476
20477@item -mverbose-cost-dump
20478@opindex mverbose-cost-dump
20479Enable verbose cost model dumping in the debug dump files.  This option is
20480provided for use in debugging the compiler.
20481
20482@item -mpure-code
20483@opindex mpure-code
20484Do not allow constant data to be placed in code sections.
20485Additionally, when compiling for ELF object format give all text sections the
20486ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
20487is only available when generating non-pic code for M-profile targets.
20488
20489@item -mcmse
20490@opindex mcmse
20491Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
20492Development Tools Engineering Specification", which can be found on
20493@url{https://developer.arm.com/documentation/ecm0359818/latest/}.
20494
20495@item -mfix-cmse-cve-2021-35465
20496@opindex mfix-cmse-cve-2021-35465
20497Mitigate against a potential security issue with the @code{VLLDM} instruction
20498in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
20499enabled by default when the option @option{-mcpu=} is used with
20500@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}.  The option
20501@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
20502
20503@item -mfdpic
20504@itemx -mno-fdpic
20505@opindex mfdpic
20506@opindex mno-fdpic
20507Select the FDPIC ABI, which uses 64-bit function descriptors to
20508represent pointers to functions.  When the compiler is configured for
20509@code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
20510and implies @option{-fPIE} if none of the PIC/PIE-related options is
20511provided.  On other targets, it only enables the FDPIC-specific code
20512generation features, and the user should explicitly provide the
20513PIC/PIE-related options as needed.
20514
20515Note that static linking is not supported because it would still
20516involve the dynamic linker when the program self-relocates.  If such
20517behavior is acceptable, use -static and -Wl,-dynamic-linker options.
20518
20519The opposite @option{-mno-fdpic} option is useful (and required) to
20520build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
20521toolchain as the one used to build the userland programs.
20522
20523@end table
20524
20525@node AVR Options
20526@subsection AVR Options
20527@cindex AVR Options
20528
20529These options are defined for AVR implementations:
20530
20531@table @gcctabopt
20532@item -mmcu=@var{mcu}
20533@opindex mmcu
20534Specify Atmel AVR instruction set architectures (ISA) or MCU type.
20535
20536The default for this option is@tie{}@samp{avr2}.
20537
20538GCC supports the following AVR devices and ISAs:
20539
20540@include avr-mmcu.texi
20541
20542@item -mabsdata
20543@opindex mabsdata
20544
20545Assume that all data in static storage can be accessed by LDS / STS
20546instructions.  This option has only an effect on reduced Tiny devices like
20547ATtiny40.  See also the @code{absdata}
20548@ref{AVR Variable Attributes,variable attribute}.
20549
20550@item -maccumulate-args
20551@opindex maccumulate-args
20552Accumulate outgoing function arguments and acquire/release the needed
20553stack space for outgoing function arguments once in function
20554prologue/epilogue.  Without this option, outgoing arguments are pushed
20555before calling a function and popped afterwards.
20556
20557Popping the arguments after the function call can be expensive on
20558AVR so that accumulating the stack space might lead to smaller
20559executables because arguments need not be removed from the
20560stack after such a function call.
20561
20562This option can lead to reduced code size for functions that perform
20563several calls to functions that get their arguments on the stack like
20564calls to printf-like functions.
20565
20566@item -mbranch-cost=@var{cost}
20567@opindex mbranch-cost
20568Set the branch costs for conditional branch instructions to
20569@var{cost}.  Reasonable values for @var{cost} are small, non-negative
20570integers. The default branch cost is 0.
20571
20572@item -mcall-prologues
20573@opindex mcall-prologues
20574Functions prologues/epilogues are expanded as calls to appropriate
20575subroutines.  Code size is smaller.
20576
20577@item -mdouble=@var{bits}
20578@itemx -mlong-double=@var{bits}
20579@opindex mdouble
20580@opindex mlong-double
20581Set the size (in bits) of the @code{double} or @code{long double} type,
20582respectively.  Possible values for @var{bits} are 32 and 64.
20583Whether or not a specific value for @var{bits} is allowed depends on
20584the @code{--with-double=} and @code{--with-long-double=}
20585@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
20586and the same applies for the default values of the options.
20587
20588@item -mgas-isr-prologues
20589@opindex mgas-isr-prologues
20590Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
20591instruction supported by GNU Binutils.
20592If this option is on, the feature can still be disabled for individual
20593ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
20594function attribute.  This feature is activated per default
20595if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
20596and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
20597
20598@item -mint8
20599@opindex mint8
20600Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
20601@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
20602and @code{long long} is 4 bytes.  Please note that this option does not
20603conform to the C standards, but it results in smaller code
20604size.
20605
20606@item -mmain-is-OS_task
20607@opindex mmain-is-OS_task
20608Do not save registers in @code{main}.  The effect is the same like
20609attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
20610to @code{main}. It is activated per default if optimization is on.
20611
20612@item -mn-flash=@var{num}
20613@opindex mn-flash
20614Assume that the flash memory has a size of
20615@var{num} times 64@tie{}KiB.
20616
20617@item -mno-interrupts
20618@opindex mno-interrupts
20619Generated code is not compatible with hardware interrupts.
20620Code size is smaller.
20621
20622@item -mrelax
20623@opindex mrelax
20624Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
20625@code{RCALL} resp.@: @code{RJMP} instruction if applicable.
20626Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
20627the assembler's command line and the @option{--relax} option to the
20628linker's command line.
20629
20630Jump relaxing is performed by the linker because jump offsets are not
20631known before code is located. Therefore, the assembler code generated by the
20632compiler is the same, but the instructions in the executable may
20633differ from instructions in the assembler code.
20634
20635Relaxing must be turned on if linker stubs are needed, see the
20636section on @code{EIND} and linker stubs below.
20637
20638@item -mrmw
20639@opindex mrmw
20640Assume that the device supports the Read-Modify-Write
20641instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
20642
20643@item -mshort-calls
20644@opindex mshort-calls
20645
20646Assume that @code{RJMP} and @code{RCALL} can target the whole
20647program memory.
20648
20649This option is used internally for multilib selection.  It is
20650not an optimization option, and you don't need to set it by hand.
20651
20652@item -msp8
20653@opindex msp8
20654Treat the stack pointer register as an 8-bit register,
20655i.e.@: assume the high byte of the stack pointer is zero.
20656In general, you don't need to set this option by hand.
20657
20658This option is used internally by the compiler to select and
20659build multilibs for architectures @code{avr2} and @code{avr25}.
20660These architectures mix devices with and without @code{SPH}.
20661For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
20662the compiler driver adds or removes this option from the compiler
20663proper's command line, because the compiler then knows if the device
20664or architecture has an 8-bit stack pointer and thus no @code{SPH}
20665register or not.
20666
20667@item -mstrict-X
20668@opindex mstrict-X
20669Use address register @code{X} in a way proposed by the hardware.  This means
20670that @code{X} is only used in indirect, post-increment or
20671pre-decrement addressing.
20672
20673Without this option, the @code{X} register may be used in the same way
20674as @code{Y} or @code{Z} which then is emulated by additional
20675instructions.
20676For example, loading a value with @code{X+const} addressing with a
20677small non-negative @code{const < 64} to a register @var{Rn} is
20678performed as
20679
20680@example
20681adiw r26, const   ; X += const
20682ld   @var{Rn}, X        ; @var{Rn} = *X
20683sbiw r26, const   ; X -= const
20684@end example
20685
20686@item -mtiny-stack
20687@opindex mtiny-stack
20688Only change the lower 8@tie{}bits of the stack pointer.
20689
20690@item -mfract-convert-truncate
20691@opindex mfract-convert-truncate
20692Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
20693
20694@item -nodevicelib
20695@opindex nodevicelib
20696Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
20697
20698@item -nodevicespecs
20699@opindex nodevicespecs
20700Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
20701command line.  The user takes responsibility for supplying the sub-processes
20702like compiler proper, assembler and linker with appropriate command line
20703options.  This means that the user has to supply her private device specs
20704file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
20705more need for option @option{-mmcu=@var{mcu}}.
20706
20707This option can also serve as a replacement for the older way of
20708specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
20709which contains a folder named @code{device-specs} which contains a specs file named
20710@code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
20711
20712@item -Waddr-space-convert
20713@opindex Waddr-space-convert
20714@opindex Wno-addr-space-convert
20715Warn about conversions between address spaces in the case where the
20716resulting address space is not contained in the incoming address space.
20717
20718@item -Wmisspelled-isr
20719@opindex Wmisspelled-isr
20720@opindex Wno-misspelled-isr
20721Warn if the ISR is misspelled, i.e.@: without __vector prefix.
20722Enabled by default.
20723@end table
20724
20725@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
20726@cindex @code{EIND}
20727Pointers in the implementation are 16@tie{}bits wide.
20728The address of a function or label is represented as word address so
20729that indirect jumps and calls can target any code address in the
20730range of 64@tie{}Ki words.
20731
20732In order to facilitate indirect jump on devices with more than 128@tie{}Ki
20733bytes of program memory space, there is a special function register called
20734@code{EIND} that serves as most significant part of the target address
20735when @code{EICALL} or @code{EIJMP} instructions are used.
20736
20737Indirect jumps and calls on these devices are handled as follows by
20738the compiler and are subject to some limitations:
20739
20740@itemize @bullet
20741
20742@item
20743The compiler never sets @code{EIND}.
20744
20745@item
20746The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
20747instructions or might read @code{EIND} directly in order to emulate an
20748indirect call/jump by means of a @code{RET} instruction.
20749
20750@item
20751The compiler assumes that @code{EIND} never changes during the startup
20752code or during the application. In particular, @code{EIND} is not
20753saved/restored in function or interrupt service routine
20754prologue/epilogue.
20755
20756@item
20757For indirect calls to functions and computed goto, the linker
20758generates @emph{stubs}. Stubs are jump pads sometimes also called
20759@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
20760The stub contains a direct jump to the desired address.
20761
20762@item
20763Linker relaxation must be turned on so that the linker generates
20764the stubs correctly in all situations. See the compiler option
20765@option{-mrelax} and the linker option @option{--relax}.
20766There are corner cases where the linker is supposed to generate stubs
20767but aborts without relaxation and without a helpful error message.
20768
20769@item
20770The default linker script is arranged for code with @code{EIND = 0}.
20771If code is supposed to work for a setup with @code{EIND != 0}, a custom
20772linker script has to be used in order to place the sections whose
20773name start with @code{.trampolines} into the segment where @code{EIND}
20774points to.
20775
20776@item
20777The startup code from libgcc never sets @code{EIND}.
20778Notice that startup code is a blend of code from libgcc and AVR-LibC.
20779For the impact of AVR-LibC on @code{EIND}, see the
20780@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
20781
20782@item
20783It is legitimate for user-specific startup code to set up @code{EIND}
20784early, for example by means of initialization code located in
20785section @code{.init3}. Such code runs prior to general startup code
20786that initializes RAM and calls constructors, but after the bit
20787of startup code from AVR-LibC that sets @code{EIND} to the segment
20788where the vector table is located.
20789@example
20790#include <avr/io.h>
20791
20792static void
20793__attribute__((section(".init3"),naked,used,no_instrument_function))
20794init3_set_eind (void)
20795@{
20796  __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
20797                  "out %i0,r24" :: "n" (&EIND) : "r24","memory");
20798@}
20799@end example
20800
20801@noindent
20802The @code{__trampolines_start} symbol is defined in the linker script.
20803
20804@item
20805Stubs are generated automatically by the linker if
20806the following two conditions are met:
20807@itemize @minus
20808
20809@item The address of a label is taken by means of the @code{gs} modifier
20810(short for @emph{generate stubs}) like so:
20811@example
20812LDI r24, lo8(gs(@var{func}))
20813LDI r25, hi8(gs(@var{func}))
20814@end example
20815@item The final location of that label is in a code segment
20816@emph{outside} the segment where the stubs are located.
20817@end itemize
20818
20819@item
20820The compiler emits such @code{gs} modifiers for code labels in the
20821following situations:
20822@itemize @minus
20823@item Taking address of a function or code label.
20824@item Computed goto.
20825@item If prologue-save function is used, see @option{-mcall-prologues}
20826command-line option.
20827@item Switch/case dispatch tables. If you do not want such dispatch
20828tables you can specify the @option{-fno-jump-tables} command-line option.
20829@item C and C++ constructors/destructors called during startup/shutdown.
20830@item If the tools hit a @code{gs()} modifier explained above.
20831@end itemize
20832
20833@item
20834Jumping to non-symbolic addresses like so is @emph{not} supported:
20835
20836@example
20837int main (void)
20838@{
20839    /* Call function at word address 0x2 */
20840    return ((int(*)(void)) 0x2)();
20841@}
20842@end example
20843
20844Instead, a stub has to be set up, i.e.@: the function has to be called
20845through a symbol (@code{func_4} in the example):
20846
20847@example
20848int main (void)
20849@{
20850    extern int func_4 (void);
20851
20852    /* Call function at byte address 0x4 */
20853    return func_4();
20854@}
20855@end example
20856
20857and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
20858Alternatively, @code{func_4} can be defined in the linker script.
20859@end itemize
20860
20861@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
20862@cindex @code{RAMPD}
20863@cindex @code{RAMPX}
20864@cindex @code{RAMPY}
20865@cindex @code{RAMPZ}
20866Some AVR devices support memories larger than the 64@tie{}KiB range
20867that can be accessed with 16-bit pointers.  To access memory locations
20868outside this 64@tie{}KiB range, the content of a @code{RAMP}
20869register is used as high part of the address:
20870The @code{X}, @code{Y}, @code{Z} address register is concatenated
20871with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
20872register, respectively, to get a wide address. Similarly,
20873@code{RAMPD} is used together with direct addressing.
20874
20875@itemize
20876@item
20877The startup code initializes the @code{RAMP} special function
20878registers with zero.
20879
20880@item
20881If a @ref{AVR Named Address Spaces,named address space} other than
20882generic or @code{__flash} is used, then @code{RAMPZ} is set
20883as needed before the operation.
20884
20885@item
20886If the device supports RAM larger than 64@tie{}KiB and the compiler
20887needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
20888is reset to zero after the operation.
20889
20890@item
20891If the device comes with a specific @code{RAMP} register, the ISR
20892prologue/epilogue saves/restores that SFR and initializes it with
20893zero in case the ISR code might (implicitly) use it.
20894
20895@item
20896RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
20897If you use inline assembler to read from locations outside the
2089816-bit address range and change one of the @code{RAMP} registers,
20899you must reset it to zero after the access.
20900
20901@end itemize
20902
20903@subsubsection AVR Built-in Macros
20904
20905GCC defines several built-in macros so that the user code can test
20906for the presence or absence of features.  Almost any of the following
20907built-in macros are deduced from device capabilities and thus
20908triggered by the @option{-mmcu=} command-line option.
20909
20910For even more AVR-specific built-in macros see
20911@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
20912
20913@table @code
20914
20915@item __AVR_ARCH__
20916Build-in macro that resolves to a decimal number that identifies the
20917architecture and depends on the @option{-mmcu=@var{mcu}} option.
20918Possible values are:
20919
20920@code{2}, @code{25}, @code{3}, @code{31}, @code{35},
20921@code{4}, @code{5}, @code{51}, @code{6}
20922
20923for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
20924@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
20925
20926respectively and
20927
20928@code{100},
20929@code{102}, @code{103}, @code{104},
20930@code{105}, @code{106}, @code{107}
20931
20932for @var{mcu}=@code{avrtiny},
20933@code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
20934@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
20935If @var{mcu} specifies a device, this built-in macro is set
20936accordingly. For example, with @option{-mmcu=atmega8} the macro is
20937defined to @code{4}.
20938
20939@item __AVR_@var{Device}__
20940Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
20941the device's name. For example, @option{-mmcu=atmega8} defines the
20942built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
20943@code{__AVR_ATtiny261A__}, etc.
20944
20945The built-in macros' names follow
20946the scheme @code{__AVR_@var{Device}__} where @var{Device} is
20947the device name as from the AVR user manual. The difference between
20948@var{Device} in the built-in macro and @var{device} in
20949@option{-mmcu=@var{device}} is that the latter is always lowercase.
20950
20951If @var{device} is not a device but only a core architecture like
20952@samp{avr51}, this macro is not defined.
20953
20954@item __AVR_DEVICE_NAME__
20955Setting @option{-mmcu=@var{device}} defines this built-in macro to
20956the device's name. For example, with @option{-mmcu=atmega8} the macro
20957is defined to @code{atmega8}.
20958
20959If @var{device} is not a device but only a core architecture like
20960@samp{avr51}, this macro is not defined.
20961
20962@item __AVR_XMEGA__
20963The device / architecture belongs to the XMEGA family of devices.
20964
20965@item __AVR_HAVE_ELPM__
20966The device has the @code{ELPM} instruction.
20967
20968@item __AVR_HAVE_ELPMX__
20969The device has the @code{ELPM R@var{n},Z} and @code{ELPM
20970R@var{n},Z+} instructions.
20971
20972@item __AVR_HAVE_MOVW__
20973The device has the @code{MOVW} instruction to perform 16-bit
20974register-register moves.
20975
20976@item __AVR_HAVE_LPMX__
20977The device has the @code{LPM R@var{n},Z} and
20978@code{LPM R@var{n},Z+} instructions.
20979
20980@item __AVR_HAVE_MUL__
20981The device has a hardware multiplier.
20982
20983@item __AVR_HAVE_JMP_CALL__
20984The device has the @code{JMP} and @code{CALL} instructions.
20985This is the case for devices with more than 8@tie{}KiB of program
20986memory.
20987
20988@item __AVR_HAVE_EIJMP_EICALL__
20989@itemx __AVR_3_BYTE_PC__
20990The device has the @code{EIJMP} and @code{EICALL} instructions.
20991This is the case for devices with more than 128@tie{}KiB of program memory.
20992This also means that the program counter
20993(PC) is 3@tie{}bytes wide.
20994
20995@item __AVR_2_BYTE_PC__
20996The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
20997with up to 128@tie{}KiB of program memory.
20998
20999@item __AVR_HAVE_8BIT_SP__
21000@itemx __AVR_HAVE_16BIT_SP__
21001The stack pointer (SP) register is treated as 8-bit respectively
2100216-bit register by the compiler.
21003The definition of these macros is affected by @option{-mtiny-stack}.
21004
21005@item __AVR_HAVE_SPH__
21006@itemx __AVR_SP8__
21007The device has the SPH (high part of stack pointer) special function
21008register or has an 8-bit stack pointer, respectively.
21009The definition of these macros is affected by @option{-mmcu=} and
21010in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
21011by @option{-msp8}.
21012
21013@item __AVR_HAVE_RAMPD__
21014@itemx __AVR_HAVE_RAMPX__
21015@itemx __AVR_HAVE_RAMPY__
21016@itemx __AVR_HAVE_RAMPZ__
21017The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
21018@code{RAMPZ} special function register, respectively.
21019
21020@item __NO_INTERRUPTS__
21021This macro reflects the @option{-mno-interrupts} command-line option.
21022
21023@item __AVR_ERRATA_SKIP__
21024@itemx __AVR_ERRATA_SKIP_JMP_CALL__
21025Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
21026instructions because of a hardware erratum.  Skip instructions are
21027@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
21028The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
21029set.
21030
21031@item __AVR_ISA_RMW__
21032The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
21033
21034@item __AVR_SFR_OFFSET__=@var{offset}
21035Instructions that can address I/O special function registers directly
21036like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
21037address as if addressed by an instruction to access RAM like @code{LD}
21038or @code{STS}. This offset depends on the device architecture and has
21039to be subtracted from the RAM address in order to get the
21040respective I/O@tie{}address.
21041
21042@item __AVR_SHORT_CALLS__
21043The @option{-mshort-calls} command line option is set.
21044
21045@item __AVR_PM_BASE_ADDRESS__=@var{addr}
21046Some devices support reading from flash memory by means of @code{LD*}
21047instructions.  The flash memory is seen in the data address space
21048at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
21049is not defined, this feature is not available.  If defined,
21050the address space is linear and there is no need to put
21051@code{.rodata} into RAM.  This is handled by the default linker
21052description file, and is currently available for
21053@code{avrtiny} and @code{avrxmega3}.  Even more convenient,
21054there is no need to use address spaces like @code{__flash} or
21055features like attribute @code{progmem} and @code{pgm_read_*}.
21056
21057@item __WITH_AVRLIBC__
21058The compiler is configured to be used together with AVR-Libc.
21059See the @option{--with-avrlibc} configure option.
21060
21061@item __HAVE_DOUBLE_MULTILIB__
21062Defined if @option{-mdouble=} acts as a multilib option.
21063
21064@item __HAVE_DOUBLE32__
21065@itemx __HAVE_DOUBLE64__
21066Defined if the compiler supports 32-bit double resp. 64-bit double.
21067The actual layout is specified by option @option{-mdouble=}.
21068
21069@item __DEFAULT_DOUBLE__
21070The size in bits of @code{double} if @option{-mdouble=} is not set.
21071To test the layout of @code{double} in a program, use the built-in
21072macro @code{__SIZEOF_DOUBLE__}.
21073
21074@item __HAVE_LONG_DOUBLE32__
21075@itemx __HAVE_LONG_DOUBLE64__
21076@itemx __HAVE_LONG_DOUBLE_MULTILIB__
21077@itemx __DEFAULT_LONG_DOUBLE__
21078Same as above, but for @code{long double} instead of @code{double}.
21079
21080@item __WITH_DOUBLE_COMPARISON__
21081Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
21082@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
21083and is defined to @code{2} or @code{3}.
21084
21085@item __WITH_LIBF7_LIBGCC__
21086@itemx __WITH_LIBF7_MATH__
21087@itemx __WITH_LIBF7_MATH_SYMBOLS__
21088Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
21089@w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
21090
21091@end table
21092
21093@node Blackfin Options
21094@subsection Blackfin Options
21095@cindex Blackfin Options
21096
21097@table @gcctabopt
21098@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
21099@opindex mcpu=
21100Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
21101can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
21102@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
21103@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
21104@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
21105@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
21106@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
21107@samp{bf561}, @samp{bf592}.
21108
21109The optional @var{sirevision} specifies the silicon revision of the target
21110Blackfin processor.  Any workarounds available for the targeted silicon revision
21111are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
21112If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
21113are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
21114hexadecimal digits representing the major and minor numbers in the silicon
21115revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
21116is not defined.  If @var{sirevision} is @samp{any}, the
21117@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
21118If this optional @var{sirevision} is not used, GCC assumes the latest known
21119silicon revision of the targeted Blackfin processor.
21120
21121GCC defines a preprocessor macro for the specified @var{cpu}.
21122For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
21123provided by libgloss to be linked in if @option{-msim} is not given.
21124
21125Without this option, @samp{bf532} is used as the processor by default.
21126
21127Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
21128only the preprocessor macro is defined.
21129
21130@item -msim
21131@opindex msim
21132Specifies that the program will be run on the simulator.  This causes
21133the simulator BSP provided by libgloss to be linked in.  This option
21134has effect only for @samp{bfin-elf} toolchain.
21135Certain other options, such as @option{-mid-shared-library} and
21136@option{-mfdpic}, imply @option{-msim}.
21137
21138@item -momit-leaf-frame-pointer
21139@opindex momit-leaf-frame-pointer
21140Don't keep the frame pointer in a register for leaf functions.  This
21141avoids the instructions to save, set up and restore frame pointers and
21142makes an extra register available in leaf functions.
21143
21144@item -mspecld-anomaly
21145@opindex mspecld-anomaly
21146When enabled, the compiler ensures that the generated code does not
21147contain speculative loads after jump instructions. If this option is used,
21148@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
21149
21150@item -mno-specld-anomaly
21151@opindex mno-specld-anomaly
21152@opindex mspecld-anomaly
21153Don't generate extra code to prevent speculative loads from occurring.
21154
21155@item -mcsync-anomaly
21156@opindex mcsync-anomaly
21157When enabled, the compiler ensures that the generated code does not
21158contain CSYNC or SSYNC instructions too soon after conditional branches.
21159If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
21160
21161@item -mno-csync-anomaly
21162@opindex mno-csync-anomaly
21163@opindex mcsync-anomaly
21164Don't generate extra code to prevent CSYNC or SSYNC instructions from
21165occurring too soon after a conditional branch.
21166
21167@item -mlow64k
21168@opindex mlow64k
21169When enabled, the compiler is free to take advantage of the knowledge that
21170the entire program fits into the low 64k of memory.
21171
21172@item -mno-low64k
21173@opindex mno-low64k
21174Assume that the program is arbitrarily large.  This is the default.
21175
21176@item -mstack-check-l1
21177@opindex mstack-check-l1
21178Do stack checking using information placed into L1 scratchpad memory by the
21179uClinux kernel.
21180
21181@item -mid-shared-library
21182@opindex mid-shared-library
21183Generate code that supports shared libraries via the library ID method.
21184This allows for execute in place and shared libraries in an environment
21185without virtual memory management.  This option implies @option{-fPIC}.
21186With a @samp{bfin-elf} target, this option implies @option{-msim}.
21187
21188@item -mno-id-shared-library
21189@opindex mno-id-shared-library
21190@opindex mid-shared-library
21191Generate code that doesn't assume ID-based shared libraries are being used.
21192This is the default.
21193
21194@item -mleaf-id-shared-library
21195@opindex mleaf-id-shared-library
21196Generate code that supports shared libraries via the library ID method,
21197but assumes that this library or executable won't link against any other
21198ID shared libraries.  That allows the compiler to use faster code for jumps
21199and calls.
21200
21201@item -mno-leaf-id-shared-library
21202@opindex mno-leaf-id-shared-library
21203@opindex mleaf-id-shared-library
21204Do not assume that the code being compiled won't link against any ID shared
21205libraries.  Slower code is generated for jump and call insns.
21206
21207@item -mshared-library-id=n
21208@opindex mshared-library-id
21209Specifies the identification number of the ID-based shared library being
21210compiled.  Specifying a value of 0 generates more compact code; specifying
21211other values forces the allocation of that number to the current
21212library but is no more space- or time-efficient than omitting this option.
21213
21214@item -msep-data
21215@opindex msep-data
21216Generate code that allows the data segment to be located in a different
21217area of memory from the text segment.  This allows for execute in place in
21218an environment without virtual memory management by eliminating relocations
21219against the text section.
21220
21221@item -mno-sep-data
21222@opindex mno-sep-data
21223@opindex msep-data
21224Generate code that assumes that the data segment follows the text segment.
21225This is the default.
21226
21227@item -mlong-calls
21228@itemx -mno-long-calls
21229@opindex mlong-calls
21230@opindex mno-long-calls
21231Tells the compiler to perform function calls by first loading the
21232address of the function into a register and then performing a subroutine
21233call on this register.  This switch is needed if the target function
21234lies outside of the 24-bit addressing range of the offset-based
21235version of subroutine call instruction.
21236
21237This feature is not enabled by default.  Specifying
21238@option{-mno-long-calls} restores the default behavior.  Note these
21239switches have no effect on how the compiler generates code to handle
21240function calls via function pointers.
21241
21242@item -mfast-fp
21243@opindex mfast-fp
21244Link with the fast floating-point library. This library relaxes some of
21245the IEEE floating-point standard's rules for checking inputs against
21246Not-a-Number (NAN), in the interest of performance.
21247
21248@item -minline-plt
21249@opindex minline-plt
21250Enable inlining of PLT entries in function calls to functions that are
21251not known to bind locally.  It has no effect without @option{-mfdpic}.
21252
21253@item -mmulticore
21254@opindex mmulticore
21255Build a standalone application for multicore Blackfin processors.
21256This option causes proper start files and link scripts supporting
21257multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
21258It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
21259
21260This option can be used with @option{-mcorea} or @option{-mcoreb}, which
21261selects the one-application-per-core programming model.  Without
21262@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
21263programming model is used. In this model, the main function of Core B
21264should be named as @code{coreb_main}.
21265
21266If this option is not used, the single-core application programming
21267model is used.
21268
21269@item -mcorea
21270@opindex mcorea
21271Build a standalone application for Core A of BF561 when using
21272the one-application-per-core programming model. Proper start files
21273and link scripts are used to support Core A, and the macro
21274@code{__BFIN_COREA} is defined.
21275This option can only be used in conjunction with @option{-mmulticore}.
21276
21277@item -mcoreb
21278@opindex mcoreb
21279Build a standalone application for Core B of BF561 when using
21280the one-application-per-core programming model. Proper start files
21281and link scripts are used to support Core B, and the macro
21282@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
21283should be used instead of @code{main}.
21284This option can only be used in conjunction with @option{-mmulticore}.
21285
21286@item -msdram
21287@opindex msdram
21288Build a standalone application for SDRAM. Proper start files and
21289link scripts are used to put the application into SDRAM, and the macro
21290@code{__BFIN_SDRAM} is defined.
21291The loader should initialize SDRAM before loading the application.
21292
21293@item -micplb
21294@opindex micplb
21295Assume that ICPLBs are enabled at run time.  This has an effect on certain
21296anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
21297are enabled; for standalone applications the default is off.
21298@end table
21299
21300@node C6X Options
21301@subsection C6X Options
21302@cindex C6X Options
21303
21304@table @gcctabopt
21305@item -march=@var{name}
21306@opindex march
21307This specifies the name of the target architecture.  GCC uses this
21308name to determine what kind of instructions it can emit when generating
21309assembly code.  Permissible names are: @samp{c62x},
21310@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
21311
21312@item -mbig-endian
21313@opindex mbig-endian
21314Generate code for a big-endian target.
21315
21316@item -mlittle-endian
21317@opindex mlittle-endian
21318Generate code for a little-endian target.  This is the default.
21319
21320@item -msim
21321@opindex msim
21322Choose startup files and linker script suitable for the simulator.
21323
21324@item -msdata=default
21325@opindex msdata=default
21326Put small global and static data in the @code{.neardata} section,
21327which is pointed to by register @code{B14}.  Put small uninitialized
21328global and static data in the @code{.bss} section, which is adjacent
21329to the @code{.neardata} section.  Put small read-only data into the
21330@code{.rodata} section.  The corresponding sections used for large
21331pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
21332
21333@item -msdata=all
21334@opindex msdata=all
21335Put all data, not just small objects, into the sections reserved for
21336small data, and use addressing relative to the @code{B14} register to
21337access them.
21338
21339@item -msdata=none
21340@opindex msdata=none
21341Make no use of the sections reserved for small data, and use absolute
21342addresses to access all data.  Put all initialized global and static
21343data in the @code{.fardata} section, and all uninitialized data in the
21344@code{.far} section.  Put all constant data into the @code{.const}
21345section.
21346@end table
21347
21348@node CRIS Options
21349@subsection CRIS Options
21350@cindex CRIS Options
21351
21352These options are defined specifically for the CRIS ports.
21353
21354@table @gcctabopt
21355@item -march=@var{architecture-type}
21356@itemx -mcpu=@var{architecture-type}
21357@opindex march
21358@opindex mcpu
21359Generate code for the specified architecture.  The choices for
21360@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
21361respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
21362Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
21363@samp{v10}.
21364
21365@item -mtune=@var{architecture-type}
21366@opindex mtune
21367Tune to @var{architecture-type} everything applicable about the generated
21368code, except for the ABI and the set of available instructions.  The
21369choices for @var{architecture-type} are the same as for
21370@option{-march=@var{architecture-type}}.
21371
21372@item -mmax-stack-frame=@var{n}
21373@opindex mmax-stack-frame
21374Warn when the stack frame of a function exceeds @var{n} bytes.
21375
21376@item -metrax4
21377@itemx -metrax100
21378@opindex metrax4
21379@opindex metrax100
21380The options @option{-metrax4} and @option{-metrax100} are synonyms for
21381@option{-march=v3} and @option{-march=v8} respectively.
21382
21383@item -mmul-bug-workaround
21384@itemx -mno-mul-bug-workaround
21385@opindex mmul-bug-workaround
21386@opindex mno-mul-bug-workaround
21387Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
21388models where it applies.  This option is active by default.
21389
21390@item -mpdebug
21391@opindex mpdebug
21392Enable CRIS-specific verbose debug-related information in the assembly
21393code.  This option also has the effect of turning off the @samp{#NO_APP}
21394formatted-code indicator to the assembler at the beginning of the
21395assembly file.
21396
21397@item -mcc-init
21398@opindex mcc-init
21399Do not use condition-code results from previous instruction; always emit
21400compare and test instructions before use of condition codes.
21401
21402@item -mno-side-effects
21403@opindex mno-side-effects
21404@opindex mside-effects
21405Do not emit instructions with side effects in addressing modes other than
21406post-increment.
21407
21408@item -mstack-align
21409@itemx -mno-stack-align
21410@itemx -mdata-align
21411@itemx -mno-data-align
21412@itemx -mconst-align
21413@itemx -mno-const-align
21414@opindex mstack-align
21415@opindex mno-stack-align
21416@opindex mdata-align
21417@opindex mno-data-align
21418@opindex mconst-align
21419@opindex mno-const-align
21420These options (@samp{no-} options) arrange (eliminate arrangements) for the
21421stack frame, individual data and constants to be aligned for the maximum
21422single data access size for the chosen CPU model.  The default is to
21423arrange for 32-bit alignment.  ABI details such as structure layout are
21424not affected by these options.
21425
21426@item -m32-bit
21427@itemx -m16-bit
21428@itemx -m8-bit
21429@opindex m32-bit
21430@opindex m16-bit
21431@opindex m8-bit
21432Similar to the stack- data- and const-align options above, these options
21433arrange for stack frame, writable data and constants to all be 32-bit,
2143416-bit or 8-bit aligned.  The default is 32-bit alignment.
21435
21436@item -mno-prologue-epilogue
21437@itemx -mprologue-epilogue
21438@opindex mno-prologue-epilogue
21439@opindex mprologue-epilogue
21440With @option{-mno-prologue-epilogue}, the normal function prologue and
21441epilogue which set up the stack frame are omitted and no return
21442instructions or return sequences are generated in the code.  Use this
21443option only together with visual inspection of the compiled code: no
21444warnings or errors are generated when call-saved registers must be saved,
21445or storage for local variables needs to be allocated.
21446
21447@item -mno-gotplt
21448@itemx -mgotplt
21449@opindex mno-gotplt
21450@opindex mgotplt
21451With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
21452instruction sequences that load addresses for functions from the PLT part
21453of the GOT rather than (traditional on other architectures) calls to the
21454PLT@.  The default is @option{-mgotplt}.
21455
21456@item -melf
21457@opindex melf
21458Legacy no-op option only recognized with the cris-axis-elf and
21459cris-axis-linux-gnu targets.
21460
21461@item -mlinux
21462@opindex mlinux
21463Legacy no-op option only recognized with the cris-axis-linux-gnu target.
21464
21465@item -sim
21466@opindex sim
21467This option, recognized for the cris-axis-elf, arranges
21468to link with input-output functions from a simulator library.  Code,
21469initialized data and zero-initialized data are allocated consecutively.
21470
21471@item -sim2
21472@opindex sim2
21473Like @option{-sim}, but pass linker options to locate initialized data at
214740x40000000 and zero-initialized data at 0x80000000.
21475@end table
21476
21477@node CR16 Options
21478@subsection CR16 Options
21479@cindex CR16 Options
21480
21481These options are defined specifically for the CR16 ports.
21482
21483@table @gcctabopt
21484
21485@item -mmac
21486@opindex mmac
21487Enable the use of multiply-accumulate instructions. Disabled by default.
21488
21489@item -mcr16cplus
21490@itemx -mcr16c
21491@opindex mcr16cplus
21492@opindex mcr16c
21493Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
21494is default.
21495
21496@item -msim
21497@opindex msim
21498Links the library libsim.a which is in compatible with simulator. Applicable
21499to ELF compiler only.
21500
21501@item -mint32
21502@opindex mint32
21503Choose integer type as 32-bit wide.
21504
21505@item -mbit-ops
21506@opindex mbit-ops
21507Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
21508
21509@item -mdata-model=@var{model}
21510@opindex mdata-model
21511Choose a data model. The choices for @var{model} are @samp{near},
21512@samp{far} or @samp{medium}. @samp{medium} is default.
21513However, @samp{far} is not valid with @option{-mcr16c}, as the
21514CR16C architecture does not support the far data model.
21515@end table
21516
21517@node C-SKY Options
21518@subsection C-SKY Options
21519@cindex C-SKY Options
21520
21521GCC supports these options when compiling for C-SKY V2 processors.
21522
21523@table @gcctabopt
21524
21525@item -march=@var{arch}
21526@opindex march=
21527Specify the C-SKY target architecture.  Valid values for @var{arch} are:
21528@samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
21529The default is @samp{ck810}.
21530
21531@item -mcpu=@var{cpu}
21532@opindex mcpu=
21533Specify the C-SKY target processor.  Valid values for @var{cpu} are:
21534@samp{ck801}, @samp{ck801t},
21535@samp{ck802}, @samp{ck802t}, @samp{ck802j},
21536@samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
21537@samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
21538@samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
21539@samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
21540@samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
21541@samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
21542@samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
21543@samp{ck803eftr1}, @samp{ck803efhtr1},
21544@samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
21545@samp{ck803sef}, @samp{ck803seft},
21546@samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
21547@samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
21548@samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
21549@samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
21550
21551@item -mbig-endian
21552@opindex mbig-endian
21553@itemx -EB
21554@opindex EB
21555@itemx -mlittle-endian
21556@opindex mlittle-endian
21557@itemx -EL
21558@opindex EL
21559
21560Select big- or little-endian code.  The default is little-endian.
21561
21562@item -mfloat-abi=@var{name}
21563@opindex mfloat-abi
21564Specifies which floating-point ABI to use.  Permissible values
21565are: @samp{soft}, @samp{softfp} and @samp{hard}.
21566
21567Specifying @samp{soft} causes GCC to generate output containing
21568library calls for floating-point operations.
21569@samp{softfp} allows the generation of code using hardware floating-point
21570instructions, but still uses the soft-float calling conventions.
21571@samp{hard} allows generation of floating-point instructions
21572and uses FPU-specific calling conventions.
21573
21574The default depends on the specific target configuration.  Note that
21575the hard-float and soft-float ABIs are not link-compatible; you must
21576compile your entire program with the same ABI, and link with a
21577compatible set of libraries.
21578
21579@item -mhard-float
21580@opindex mhard-float
21581@itemx -msoft-float
21582@opindex msoft-float
21583
21584Select hardware or software floating-point implementations.
21585The default is soft float.
21586
21587@item -mdouble-float
21588@itemx -mno-double-float
21589@opindex mdouble-float
21590When @option{-mhard-float} is in effect, enable generation of
21591double-precision float instructions.  This is the default except
21592when compiling for CK803.
21593
21594@item -mfdivdu
21595@itemx -mno-fdivdu
21596@opindex mfdivdu
21597When @option{-mhard-float} is in effect, enable generation of
21598@code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
21599This is the default except when compiling for CK803.
21600
21601@item -mfpu=@var{fpu}
21602@opindex mfpu=
21603Select the floating-point processor.  This option can only be used with
21604@option{-mhard-float}.
21605Values for @var{fpu} are
21606@samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
21607@samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
21608@samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
21609
21610@item -melrw
21611@itemx -mno-elrw
21612@opindex melrw
21613Enable the extended @code{lrw} instruction.  This option defaults to on
21614for CK801 and off otherwise.
21615
21616@item -mistack
21617@itemx -mno-istack
21618@opindex mistack
21619Enable interrupt stack instructions; the default is off.
21620
21621The @option{-mistack} option is required to handle the
21622@code{interrupt} and @code{isr} function attributes
21623(@pxref{C-SKY Function Attributes}).
21624
21625@item -mmp
21626@opindex mmp
21627Enable multiprocessor instructions; the default is off.
21628
21629@item -mcp
21630@opindex mcp
21631Enable coprocessor instructions; the default is off.
21632
21633@item -mcache
21634@opindex mcache
21635Enable coprocessor instructions; the default is off.
21636
21637@item -msecurity
21638@opindex msecurity
21639Enable C-SKY security instructions; the default is off.
21640
21641@item -mtrust
21642@opindex mtrust
21643Enable C-SKY trust instructions; the default is off.
21644
21645@item -mdsp
21646@opindex mdsp
21647@itemx -medsp
21648@opindex medsp
21649@itemx -mvdsp
21650@opindex mvdsp
21651Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
21652All of these options default to off.
21653
21654@item -mdiv
21655@itemx -mno-div
21656@opindex mdiv
21657Generate divide instructions.  Default is off.
21658
21659@item -msmart
21660@itemx -mno-smart
21661@opindex msmart
21662Generate code for Smart Mode, using only registers numbered 0-7 to allow
21663use of 16-bit instructions.  This option is ignored for CK801 where this
21664is the required behavior, and it defaults to on for CK802.
21665For other targets, the default is off.
21666
21667@item -mhigh-registers
21668@itemx -mno-high-registers
21669@opindex mhigh-registers
21670Generate code using the high registers numbered 16-31.  This option
21671is not supported on CK801, CK802, or CK803, and is enabled by default
21672for other processors.
21673
21674@item -manchor
21675@itemx -mno-anchor
21676@opindex manchor
21677Generate code using global anchor symbol addresses.
21678
21679@item -mpushpop
21680@itemx -mno-pushpop
21681@opindex mpushpop
21682Generate code using @code{push} and @code{pop} instructions.  This option
21683defaults to on.
21684
21685@item -mmultiple-stld
21686@itemx -mstm
21687@itemx -mno-multiple-stld
21688@itemx -mno-stm
21689@opindex mmultiple-stld
21690Generate code using @code{stm} and @code{ldm} instructions.  This option
21691isn't supported on CK801 but is enabled by default on other processors.
21692
21693@item -mconstpool
21694@itemx -mno-constpool
21695@opindex mconstpool
21696Create constant pools in the compiler instead of deferring it to the
21697assembler.  This option is the default and required for correct code
21698generation on CK801 and CK802, and is optional on other processors.
21699
21700@item -mstack-size
21701@item -mno-stack-size
21702@opindex mstack-size
21703Emit @code{.stack_size} directives for each function in the assembly
21704output.  This option defaults to off.
21705
21706@item -mccrt
21707@itemx -mno-ccrt
21708@opindex mccrt
21709Generate code for the C-SKY compiler runtime instead of libgcc.  This
21710option defaults to off.
21711
21712@item -mbranch-cost=@var{n}
21713@opindex mbranch-cost=
21714Set the branch costs to roughly @code{n} instructions.  The default is 1.
21715
21716@item -msched-prolog
21717@itemx -mno-sched-prolog
21718@opindex msched-prolog
21719Permit scheduling of function prologue and epilogue sequences.  Using
21720this option can result in code that is not compliant with the C-SKY V2 ABI
21721prologue requirements and that cannot be debugged or backtraced.
21722It is disabled by default.
21723
21724@item -msim
21725@opindex msim
21726Links the library libsemi.a which is in compatible with simulator. Applicable
21727to ELF compiler only.
21728
21729@end table
21730
21731@node Darwin Options
21732@subsection Darwin Options
21733@cindex Darwin options
21734
21735These options are defined for all architectures running the Darwin operating
21736system.
21737
21738FSF GCC on Darwin does not create ``fat'' object files; it creates
21739an object file for the single architecture that GCC was built to
21740target.  Apple's GCC on Darwin does create ``fat'' files if multiple
21741@option{-arch} options are used; it does so by running the compiler or
21742linker multiple times and joining the results together with
21743@file{lipo}.
21744
21745The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
21746@samp{i686}) is determined by the flags that specify the ISA
21747that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
21748@option{-force_cpusubtype_ALL} option can be used to override this.
21749
21750The Darwin tools vary in their behavior when presented with an ISA
21751mismatch.  The assembler, @file{as}, only permits instructions to
21752be used that are valid for the subtype of the file it is generating,
21753so you cannot put 64-bit instructions in a @samp{ppc750} object file.
21754The linker for shared libraries, @file{/usr/bin/libtool}, fails
21755and prints an error if asked to create a shared library with a less
21756restrictive subtype than its input files (for instance, trying to put
21757a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
21758for executables, @command{ld}, quietly gives the executable the most
21759restrictive subtype of any of its input files.
21760
21761@table @gcctabopt
21762@item -F@var{dir}
21763@opindex F
21764Add the framework directory @var{dir} to the head of the list of
21765directories to be searched for header files.  These directories are
21766interleaved with those specified by @option{-I} options and are
21767scanned in a left-to-right order.
21768
21769A framework directory is a directory with frameworks in it.  A
21770framework is a directory with a @file{Headers} and/or
21771@file{PrivateHeaders} directory contained directly in it that ends
21772in @file{.framework}.  The name of a framework is the name of this
21773directory excluding the @file{.framework}.  Headers associated with
21774the framework are found in one of those two directories, with
21775@file{Headers} being searched first.  A subframework is a framework
21776directory that is in a framework's @file{Frameworks} directory.
21777Includes of subframework headers can only appear in a header of a
21778framework that contains the subframework, or in a sibling subframework
21779header.  Two subframeworks are siblings if they occur in the same
21780framework.  A subframework should not have the same name as a
21781framework; a warning is issued if this is violated.  Currently a
21782subframework cannot have subframeworks; in the future, the mechanism
21783may be extended to support this.  The standard frameworks can be found
21784in @file{/System/Library/Frameworks} and
21785@file{/Library/Frameworks}.  An example include looks like
21786@code{#include <Framework/header.h>}, where @file{Framework} denotes
21787the name of the framework and @file{header.h} is found in the
21788@file{PrivateHeaders} or @file{Headers} directory.
21789
21790@item -iframework@var{dir}
21791@opindex iframework
21792Like @option{-F} except the directory is a treated as a system
21793directory.  The main difference between this @option{-iframework} and
21794@option{-F} is that with @option{-iframework} the compiler does not
21795warn about constructs contained within header files found via
21796@var{dir}.  This option is valid only for the C family of languages.
21797
21798@item -gused
21799@opindex gused
21800Emit debugging information for symbols that are used.  For stabs
21801debugging format, this enables @option{-feliminate-unused-debug-symbols}.
21802This is by default ON@.
21803
21804@item -gfull
21805@opindex gfull
21806Emit debugging information for all symbols and types.
21807
21808@item -mmacosx-version-min=@var{version}
21809The earliest version of MacOS X that this executable will run on
21810is @var{version}.  Typical values of @var{version} include @code{10.1},
21811@code{10.2}, and @code{10.3.9}.
21812
21813If the compiler was built to use the system's headers by default,
21814then the default for this option is the system version on which the
21815compiler is running, otherwise the default is to make choices that
21816are compatible with as many systems and code bases as possible.
21817
21818@item -mkernel
21819@opindex mkernel
21820Enable kernel development mode.  The @option{-mkernel} option sets
21821@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
21822@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
21823@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
21824applicable.  This mode also sets @option{-mno-altivec},
21825@option{-msoft-float}, @option{-fno-builtin} and
21826@option{-mlong-branch} for PowerPC targets.
21827
21828@item -mone-byte-bool
21829@opindex mone-byte-bool
21830Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
21831By default @code{sizeof(bool)} is @code{4} when compiling for
21832Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
21833option has no effect on x86.
21834
21835@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
21836to generate code that is not binary compatible with code generated
21837without that switch.  Using this switch may require recompiling all
21838other modules in a program, including system libraries.  Use this
21839switch to conform to a non-default data model.
21840
21841@item -mfix-and-continue
21842@itemx -ffix-and-continue
21843@itemx -findirect-data
21844@opindex mfix-and-continue
21845@opindex ffix-and-continue
21846@opindex findirect-data
21847Generate code suitable for fast turnaround development, such as to
21848allow GDB to dynamically load @file{.o} files into already-running
21849programs.  @option{-findirect-data} and @option{-ffix-and-continue}
21850are provided for backwards compatibility.
21851
21852@item -all_load
21853@opindex all_load
21854Loads all members of static archive libraries.
21855See man ld(1) for more information.
21856
21857@item -arch_errors_fatal
21858@opindex arch_errors_fatal
21859Cause the errors having to do with files that have the wrong architecture
21860to be fatal.
21861
21862@item -bind_at_load
21863@opindex bind_at_load
21864Causes the output file to be marked such that the dynamic linker will
21865bind all undefined references when the file is loaded or launched.
21866
21867@item -bundle
21868@opindex bundle
21869Produce a Mach-o bundle format file.
21870See man ld(1) for more information.
21871
21872@item -bundle_loader @var{executable}
21873@opindex bundle_loader
21874This option specifies the @var{executable} that will load the build
21875output file being linked.  See man ld(1) for more information.
21876
21877@item -dynamiclib
21878@opindex dynamiclib
21879When passed this option, GCC produces a dynamic library instead of
21880an executable when linking, using the Darwin @file{libtool} command.
21881
21882@item -force_cpusubtype_ALL
21883@opindex force_cpusubtype_ALL
21884This causes GCC's output file to have the @samp{ALL} subtype, instead of
21885one controlled by the @option{-mcpu} or @option{-march} option.
21886
21887@item -allowable_client  @var{client_name}
21888@itemx -client_name
21889@itemx -compatibility_version
21890@itemx -current_version
21891@itemx -dead_strip
21892@itemx -dependency-file
21893@itemx -dylib_file
21894@itemx -dylinker_install_name
21895@itemx -dynamic
21896@itemx -exported_symbols_list
21897@itemx -filelist
21898@need 800
21899@itemx -flat_namespace
21900@itemx -force_flat_namespace
21901@itemx -headerpad_max_install_names
21902@itemx -image_base
21903@itemx -init
21904@itemx -install_name
21905@itemx -keep_private_externs
21906@itemx -multi_module
21907@itemx -multiply_defined
21908@itemx -multiply_defined_unused
21909@need 800
21910@itemx -noall_load
21911@itemx -no_dead_strip_inits_and_terms
21912@itemx -nofixprebinding
21913@itemx -nomultidefs
21914@itemx -noprebind
21915@itemx -noseglinkedit
21916@itemx -pagezero_size
21917@itemx -prebind
21918@itemx -prebind_all_twolevel_modules
21919@itemx -private_bundle
21920@need 800
21921@itemx -read_only_relocs
21922@itemx -sectalign
21923@itemx -sectobjectsymbols
21924@itemx -whyload
21925@itemx -seg1addr
21926@itemx -sectcreate
21927@itemx -sectobjectsymbols
21928@itemx -sectorder
21929@itemx -segaddr
21930@itemx -segs_read_only_addr
21931@need 800
21932@itemx -segs_read_write_addr
21933@itemx -seg_addr_table
21934@itemx -seg_addr_table_filename
21935@itemx -seglinkedit
21936@itemx -segprot
21937@itemx -segs_read_only_addr
21938@itemx -segs_read_write_addr
21939@itemx -single_module
21940@itemx -static
21941@itemx -sub_library
21942@need 800
21943@itemx -sub_umbrella
21944@itemx -twolevel_namespace
21945@itemx -umbrella
21946@itemx -undefined
21947@itemx -unexported_symbols_list
21948@itemx -weak_reference_mismatches
21949@itemx -whatsloaded
21950@opindex allowable_client
21951@opindex client_name
21952@opindex compatibility_version
21953@opindex current_version
21954@opindex dead_strip
21955@opindex dependency-file
21956@opindex dylib_file
21957@opindex dylinker_install_name
21958@opindex dynamic
21959@opindex exported_symbols_list
21960@opindex filelist
21961@opindex flat_namespace
21962@opindex force_flat_namespace
21963@opindex headerpad_max_install_names
21964@opindex image_base
21965@opindex init
21966@opindex install_name
21967@opindex keep_private_externs
21968@opindex multi_module
21969@opindex multiply_defined
21970@opindex multiply_defined_unused
21971@opindex noall_load
21972@opindex no_dead_strip_inits_and_terms
21973@opindex nofixprebinding
21974@opindex nomultidefs
21975@opindex noprebind
21976@opindex noseglinkedit
21977@opindex pagezero_size
21978@opindex prebind
21979@opindex prebind_all_twolevel_modules
21980@opindex private_bundle
21981@opindex read_only_relocs
21982@opindex sectalign
21983@opindex sectobjectsymbols
21984@opindex whyload
21985@opindex seg1addr
21986@opindex sectcreate
21987@opindex sectobjectsymbols
21988@opindex sectorder
21989@opindex segaddr
21990@opindex segs_read_only_addr
21991@opindex segs_read_write_addr
21992@opindex seg_addr_table
21993@opindex seg_addr_table_filename
21994@opindex seglinkedit
21995@opindex segprot
21996@opindex segs_read_only_addr
21997@opindex segs_read_write_addr
21998@opindex single_module
21999@opindex static
22000@opindex sub_library
22001@opindex sub_umbrella
22002@opindex twolevel_namespace
22003@opindex umbrella
22004@opindex undefined
22005@opindex unexported_symbols_list
22006@opindex weak_reference_mismatches
22007@opindex whatsloaded
22008These options are passed to the Darwin linker.  The Darwin linker man page
22009describes them in detail.
22010@end table
22011
22012@node DEC Alpha Options
22013@subsection DEC Alpha Options
22014
22015These @samp{-m} options are defined for the DEC Alpha implementations:
22016
22017@table @gcctabopt
22018@item -mno-soft-float
22019@itemx -msoft-float
22020@opindex mno-soft-float
22021@opindex msoft-float
22022Use (do not use) the hardware floating-point instructions for
22023floating-point operations.  When @option{-msoft-float} is specified,
22024functions in @file{libgcc.a} are used to perform floating-point
22025operations.  Unless they are replaced by routines that emulate the
22026floating-point operations, or compiled in such a way as to call such
22027emulations routines, these routines issue floating-point
22028operations.   If you are compiling for an Alpha without floating-point
22029operations, you must ensure that the library is built so as not to call
22030them.
22031
22032Note that Alpha implementations without floating-point operations are
22033required to have floating-point registers.
22034
22035@item -mfp-reg
22036@itemx -mno-fp-regs
22037@opindex mfp-reg
22038@opindex mno-fp-regs
22039Generate code that uses (does not use) the floating-point register set.
22040@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
22041register set is not used, floating-point operands are passed in integer
22042registers as if they were integers and floating-point results are passed
22043in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
22044so any function with a floating-point argument or return value called by code
22045compiled with @option{-mno-fp-regs} must also be compiled with that
22046option.
22047
22048A typical use of this option is building a kernel that does not use,
22049and hence need not save and restore, any floating-point registers.
22050
22051@item -mieee
22052@opindex mieee
22053The Alpha architecture implements floating-point hardware optimized for
22054maximum performance.  It is mostly compliant with the IEEE floating-point
22055standard.  However, for full compliance, software assistance is
22056required.  This option generates code fully IEEE-compliant code
22057@emph{except} that the @var{inexact-flag} is not maintained (see below).
22058If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
22059defined during compilation.  The resulting code is less efficient but is
22060able to correctly support denormalized numbers and exceptional IEEE
22061values such as not-a-number and plus/minus infinity.  Other Alpha
22062compilers call this option @option{-ieee_with_no_inexact}.
22063
22064@item -mieee-with-inexact
22065@opindex mieee-with-inexact
22066This is like @option{-mieee} except the generated code also maintains
22067the IEEE @var{inexact-flag}.  Turning on this option causes the
22068generated code to implement fully-compliant IEEE math.  In addition to
22069@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
22070macro.  On some Alpha implementations the resulting code may execute
22071significantly slower than the code generated by default.  Since there is
22072very little code that depends on the @var{inexact-flag}, you should
22073normally not specify this option.  Other Alpha compilers call this
22074option @option{-ieee_with_inexact}.
22075
22076@item -mfp-trap-mode=@var{trap-mode}
22077@opindex mfp-trap-mode
22078This option controls what floating-point related traps are enabled.
22079Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
22080The trap mode can be set to one of four values:
22081
22082@table @samp
22083@item n
22084This is the default (normal) setting.  The only traps that are enabled
22085are the ones that cannot be disabled in software (e.g., division by zero
22086trap).
22087
22088@item u
22089In addition to the traps enabled by @samp{n}, underflow traps are enabled
22090as well.
22091
22092@item su
22093Like @samp{u}, but the instructions are marked to be safe for software
22094completion (see Alpha architecture manual for details).
22095
22096@item sui
22097Like @samp{su}, but inexact traps are enabled as well.
22098@end table
22099
22100@item -mfp-rounding-mode=@var{rounding-mode}
22101@opindex mfp-rounding-mode
22102Selects the IEEE rounding mode.  Other Alpha compilers call this option
22103@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
22104of:
22105
22106@table @samp
22107@item n
22108Normal IEEE rounding mode.  Floating-point numbers are rounded towards
22109the nearest machine number or towards the even machine number in case
22110of a tie.
22111
22112@item m
22113Round towards minus infinity.
22114
22115@item c
22116Chopped rounding mode.  Floating-point numbers are rounded towards zero.
22117
22118@item d
22119Dynamic rounding mode.  A field in the floating-point control register
22120(@var{fpcr}, see Alpha architecture reference manual) controls the
22121rounding mode in effect.  The C library initializes this register for
22122rounding towards plus infinity.  Thus, unless your program modifies the
22123@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
22124@end table
22125
22126@item -mtrap-precision=@var{trap-precision}
22127@opindex mtrap-precision
22128In the Alpha architecture, floating-point traps are imprecise.  This
22129means without software assistance it is impossible to recover from a
22130floating trap and program execution normally needs to be terminated.
22131GCC can generate code that can assist operating system trap handlers
22132in determining the exact location that caused a floating-point trap.
22133Depending on the requirements of an application, different levels of
22134precisions can be selected:
22135
22136@table @samp
22137@item p
22138Program precision.  This option is the default and means a trap handler
22139can only identify which program caused a floating-point exception.
22140
22141@item f
22142Function precision.  The trap handler can determine the function that
22143caused a floating-point exception.
22144
22145@item i
22146Instruction precision.  The trap handler can determine the exact
22147instruction that caused a floating-point exception.
22148@end table
22149
22150Other Alpha compilers provide the equivalent options called
22151@option{-scope_safe} and @option{-resumption_safe}.
22152
22153@item -mieee-conformant
22154@opindex mieee-conformant
22155This option marks the generated code as IEEE conformant.  You must not
22156use this option unless you also specify @option{-mtrap-precision=i} and either
22157@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
22158is to emit the line @samp{.eflag 48} in the function prologue of the
22159generated assembly file.
22160
22161@item -mbuild-constants
22162@opindex mbuild-constants
22163Normally GCC examines a 32- or 64-bit integer constant to
22164see if it can construct it from smaller constants in two or three
22165instructions.  If it cannot, it outputs the constant as a literal and
22166generates code to load it from the data segment at run time.
22167
22168Use this option to require GCC to construct @emph{all} integer constants
22169using code, even if it takes more instructions (the maximum is six).
22170
22171You typically use this option to build a shared library dynamic
22172loader.  Itself a shared library, it must relocate itself in memory
22173before it can find the variables and constants in its own data segment.
22174
22175@item -mbwx
22176@itemx -mno-bwx
22177@itemx -mcix
22178@itemx -mno-cix
22179@itemx -mfix
22180@itemx -mno-fix
22181@itemx -mmax
22182@itemx -mno-max
22183@opindex mbwx
22184@opindex mno-bwx
22185@opindex mcix
22186@opindex mno-cix
22187@opindex mfix
22188@opindex mno-fix
22189@opindex mmax
22190@opindex mno-max
22191Indicate whether GCC should generate code to use the optional BWX,
22192CIX, FIX and MAX instruction sets.  The default is to use the instruction
22193sets supported by the CPU type specified via @option{-mcpu=} option or that
22194of the CPU on which GCC was built if none is specified.
22195
22196@item -mfloat-vax
22197@itemx -mfloat-ieee
22198@opindex mfloat-vax
22199@opindex mfloat-ieee
22200Generate code that uses (does not use) VAX F and G floating-point
22201arithmetic instead of IEEE single and double precision.
22202
22203@item -mexplicit-relocs
22204@itemx -mno-explicit-relocs
22205@opindex mexplicit-relocs
22206@opindex mno-explicit-relocs
22207Older Alpha assemblers provided no way to generate symbol relocations
22208except via assembler macros.  Use of these macros does not allow
22209optimal instruction scheduling.  GNU binutils as of version 2.12
22210supports a new syntax that allows the compiler to explicitly mark
22211which relocations should apply to which instructions.  This option
22212is mostly useful for debugging, as GCC detects the capabilities of
22213the assembler when it is built and sets the default accordingly.
22214
22215@item -msmall-data
22216@itemx -mlarge-data
22217@opindex msmall-data
22218@opindex mlarge-data
22219When @option{-mexplicit-relocs} is in effect, static data is
22220accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
22221is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
22222(the @code{.sdata} and @code{.sbss} sections) and are accessed via
2222316-bit relocations off of the @code{$gp} register.  This limits the
22224size of the small data area to 64KB, but allows the variables to be
22225directly accessed via a single instruction.
22226
22227The default is @option{-mlarge-data}.  With this option the data area
22228is limited to just below 2GB@.  Programs that require more than 2GB of
22229data must use @code{malloc} or @code{mmap} to allocate the data in the
22230heap instead of in the program's data segment.
22231
22232When generating code for shared libraries, @option{-fpic} implies
22233@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
22234
22235@item -msmall-text
22236@itemx -mlarge-text
22237@opindex msmall-text
22238@opindex mlarge-text
22239When @option{-msmall-text} is used, the compiler assumes that the
22240code of the entire program (or shared library) fits in 4MB, and is
22241thus reachable with a branch instruction.  When @option{-msmall-data}
22242is used, the compiler can assume that all local symbols share the
22243same @code{$gp} value, and thus reduce the number of instructions
22244required for a function call from 4 to 1.
22245
22246The default is @option{-mlarge-text}.
22247
22248@item -mcpu=@var{cpu_type}
22249@opindex mcpu
22250Set the instruction set and instruction scheduling parameters for
22251machine type @var{cpu_type}.  You can specify either the @samp{EV}
22252style name or the corresponding chip number.  GCC supports scheduling
22253parameters for the EV4, EV5 and EV6 family of processors and
22254chooses the default values for the instruction set from the processor
22255you specify.  If you do not specify a processor type, GCC defaults
22256to the processor on which the compiler was built.
22257
22258Supported values for @var{cpu_type} are
22259
22260@table @samp
22261@item ev4
22262@itemx ev45
22263@itemx 21064
22264Schedules as an EV4 and has no instruction set extensions.
22265
22266@item ev5
22267@itemx 21164
22268Schedules as an EV5 and has no instruction set extensions.
22269
22270@item ev56
22271@itemx 21164a
22272Schedules as an EV5 and supports the BWX extension.
22273
22274@item pca56
22275@itemx 21164pc
22276@itemx 21164PC
22277Schedules as an EV5 and supports the BWX and MAX extensions.
22278
22279@item ev6
22280@itemx 21264
22281Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
22282
22283@item ev67
22284@itemx 21264a
22285Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
22286@end table
22287
22288Native toolchains also support the value @samp{native},
22289which selects the best architecture option for the host processor.
22290@option{-mcpu=native} has no effect if GCC does not recognize
22291the processor.
22292
22293@item -mtune=@var{cpu_type}
22294@opindex mtune
22295Set only the instruction scheduling parameters for machine type
22296@var{cpu_type}.  The instruction set is not changed.
22297
22298Native toolchains also support the value @samp{native},
22299which selects the best architecture option for the host processor.
22300@option{-mtune=native} has no effect if GCC does not recognize
22301the processor.
22302
22303@item -mmemory-latency=@var{time}
22304@opindex mmemory-latency
22305Sets the latency the scheduler should assume for typical memory
22306references as seen by the application.  This number is highly
22307dependent on the memory access patterns used by the application
22308and the size of the external cache on the machine.
22309
22310Valid options for @var{time} are
22311
22312@table @samp
22313@item @var{number}
22314A decimal number representing clock cycles.
22315
22316@item L1
22317@itemx L2
22318@itemx L3
22319@itemx main
22320The compiler contains estimates of the number of clock cycles for
22321``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
22322(also called Dcache, Scache, and Bcache), as well as to main memory.
22323Note that L3 is only valid for EV5.
22324
22325@end table
22326@end table
22327
22328@node eBPF Options
22329@subsection eBPF Options
22330@cindex eBPF Options
22331
22332@table @gcctabopt
22333@item -mframe-limit=@var{bytes}
22334This specifies the hard limit for frame sizes, in bytes.  Currently,
22335the value that can be specified should be less than or equal to
22336@samp{32767}.  Defaults to whatever limit is imposed by the version of
22337the Linux kernel targeted.
22338
22339@item -mkernel=@var{version}
22340@opindex mkernel
22341This specifies the minimum version of the kernel that will run the
22342compiled program.  GCC uses this version to determine which
22343instructions to use, what kernel helpers to allow, etc.  Currently,
22344@var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
22345@samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
22346@samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
22347@samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
22348@samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
22349@samp{5.2}, @samp{latest} and @samp{native}.
22350
22351@item -mbig-endian
22352@opindex mbig-endian
22353Generate code for a big-endian target.
22354
22355@item -mlittle-endian
22356@opindex mlittle-endian
22357Generate code for a little-endian target.  This is the default.
22358
22359@item -mxbpf
22360Generate code for an expanded version of BPF, which relaxes some of
22361the restrictions imposed by the BPF architecture:
22362@itemize @minus
22363@item Save and restore callee-saved registers at function entry and
22364exit, respectively.
22365@end itemize
22366@end table
22367
22368@node FR30 Options
22369@subsection FR30 Options
22370@cindex FR30 Options
22371
22372These options are defined specifically for the FR30 port.
22373
22374@table @gcctabopt
22375
22376@item -msmall-model
22377@opindex msmall-model
22378Use the small address space model.  This can produce smaller code, but
22379it does assume that all symbolic values and addresses fit into a
2238020-bit range.
22381
22382@item -mno-lsim
22383@opindex mno-lsim
22384Assume that runtime support has been provided and so there is no need
22385to include the simulator library (@file{libsim.a}) on the linker
22386command line.
22387
22388@end table
22389
22390@node FT32 Options
22391@subsection FT32 Options
22392@cindex FT32 Options
22393
22394These options are defined specifically for the FT32 port.
22395
22396@table @gcctabopt
22397
22398@item -msim
22399@opindex msim
22400Specifies that the program will be run on the simulator.  This causes
22401an alternate runtime startup and library to be linked.
22402You must not use this option when generating programs that will run on
22403real hardware; you must provide your own runtime library for whatever
22404I/O functions are needed.
22405
22406@item -mlra
22407@opindex mlra
22408Enable Local Register Allocation.  This is still experimental for FT32,
22409so by default the compiler uses standard reload.
22410
22411@item -mnodiv
22412@opindex mnodiv
22413Do not use div and mod instructions.
22414
22415@item -mft32b
22416@opindex mft32b
22417Enable use of the extended instructions of the FT32B processor.
22418
22419@item -mcompress
22420@opindex mcompress
22421Compress all code using the Ft32B code compression scheme.
22422
22423@item -mnopm
22424@opindex  mnopm
22425Do not generate code that reads program memory.
22426
22427@end table
22428
22429@node FRV Options
22430@subsection FRV Options
22431@cindex FRV Options
22432
22433@table @gcctabopt
22434@item -mgpr-32
22435@opindex mgpr-32
22436
22437Only use the first 32 general-purpose registers.
22438
22439@item -mgpr-64
22440@opindex mgpr-64
22441
22442Use all 64 general-purpose registers.
22443
22444@item -mfpr-32
22445@opindex mfpr-32
22446
22447Use only the first 32 floating-point registers.
22448
22449@item -mfpr-64
22450@opindex mfpr-64
22451
22452Use all 64 floating-point registers.
22453
22454@item -mhard-float
22455@opindex mhard-float
22456
22457Use hardware instructions for floating-point operations.
22458
22459@item -msoft-float
22460@opindex msoft-float
22461
22462Use library routines for floating-point operations.
22463
22464@item -malloc-cc
22465@opindex malloc-cc
22466
22467Dynamically allocate condition code registers.
22468
22469@item -mfixed-cc
22470@opindex mfixed-cc
22471
22472Do not try to dynamically allocate condition code registers, only
22473use @code{icc0} and @code{fcc0}.
22474
22475@item -mdword
22476@opindex mdword
22477
22478Change ABI to use double word insns.
22479
22480@item -mno-dword
22481@opindex mno-dword
22482@opindex mdword
22483
22484Do not use double word instructions.
22485
22486@item -mdouble
22487@opindex mdouble
22488
22489Use floating-point double instructions.
22490
22491@item -mno-double
22492@opindex mno-double
22493
22494Do not use floating-point double instructions.
22495
22496@item -mmedia
22497@opindex mmedia
22498
22499Use media instructions.
22500
22501@item -mno-media
22502@opindex mno-media
22503
22504Do not use media instructions.
22505
22506@item -mmuladd
22507@opindex mmuladd
22508
22509Use multiply and add/subtract instructions.
22510
22511@item -mno-muladd
22512@opindex mno-muladd
22513
22514Do not use multiply and add/subtract instructions.
22515
22516@item -mfdpic
22517@opindex mfdpic
22518
22519Select the FDPIC ABI, which uses function descriptors to represent
22520pointers to functions.  Without any PIC/PIE-related options, it
22521implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
22522assumes GOT entries and small data are within a 12-bit range from the
22523GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
22524are computed with 32 bits.
22525With a @samp{bfin-elf} target, this option implies @option{-msim}.
22526
22527@item -minline-plt
22528@opindex minline-plt
22529
22530Enable inlining of PLT entries in function calls to functions that are
22531not known to bind locally.  It has no effect without @option{-mfdpic}.
22532It's enabled by default if optimizing for speed and compiling for
22533shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
22534optimization option such as @option{-O3} or above is present in the
22535command line.
22536
22537@item -mTLS
22538@opindex mTLS
22539
22540Assume a large TLS segment when generating thread-local code.
22541
22542@item -mtls
22543@opindex mtls
22544
22545Do not assume a large TLS segment when generating thread-local code.
22546
22547@item -mgprel-ro
22548@opindex mgprel-ro
22549
22550Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
22551that is known to be in read-only sections.  It's enabled by default,
22552except for @option{-fpic} or @option{-fpie}: even though it may help
22553make the global offset table smaller, it trades 1 instruction for 4.
22554With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
22555one of which may be shared by multiple symbols, and it avoids the need
22556for a GOT entry for the referenced symbol, so it's more likely to be a
22557win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
22558
22559@item -multilib-library-pic
22560@opindex multilib-library-pic
22561
22562Link with the (library, not FD) pic libraries.  It's implied by
22563@option{-mlibrary-pic}, as well as by @option{-fPIC} and
22564@option{-fpic} without @option{-mfdpic}.  You should never have to use
22565it explicitly.
22566
22567@item -mlinked-fp
22568@opindex mlinked-fp
22569
22570Follow the EABI requirement of always creating a frame pointer whenever
22571a stack frame is allocated.  This option is enabled by default and can
22572be disabled with @option{-mno-linked-fp}.
22573
22574@item -mlong-calls
22575@opindex mlong-calls
22576
22577Use indirect addressing to call functions outside the current
22578compilation unit.  This allows the functions to be placed anywhere
22579within the 32-bit address space.
22580
22581@item -malign-labels
22582@opindex malign-labels
22583
22584Try to align labels to an 8-byte boundary by inserting NOPs into the
22585previous packet.  This option only has an effect when VLIW packing
22586is enabled.  It doesn't create new packets; it merely adds NOPs to
22587existing ones.
22588
22589@item -mlibrary-pic
22590@opindex mlibrary-pic
22591
22592Generate position-independent EABI code.
22593
22594@item -macc-4
22595@opindex macc-4
22596
22597Use only the first four media accumulator registers.
22598
22599@item -macc-8
22600@opindex macc-8
22601
22602Use all eight media accumulator registers.
22603
22604@item -mpack
22605@opindex mpack
22606
22607Pack VLIW instructions.
22608
22609@item -mno-pack
22610@opindex mno-pack
22611
22612Do not pack VLIW instructions.
22613
22614@item -mno-eflags
22615@opindex mno-eflags
22616
22617Do not mark ABI switches in e_flags.
22618
22619@item -mcond-move
22620@opindex mcond-move
22621
22622Enable the use of conditional-move instructions (default).
22623
22624This switch is mainly for debugging the compiler and will likely be removed
22625in a future version.
22626
22627@item -mno-cond-move
22628@opindex mno-cond-move
22629
22630Disable the use of conditional-move instructions.
22631
22632This switch is mainly for debugging the compiler and will likely be removed
22633in a future version.
22634
22635@item -mscc
22636@opindex mscc
22637
22638Enable the use of conditional set instructions (default).
22639
22640This switch is mainly for debugging the compiler and will likely be removed
22641in a future version.
22642
22643@item -mno-scc
22644@opindex mno-scc
22645
22646Disable the use of conditional set instructions.
22647
22648This switch is mainly for debugging the compiler and will likely be removed
22649in a future version.
22650
22651@item -mcond-exec
22652@opindex mcond-exec
22653
22654Enable the use of conditional execution (default).
22655
22656This switch is mainly for debugging the compiler and will likely be removed
22657in a future version.
22658
22659@item -mno-cond-exec
22660@opindex mno-cond-exec
22661
22662Disable the use of conditional execution.
22663
22664This switch is mainly for debugging the compiler and will likely be removed
22665in a future version.
22666
22667@item -mvliw-branch
22668@opindex mvliw-branch
22669
22670Run a pass to pack branches into VLIW instructions (default).
22671
22672This switch is mainly for debugging the compiler and will likely be removed
22673in a future version.
22674
22675@item -mno-vliw-branch
22676@opindex mno-vliw-branch
22677
22678Do not run a pass to pack branches into VLIW instructions.
22679
22680This switch is mainly for debugging the compiler and will likely be removed
22681in a future version.
22682
22683@item -mmulti-cond-exec
22684@opindex mmulti-cond-exec
22685
22686Enable optimization of @code{&&} and @code{||} in conditional execution
22687(default).
22688
22689This switch is mainly for debugging the compiler and will likely be removed
22690in a future version.
22691
22692@item -mno-multi-cond-exec
22693@opindex mno-multi-cond-exec
22694
22695Disable optimization of @code{&&} and @code{||} in conditional execution.
22696
22697This switch is mainly for debugging the compiler and will likely be removed
22698in a future version.
22699
22700@item -mnested-cond-exec
22701@opindex mnested-cond-exec
22702
22703Enable nested conditional execution optimizations (default).
22704
22705This switch is mainly for debugging the compiler and will likely be removed
22706in a future version.
22707
22708@item -mno-nested-cond-exec
22709@opindex mno-nested-cond-exec
22710
22711Disable nested conditional execution optimizations.
22712
22713This switch is mainly for debugging the compiler and will likely be removed
22714in a future version.
22715
22716@item -moptimize-membar
22717@opindex moptimize-membar
22718
22719This switch removes redundant @code{membar} instructions from the
22720compiler-generated code.  It is enabled by default.
22721
22722@item -mno-optimize-membar
22723@opindex mno-optimize-membar
22724@opindex moptimize-membar
22725
22726This switch disables the automatic removal of redundant @code{membar}
22727instructions from the generated code.
22728
22729@item -mtomcat-stats
22730@opindex mtomcat-stats
22731
22732Cause gas to print out tomcat statistics.
22733
22734@item -mcpu=@var{cpu}
22735@opindex mcpu
22736
22737Select the processor type for which to generate code.  Possible values are
22738@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
22739@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
22740
22741@end table
22742
22743@node GNU/Linux Options
22744@subsection GNU/Linux Options
22745
22746These @samp{-m} options are defined for GNU/Linux targets:
22747
22748@table @gcctabopt
22749@item -mglibc
22750@opindex mglibc
22751Use the GNU C library.  This is the default except
22752on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
22753@samp{*-*-linux-*android*} targets.
22754
22755@item -muclibc
22756@opindex muclibc
22757Use uClibc C library.  This is the default on
22758@samp{*-*-linux-*uclibc*} targets.
22759
22760@item -mmusl
22761@opindex mmusl
22762Use the musl C library.  This is the default on
22763@samp{*-*-linux-*musl*} targets.
22764
22765@item -mbionic
22766@opindex mbionic
22767Use Bionic C library.  This is the default on
22768@samp{*-*-linux-*android*} targets.
22769
22770@item -mandroid
22771@opindex mandroid
22772Compile code compatible with Android platform.  This is the default on
22773@samp{*-*-linux-*android*} targets.
22774
22775When compiling, this option enables @option{-mbionic}, @option{-fPIC},
22776@option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
22777this option makes the GCC driver pass Android-specific options to the linker.
22778Finally, this option causes the preprocessor macro @code{__ANDROID__}
22779to be defined.
22780
22781@item -tno-android-cc
22782@opindex tno-android-cc
22783Disable compilation effects of @option{-mandroid}, i.e., do not enable
22784@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
22785@option{-fno-rtti} by default.
22786
22787@item -tno-android-ld
22788@opindex tno-android-ld
22789Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
22790linking options to the linker.
22791
22792@end table
22793
22794@node H8/300 Options
22795@subsection H8/300 Options
22796
22797These @samp{-m} options are defined for the H8/300 implementations:
22798
22799@table @gcctabopt
22800@item -mrelax
22801@opindex mrelax
22802Shorten some address references at link time, when possible; uses the
22803linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
22804ld, Using ld}, for a fuller description.
22805
22806@item -mh
22807@opindex mh
22808Generate code for the H8/300H@.
22809
22810@item -ms
22811@opindex ms
22812Generate code for the H8S@.
22813
22814@item -mn
22815@opindex mn
22816Generate code for the H8S and H8/300H in the normal mode.  This switch
22817must be used either with @option{-mh} or @option{-ms}.
22818
22819@item -ms2600
22820@opindex ms2600
22821Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
22822
22823@item -mexr
22824@opindex mexr
22825Extended registers are stored on stack before execution of function
22826with monitor attribute. Default option is @option{-mexr}.
22827This option is valid only for H8S targets.
22828
22829@item -mno-exr
22830@opindex mno-exr
22831@opindex mexr
22832Extended registers are not stored on stack before execution of function
22833with monitor attribute. Default option is @option{-mno-exr}.
22834This option is valid only for H8S targets.
22835
22836@item -mint32
22837@opindex mint32
22838Make @code{int} data 32 bits by default.
22839
22840@item -malign-300
22841@opindex malign-300
22842On the H8/300H and H8S, use the same alignment rules as for the H8/300.
22843The default for the H8/300H and H8S is to align longs and floats on
228444-byte boundaries.
22845@option{-malign-300} causes them to be aligned on 2-byte boundaries.
22846This option has no effect on the H8/300.
22847@end table
22848
22849@node HPPA Options
22850@subsection HPPA Options
22851@cindex HPPA Options
22852
22853These @samp{-m} options are defined for the HPPA family of computers:
22854
22855@table @gcctabopt
22856@item -march=@var{architecture-type}
22857@opindex march
22858Generate code for the specified architecture.  The choices for
22859@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
228601.1, and @samp{2.0} for PA 2.0 processors.  Refer to
22861@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
22862architecture option for your machine.  Code compiled for lower numbered
22863architectures runs on higher numbered architectures, but not the
22864other way around.
22865
22866@item -mpa-risc-1-0
22867@itemx -mpa-risc-1-1
22868@itemx -mpa-risc-2-0
22869@opindex mpa-risc-1-0
22870@opindex mpa-risc-1-1
22871@opindex mpa-risc-2-0
22872Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
22873
22874@item -mcaller-copies
22875@opindex mcaller-copies
22876The caller copies function arguments passed by hidden reference.  This
22877option should be used with care as it is not compatible with the default
2287832-bit runtime.  However, only aggregates larger than eight bytes are
22879passed by hidden reference and the option provides better compatibility
22880with OpenMP.
22881
22882@item -mjump-in-delay
22883@opindex mjump-in-delay
22884This option is ignored and provided for compatibility purposes only.
22885
22886@item -mdisable-fpregs
22887@opindex mdisable-fpregs
22888Prevent floating-point registers from being used in any manner.  This is
22889necessary for compiling kernels that perform lazy context switching of
22890floating-point registers.  If you use this option and attempt to perform
22891floating-point operations, the compiler aborts.
22892
22893@item -mdisable-indexing
22894@opindex mdisable-indexing
22895Prevent the compiler from using indexing address modes.  This avoids some
22896rather obscure problems when compiling MIG generated code under MACH@.
22897
22898@item -mno-space-regs
22899@opindex mno-space-regs
22900@opindex mspace-regs
22901Generate code that assumes the target has no space registers.  This allows
22902GCC to generate faster indirect calls and use unscaled index address modes.
22903
22904Such code is suitable for level 0 PA systems and kernels.
22905
22906@item -mfast-indirect-calls
22907@opindex mfast-indirect-calls
22908Generate code that assumes calls never cross space boundaries.  This
22909allows GCC to emit code that performs faster indirect calls.
22910
22911This option does not work in the presence of shared libraries or nested
22912functions.
22913
22914@item -mfixed-range=@var{register-range}
22915@opindex mfixed-range
22916Generate code treating the given register range as fixed registers.
22917A fixed register is one that the register allocator cannot use.  This is
22918useful when compiling kernel code.  A register range is specified as
22919two registers separated by a dash.  Multiple register ranges can be
22920specified separated by a comma.
22921
22922@item -mlong-load-store
22923@opindex mlong-load-store
22924Generate 3-instruction load and store sequences as sometimes required by
22925the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
22926the HP compilers.
22927
22928@item -mportable-runtime
22929@opindex mportable-runtime
22930Use the portable calling conventions proposed by HP for ELF systems.
22931
22932@item -mgas
22933@opindex mgas
22934Enable the use of assembler directives only GAS understands.
22935
22936@item -mschedule=@var{cpu-type}
22937@opindex mschedule
22938Schedule code according to the constraints for the machine type
22939@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
22940@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
22941to @file{/usr/lib/sched.models} on an HP-UX system to determine the
22942proper scheduling option for your machine.  The default scheduling is
22943@samp{8000}.
22944
22945@item -mlinker-opt
22946@opindex mlinker-opt
22947Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
22948debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
22949linkers in which they give bogus error messages when linking some programs.
22950
22951@item -msoft-float
22952@opindex msoft-float
22953Generate output containing library calls for floating point.
22954@strong{Warning:} the requisite libraries are not available for all HPPA
22955targets.  Normally the facilities of the machine's usual C compiler are
22956used, but this cannot be done directly in cross-compilation.  You must make
22957your own arrangements to provide suitable library functions for
22958cross-compilation.
22959
22960@option{-msoft-float} changes the calling convention in the output file;
22961therefore, it is only useful if you compile @emph{all} of a program with
22962this option.  In particular, you need to compile @file{libgcc.a}, the
22963library that comes with GCC, with @option{-msoft-float} in order for
22964this to work.
22965
22966@item -msio
22967@opindex msio
22968Generate the predefine, @code{_SIO}, for server IO@.  The default is
22969@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
22970@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
22971options are available under HP-UX and HI-UX@.
22972
22973@item -mgnu-ld
22974@opindex mgnu-ld
22975Use options specific to GNU @command{ld}.
22976This passes @option{-shared} to @command{ld} when
22977building a shared library.  It is the default when GCC is configured,
22978explicitly or implicitly, with the GNU linker.  This option does not
22979affect which @command{ld} is called; it only changes what parameters
22980are passed to that @command{ld}.
22981The @command{ld} that is called is determined by the
22982@option{--with-ld} configure option, GCC's program search path, and
22983finally by the user's @env{PATH}.  The linker used by GCC can be printed
22984using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
22985on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
22986
22987@item -mhp-ld
22988@opindex mhp-ld
22989Use options specific to HP @command{ld}.
22990This passes @option{-b} to @command{ld} when building
22991a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
22992links.  It is the default when GCC is configured, explicitly or
22993implicitly, with the HP linker.  This option does not affect
22994which @command{ld} is called; it only changes what parameters are passed to that
22995@command{ld}.
22996The @command{ld} that is called is determined by the @option{--with-ld}
22997configure option, GCC's program search path, and finally by the user's
22998@env{PATH}.  The linker used by GCC can be printed using @samp{which
22999`gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
23000HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
23001
23002@item -mlong-calls
23003@opindex mno-long-calls
23004@opindex mlong-calls
23005Generate code that uses long call sequences.  This ensures that a call
23006is always able to reach linker generated stubs.  The default is to generate
23007long calls only when the distance from the call site to the beginning
23008of the function or translation unit, as the case may be, exceeds a
23009predefined limit set by the branch type being used.  The limits for
23010normal calls are 7,600,000 and 240,000 bytes, respectively for the
23011PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
23012240,000 bytes.
23013
23014Distances are measured from the beginning of functions when using the
23015@option{-ffunction-sections} option, or when using the @option{-mgas}
23016and @option{-mno-portable-runtime} options together under HP-UX with
23017the SOM linker.
23018
23019It is normally not desirable to use this option as it degrades
23020performance.  However, it may be useful in large applications,
23021particularly when partial linking is used to build the application.
23022
23023The types of long calls used depends on the capabilities of the
23024assembler and linker, and the type of code being generated.  The
23025impact on systems that support long absolute calls, and long pic
23026symbol-difference or pc-relative calls should be relatively small.
23027However, an indirect call is used on 32-bit ELF systems in pic code
23028and it is quite long.
23029
23030@item -munix=@var{unix-std}
23031@opindex march
23032Generate compiler predefines and select a startfile for the specified
23033UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
23034and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
23035is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
2303611.11 and later.  The default values are @samp{93} for HP-UX 10.00,
23037@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
23038and later.
23039
23040@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
23041@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
23042and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
23043@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
23044@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
23045@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
23046
23047It is @emph{important} to note that this option changes the interfaces
23048for various library routines.  It also affects the operational behavior
23049of the C library.  Thus, @emph{extreme} care is needed in using this
23050option.
23051
23052Library code that is intended to operate with more than one UNIX
23053standard must test, set and restore the variable @code{__xpg4_extended_mask}
23054as appropriate.  Most GNU software doesn't provide this capability.
23055
23056@item -nolibdld
23057@opindex nolibdld
23058Suppress the generation of link options to search libdld.sl when the
23059@option{-static} option is specified on HP-UX 10 and later.
23060
23061@item -static
23062@opindex static
23063The HP-UX implementation of setlocale in libc has a dependency on
23064libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
23065when the @option{-static} option is specified, special link options
23066are needed to resolve this dependency.
23067
23068On HP-UX 10 and later, the GCC driver adds the necessary options to
23069link with libdld.sl when the @option{-static} option is specified.
23070This causes the resulting binary to be dynamic.  On the 64-bit port,
23071the linkers generate dynamic binaries by default in any case.  The
23072@option{-nolibdld} option can be used to prevent the GCC driver from
23073adding these link options.
23074
23075@item -threads
23076@opindex threads
23077Add support for multithreading with the @dfn{dce thread} library
23078under HP-UX@.  This option sets flags for both the preprocessor and
23079linker.
23080@end table
23081
23082@node IA-64 Options
23083@subsection IA-64 Options
23084@cindex IA-64 Options
23085
23086These are the @samp{-m} options defined for the Intel IA-64 architecture.
23087
23088@table @gcctabopt
23089@item -mbig-endian
23090@opindex mbig-endian
23091Generate code for a big-endian target.  This is the default for HP-UX@.
23092
23093@item -mlittle-endian
23094@opindex mlittle-endian
23095Generate code for a little-endian target.  This is the default for AIX5
23096and GNU/Linux.
23097
23098@item -mgnu-as
23099@itemx -mno-gnu-as
23100@opindex mgnu-as
23101@opindex mno-gnu-as
23102Generate (or don't) code for the GNU assembler.  This is the default.
23103@c Also, this is the default if the configure option @option{--with-gnu-as}
23104@c is used.
23105
23106@item -mgnu-ld
23107@itemx -mno-gnu-ld
23108@opindex mgnu-ld
23109@opindex mno-gnu-ld
23110Generate (or don't) code for the GNU linker.  This is the default.
23111@c Also, this is the default if the configure option @option{--with-gnu-ld}
23112@c is used.
23113
23114@item -mno-pic
23115@opindex mno-pic
23116Generate code that does not use a global pointer register.  The result
23117is not position independent code, and violates the IA-64 ABI@.
23118
23119@item -mvolatile-asm-stop
23120@itemx -mno-volatile-asm-stop
23121@opindex mvolatile-asm-stop
23122@opindex mno-volatile-asm-stop
23123Generate (or don't) a stop bit immediately before and after volatile asm
23124statements.
23125
23126@item -mregister-names
23127@itemx -mno-register-names
23128@opindex mregister-names
23129@opindex mno-register-names
23130Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
23131the stacked registers.  This may make assembler output more readable.
23132
23133@item -mno-sdata
23134@itemx -msdata
23135@opindex mno-sdata
23136@opindex msdata
23137Disable (or enable) optimizations that use the small data section.  This may
23138be useful for working around optimizer bugs.
23139
23140@item -mconstant-gp
23141@opindex mconstant-gp
23142Generate code that uses a single constant global pointer value.  This is
23143useful when compiling kernel code.
23144
23145@item -mauto-pic
23146@opindex mauto-pic
23147Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
23148This is useful when compiling firmware code.
23149
23150@item -minline-float-divide-min-latency
23151@opindex minline-float-divide-min-latency
23152Generate code for inline divides of floating-point values
23153using the minimum latency algorithm.
23154
23155@item -minline-float-divide-max-throughput
23156@opindex minline-float-divide-max-throughput
23157Generate code for inline divides of floating-point values
23158using the maximum throughput algorithm.
23159
23160@item -mno-inline-float-divide
23161@opindex mno-inline-float-divide
23162Do not generate inline code for divides of floating-point values.
23163
23164@item -minline-int-divide-min-latency
23165@opindex minline-int-divide-min-latency
23166Generate code for inline divides of integer values
23167using the minimum latency algorithm.
23168
23169@item -minline-int-divide-max-throughput
23170@opindex minline-int-divide-max-throughput
23171Generate code for inline divides of integer values
23172using the maximum throughput algorithm.
23173
23174@item -mno-inline-int-divide
23175@opindex mno-inline-int-divide
23176@opindex minline-int-divide
23177Do not generate inline code for divides of integer values.
23178
23179@item -minline-sqrt-min-latency
23180@opindex minline-sqrt-min-latency
23181Generate code for inline square roots
23182using the minimum latency algorithm.
23183
23184@item -minline-sqrt-max-throughput
23185@opindex minline-sqrt-max-throughput
23186Generate code for inline square roots
23187using the maximum throughput algorithm.
23188
23189@item -mno-inline-sqrt
23190@opindex mno-inline-sqrt
23191Do not generate inline code for @code{sqrt}.
23192
23193@item -mfused-madd
23194@itemx -mno-fused-madd
23195@opindex mfused-madd
23196@opindex mno-fused-madd
23197Do (don't) generate code that uses the fused multiply/add or multiply/subtract
23198instructions.  The default is to use these instructions.
23199
23200@item -mno-dwarf2-asm
23201@itemx -mdwarf2-asm
23202@opindex mno-dwarf2-asm
23203@opindex mdwarf2-asm
23204Don't (or do) generate assembler code for the DWARF line number debugging
23205info.  This may be useful when not using the GNU assembler.
23206
23207@item -mearly-stop-bits
23208@itemx -mno-early-stop-bits
23209@opindex mearly-stop-bits
23210@opindex mno-early-stop-bits
23211Allow stop bits to be placed earlier than immediately preceding the
23212instruction that triggered the stop bit.  This can improve instruction
23213scheduling, but does not always do so.
23214
23215@item -mfixed-range=@var{register-range}
23216@opindex mfixed-range
23217Generate code treating the given register range as fixed registers.
23218A fixed register is one that the register allocator cannot use.  This is
23219useful when compiling kernel code.  A register range is specified as
23220two registers separated by a dash.  Multiple register ranges can be
23221specified separated by a comma.
23222
23223@item -mtls-size=@var{tls-size}
23224@opindex mtls-size
23225Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
2322664.
23227
23228@item -mtune=@var{cpu-type}
23229@opindex mtune
23230Tune the instruction scheduling for a particular CPU, Valid values are
23231@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
23232and @samp{mckinley}.
23233
23234@item -milp32
23235@itemx -mlp64
23236@opindex milp32
23237@opindex mlp64
23238Generate code for a 32-bit or 64-bit environment.
23239The 32-bit environment sets int, long and pointer to 32 bits.
23240The 64-bit environment sets int to 32 bits and long and pointer
23241to 64 bits.  These are HP-UX specific flags.
23242
23243@item -mno-sched-br-data-spec
23244@itemx -msched-br-data-spec
23245@opindex mno-sched-br-data-spec
23246@opindex msched-br-data-spec
23247(Dis/En)able data speculative scheduling before reload.
23248This results in generation of @code{ld.a} instructions and
23249the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23250The default setting is disabled.
23251
23252@item -msched-ar-data-spec
23253@itemx -mno-sched-ar-data-spec
23254@opindex msched-ar-data-spec
23255@opindex mno-sched-ar-data-spec
23256(En/Dis)able data speculative scheduling after reload.
23257This results in generation of @code{ld.a} instructions and
23258the corresponding check instructions (@code{ld.c} / @code{chk.a}).
23259The default setting is enabled.
23260
23261@item -mno-sched-control-spec
23262@itemx -msched-control-spec
23263@opindex mno-sched-control-spec
23264@opindex msched-control-spec
23265(Dis/En)able control speculative scheduling.  This feature is
23266available only during region scheduling (i.e.@: before reload).
23267This results in generation of the @code{ld.s} instructions and
23268the corresponding check instructions @code{chk.s}.
23269The default setting is disabled.
23270
23271@item -msched-br-in-data-spec
23272@itemx -mno-sched-br-in-data-spec
23273@opindex msched-br-in-data-spec
23274@opindex mno-sched-br-in-data-spec
23275(En/Dis)able speculative scheduling of the instructions that
23276are dependent on the data speculative loads before reload.
23277This is effective only with @option{-msched-br-data-spec} enabled.
23278The default setting is enabled.
23279
23280@item -msched-ar-in-data-spec
23281@itemx -mno-sched-ar-in-data-spec
23282@opindex msched-ar-in-data-spec
23283@opindex mno-sched-ar-in-data-spec
23284(En/Dis)able speculative scheduling of the instructions that
23285are dependent on the data speculative loads after reload.
23286This is effective only with @option{-msched-ar-data-spec} enabled.
23287The default setting is enabled.
23288
23289@item -msched-in-control-spec
23290@itemx -mno-sched-in-control-spec
23291@opindex msched-in-control-spec
23292@opindex mno-sched-in-control-spec
23293(En/Dis)able speculative scheduling of the instructions that
23294are dependent on the control speculative loads.
23295This is effective only with @option{-msched-control-spec} enabled.
23296The default setting is enabled.
23297
23298@item -mno-sched-prefer-non-data-spec-insns
23299@itemx -msched-prefer-non-data-spec-insns
23300@opindex mno-sched-prefer-non-data-spec-insns
23301@opindex msched-prefer-non-data-spec-insns
23302If enabled, data-speculative instructions are chosen for schedule
23303only if there are no other choices at the moment.  This makes
23304the use of the data speculation much more conservative.
23305The default setting is disabled.
23306
23307@item -mno-sched-prefer-non-control-spec-insns
23308@itemx -msched-prefer-non-control-spec-insns
23309@opindex mno-sched-prefer-non-control-spec-insns
23310@opindex msched-prefer-non-control-spec-insns
23311If enabled, control-speculative instructions are chosen for schedule
23312only if there are no other choices at the moment.  This makes
23313the use of the control speculation much more conservative.
23314The default setting is disabled.
23315
23316@item -mno-sched-count-spec-in-critical-path
23317@itemx -msched-count-spec-in-critical-path
23318@opindex mno-sched-count-spec-in-critical-path
23319@opindex msched-count-spec-in-critical-path
23320If enabled, speculative dependencies are considered during
23321computation of the instructions priorities.  This makes the use of the
23322speculation a bit more conservative.
23323The default setting is disabled.
23324
23325@item -msched-spec-ldc
23326@opindex msched-spec-ldc
23327Use a simple data speculation check.  This option is on by default.
23328
23329@item -msched-control-spec-ldc
23330@opindex msched-spec-ldc
23331Use a simple check for control speculation.  This option is on by default.
23332
23333@item -msched-stop-bits-after-every-cycle
23334@opindex msched-stop-bits-after-every-cycle
23335Place a stop bit after every cycle when scheduling.  This option is on
23336by default.
23337
23338@item -msched-fp-mem-deps-zero-cost
23339@opindex msched-fp-mem-deps-zero-cost
23340Assume that floating-point stores and loads are not likely to cause a conflict
23341when placed into the same instruction group.  This option is disabled by
23342default.
23343
23344@item -msel-sched-dont-check-control-spec
23345@opindex msel-sched-dont-check-control-spec
23346Generate checks for control speculation in selective scheduling.
23347This flag is disabled by default.
23348
23349@item -msched-max-memory-insns=@var{max-insns}
23350@opindex msched-max-memory-insns
23351Limit on the number of memory insns per instruction group, giving lower
23352priority to subsequent memory insns attempting to schedule in the same
23353instruction group. Frequently useful to prevent cache bank conflicts.
23354The default value is 1.
23355
23356@item -msched-max-memory-insns-hard-limit
23357@opindex msched-max-memory-insns-hard-limit
23358Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
23359disallowing more than that number in an instruction group.
23360Otherwise, the limit is ``soft'', meaning that non-memory operations
23361are preferred when the limit is reached, but memory operations may still
23362be scheduled.
23363
23364@end table
23365
23366@node LM32 Options
23367@subsection LM32 Options
23368@cindex LM32 options
23369
23370These @option{-m} options are defined for the LatticeMico32 architecture:
23371
23372@table @gcctabopt
23373@item -mbarrel-shift-enabled
23374@opindex mbarrel-shift-enabled
23375Enable barrel-shift instructions.
23376
23377@item -mdivide-enabled
23378@opindex mdivide-enabled
23379Enable divide and modulus instructions.
23380
23381@item -mmultiply-enabled
23382@opindex multiply-enabled
23383Enable multiply instructions.
23384
23385@item -msign-extend-enabled
23386@opindex msign-extend-enabled
23387Enable sign extend instructions.
23388
23389@item -muser-enabled
23390@opindex muser-enabled
23391Enable user-defined instructions.
23392
23393@end table
23394
23395@node M32C Options
23396@subsection M32C Options
23397@cindex M32C options
23398
23399@table @gcctabopt
23400@item -mcpu=@var{name}
23401@opindex mcpu=
23402Select the CPU for which code is generated.  @var{name} may be one of
23403@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
23404/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
23405the M32C/80 series.
23406
23407@item -msim
23408@opindex msim
23409Specifies that the program will be run on the simulator.  This causes
23410an alternate runtime library to be linked in which supports, for
23411example, file I/O@.  You must not use this option when generating
23412programs that will run on real hardware; you must provide your own
23413runtime library for whatever I/O functions are needed.
23414
23415@item -memregs=@var{number}
23416@opindex memregs=
23417Specifies the number of memory-based pseudo-registers GCC uses
23418during code generation.  These pseudo-registers are used like real
23419registers, so there is a tradeoff between GCC's ability to fit the
23420code into available registers, and the performance penalty of using
23421memory instead of registers.  Note that all modules in a program must
23422be compiled with the same value for this option.  Because of that, you
23423must not use this option with GCC's default runtime libraries.
23424
23425@end table
23426
23427@node M32R/D Options
23428@subsection M32R/D Options
23429@cindex M32R/D options
23430
23431These @option{-m} options are defined for Renesas M32R/D architectures:
23432
23433@table @gcctabopt
23434@item -m32r2
23435@opindex m32r2
23436Generate code for the M32R/2@.
23437
23438@item -m32rx
23439@opindex m32rx
23440Generate code for the M32R/X@.
23441
23442@item -m32r
23443@opindex m32r
23444Generate code for the M32R@.  This is the default.
23445
23446@item -mmodel=small
23447@opindex mmodel=small
23448Assume all objects live in the lower 16MB of memory (so that their addresses
23449can be loaded with the @code{ld24} instruction), and assume all subroutines
23450are reachable with the @code{bl} instruction.
23451This is the default.
23452
23453The addressability of a particular object can be set with the
23454@code{model} attribute.
23455
23456@item -mmodel=medium
23457@opindex mmodel=medium
23458Assume objects may be anywhere in the 32-bit address space (the compiler
23459generates @code{seth/add3} instructions to load their addresses), and
23460assume all subroutines are reachable with the @code{bl} instruction.
23461
23462@item -mmodel=large
23463@opindex mmodel=large
23464Assume objects may be anywhere in the 32-bit address space (the compiler
23465generates @code{seth/add3} instructions to load their addresses), and
23466assume subroutines may not be reachable with the @code{bl} instruction
23467(the compiler generates the much slower @code{seth/add3/jl}
23468instruction sequence).
23469
23470@item -msdata=none
23471@opindex msdata=none
23472Disable use of the small data area.  Variables are put into
23473one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
23474@code{section} attribute has been specified).
23475This is the default.
23476
23477The small data area consists of sections @code{.sdata} and @code{.sbss}.
23478Objects may be explicitly put in the small data area with the
23479@code{section} attribute using one of these sections.
23480
23481@item -msdata=sdata
23482@opindex msdata=sdata
23483Put small global and static data in the small data area, but do not
23484generate special code to reference them.
23485
23486@item -msdata=use
23487@opindex msdata=use
23488Put small global and static data in the small data area, and generate
23489special instructions to reference them.
23490
23491@item -G @var{num}
23492@opindex G
23493@cindex smaller data references
23494Put global and static objects less than or equal to @var{num} bytes
23495into the small data or BSS sections instead of the normal data or BSS
23496sections.  The default value of @var{num} is 8.
23497The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
23498for this option to have any effect.
23499
23500All modules should be compiled with the same @option{-G @var{num}} value.
23501Compiling with different values of @var{num} may or may not work; if it
23502doesn't the linker gives an error message---incorrect code is not
23503generated.
23504
23505@item -mdebug
23506@opindex mdebug
23507Makes the M32R-specific code in the compiler display some statistics
23508that might help in debugging programs.
23509
23510@item -malign-loops
23511@opindex malign-loops
23512Align all loops to a 32-byte boundary.
23513
23514@item -mno-align-loops
23515@opindex mno-align-loops
23516Do not enforce a 32-byte alignment for loops.  This is the default.
23517
23518@item -missue-rate=@var{number}
23519@opindex missue-rate=@var{number}
23520Issue @var{number} instructions per cycle.  @var{number} can only be 1
23521or 2.
23522
23523@item -mbranch-cost=@var{number}
23524@opindex mbranch-cost=@var{number}
23525@var{number} can only be 1 or 2.  If it is 1 then branches are
23526preferred over conditional code, if it is 2, then the opposite applies.
23527
23528@item -mflush-trap=@var{number}
23529@opindex mflush-trap=@var{number}
23530Specifies the trap number to use to flush the cache.  The default is
2353112.  Valid numbers are between 0 and 15 inclusive.
23532
23533@item -mno-flush-trap
23534@opindex mno-flush-trap
23535Specifies that the cache cannot be flushed by using a trap.
23536
23537@item -mflush-func=@var{name}
23538@opindex mflush-func=@var{name}
23539Specifies the name of the operating system function to call to flush
23540the cache.  The default is @samp{_flush_cache}, but a function call
23541is only used if a trap is not available.
23542
23543@item -mno-flush-func
23544@opindex mno-flush-func
23545Indicates that there is no OS function for flushing the cache.
23546
23547@end table
23548
23549@node M680x0 Options
23550@subsection M680x0 Options
23551@cindex M680x0 options
23552
23553These are the @samp{-m} options defined for M680x0 and ColdFire processors.
23554The default settings depend on which architecture was selected when
23555the compiler was configured; the defaults for the most common choices
23556are given below.
23557
23558@table @gcctabopt
23559@item -march=@var{arch}
23560@opindex march
23561Generate code for a specific M680x0 or ColdFire instruction set
23562architecture.  Permissible values of @var{arch} for M680x0
23563architectures are: @samp{68000}, @samp{68010}, @samp{68020},
23564@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
23565architectures are selected according to Freescale's ISA classification
23566and the permissible values are: @samp{isaa}, @samp{isaaplus},
23567@samp{isab} and @samp{isac}.
23568
23569GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
23570code for a ColdFire target.  The @var{arch} in this macro is one of the
23571@option{-march} arguments given above.
23572
23573When used together, @option{-march} and @option{-mtune} select code
23574that runs on a family of similar processors but that is optimized
23575for a particular microarchitecture.
23576
23577@item -mcpu=@var{cpu}
23578@opindex mcpu
23579Generate code for a specific M680x0 or ColdFire processor.
23580The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
23581@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
23582and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
23583below, which also classifies the CPUs into families:
23584
23585@multitable @columnfractions 0.20 0.80
23586@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
23587@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}
23588@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
23589@item @samp{5206e} @tab @samp{5206e}
23590@item @samp{5208} @tab @samp{5207} @samp{5208}
23591@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
23592@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
23593@item @samp{5216} @tab @samp{5214} @samp{5216}
23594@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
23595@item @samp{5225} @tab @samp{5224} @samp{5225}
23596@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
23597@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
23598@item @samp{5249} @tab @samp{5249}
23599@item @samp{5250} @tab @samp{5250}
23600@item @samp{5271} @tab @samp{5270} @samp{5271}
23601@item @samp{5272} @tab @samp{5272}
23602@item @samp{5275} @tab @samp{5274} @samp{5275}
23603@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
23604@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
23605@item @samp{5307} @tab @samp{5307}
23606@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
23607@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
23608@item @samp{5407} @tab @samp{5407}
23609@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}
23610@end multitable
23611
23612@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
23613@var{arch} is compatible with @var{cpu}.  Other combinations of
23614@option{-mcpu} and @option{-march} are rejected.
23615
23616GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
23617@var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
23618where the value of @var{family} is given by the table above.
23619
23620@item -mtune=@var{tune}
23621@opindex mtune
23622Tune the code for a particular microarchitecture within the
23623constraints set by @option{-march} and @option{-mcpu}.
23624The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
23625@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
23626and @samp{cpu32}.  The ColdFire microarchitectures
23627are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
23628
23629You can also use @option{-mtune=68020-40} for code that needs
23630to run relatively well on 68020, 68030 and 68040 targets.
23631@option{-mtune=68020-60} is similar but includes 68060 targets
23632as well.  These two options select the same tuning decisions as
23633@option{-m68020-40} and @option{-m68020-60} respectively.
23634
23635GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
23636when tuning for 680x0 architecture @var{arch}.  It also defines
23637@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
23638option is used.  If GCC is tuning for a range of architectures,
23639as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
23640it defines the macros for every architecture in the range.
23641
23642GCC also defines the macro @code{__m@var{uarch}__} when tuning for
23643ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
23644of the arguments given above.
23645
23646@item -m68000
23647@itemx -mc68000
23648@opindex m68000
23649@opindex mc68000
23650Generate output for a 68000.  This is the default
23651when the compiler is configured for 68000-based systems.
23652It is equivalent to @option{-march=68000}.
23653
23654Use this option for microcontrollers with a 68000 or EC000 core,
23655including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
23656
23657@item -m68010
23658@opindex m68010
23659Generate output for a 68010.  This is the default
23660when the compiler is configured for 68010-based systems.
23661It is equivalent to @option{-march=68010}.
23662
23663@item -m68020
23664@itemx -mc68020
23665@opindex m68020
23666@opindex mc68020
23667Generate output for a 68020.  This is the default
23668when the compiler is configured for 68020-based systems.
23669It is equivalent to @option{-march=68020}.
23670
23671@item -m68030
23672@opindex m68030
23673Generate output for a 68030.  This is the default when the compiler is
23674configured for 68030-based systems.  It is equivalent to
23675@option{-march=68030}.
23676
23677@item -m68040
23678@opindex m68040
23679Generate output for a 68040.  This is the default when the compiler is
23680configured for 68040-based systems.  It is equivalent to
23681@option{-march=68040}.
23682
23683This option inhibits the use of 68881/68882 instructions that have to be
23684emulated by software on the 68040.  Use this option if your 68040 does not
23685have code to emulate those instructions.
23686
23687@item -m68060
23688@opindex m68060
23689Generate output for a 68060.  This is the default when the compiler is
23690configured for 68060-based systems.  It is equivalent to
23691@option{-march=68060}.
23692
23693This option inhibits the use of 68020 and 68881/68882 instructions that
23694have to be emulated by software on the 68060.  Use this option if your 68060
23695does not have code to emulate those instructions.
23696
23697@item -mcpu32
23698@opindex mcpu32
23699Generate output for a CPU32.  This is the default
23700when the compiler is configured for CPU32-based systems.
23701It is equivalent to @option{-march=cpu32}.
23702
23703Use this option for microcontrollers with a
23704CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
2370568336, 68340, 68341, 68349 and 68360.
23706
23707@item -m5200
23708@opindex m5200
23709Generate output for a 520X ColdFire CPU@.  This is the default
23710when the compiler is configured for 520X-based systems.
23711It is equivalent to @option{-mcpu=5206}, and is now deprecated
23712in favor of that option.
23713
23714Use this option for microcontroller with a 5200 core, including
23715the MCF5202, MCF5203, MCF5204 and MCF5206.
23716
23717@item -m5206e
23718@opindex m5206e
23719Generate output for a 5206e ColdFire CPU@.  The option is now
23720deprecated in favor of the equivalent @option{-mcpu=5206e}.
23721
23722@item -m528x
23723@opindex m528x
23724Generate output for a member of the ColdFire 528X family.
23725The option is now deprecated in favor of the equivalent
23726@option{-mcpu=528x}.
23727
23728@item -m5307
23729@opindex m5307
23730Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
23731in favor of the equivalent @option{-mcpu=5307}.
23732
23733@item -m5407
23734@opindex m5407
23735Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
23736in favor of the equivalent @option{-mcpu=5407}.
23737
23738@item -mcfv4e
23739@opindex mcfv4e
23740Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
23741This includes use of hardware floating-point instructions.
23742The option is equivalent to @option{-mcpu=547x}, and is now
23743deprecated in favor of that option.
23744
23745@item -m68020-40
23746@opindex m68020-40
23747Generate output for a 68040, without using any of the new instructions.
23748This results in code that can run relatively efficiently on either a
2374968020/68881 or a 68030 or a 68040.  The generated code does use the
2375068881 instructions that are emulated on the 68040.
23751
23752The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
23753
23754@item -m68020-60
23755@opindex m68020-60
23756Generate output for a 68060, without using any of the new instructions.
23757This results in code that can run relatively efficiently on either a
2375868020/68881 or a 68030 or a 68040.  The generated code does use the
2375968881 instructions that are emulated on the 68060.
23760
23761The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
23762
23763@item -mhard-float
23764@itemx -m68881
23765@opindex mhard-float
23766@opindex m68881
23767Generate floating-point instructions.  This is the default for 68020
23768and above, and for ColdFire devices that have an FPU@.  It defines the
23769macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
23770on ColdFire targets.
23771
23772@item -msoft-float
23773@opindex msoft-float
23774Do not generate floating-point instructions; use library calls instead.
23775This is the default for 68000, 68010, and 68832 targets.  It is also
23776the default for ColdFire devices that have no FPU.
23777
23778@item -mdiv
23779@itemx -mno-div
23780@opindex mdiv
23781@opindex mno-div
23782Generate (do not generate) ColdFire hardware divide and remainder
23783instructions.  If @option{-march} is used without @option{-mcpu},
23784the default is ``on'' for ColdFire architectures and ``off'' for M680x0
23785architectures.  Otherwise, the default is taken from the target CPU
23786(either the default CPU, or the one specified by @option{-mcpu}).  For
23787example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
23788@option{-mcpu=5206e}.
23789
23790GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
23791
23792@item -mshort
23793@opindex mshort
23794Consider type @code{int} to be 16 bits wide, like @code{short int}.
23795Additionally, parameters passed on the stack are also aligned to a
2379616-bit boundary even on targets whose API mandates promotion to 32-bit.
23797
23798@item -mno-short
23799@opindex mno-short
23800Do not consider type @code{int} to be 16 bits wide.  This is the default.
23801
23802@item -mnobitfield
23803@itemx -mno-bitfield
23804@opindex mnobitfield
23805@opindex mno-bitfield
23806Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
23807and @option{-m5200} options imply @w{@option{-mnobitfield}}.
23808
23809@item -mbitfield
23810@opindex mbitfield
23811Do use the bit-field instructions.  The @option{-m68020} option implies
23812@option{-mbitfield}.  This is the default if you use a configuration
23813designed for a 68020.
23814
23815@item -mrtd
23816@opindex mrtd
23817Use a different function-calling convention, in which functions
23818that take a fixed number of arguments return with the @code{rtd}
23819instruction, which pops their arguments while returning.  This
23820saves one instruction in the caller since there is no need to pop
23821the arguments there.
23822
23823This calling convention is incompatible with the one normally
23824used on Unix, so you cannot use it if you need to call libraries
23825compiled with the Unix compiler.
23826
23827Also, you must provide function prototypes for all functions that
23828take variable numbers of arguments (including @code{printf});
23829otherwise incorrect code is generated for calls to those
23830functions.
23831
23832In addition, seriously incorrect code results if you call a
23833function with too many arguments.  (Normally, extra arguments are
23834harmlessly ignored.)
23835
23836The @code{rtd} instruction is supported by the 68010, 68020, 68030,
2383768040, 68060 and CPU32 processors, but not by the 68000 or 5200.
23838
23839The default is @option{-mno-rtd}.
23840
23841@item -malign-int
23842@itemx -mno-align-int
23843@opindex malign-int
23844@opindex mno-align-int
23845Control whether GCC aligns @code{int}, @code{long}, @code{long long},
23846@code{float}, @code{double}, and @code{long double} variables on a 32-bit
23847boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
23848Aligning variables on 32-bit boundaries produces code that runs somewhat
23849faster on processors with 32-bit busses at the expense of more memory.
23850
23851@strong{Warning:} if you use the @option{-malign-int} switch, GCC
23852aligns structures containing the above types differently than
23853most published application binary interface specifications for the m68k.
23854
23855@opindex mpcrel
23856Use the pc-relative addressing mode of the 68000 directly, instead of
23857using a global offset table.  At present, this option implies @option{-fpic},
23858allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
23859not presently supported with @option{-mpcrel}, though this could be supported for
2386068020 and higher processors.
23861
23862@item -mno-strict-align
23863@itemx -mstrict-align
23864@opindex mno-strict-align
23865@opindex mstrict-align
23866Do not (do) assume that unaligned memory references are handled by
23867the system.
23868
23869@item -msep-data
23870Generate code that allows the data segment to be located in a different
23871area of memory from the text segment.  This allows for execute-in-place in
23872an environment without virtual memory management.  This option implies
23873@option{-fPIC}.
23874
23875@item -mno-sep-data
23876Generate code that assumes that the data segment follows the text segment.
23877This is the default.
23878
23879@item -mid-shared-library
23880Generate code that supports shared libraries via the library ID method.
23881This allows for execute-in-place and shared libraries in an environment
23882without virtual memory management.  This option implies @option{-fPIC}.
23883
23884@item -mno-id-shared-library
23885Generate code that doesn't assume ID-based shared libraries are being used.
23886This is the default.
23887
23888@item -mshared-library-id=n
23889Specifies the identification number of the ID-based shared library being
23890compiled.  Specifying a value of 0 generates more compact code; specifying
23891other values forces the allocation of that number to the current
23892library, but is no more space- or time-efficient than omitting this option.
23893
23894@item -mxgot
23895@itemx -mno-xgot
23896@opindex mxgot
23897@opindex mno-xgot
23898When generating position-independent code for ColdFire, generate code
23899that works if the GOT has more than 8192 entries.  This code is
23900larger and slower than code generated without this option.  On M680x0
23901processors, this option is not needed; @option{-fPIC} suffices.
23902
23903GCC normally uses a single instruction to load values from the GOT@.
23904While this is relatively efficient, it only works if the GOT
23905is smaller than about 64k.  Anything larger causes the linker
23906to report an error such as:
23907
23908@cindex relocation truncated to fit (ColdFire)
23909@smallexample
23910relocation truncated to fit: R_68K_GOT16O foobar
23911@end smallexample
23912
23913If this happens, you should recompile your code with @option{-mxgot}.
23914It should then work with very large GOTs.  However, code generated with
23915@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
23916the value of a global symbol.
23917
23918Note that some linkers, including newer versions of the GNU linker,
23919can create multiple GOTs and sort GOT entries.  If you have such a linker,
23920you should only need to use @option{-mxgot} when compiling a single
23921object file that accesses more than 8192 GOT entries.  Very few do.
23922
23923These options have no effect unless GCC is generating
23924position-independent code.
23925
23926@item -mlong-jump-table-offsets
23927@opindex mlong-jump-table-offsets
23928Use 32-bit offsets in @code{switch} tables.  The default is to use
2392916-bit offsets.
23930
23931@end table
23932
23933@node MCore Options
23934@subsection MCore Options
23935@cindex MCore options
23936
23937These are the @samp{-m} options defined for the Motorola M*Core
23938processors.
23939
23940@table @gcctabopt
23941
23942@item -mhardlit
23943@itemx -mno-hardlit
23944@opindex mhardlit
23945@opindex mno-hardlit
23946Inline constants into the code stream if it can be done in two
23947instructions or less.
23948
23949@item -mdiv
23950@itemx -mno-div
23951@opindex mdiv
23952@opindex mno-div
23953Use the divide instruction.  (Enabled by default).
23954
23955@item -mrelax-immediate
23956@itemx -mno-relax-immediate
23957@opindex mrelax-immediate
23958@opindex mno-relax-immediate
23959Allow arbitrary-sized immediates in bit operations.
23960
23961@item -mwide-bitfields
23962@itemx -mno-wide-bitfields
23963@opindex mwide-bitfields
23964@opindex mno-wide-bitfields
23965Always treat bit-fields as @code{int}-sized.
23966
23967@item -m4byte-functions
23968@itemx -mno-4byte-functions
23969@opindex m4byte-functions
23970@opindex mno-4byte-functions
23971Force all functions to be aligned to a 4-byte boundary.
23972
23973@item -mcallgraph-data
23974@itemx -mno-callgraph-data
23975@opindex mcallgraph-data
23976@opindex mno-callgraph-data
23977Emit callgraph information.
23978
23979@item -mslow-bytes
23980@itemx -mno-slow-bytes
23981@opindex mslow-bytes
23982@opindex mno-slow-bytes
23983Prefer word access when reading byte quantities.
23984
23985@item -mlittle-endian
23986@itemx -mbig-endian
23987@opindex mlittle-endian
23988@opindex mbig-endian
23989Generate code for a little-endian target.
23990
23991@item -m210
23992@itemx -m340
23993@opindex m210
23994@opindex m340
23995Generate code for the 210 processor.
23996
23997@item -mno-lsim
23998@opindex mno-lsim
23999Assume that runtime support has been provided and so omit the
24000simulator library (@file{libsim.a)} from the linker command line.
24001
24002@item -mstack-increment=@var{size}
24003@opindex mstack-increment
24004Set the maximum amount for a single stack increment operation.  Large
24005values can increase the speed of programs that contain functions
24006that need a large amount of stack space, but they can also trigger a
24007segmentation fault if the stack is extended too much.  The default
24008value is 0x1000.
24009
24010@end table
24011
24012@node MeP Options
24013@subsection MeP Options
24014@cindex MeP options
24015
24016@table @gcctabopt
24017
24018@item -mabsdiff
24019@opindex mabsdiff
24020Enables the @code{abs} instruction, which is the absolute difference
24021between two registers.
24022
24023@item -mall-opts
24024@opindex mall-opts
24025Enables all the optional instructions---average, multiply, divide, bit
24026operations, leading zero, absolute difference, min/max, clip, and
24027saturation.
24028
24029
24030@item -maverage
24031@opindex maverage
24032Enables the @code{ave} instruction, which computes the average of two
24033registers.
24034
24035@item -mbased=@var{n}
24036@opindex mbased=
24037Variables of size @var{n} bytes or smaller are placed in the
24038@code{.based} section by default.  Based variables use the @code{$tp}
24039register as a base register, and there is a 128-byte limit to the
24040@code{.based} section.
24041
24042@item -mbitops
24043@opindex mbitops
24044Enables the bit operation instructions---bit test (@code{btstm}), set
24045(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
24046test-and-set (@code{tas}).
24047
24048@item -mc=@var{name}
24049@opindex mc=
24050Selects which section constant data is placed in.  @var{name} may
24051be @samp{tiny}, @samp{near}, or @samp{far}.
24052
24053@item -mclip
24054@opindex mclip
24055Enables the @code{clip} instruction.  Note that @option{-mclip} is not
24056useful unless you also provide @option{-mminmax}.
24057
24058@item -mconfig=@var{name}
24059@opindex mconfig=
24060Selects one of the built-in core configurations.  Each MeP chip has
24061one or more modules in it; each module has a core CPU and a variety of
24062coprocessors, optional instructions, and peripherals.  The
24063@code{MeP-Integrator} tool, not part of GCC, provides these
24064configurations through this option; using this option is the same as
24065using all the corresponding command-line options.  The default
24066configuration is @samp{default}.
24067
24068@item -mcop
24069@opindex mcop
24070Enables the coprocessor instructions.  By default, this is a 32-bit
24071coprocessor.  Note that the coprocessor is normally enabled via the
24072@option{-mconfig=} option.
24073
24074@item -mcop32
24075@opindex mcop32
24076Enables the 32-bit coprocessor's instructions.
24077
24078@item -mcop64
24079@opindex mcop64
24080Enables the 64-bit coprocessor's instructions.
24081
24082@item -mivc2
24083@opindex mivc2
24084Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
24085
24086@item -mdc
24087@opindex mdc
24088Causes constant variables to be placed in the @code{.near} section.
24089
24090@item -mdiv
24091@opindex mdiv
24092Enables the @code{div} and @code{divu} instructions.
24093
24094@item -meb
24095@opindex meb
24096Generate big-endian code.
24097
24098@item -mel
24099@opindex mel
24100Generate little-endian code.
24101
24102@item -mio-volatile
24103@opindex mio-volatile
24104Tells the compiler that any variable marked with the @code{io}
24105attribute is to be considered volatile.
24106
24107@item -ml
24108@opindex ml
24109Causes variables to be assigned to the @code{.far} section by default.
24110
24111@item -mleadz
24112@opindex mleadz
24113Enables the @code{leadz} (leading zero) instruction.
24114
24115@item -mm
24116@opindex mm
24117Causes variables to be assigned to the @code{.near} section by default.
24118
24119@item -mminmax
24120@opindex mminmax
24121Enables the @code{min} and @code{max} instructions.
24122
24123@item -mmult
24124@opindex mmult
24125Enables the multiplication and multiply-accumulate instructions.
24126
24127@item -mno-opts
24128@opindex mno-opts
24129Disables all the optional instructions enabled by @option{-mall-opts}.
24130
24131@item -mrepeat
24132@opindex mrepeat
24133Enables the @code{repeat} and @code{erepeat} instructions, used for
24134low-overhead looping.
24135
24136@item -ms
24137@opindex ms
24138Causes all variables to default to the @code{.tiny} section.  Note
24139that there is a 65536-byte limit to this section.  Accesses to these
24140variables use the @code{%gp} base register.
24141
24142@item -msatur
24143@opindex msatur
24144Enables the saturation instructions.  Note that the compiler does not
24145currently generate these itself, but this option is included for
24146compatibility with other tools, like @code{as}.
24147
24148@item -msdram
24149@opindex msdram
24150Link the SDRAM-based runtime instead of the default ROM-based runtime.
24151
24152@item -msim
24153@opindex msim
24154Link the simulator run-time libraries.
24155
24156@item -msimnovec
24157@opindex msimnovec
24158Link the simulator runtime libraries, excluding built-in support
24159for reset and exception vectors and tables.
24160
24161@item -mtf
24162@opindex mtf
24163Causes all functions to default to the @code{.far} section.  Without
24164this option, functions default to the @code{.near} section.
24165
24166@item -mtiny=@var{n}
24167@opindex mtiny=
24168Variables that are @var{n} bytes or smaller are allocated to the
24169@code{.tiny} section.  These variables use the @code{$gp} base
24170register.  The default for this option is 4, but note that there's a
2417165536-byte limit to the @code{.tiny} section.
24172
24173@end table
24174
24175@node MicroBlaze Options
24176@subsection MicroBlaze Options
24177@cindex MicroBlaze Options
24178
24179@table @gcctabopt
24180
24181@item -msoft-float
24182@opindex msoft-float
24183Use software emulation for floating point (default).
24184
24185@item -mhard-float
24186@opindex mhard-float
24187Use hardware floating-point instructions.
24188
24189@item -mmemcpy
24190@opindex mmemcpy
24191Do not optimize block moves, use @code{memcpy}.
24192
24193@item -mno-clearbss
24194@opindex mno-clearbss
24195This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
24196
24197@item -mcpu=@var{cpu-type}
24198@opindex mcpu=
24199Use features of, and schedule code for, the given CPU.
24200Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
24201where @var{X} is a major version, @var{YY} is the minor version, and
24202@var{Z} is compatibility code.  Example values are @samp{v3.00.a},
24203@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
24204
24205@item -mxl-soft-mul
24206@opindex mxl-soft-mul
24207Use software multiply emulation (default).
24208
24209@item -mxl-soft-div
24210@opindex mxl-soft-div
24211Use software emulation for divides (default).
24212
24213@item -mxl-barrel-shift
24214@opindex mxl-barrel-shift
24215Use the hardware barrel shifter.
24216
24217@item -mxl-pattern-compare
24218@opindex mxl-pattern-compare
24219Use pattern compare instructions.
24220
24221@item -msmall-divides
24222@opindex msmall-divides
24223Use table lookup optimization for small signed integer divisions.
24224
24225@item -mxl-stack-check
24226@opindex mxl-stack-check
24227This option is deprecated.  Use @option{-fstack-check} instead.
24228
24229@item -mxl-gp-opt
24230@opindex mxl-gp-opt
24231Use GP-relative @code{.sdata}/@code{.sbss} sections.
24232
24233@item -mxl-multiply-high
24234@opindex mxl-multiply-high
24235Use multiply high instructions for high part of 32x32 multiply.
24236
24237@item -mxl-float-convert
24238@opindex mxl-float-convert
24239Use hardware floating-point conversion instructions.
24240
24241@item -mxl-float-sqrt
24242@opindex mxl-float-sqrt
24243Use hardware floating-point square root instruction.
24244
24245@item -mbig-endian
24246@opindex mbig-endian
24247Generate code for a big-endian target.
24248
24249@item -mlittle-endian
24250@opindex mlittle-endian
24251Generate code for a little-endian target.
24252
24253@item -mxl-reorder
24254@opindex mxl-reorder
24255Use reorder instructions (swap and byte reversed load/store).
24256
24257@item -mxl-mode-@var{app-model}
24258Select application model @var{app-model}.  Valid models are
24259@table @samp
24260@item executable
24261normal executable (default), uses startup code @file{crt0.o}.
24262
24263@item -mpic-data-is-text-relative
24264@opindex mpic-data-is-text-relative
24265Assume that the displacement between the text and data segments is fixed
24266at static link time.  This allows data to be referenced by offset from start of
24267text address instead of GOT since PC-relative addressing is not supported.
24268
24269@item xmdstub
24270for use with Xilinx Microprocessor Debugger (XMD) based
24271software intrusive debug agent called xmdstub. This uses startup file
24272@file{crt1.o} and sets the start address of the program to 0x800.
24273
24274@item bootstrap
24275for applications that are loaded using a bootloader.
24276This model uses startup file @file{crt2.o} which does not contain a processor
24277reset vector handler. This is suitable for transferring control on a
24278processor reset to the bootloader rather than the application.
24279
24280@item novectors
24281for applications that do not require any of the
24282MicroBlaze vectors. This option may be useful for applications running
24283within a monitoring application. This model uses @file{crt3.o} as a startup file.
24284@end table
24285
24286Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
24287@option{-mxl-mode-@var{app-model}}.
24288
24289@end table
24290
24291@node MIPS Options
24292@subsection MIPS Options
24293@cindex MIPS options
24294
24295@table @gcctabopt
24296
24297@item -EB
24298@opindex EB
24299Generate big-endian code.
24300
24301@item -EL
24302@opindex EL
24303Generate little-endian code.  This is the default for @samp{mips*el-*-*}
24304configurations.
24305
24306@item -march=@var{arch}
24307@opindex march
24308Generate code that runs on @var{arch}, which can be the name of a
24309generic MIPS ISA, or the name of a particular processor.
24310The ISA names are:
24311@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
24312@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
24313@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
24314@samp{mips64r5} and @samp{mips64r6}.
24315The processor names are:
24316@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
24317@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
24318@samp{5kc}, @samp{5kf},
24319@samp{20kc},
24320@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
24321@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
24322@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
24323@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
24324@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
24325@samp{i6400}, @samp{i6500},
24326@samp{interaptiv},
24327@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
24328@samp{gs464e}, @samp{gs264e},
24329@samp{m4k},
24330@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
24331@samp{m5100}, @samp{m5101},
24332@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
24333@samp{orion},
24334@samp{p5600}, @samp{p6600},
24335@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
24336@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
24337@samp{r6000}, @samp{r8000},
24338@samp{rm7000}, @samp{rm9000},
24339@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
24340@samp{sb1},
24341@samp{sr71000},
24342@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
24343@samp{vr5000}, @samp{vr5400}, @samp{vr5500},
24344@samp{xlr} and @samp{xlp}.
24345The special value @samp{from-abi} selects the
24346most compatible architecture for the selected ABI (that is,
24347@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
24348
24349The native Linux/GNU toolchain also supports the value @samp{native},
24350which selects the best architecture option for the host processor.
24351@option{-march=native} has no effect if GCC does not recognize
24352the processor.
24353
24354In processor names, a final @samp{000} can be abbreviated as @samp{k}
24355(for example, @option{-march=r2k}).  Prefixes are optional, and
24356@samp{vr} may be written @samp{r}.
24357
24358Names of the form @samp{@var{n}f2_1} refer to processors with
24359FPUs clocked at half the rate of the core, names of the form
24360@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
24361rate as the core, and names of the form @samp{@var{n}f3_2} refer to
24362processors with FPUs clocked a ratio of 3:2 with respect to the core.
24363For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
24364for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
24365accepted as synonyms for @samp{@var{n}f1_1}.
24366
24367GCC defines two macros based on the value of this option.  The first
24368is @code{_MIPS_ARCH}, which gives the name of target architecture, as
24369a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
24370where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
24371For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
24372to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
24373
24374Note that the @code{_MIPS_ARCH} macro uses the processor names given
24375above.  In other words, it has the full prefix and does not
24376abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
24377the macro names the resolved architecture (either @code{"mips1"} or
24378@code{"mips3"}).  It names the default architecture when no
24379@option{-march} option is given.
24380
24381@item -mtune=@var{arch}
24382@opindex mtune
24383Optimize for @var{arch}.  Among other things, this option controls
24384the way instructions are scheduled, and the perceived cost of arithmetic
24385operations.  The list of @var{arch} values is the same as for
24386@option{-march}.
24387
24388When this option is not used, GCC optimizes for the processor
24389specified by @option{-march}.  By using @option{-march} and
24390@option{-mtune} together, it is possible to generate code that
24391runs on a family of processors, but optimize the code for one
24392particular member of that family.
24393
24394@option{-mtune} defines the macros @code{_MIPS_TUNE} and
24395@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
24396@option{-march} ones described above.
24397
24398@item -mips1
24399@opindex mips1
24400Equivalent to @option{-march=mips1}.
24401
24402@item -mips2
24403@opindex mips2
24404Equivalent to @option{-march=mips2}.
24405
24406@item -mips3
24407@opindex mips3
24408Equivalent to @option{-march=mips3}.
24409
24410@item -mips4
24411@opindex mips4
24412Equivalent to @option{-march=mips4}.
24413
24414@item -mips32
24415@opindex mips32
24416Equivalent to @option{-march=mips32}.
24417
24418@item -mips32r3
24419@opindex mips32r3
24420Equivalent to @option{-march=mips32r3}.
24421
24422@item -mips32r5
24423@opindex mips32r5
24424Equivalent to @option{-march=mips32r5}.
24425
24426@item -mips32r6
24427@opindex mips32r6
24428Equivalent to @option{-march=mips32r6}.
24429
24430@item -mips64
24431@opindex mips64
24432Equivalent to @option{-march=mips64}.
24433
24434@item -mips64r2
24435@opindex mips64r2
24436Equivalent to @option{-march=mips64r2}.
24437
24438@item -mips64r3
24439@opindex mips64r3
24440Equivalent to @option{-march=mips64r3}.
24441
24442@item -mips64r5
24443@opindex mips64r5
24444Equivalent to @option{-march=mips64r5}.
24445
24446@item -mips64r6
24447@opindex mips64r6
24448Equivalent to @option{-march=mips64r6}.
24449
24450@item -mips16
24451@itemx -mno-mips16
24452@opindex mips16
24453@opindex mno-mips16
24454Generate (do not generate) MIPS16 code.  If GCC is targeting a
24455MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
24456
24457MIPS16 code generation can also be controlled on a per-function basis
24458by means of @code{mips16} and @code{nomips16} attributes.
24459@xref{Function Attributes}, for more information.
24460
24461@item -mflip-mips16
24462@opindex mflip-mips16
24463Generate MIPS16 code on alternating functions.  This option is provided
24464for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
24465not intended for ordinary use in compiling user code.
24466
24467@item -minterlink-compressed
24468@itemx -mno-interlink-compressed
24469@opindex minterlink-compressed
24470@opindex mno-interlink-compressed
24471Require (do not require) that code using the standard (uncompressed) MIPS ISA
24472be link-compatible with MIPS16 and microMIPS code, and vice versa.
24473
24474For example, code using the standard ISA encoding cannot jump directly
24475to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
24476@option{-minterlink-compressed} therefore disables direct jumps unless GCC
24477knows that the target of the jump is not compressed.
24478
24479@item -minterlink-mips16
24480@itemx -mno-interlink-mips16
24481@opindex minterlink-mips16
24482@opindex mno-interlink-mips16
24483Aliases of @option{-minterlink-compressed} and
24484@option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
24485and are retained for backwards compatibility.
24486
24487@item -mabi=32
24488@itemx -mabi=o64
24489@itemx -mabi=n32
24490@itemx -mabi=64
24491@itemx -mabi=eabi
24492@opindex mabi=32
24493@opindex mabi=o64
24494@opindex mabi=n32
24495@opindex mabi=64
24496@opindex mabi=eabi
24497Generate code for the given ABI@.
24498
24499Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
24500generates 64-bit code when you select a 64-bit architecture, but you
24501can use @option{-mgp32} to get 32-bit code instead.
24502
24503For information about the O64 ABI, see
24504@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
24505
24506GCC supports a variant of the o32 ABI in which floating-point registers
24507are 64 rather than 32 bits wide.  You can select this combination with
24508@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
24509and @code{mfhc1} instructions and is therefore only supported for
24510MIPS32R2, MIPS32R3 and MIPS32R5 processors.
24511
24512The register assignments for arguments and return values remain the
24513same, but each scalar value is passed in a single 64-bit register
24514rather than a pair of 32-bit registers.  For example, scalar
24515floating-point values are returned in @samp{$f0} only, not a
24516@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
24517remains the same in that the even-numbered double-precision registers
24518are saved.
24519
24520Two additional variants of the o32 ABI are supported to enable
24521a transition from 32-bit to 64-bit registers.  These are FPXX
24522(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
24523The FPXX extension mandates that all code must execute correctly
24524when run using 32-bit or 64-bit registers.  The code can be interlinked
24525with either FP32 or FP64, but not both.
24526The FP64A extension is similar to the FP64 extension but forbids the
24527use of odd-numbered single-precision registers.  This can be used
24528in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
24529processors and allows both FP32 and FP64A code to interlink and
24530run in the same process without changing FPU modes.
24531
24532@item -mabicalls
24533@itemx -mno-abicalls
24534@opindex mabicalls
24535@opindex mno-abicalls
24536Generate (do not generate) code that is suitable for SVR4-style
24537dynamic objects.  @option{-mabicalls} is the default for SVR4-based
24538systems.
24539
24540@item -mshared
24541@itemx -mno-shared
24542Generate (do not generate) code that is fully position-independent,
24543and that can therefore be linked into shared libraries.  This option
24544only affects @option{-mabicalls}.
24545
24546All @option{-mabicalls} code has traditionally been position-independent,
24547regardless of options like @option{-fPIC} and @option{-fpic}.  However,
24548as an extension, the GNU toolchain allows executables to use absolute
24549accesses for locally-binding symbols.  It can also use shorter GP
24550initialization sequences and generate direct calls to locally-defined
24551functions.  This mode is selected by @option{-mno-shared}.
24552
24553@option{-mno-shared} depends on binutils 2.16 or higher and generates
24554objects that can only be linked by the GNU linker.  However, the option
24555does not affect the ABI of the final executable; it only affects the ABI
24556of relocatable objects.  Using @option{-mno-shared} generally makes
24557executables both smaller and quicker.
24558
24559@option{-mshared} is the default.
24560
24561@item -mplt
24562@itemx -mno-plt
24563@opindex mplt
24564@opindex mno-plt
24565Assume (do not assume) that the static and dynamic linkers
24566support PLTs and copy relocations.  This option only affects
24567@option{-mno-shared -mabicalls}.  For the n64 ABI, this option
24568has no effect without @option{-msym32}.
24569
24570You can make @option{-mplt} the default by configuring
24571GCC with @option{--with-mips-plt}.  The default is
24572@option{-mno-plt} otherwise.
24573
24574@item -mxgot
24575@itemx -mno-xgot
24576@opindex mxgot
24577@opindex mno-xgot
24578Lift (do not lift) the usual restrictions on the size of the global
24579offset table.
24580
24581GCC normally uses a single instruction to load values from the GOT@.
24582While this is relatively efficient, it only works if the GOT
24583is smaller than about 64k.  Anything larger causes the linker
24584to report an error such as:
24585
24586@cindex relocation truncated to fit (MIPS)
24587@smallexample
24588relocation truncated to fit: R_MIPS_GOT16 foobar
24589@end smallexample
24590
24591If this happens, you should recompile your code with @option{-mxgot}.
24592This works with very large GOTs, although the code is also
24593less efficient, since it takes three instructions to fetch the
24594value of a global symbol.
24595
24596Note that some linkers can create multiple GOTs.  If you have such a
24597linker, you should only need to use @option{-mxgot} when a single object
24598file accesses more than 64k's worth of GOT entries.  Very few do.
24599
24600These options have no effect unless GCC is generating position
24601independent code.
24602
24603@item -mgp32
24604@opindex mgp32
24605Assume that general-purpose registers are 32 bits wide.
24606
24607@item -mgp64
24608@opindex mgp64
24609Assume that general-purpose registers are 64 bits wide.
24610
24611@item -mfp32
24612@opindex mfp32
24613Assume that floating-point registers are 32 bits wide.
24614
24615@item -mfp64
24616@opindex mfp64
24617Assume that floating-point registers are 64 bits wide.
24618
24619@item -mfpxx
24620@opindex mfpxx
24621Do not assume the width of floating-point registers.
24622
24623@item -mhard-float
24624@opindex mhard-float
24625Use floating-point coprocessor instructions.
24626
24627@item -msoft-float
24628@opindex msoft-float
24629Do not use floating-point coprocessor instructions.  Implement
24630floating-point calculations using library calls instead.
24631
24632@item -mno-float
24633@opindex mno-float
24634Equivalent to @option{-msoft-float}, but additionally asserts that the
24635program being compiled does not perform any floating-point operations.
24636This option is presently supported only by some bare-metal MIPS
24637configurations, where it may select a special set of libraries
24638that lack all floating-point support (including, for example, the
24639floating-point @code{printf} formats).
24640If code compiled with @option{-mno-float} accidentally contains
24641floating-point operations, it is likely to suffer a link-time
24642or run-time failure.
24643
24644@item -msingle-float
24645@opindex msingle-float
24646Assume that the floating-point coprocessor only supports single-precision
24647operations.
24648
24649@item -mdouble-float
24650@opindex mdouble-float
24651Assume that the floating-point coprocessor supports double-precision
24652operations.  This is the default.
24653
24654@item -modd-spreg
24655@itemx -mno-odd-spreg
24656@opindex modd-spreg
24657@opindex mno-odd-spreg
24658Enable the use of odd-numbered single-precision floating-point registers
24659for the o32 ABI.  This is the default for processors that are known to
24660support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
24661is set by default.
24662
24663@item -mabs=2008
24664@itemx -mabs=legacy
24665@opindex mabs=2008
24666@opindex mabs=legacy
24667These options control the treatment of the special not-a-number (NaN)
24668IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
24669@code{neg.@i{fmt}} machine instructions.
24670
24671By default or when @option{-mabs=legacy} is used the legacy
24672treatment is selected.  In this case these instructions are considered
24673arithmetic and avoided where correct operation is required and the
24674input operand might be a NaN.  A longer sequence of instructions that
24675manipulate the sign bit of floating-point datum manually is used
24676instead unless the @option{-ffinite-math-only} option has also been
24677specified.
24678
24679The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
24680this case these instructions are considered non-arithmetic and therefore
24681operating correctly in all cases, including in particular where the
24682input operand is a NaN.  These instructions are therefore always used
24683for the respective operations.
24684
24685@item -mnan=2008
24686@itemx -mnan=legacy
24687@opindex mnan=2008
24688@opindex mnan=legacy
24689These options control the encoding of the special not-a-number (NaN)
24690IEEE 754 floating-point data.
24691
24692The @option{-mnan=legacy} option selects the legacy encoding.  In this
24693case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
24694significand field being 0, whereas signaling NaNs (sNaNs) are denoted
24695by the first bit of their trailing significand field being 1.
24696
24697The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
24698this case qNaNs are denoted by the first bit of their trailing
24699significand field being 1, whereas sNaNs are denoted by the first bit of
24700their trailing significand field being 0.
24701
24702The default is @option{-mnan=legacy} unless GCC has been configured with
24703@option{--with-nan=2008}.
24704
24705@item -mllsc
24706@itemx -mno-llsc
24707@opindex mllsc
24708@opindex mno-llsc
24709Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
24710implement atomic memory built-in functions.  When neither option is
24711specified, GCC uses the instructions if the target architecture
24712supports them.
24713
24714@option{-mllsc} is useful if the runtime environment can emulate the
24715instructions and @option{-mno-llsc} can be useful when compiling for
24716nonstandard ISAs.  You can make either option the default by
24717configuring GCC with @option{--with-llsc} and @option{--without-llsc}
24718respectively.  @option{--with-llsc} is the default for some
24719configurations; see the installation documentation for details.
24720
24721@item -mdsp
24722@itemx -mno-dsp
24723@opindex mdsp
24724@opindex mno-dsp
24725Use (do not use) revision 1 of the MIPS DSP ASE@.
24726@xref{MIPS DSP Built-in Functions}.  This option defines the
24727preprocessor macro @code{__mips_dsp}.  It also defines
24728@code{__mips_dsp_rev} to 1.
24729
24730@item -mdspr2
24731@itemx -mno-dspr2
24732@opindex mdspr2
24733@opindex mno-dspr2
24734Use (do not use) revision 2 of the MIPS DSP ASE@.
24735@xref{MIPS DSP Built-in Functions}.  This option defines the
24736preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
24737It also defines @code{__mips_dsp_rev} to 2.
24738
24739@item -msmartmips
24740@itemx -mno-smartmips
24741@opindex msmartmips
24742@opindex mno-smartmips
24743Use (do not use) the MIPS SmartMIPS ASE.
24744
24745@item -mpaired-single
24746@itemx -mno-paired-single
24747@opindex mpaired-single
24748@opindex mno-paired-single
24749Use (do not use) paired-single floating-point instructions.
24750@xref{MIPS Paired-Single Support}.  This option requires
24751hardware floating-point support to be enabled.
24752
24753@item -mdmx
24754@itemx -mno-mdmx
24755@opindex mdmx
24756@opindex mno-mdmx
24757Use (do not use) MIPS Digital Media Extension instructions.
24758This option can only be used when generating 64-bit code and requires
24759hardware floating-point support to be enabled.
24760
24761@item -mips3d
24762@itemx -mno-mips3d
24763@opindex mips3d
24764@opindex mno-mips3d
24765Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
24766The option @option{-mips3d} implies @option{-mpaired-single}.
24767
24768@item -mmicromips
24769@itemx -mno-micromips
24770@opindex mmicromips
24771@opindex mno-mmicromips
24772Generate (do not generate) microMIPS code.
24773
24774MicroMIPS code generation can also be controlled on a per-function basis
24775by means of @code{micromips} and @code{nomicromips} attributes.
24776@xref{Function Attributes}, for more information.
24777
24778@item -mmt
24779@itemx -mno-mt
24780@opindex mmt
24781@opindex mno-mt
24782Use (do not use) MT Multithreading instructions.
24783
24784@item -mmcu
24785@itemx -mno-mcu
24786@opindex mmcu
24787@opindex mno-mcu
24788Use (do not use) the MIPS MCU ASE instructions.
24789
24790@item -meva
24791@itemx -mno-eva
24792@opindex meva
24793@opindex mno-eva
24794Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
24795
24796@item -mvirt
24797@itemx -mno-virt
24798@opindex mvirt
24799@opindex mno-virt
24800Use (do not use) the MIPS Virtualization (VZ) instructions.
24801
24802@item -mxpa
24803@itemx -mno-xpa
24804@opindex mxpa
24805@opindex mno-xpa
24806Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
24807
24808@item -mcrc
24809@itemx -mno-crc
24810@opindex mcrc
24811@opindex mno-crc
24812Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
24813
24814@item -mginv
24815@itemx -mno-ginv
24816@opindex mginv
24817@opindex mno-ginv
24818Use (do not use) the MIPS Global INValidate (GINV) instructions.
24819
24820@item -mloongson-mmi
24821@itemx -mno-loongson-mmi
24822@opindex mloongson-mmi
24823@opindex mno-loongson-mmi
24824Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
24825
24826@item -mloongson-ext
24827@itemx -mno-loongson-ext
24828@opindex mloongson-ext
24829@opindex mno-loongson-ext
24830Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
24831
24832@item -mloongson-ext2
24833@itemx -mno-loongson-ext2
24834@opindex mloongson-ext2
24835@opindex mno-loongson-ext2
24836Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
24837
24838@item -mlong64
24839@opindex mlong64
24840Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
24841an explanation of the default and the way that the pointer size is
24842determined.
24843
24844@item -mlong32
24845@opindex mlong32
24846Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
24847
24848The default size of @code{int}s, @code{long}s and pointers depends on
24849the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
24850uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
2485132-bit @code{long}s.  Pointers are the same size as @code{long}s,
24852or the same size as integer registers, whichever is smaller.
24853
24854@item -msym32
24855@itemx -mno-sym32
24856@opindex msym32
24857@opindex mno-sym32
24858Assume (do not assume) that all symbols have 32-bit values, regardless
24859of the selected ABI@.  This option is useful in combination with
24860@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
24861to generate shorter and faster references to symbolic addresses.
24862
24863@item -G @var{num}
24864@opindex G
24865Put definitions of externally-visible data in a small data section
24866if that data is no bigger than @var{num} bytes.  GCC can then generate
24867more efficient accesses to the data; see @option{-mgpopt} for details.
24868
24869The default @option{-G} option depends on the configuration.
24870
24871@item -mlocal-sdata
24872@itemx -mno-local-sdata
24873@opindex mlocal-sdata
24874@opindex mno-local-sdata
24875Extend (do not extend) the @option{-G} behavior to local data too,
24876such as to static variables in C@.  @option{-mlocal-sdata} is the
24877default for all configurations.
24878
24879If the linker complains that an application is using too much small data,
24880you might want to try rebuilding the less performance-critical parts with
24881@option{-mno-local-sdata}.  You might also want to build large
24882libraries with @option{-mno-local-sdata}, so that the libraries leave
24883more room for the main program.
24884
24885@item -mextern-sdata
24886@itemx -mno-extern-sdata
24887@opindex mextern-sdata
24888@opindex mno-extern-sdata
24889Assume (do not assume) that externally-defined data is in
24890a small data section if the size of that data is within the @option{-G} limit.
24891@option{-mextern-sdata} is the default for all configurations.
24892
24893If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
24894@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
24895that is no bigger than @var{num} bytes, you must make sure that @var{Var}
24896is placed in a small data section.  If @var{Var} is defined by another
24897module, you must either compile that module with a high-enough
24898@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
24899definition.  If @var{Var} is common, you must link the application
24900with a high-enough @option{-G} setting.
24901
24902The easiest way of satisfying these restrictions is to compile
24903and link every module with the same @option{-G} option.  However,
24904you may wish to build a library that supports several different
24905small data limits.  You can do this by compiling the library with
24906the highest supported @option{-G} setting and additionally using
24907@option{-mno-extern-sdata} to stop the library from making assumptions
24908about externally-defined data.
24909
24910@item -mgpopt
24911@itemx -mno-gpopt
24912@opindex mgpopt
24913@opindex mno-gpopt
24914Use (do not use) GP-relative accesses for symbols that are known to be
24915in a small data section; see @option{-G}, @option{-mlocal-sdata} and
24916@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
24917configurations.
24918
24919@option{-mno-gpopt} is useful for cases where the @code{$gp} register
24920might not hold the value of @code{_gp}.  For example, if the code is
24921part of a library that might be used in a boot monitor, programs that
24922call boot monitor routines pass an unknown value in @code{$gp}.
24923(In such situations, the boot monitor itself is usually compiled
24924with @option{-G0}.)
24925
24926@option{-mno-gpopt} implies @option{-mno-local-sdata} and
24927@option{-mno-extern-sdata}.
24928
24929@item -membedded-data
24930@itemx -mno-embedded-data
24931@opindex membedded-data
24932@opindex mno-embedded-data
24933Allocate variables to the read-only data section first if possible, then
24934next in the small data section if possible, otherwise in data.  This gives
24935slightly slower code than the default, but reduces the amount of RAM required
24936when executing, and thus may be preferred for some embedded systems.
24937
24938@item -muninit-const-in-rodata
24939@itemx -mno-uninit-const-in-rodata
24940@opindex muninit-const-in-rodata
24941@opindex mno-uninit-const-in-rodata
24942Put uninitialized @code{const} variables in the read-only data section.
24943This option is only meaningful in conjunction with @option{-membedded-data}.
24944
24945@item -mcode-readable=@var{setting}
24946@opindex mcode-readable
24947Specify whether GCC may generate code that reads from executable sections.
24948There are three possible settings:
24949
24950@table @gcctabopt
24951@item -mcode-readable=yes
24952Instructions may freely access executable sections.  This is the
24953default setting.
24954
24955@item -mcode-readable=pcrel
24956MIPS16 PC-relative load instructions can access executable sections,
24957but other instructions must not do so.  This option is useful on 4KSc
24958and 4KSd processors when the code TLBs have the Read Inhibit bit set.
24959It is also useful on processors that can be configured to have a dual
24960instruction/data SRAM interface and that, like the M4K, automatically
24961redirect PC-relative loads to the instruction RAM.
24962
24963@item -mcode-readable=no
24964Instructions must not access executable sections.  This option can be
24965useful on targets that are configured to have a dual instruction/data
24966SRAM interface but that (unlike the M4K) do not automatically redirect
24967PC-relative loads to the instruction RAM.
24968@end table
24969
24970@item -msplit-addresses
24971@itemx -mno-split-addresses
24972@opindex msplit-addresses
24973@opindex mno-split-addresses
24974Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
24975relocation operators.  This option has been superseded by
24976@option{-mexplicit-relocs} but is retained for backwards compatibility.
24977
24978@item -mexplicit-relocs
24979@itemx -mno-explicit-relocs
24980@opindex mexplicit-relocs
24981@opindex mno-explicit-relocs
24982Use (do not use) assembler relocation operators when dealing with symbolic
24983addresses.  The alternative, selected by @option{-mno-explicit-relocs},
24984is to use assembler macros instead.
24985
24986@option{-mexplicit-relocs} is the default if GCC was configured
24987to use an assembler that supports relocation operators.
24988
24989@item -mcheck-zero-division
24990@itemx -mno-check-zero-division
24991@opindex mcheck-zero-division
24992@opindex mno-check-zero-division
24993Trap (do not trap) on integer division by zero.
24994
24995The default is @option{-mcheck-zero-division}.
24996
24997@item -mdivide-traps
24998@itemx -mdivide-breaks
24999@opindex mdivide-traps
25000@opindex mdivide-breaks
25001MIPS systems check for division by zero by generating either a
25002conditional trap or a break instruction.  Using traps results in
25003smaller code, but is only supported on MIPS II and later.  Also, some
25004versions of the Linux kernel have a bug that prevents trap from
25005generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
25006allow conditional traps on architectures that support them and
25007@option{-mdivide-breaks} to force the use of breaks.
25008
25009The default is usually @option{-mdivide-traps}, but this can be
25010overridden at configure time using @option{--with-divide=breaks}.
25011Divide-by-zero checks can be completely disabled using
25012@option{-mno-check-zero-division}.
25013
25014@item -mload-store-pairs
25015@itemx -mno-load-store-pairs
25016@opindex mload-store-pairs
25017@opindex mno-load-store-pairs
25018Enable (disable) an optimization that pairs consecutive load or store
25019instructions to enable load/store bonding.  This option is enabled by
25020default but only takes effect when the selected architecture is known
25021to support bonding.
25022
25023@item -mmemcpy
25024@itemx -mno-memcpy
25025@opindex mmemcpy
25026@opindex mno-memcpy
25027Force (do not force) the use of @code{memcpy} for non-trivial block
25028moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
25029most constant-sized copies.
25030
25031@item -mlong-calls
25032@itemx -mno-long-calls
25033@opindex mlong-calls
25034@opindex mno-long-calls
25035Disable (do not disable) use of the @code{jal} instruction.  Calling
25036functions using @code{jal} is more efficient but requires the caller
25037and callee to be in the same 256 megabyte segment.
25038
25039This option has no effect on abicalls code.  The default is
25040@option{-mno-long-calls}.
25041
25042@item -mmad
25043@itemx -mno-mad
25044@opindex mmad
25045@opindex mno-mad
25046Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
25047instructions, as provided by the R4650 ISA@.
25048
25049@item -mimadd
25050@itemx -mno-imadd
25051@opindex mimadd
25052@opindex mno-imadd
25053Enable (disable) use of the @code{madd} and @code{msub} integer
25054instructions.  The default is @option{-mimadd} on architectures
25055that support @code{madd} and @code{msub} except for the 74k
25056architecture where it was found to generate slower code.
25057
25058@item -mfused-madd
25059@itemx -mno-fused-madd
25060@opindex mfused-madd
25061@opindex mno-fused-madd
25062Enable (disable) use of the floating-point multiply-accumulate
25063instructions, when they are available.  The default is
25064@option{-mfused-madd}.
25065
25066On the R8000 CPU when multiply-accumulate instructions are used,
25067the intermediate product is calculated to infinite precision
25068and is not subject to the FCSR Flush to Zero bit.  This may be
25069undesirable in some circumstances.  On other processors the result
25070is numerically identical to the equivalent computation using
25071separate multiply, add, subtract and negate instructions.
25072
25073@item -nocpp
25074@opindex nocpp
25075Tell the MIPS assembler to not run its preprocessor over user
25076assembler files (with a @samp{.s} suffix) when assembling them.
25077
25078@item -mfix-24k
25079@itemx -mno-fix-24k
25080@opindex mfix-24k
25081@opindex mno-fix-24k
25082Work around the 24K E48 (lost data on stores during refill) errata.
25083The workarounds are implemented by the assembler rather than by GCC@.
25084
25085@item -mfix-r4000
25086@itemx -mno-fix-r4000
25087@opindex mfix-r4000
25088@opindex mno-fix-r4000
25089Work around certain R4000 CPU errata:
25090@itemize @minus
25091@item
25092A double-word or a variable shift may give an incorrect result if executed
25093immediately after starting an integer division.
25094@item
25095A double-word or a variable shift may give an incorrect result if executed
25096while an integer multiplication is in progress.
25097@item
25098An integer division may give an incorrect result if started in a delay slot
25099of a taken branch or a jump.
25100@end itemize
25101
25102@item -mfix-r4400
25103@itemx -mno-fix-r4400
25104@opindex mfix-r4400
25105@opindex mno-fix-r4400
25106Work around certain R4400 CPU errata:
25107@itemize @minus
25108@item
25109A double-word or a variable shift may give an incorrect result if executed
25110immediately after starting an integer division.
25111@end itemize
25112
25113@item -mfix-r10000
25114@itemx -mno-fix-r10000
25115@opindex mfix-r10000
25116@opindex mno-fix-r10000
25117Work around certain R10000 errata:
25118@itemize @minus
25119@item
25120@code{ll}/@code{sc} sequences may not behave atomically on revisions
25121prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
25122@end itemize
25123
25124This option can only be used if the target architecture supports
25125branch-likely instructions.  @option{-mfix-r10000} is the default when
25126@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
25127otherwise.
25128
25129@item -mfix-r5900
25130@itemx -mno-fix-r5900
25131@opindex mfix-r5900
25132Do not attempt to schedule the preceding instruction into the delay slot
25133of a branch instruction placed at the end of a short loop of six
25134instructions or fewer and always schedule a @code{nop} instruction there
25135instead.  The short loop bug under certain conditions causes loops to
25136execute only once or twice, due to a hardware bug in the R5900 chip.  The
25137workaround is implemented by the assembler rather than by GCC@.
25138
25139@item -mfix-rm7000
25140@itemx -mno-fix-rm7000
25141@opindex mfix-rm7000
25142Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
25143workarounds are implemented by the assembler rather than by GCC@.
25144
25145@item -mfix-vr4120
25146@itemx -mno-fix-vr4120
25147@opindex mfix-vr4120
25148Work around certain VR4120 errata:
25149@itemize @minus
25150@item
25151@code{dmultu} does not always produce the correct result.
25152@item
25153@code{div} and @code{ddiv} do not always produce the correct result if one
25154of the operands is negative.
25155@end itemize
25156The workarounds for the division errata rely on special functions in
25157@file{libgcc.a}.  At present, these functions are only provided by
25158the @code{mips64vr*-elf} configurations.
25159
25160Other VR4120 errata require a NOP to be inserted between certain pairs of
25161instructions.  These errata are handled by the assembler, not by GCC itself.
25162
25163@item -mfix-vr4130
25164@opindex mfix-vr4130
25165Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
25166workarounds are implemented by the assembler rather than by GCC,
25167although GCC avoids using @code{mflo} and @code{mfhi} if the
25168VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
25169instructions are available instead.
25170
25171@item -mfix-sb1
25172@itemx -mno-fix-sb1
25173@opindex mfix-sb1
25174Work around certain SB-1 CPU core errata.
25175(This flag currently works around the SB-1 revision 2
25176``F1'' and ``F2'' floating-point errata.)
25177
25178@item -mr10k-cache-barrier=@var{setting}
25179@opindex mr10k-cache-barrier
25180Specify whether GCC should insert cache barriers to avoid the
25181side effects of speculation on R10K processors.
25182
25183In common with many processors, the R10K tries to predict the outcome
25184of a conditional branch and speculatively executes instructions from
25185the ``taken'' branch.  It later aborts these instructions if the
25186predicted outcome is wrong.  However, on the R10K, even aborted
25187instructions can have side effects.
25188
25189This problem only affects kernel stores and, depending on the system,
25190kernel loads.  As an example, a speculatively-executed store may load
25191the target memory into cache and mark the cache line as dirty, even if
25192the store itself is later aborted.  If a DMA operation writes to the
25193same area of memory before the ``dirty'' line is flushed, the cached
25194data overwrites the DMA-ed data.  See the R10K processor manual
25195for a full description, including other potential problems.
25196
25197One workaround is to insert cache barrier instructions before every memory
25198access that might be speculatively executed and that might have side
25199effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
25200controls GCC's implementation of this workaround.  It assumes that
25201aborted accesses to any byte in the following regions does not have
25202side effects:
25203
25204@enumerate
25205@item
25206the memory occupied by the current function's stack frame;
25207
25208@item
25209the memory occupied by an incoming stack argument;
25210
25211@item
25212the memory occupied by an object with a link-time-constant address.
25213@end enumerate
25214
25215It is the kernel's responsibility to ensure that speculative
25216accesses to these regions are indeed safe.
25217
25218If the input program contains a function declaration such as:
25219
25220@smallexample
25221void foo (void);
25222@end smallexample
25223
25224then the implementation of @code{foo} must allow @code{j foo} and
25225@code{jal foo} to be executed speculatively.  GCC honors this
25226restriction for functions it compiles itself.  It expects non-GCC
25227functions (such as hand-written assembly code) to do the same.
25228
25229The option has three forms:
25230
25231@table @gcctabopt
25232@item -mr10k-cache-barrier=load-store
25233Insert a cache barrier before a load or store that might be
25234speculatively executed and that might have side effects even
25235if aborted.
25236
25237@item -mr10k-cache-barrier=store
25238Insert a cache barrier before a store that might be speculatively
25239executed and that might have side effects even if aborted.
25240
25241@item -mr10k-cache-barrier=none
25242Disable the insertion of cache barriers.  This is the default setting.
25243@end table
25244
25245@item -mflush-func=@var{func}
25246@itemx -mno-flush-func
25247@opindex mflush-func
25248Specifies the function to call to flush the I and D caches, or to not
25249call any such function.  If called, the function must take the same
25250arguments as the common @code{_flush_func}, that is, the address of the
25251memory range for which the cache is being flushed, the size of the
25252memory range, and the number 3 (to flush both caches).  The default
25253depends on the target GCC was configured for, but commonly is either
25254@code{_flush_func} or @code{__cpu_flush}.
25255
25256@item mbranch-cost=@var{num}
25257@opindex mbranch-cost
25258Set the cost of branches to roughly @var{num} ``simple'' instructions.
25259This cost is only a heuristic and is not guaranteed to produce
25260consistent results across releases.  A zero cost redundantly selects
25261the default, which is based on the @option{-mtune} setting.
25262
25263@item -mbranch-likely
25264@itemx -mno-branch-likely
25265@opindex mbranch-likely
25266@opindex mno-branch-likely
25267Enable or disable use of Branch Likely instructions, regardless of the
25268default for the selected architecture.  By default, Branch Likely
25269instructions may be generated if they are supported by the selected
25270architecture.  An exception is for the MIPS32 and MIPS64 architectures
25271and processors that implement those architectures; for those, Branch
25272Likely instructions are not be generated by default because the MIPS32
25273and MIPS64 architectures specifically deprecate their use.
25274
25275@item -mcompact-branches=never
25276@itemx -mcompact-branches=optimal
25277@itemx -mcompact-branches=always
25278@opindex mcompact-branches=never
25279@opindex mcompact-branches=optimal
25280@opindex mcompact-branches=always
25281These options control which form of branches will be generated.  The
25282default is @option{-mcompact-branches=optimal}.
25283
25284The @option{-mcompact-branches=never} option ensures that compact branch
25285instructions will never be generated.
25286
25287The @option{-mcompact-branches=always} option ensures that a compact
25288branch instruction will be generated if available.  If a compact branch
25289instruction is not available, a delay slot form of the branch will be
25290used instead.
25291
25292This option is supported from MIPS Release 6 onwards.
25293
25294The @option{-mcompact-branches=optimal} option will cause a delay slot
25295branch to be used if one is available in the current ISA and the delay
25296slot is successfully filled.  If the delay slot is not filled, a compact
25297branch will be chosen if one is available.
25298
25299@item -mfp-exceptions
25300@itemx -mno-fp-exceptions
25301@opindex mfp-exceptions
25302Specifies whether FP exceptions are enabled.  This affects how
25303FP instructions are scheduled for some processors.
25304The default is that FP exceptions are
25305enabled.
25306
25307For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
2530864-bit code, then we can use both FP pipes.  Otherwise, we can only use one
25309FP pipe.
25310
25311@item -mvr4130-align
25312@itemx -mno-vr4130-align
25313@opindex mvr4130-align
25314The VR4130 pipeline is two-way superscalar, but can only issue two
25315instructions together if the first one is 8-byte aligned.  When this
25316option is enabled, GCC aligns pairs of instructions that it
25317thinks should execute in parallel.
25318
25319This option only has an effect when optimizing for the VR4130.
25320It normally makes code faster, but at the expense of making it bigger.
25321It is enabled by default at optimization level @option{-O3}.
25322
25323@item -msynci
25324@itemx -mno-synci
25325@opindex msynci
25326Enable (disable) generation of @code{synci} instructions on
25327architectures that support it.  The @code{synci} instructions (if
25328enabled) are generated when @code{__builtin___clear_cache} is
25329compiled.
25330
25331This option defaults to @option{-mno-synci}, but the default can be
25332overridden by configuring GCC with @option{--with-synci}.
25333
25334When compiling code for single processor systems, it is generally safe
25335to use @code{synci}.  However, on many multi-core (SMP) systems, it
25336does not invalidate the instruction caches on all cores and may lead
25337to undefined behavior.
25338
25339@item -mrelax-pic-calls
25340@itemx -mno-relax-pic-calls
25341@opindex mrelax-pic-calls
25342Try to turn PIC calls that are normally dispatched via register
25343@code{$25} into direct calls.  This is only possible if the linker can
25344resolve the destination at link time and if the destination is within
25345range for a direct call.
25346
25347@option{-mrelax-pic-calls} is the default if GCC was configured to use
25348an assembler and a linker that support the @code{.reloc} assembly
25349directive and @option{-mexplicit-relocs} is in effect.  With
25350@option{-mno-explicit-relocs}, this optimization can be performed by the
25351assembler and the linker alone without help from the compiler.
25352
25353@item -mmcount-ra-address
25354@itemx -mno-mcount-ra-address
25355@opindex mmcount-ra-address
25356@opindex mno-mcount-ra-address
25357Emit (do not emit) code that allows @code{_mcount} to modify the
25358calling function's return address.  When enabled, this option extends
25359the usual @code{_mcount} interface with a new @var{ra-address}
25360parameter, which has type @code{intptr_t *} and is passed in register
25361@code{$12}.  @code{_mcount} can then modify the return address by
25362doing both of the following:
25363@itemize
25364@item
25365Returning the new address in register @code{$31}.
25366@item
25367Storing the new address in @code{*@var{ra-address}},
25368if @var{ra-address} is nonnull.
25369@end itemize
25370
25371The default is @option{-mno-mcount-ra-address}.
25372
25373@item -mframe-header-opt
25374@itemx -mno-frame-header-opt
25375@opindex mframe-header-opt
25376Enable (disable) frame header optimization in the o32 ABI.  When using the
25377o32 ABI, calling functions will allocate 16 bytes on the stack for the called
25378function to write out register arguments.  When enabled, this optimization
25379will suppress the allocation of the frame header if it can be determined that
25380it is unused.
25381
25382This optimization is off by default at all optimization levels.
25383
25384@item -mlxc1-sxc1
25385@itemx -mno-lxc1-sxc1
25386@opindex mlxc1-sxc1
25387When applicable, enable (disable) the generation of @code{lwxc1},
25388@code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
25389
25390@item -mmadd4
25391@itemx -mno-madd4
25392@opindex mmadd4
25393When applicable, enable (disable) the generation of 4-operand @code{madd.s},
25394@code{madd.d} and related instructions.  Enabled by default.
25395
25396@end table
25397
25398@node MMIX Options
25399@subsection MMIX Options
25400@cindex MMIX Options
25401
25402These options are defined for the MMIX:
25403
25404@table @gcctabopt
25405@item -mlibfuncs
25406@itemx -mno-libfuncs
25407@opindex mlibfuncs
25408@opindex mno-libfuncs
25409Specify that intrinsic library functions are being compiled, passing all
25410values in registers, no matter the size.
25411
25412@item -mepsilon
25413@itemx -mno-epsilon
25414@opindex mepsilon
25415@opindex mno-epsilon
25416Generate floating-point comparison instructions that compare with respect
25417to the @code{rE} epsilon register.
25418
25419@item -mabi=mmixware
25420@itemx -mabi=gnu
25421@opindex mabi=mmixware
25422@opindex mabi=gnu
25423Generate code that passes function parameters and return values that (in
25424the called function) are seen as registers @code{$0} and up, as opposed to
25425the GNU ABI which uses global registers @code{$231} and up.
25426
25427@item -mzero-extend
25428@itemx -mno-zero-extend
25429@opindex mzero-extend
25430@opindex mno-zero-extend
25431When reading data from memory in sizes shorter than 64 bits, use (do not
25432use) zero-extending load instructions by default, rather than
25433sign-extending ones.
25434
25435@item -mknuthdiv
25436@itemx -mno-knuthdiv
25437@opindex mknuthdiv
25438@opindex mno-knuthdiv
25439Make the result of a division yielding a remainder have the same sign as
25440the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
25441remainder follows the sign of the dividend.  Both methods are
25442arithmetically valid, the latter being almost exclusively used.
25443
25444@item -mtoplevel-symbols
25445@itemx -mno-toplevel-symbols
25446@opindex mtoplevel-symbols
25447@opindex mno-toplevel-symbols
25448Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
25449code can be used with the @code{PREFIX} assembly directive.
25450
25451@item -melf
25452@opindex melf
25453Generate an executable in the ELF format, rather than the default
25454@samp{mmo} format used by the @command{mmix} simulator.
25455
25456@item -mbranch-predict
25457@itemx -mno-branch-predict
25458@opindex mbranch-predict
25459@opindex mno-branch-predict
25460Use (do not use) the probable-branch instructions, when static branch
25461prediction indicates a probable branch.
25462
25463@item -mbase-addresses
25464@itemx -mno-base-addresses
25465@opindex mbase-addresses
25466@opindex mno-base-addresses
25467Generate (do not generate) code that uses @emph{base addresses}.  Using a
25468base address automatically generates a request (handled by the assembler
25469and the linker) for a constant to be set up in a global register.  The
25470register is used for one or more base address requests within the range 0
25471to 255 from the value held in the register.  The generally leads to short
25472and fast code, but the number of different data items that can be
25473addressed is limited.  This means that a program that uses lots of static
25474data may require @option{-mno-base-addresses}.
25475
25476@item -msingle-exit
25477@itemx -mno-single-exit
25478@opindex msingle-exit
25479@opindex mno-single-exit
25480Force (do not force) generated code to have a single exit point in each
25481function.
25482@end table
25483
25484@node MN10300 Options
25485@subsection MN10300 Options
25486@cindex MN10300 options
25487
25488These @option{-m} options are defined for Matsushita MN10300 architectures:
25489
25490@table @gcctabopt
25491@item -mmult-bug
25492@opindex mmult-bug
25493Generate code to avoid bugs in the multiply instructions for the MN10300
25494processors.  This is the default.
25495
25496@item -mno-mult-bug
25497@opindex mno-mult-bug
25498Do not generate code to avoid bugs in the multiply instructions for the
25499MN10300 processors.
25500
25501@item -mam33
25502@opindex mam33
25503Generate code using features specific to the AM33 processor.
25504
25505@item -mno-am33
25506@opindex mno-am33
25507Do not generate code using features specific to the AM33 processor.  This
25508is the default.
25509
25510@item -mam33-2
25511@opindex mam33-2
25512Generate code using features specific to the AM33/2.0 processor.
25513
25514@item -mam34
25515@opindex mam34
25516Generate code using features specific to the AM34 processor.
25517
25518@item -mtune=@var{cpu-type}
25519@opindex mtune
25520Use the timing characteristics of the indicated CPU type when
25521scheduling instructions.  This does not change the targeted processor
25522type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
25523@samp{am33-2} or @samp{am34}.
25524
25525@item -mreturn-pointer-on-d0
25526@opindex mreturn-pointer-on-d0
25527When generating a function that returns a pointer, return the pointer
25528in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
25529only in @code{a0}, and attempts to call such functions without a prototype
25530result in errors.  Note that this option is on by default; use
25531@option{-mno-return-pointer-on-d0} to disable it.
25532
25533@item -mno-crt0
25534@opindex mno-crt0
25535Do not link in the C run-time initialization object file.
25536
25537@item -mrelax
25538@opindex mrelax
25539Indicate to the linker that it should perform a relaxation optimization pass
25540to shorten branches, calls and absolute memory addresses.  This option only
25541has an effect when used on the command line for the final link step.
25542
25543This option makes symbolic debugging impossible.
25544
25545@item -mliw
25546@opindex mliw
25547Allow the compiler to generate @emph{Long Instruction Word}
25548instructions if the target is the @samp{AM33} or later.  This is the
25549default.  This option defines the preprocessor macro @code{__LIW__}.
25550
25551@item -mno-liw
25552@opindex mno-liw
25553Do not allow the compiler to generate @emph{Long Instruction Word}
25554instructions.  This option defines the preprocessor macro
25555@code{__NO_LIW__}.
25556
25557@item -msetlb
25558@opindex msetlb
25559Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
25560instructions if the target is the @samp{AM33} or later.  This is the
25561default.  This option defines the preprocessor macro @code{__SETLB__}.
25562
25563@item -mno-setlb
25564@opindex mno-setlb
25565Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
25566instructions.  This option defines the preprocessor macro
25567@code{__NO_SETLB__}.
25568
25569@end table
25570
25571@node Moxie Options
25572@subsection Moxie Options
25573@cindex Moxie Options
25574
25575@table @gcctabopt
25576
25577@item -meb
25578@opindex meb
25579Generate big-endian code.  This is the default for @samp{moxie-*-*}
25580configurations.
25581
25582@item -mel
25583@opindex mel
25584Generate little-endian code.
25585
25586@item -mmul.x
25587@opindex mmul.x
25588Generate mul.x and umul.x instructions.  This is the default for
25589@samp{moxiebox-*-*} configurations.
25590
25591@item -mno-crt0
25592@opindex mno-crt0
25593Do not link in the C run-time initialization object file.
25594
25595@end table
25596
25597@node MSP430 Options
25598@subsection MSP430 Options
25599@cindex MSP430 Options
25600
25601These options are defined for the MSP430:
25602
25603@table @gcctabopt
25604
25605@item -masm-hex
25606@opindex masm-hex
25607Force assembly output to always use hex constants.  Normally such
25608constants are signed decimals, but this option is available for
25609testsuite and/or aesthetic purposes.
25610
25611@item -mmcu=
25612@opindex mmcu=
25613Select the MCU to target.  This is used to create a C preprocessor
25614symbol based upon the MCU name, converted to upper case and pre- and
25615post-fixed with @samp{__}.  This in turn is used by the
25616@file{msp430.h} header file to select an MCU-specific supplementary
25617header file.
25618
25619The option also sets the ISA to use.  If the MCU name is one that is
25620known to only support the 430 ISA then that is selected, otherwise the
25621430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
25622used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
25623name selects the 430X ISA.
25624
25625In addition an MCU-specific linker script is added to the linker
25626command line.  The script's name is the name of the MCU with
25627@file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
25628command line defines the C preprocessor symbol @code{__XXX__} and
25629cause the linker to search for a script called @file{xxx.ld}.
25630
25631The ISA and hardware multiply supported for the different MCUs is hard-coded
25632into GCC.  However, an external @samp{devices.csv} file can be used to
25633extend device support beyond those that have been hard-coded.
25634
25635GCC searches for the @samp{devices.csv} file using the following methods in the
25636given precedence order, where the first method takes precendence over the
25637second which takes precedence over the third.
25638
25639@table @asis
25640@item Include path specified with @code{-I} and @code{-L}
25641@samp{devices.csv} will be searched for in each of the directories specified by
25642include paths and linker library search paths.
25643@item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
25644Define the value of the global environment variable
25645@samp{MSP430_GCC_INCLUDE_DIR}
25646to the full path to the directory containing devices.csv, and GCC will search
25647this directory for devices.csv.  If devices.csv is found, this directory will
25648also be registered as an include path, and linker library path.  Header files
25649and linker scripts in this directory can therefore be used without manually
25650specifying @code{-I} and @code{-L} on the command line.
25651@item The @samp{msp430-elf@{,bare@}/include/devices} directory
25652Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
25653toolchain root directory.  This directory does not exist in a default
25654installation, but if the user has created it and copied @samp{devices.csv}
25655there, then the MCU data will be read.  As above, this directory will
25656also be registered as an include path, and linker library path.
25657
25658@end table
25659If none of the above search methods find @samp{devices.csv}, then the
25660hard-coded MCU data is used.
25661
25662
25663@item -mwarn-mcu
25664@itemx -mno-warn-mcu
25665@opindex mwarn-mcu
25666@opindex mno-warn-mcu
25667This option enables or disables warnings about conflicts between the
25668MCU name specified by the @option{-mmcu} option and the ISA set by the
25669@option{-mcpu} option and/or the hardware multiply support set by the
25670@option{-mhwmult} option.  It also toggles warnings about unrecognized
25671MCU names.  This option is on by default.
25672
25673@item -mcpu=
25674@opindex mcpu=
25675Specifies the ISA to use.  Accepted values are @samp{msp430},
25676@samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
25677@option{-mmcu=} option should be used to select the ISA.
25678
25679@item -msim
25680@opindex msim
25681Link to the simulator runtime libraries and linker script.  Overrides
25682any scripts that would be selected by the @option{-mmcu=} option.
25683
25684@item -mlarge
25685@opindex mlarge
25686Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
25687
25688@item -msmall
25689@opindex msmall
25690Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
25691
25692@item -mrelax
25693@opindex mrelax
25694This option is passed to the assembler and linker, and allows the
25695linker to perform certain optimizations that cannot be done until
25696the final link.
25697
25698@item mhwmult=
25699@opindex mhwmult=
25700Describes the type of hardware multiply supported by the target.
25701Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
25702for the original 16-bit-only multiply supported by early MCUs.
25703@samp{32bit} for the 16/32-bit multiply supported by later MCUs and
25704@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
25705A value of @samp{auto} can also be given.  This tells GCC to deduce
25706the hardware multiply support based upon the MCU name provided by the
25707@option{-mmcu} option.  If no @option{-mmcu} option is specified or if
25708the MCU name is not recognized then no hardware multiply support is
25709assumed.  @code{auto} is the default setting.
25710
25711Hardware multiplies are normally performed by calling a library
25712routine.  This saves space in the generated code.  When compiling at
25713@option{-O3} or higher however the hardware multiplier is invoked
25714inline.  This makes for bigger, but faster code.
25715
25716The hardware multiply routines disable interrupts whilst running and
25717restore the previous interrupt state when they finish.  This makes
25718them safe to use inside interrupt handlers as well as in normal code.
25719
25720@item -minrt
25721@opindex minrt
25722Enable the use of a minimum runtime environment - no static
25723initializers or constructors.  This is intended for memory-constrained
25724devices.  The compiler includes special symbols in some objects
25725that tell the linker and runtime which code fragments are required.
25726
25727@item -mtiny-printf
25728@opindex mtiny-printf
25729Enable reduced code size @code{printf} and @code{puts} library functions.
25730The @samp{tiny} implementations of these functions are not reentrant, so
25731must be used with caution in multi-threaded applications.
25732
25733Support for streams has been removed and the string to be printed will
25734always be sent to stdout via the @code{write} syscall.  The string is not
25735buffered before it is sent to write.
25736
25737This option requires Newlib Nano IO, so GCC must be configured with
25738@samp{--enable-newlib-nano-formatted-io}.
25739
25740@item -mmax-inline-shift=
25741@opindex mmax-inline-shift=
25742This option takes an integer between 0 and 64 inclusive, and sets
25743the maximum number of inline shift instructions which should be emitted to
25744perform a shift operation by a constant amount.  When this value needs to be
25745exceeded, an mspabi helper function is used instead.  The default value is 4.
25746
25747This only affects cases where a shift by multiple positions cannot be
25748completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
25749
25750Shifts of a 32-bit value are at least twice as costly, so the value passed for
25751this option is divided by 2 and the resulting value used instead.
25752
25753@item -mcode-region=
25754@itemx -mdata-region=
25755@opindex mcode-region
25756@opindex mdata-region
25757These options tell the compiler where to place functions and data that
25758do not have one of the @code{lower}, @code{upper}, @code{either} or
25759@code{section} attributes.  Possible values are @code{lower},
25760@code{upper}, @code{either} or @code{any}.  The first three behave
25761like the corresponding attribute.  The fourth possible value -
25762@code{any} - is the default.  It leaves placement entirely up to the
25763linker script and how it assigns the standard sections
25764(@code{.text}, @code{.data}, etc) to the memory regions.
25765
25766@item -msilicon-errata=
25767@opindex msilicon-errata
25768This option passes on a request to assembler to enable the fixes for
25769the named silicon errata.
25770
25771@item -msilicon-errata-warn=
25772@opindex msilicon-errata-warn
25773This option passes on a request to the assembler to enable warning
25774messages when a silicon errata might need to be applied.
25775
25776@item -mwarn-devices-csv
25777@itemx -mno-warn-devices-csv
25778@opindex mwarn-devices-csv
25779@opindex mno-warn-devices-csv
25780Warn if @samp{devices.csv} is not found or there are problem parsing it
25781(default: on).
25782
25783@end table
25784
25785@node NDS32 Options
25786@subsection NDS32 Options
25787@cindex NDS32 Options
25788
25789These options are defined for NDS32 implementations:
25790
25791@table @gcctabopt
25792
25793@item -mbig-endian
25794@opindex mbig-endian
25795Generate code in big-endian mode.
25796
25797@item -mlittle-endian
25798@opindex mlittle-endian
25799Generate code in little-endian mode.
25800
25801@item -mreduced-regs
25802@opindex mreduced-regs
25803Use reduced-set registers for register allocation.
25804
25805@item -mfull-regs
25806@opindex mfull-regs
25807Use full-set registers for register allocation.
25808
25809@item -mcmov
25810@opindex mcmov
25811Generate conditional move instructions.
25812
25813@item -mno-cmov
25814@opindex mno-cmov
25815Do not generate conditional move instructions.
25816
25817@item -mext-perf
25818@opindex mext-perf
25819Generate performance extension instructions.
25820
25821@item -mno-ext-perf
25822@opindex mno-ext-perf
25823Do not generate performance extension instructions.
25824
25825@item -mext-perf2
25826@opindex mext-perf2
25827Generate performance extension 2 instructions.
25828
25829@item -mno-ext-perf2
25830@opindex mno-ext-perf2
25831Do not generate performance extension 2 instructions.
25832
25833@item -mext-string
25834@opindex mext-string
25835Generate string extension instructions.
25836
25837@item -mno-ext-string
25838@opindex mno-ext-string
25839Do not generate string extension instructions.
25840
25841@item -mv3push
25842@opindex mv3push
25843Generate v3 push25/pop25 instructions.
25844
25845@item -mno-v3push
25846@opindex mno-v3push
25847Do not generate v3 push25/pop25 instructions.
25848
25849@item -m16-bit
25850@opindex m16-bit
25851Generate 16-bit instructions.
25852
25853@item -mno-16-bit
25854@opindex mno-16-bit
25855Do not generate 16-bit instructions.
25856
25857@item -misr-vector-size=@var{num}
25858@opindex misr-vector-size
25859Specify the size of each interrupt vector, which must be 4 or 16.
25860
25861@item -mcache-block-size=@var{num}
25862@opindex mcache-block-size
25863Specify the size of each cache block,
25864which must be a power of 2 between 4 and 512.
25865
25866@item -march=@var{arch}
25867@opindex march
25868Specify the name of the target architecture.
25869
25870@item -mcmodel=@var{code-model}
25871@opindex mcmodel
25872Set the code model to one of
25873@table @asis
25874@item @samp{small}
25875All the data and read-only data segments must be within 512KB addressing space.
25876The text segment must be within 16MB addressing space.
25877@item @samp{medium}
25878The data segment must be within 512KB while the read-only data segment can be
25879within 4GB addressing space.  The text segment should be still within 16MB
25880addressing space.
25881@item @samp{large}
25882All the text and data segments can be within 4GB addressing space.
25883@end table
25884
25885@item -mctor-dtor
25886@opindex mctor-dtor
25887Enable constructor/destructor feature.
25888
25889@item -mrelax
25890@opindex mrelax
25891Guide linker to relax instructions.
25892
25893@end table
25894
25895@node Nios II Options
25896@subsection Nios II Options
25897@cindex Nios II options
25898@cindex Altera Nios II options
25899
25900These are the options defined for the Altera Nios II processor.
25901
25902@table @gcctabopt
25903
25904@item -G @var{num}
25905@opindex G
25906@cindex smaller data references
25907Put global and static objects less than or equal to @var{num} bytes
25908into the small data or BSS sections instead of the normal data or BSS
25909sections.  The default value of @var{num} is 8.
25910
25911@item -mgpopt=@var{option}
25912@itemx -mgpopt
25913@itemx -mno-gpopt
25914@opindex mgpopt
25915@opindex mno-gpopt
25916Generate (do not generate) GP-relative accesses.  The following
25917@var{option} names are recognized:
25918
25919@table @samp
25920
25921@item none
25922Do not generate GP-relative accesses.
25923
25924@item local
25925Generate GP-relative accesses for small data objects that are not
25926external, weak, or uninitialized common symbols.
25927Also use GP-relative addressing for objects that
25928have been explicitly placed in a small data section via a @code{section}
25929attribute.
25930
25931@item global
25932As for @samp{local}, but also generate GP-relative accesses for
25933small data objects that are external, weak, or common.  If you use this option,
25934you must ensure that all parts of your program (including libraries) are
25935compiled with the same @option{-G} setting.
25936
25937@item data
25938Generate GP-relative accesses for all data objects in the program.  If you
25939use this option, the entire data and BSS segments
25940of your program must fit in 64K of memory and you must use an appropriate
25941linker script to allocate them within the addressable range of the
25942global pointer.
25943
25944@item all
25945Generate GP-relative addresses for function pointers as well as data
25946pointers.  If you use this option, the entire text, data, and BSS segments
25947of your program must fit in 64K of memory and you must use an appropriate
25948linker script to allocate them within the addressable range of the
25949global pointer.
25950
25951@end table
25952
25953@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
25954@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
25955
25956The default is @option{-mgpopt} except when @option{-fpic} or
25957@option{-fPIC} is specified to generate position-independent code.
25958Note that the Nios II ABI does not permit GP-relative accesses from
25959shared libraries.
25960
25961You may need to specify @option{-mno-gpopt} explicitly when building
25962programs that include large amounts of small data, including large
25963GOT data sections.  In this case, the 16-bit offset for GP-relative
25964addressing may not be large enough to allow access to the entire
25965small data section.
25966
25967@item -mgprel-sec=@var{regexp}
25968@opindex mgprel-sec
25969This option specifies additional section names that can be accessed via
25970GP-relative addressing.  It is most useful in conjunction with
25971@code{section} attributes on variable declarations
25972(@pxref{Common Variable Attributes}) and a custom linker script.
25973The @var{regexp} is a POSIX Extended Regular Expression.
25974
25975This option does not affect the behavior of the @option{-G} option, and
25976the specified sections are in addition to the standard @code{.sdata}
25977and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
25978
25979@item -mr0rel-sec=@var{regexp}
25980@opindex mr0rel-sec
25981This option specifies names of sections that can be accessed via a
2598216-bit offset from @code{r0}; that is, in the low 32K or high 32K
25983of the 32-bit address space.  It is most useful in conjunction with
25984@code{section} attributes on variable declarations
25985(@pxref{Common Variable Attributes}) and a custom linker script.
25986The @var{regexp} is a POSIX Extended Regular Expression.
25987
25988In contrast to the use of GP-relative addressing for small data,
25989zero-based addressing is never generated by default and there are no
25990conventional section names used in standard linker scripts for sections
25991in the low or high areas of memory.
25992
25993@item -mel
25994@itemx -meb
25995@opindex mel
25996@opindex meb
25997Generate little-endian (default) or big-endian (experimental) code,
25998respectively.
25999
26000@item -march=@var{arch}
26001@opindex march
26002This specifies the name of the target Nios II architecture.  GCC uses this
26003name to determine what kind of instructions it can emit when generating
26004assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
26005
26006The preprocessor macro @code{__nios2_arch__} is available to programs,
26007with value 1 or 2, indicating the targeted ISA level.
26008
26009@item -mbypass-cache
26010@itemx -mno-bypass-cache
26011@opindex mno-bypass-cache
26012@opindex mbypass-cache
26013Force all load and store instructions to always bypass cache by
26014using I/O variants of the instructions. The default is not to
26015bypass the cache.
26016
26017@item -mno-cache-volatile
26018@itemx -mcache-volatile
26019@opindex mcache-volatile
26020@opindex mno-cache-volatile
26021Volatile memory access bypass the cache using the I/O variants of
26022the load and store instructions. The default is not to bypass the cache.
26023
26024@item -mno-fast-sw-div
26025@itemx -mfast-sw-div
26026@opindex mno-fast-sw-div
26027@opindex mfast-sw-div
26028Do not use table-based fast divide for small numbers. The default
26029is to use the fast divide at @option{-O3} and above.
26030
26031@item -mno-hw-mul
26032@itemx -mhw-mul
26033@itemx -mno-hw-mulx
26034@itemx -mhw-mulx
26035@itemx -mno-hw-div
26036@itemx -mhw-div
26037@opindex mno-hw-mul
26038@opindex mhw-mul
26039@opindex mno-hw-mulx
26040@opindex mhw-mulx
26041@opindex mno-hw-div
26042@opindex mhw-div
26043Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
26044instructions by the compiler. The default is to emit @code{mul}
26045and not emit @code{div} and @code{mulx}.
26046
26047@item -mbmx
26048@itemx -mno-bmx
26049@itemx -mcdx
26050@itemx -mno-cdx
26051Enable or disable generation of Nios II R2 BMX (bit manipulation) and
26052CDX (code density) instructions.  Enabling these instructions also
26053requires @option{-march=r2}.  Since these instructions are optional
26054extensions to the R2 architecture, the default is not to emit them.
26055
26056@item -mcustom-@var{insn}=@var{N}
26057@itemx -mno-custom-@var{insn}
26058@opindex mcustom-@var{insn}
26059@opindex mno-custom-@var{insn}
26060Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
26061custom instruction with encoding @var{N} when generating code that uses
26062@var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
26063instruction 253 for single-precision floating-point add operations instead
26064of the default behavior of using a library call.
26065
26066The following values of @var{insn} are supported.  Except as otherwise
26067noted, floating-point operations are expected to be implemented with
26068normal IEEE 754 semantics and correspond directly to the C operators or the
26069equivalent GCC built-in functions (@pxref{Other Builtins}).
26070
26071Single-precision floating point:
26072@table @asis
26073
26074@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
26075Binary arithmetic operations.
26076
26077@item @samp{fnegs}
26078Unary negation.
26079
26080@item @samp{fabss}
26081Unary absolute value.
26082
26083@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
26084Comparison operations.
26085
26086@item @samp{fmins}, @samp{fmaxs}
26087Floating-point minimum and maximum.  These instructions are only
26088generated if @option{-ffinite-math-only} is specified.
26089
26090@item @samp{fsqrts}
26091Unary square root operation.
26092
26093@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
26094Floating-point trigonometric and exponential functions.  These instructions
26095are only generated if @option{-funsafe-math-optimizations} is also specified.
26096
26097@end table
26098
26099Double-precision floating point:
26100@table @asis
26101
26102@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
26103Binary arithmetic operations.
26104
26105@item @samp{fnegd}
26106Unary negation.
26107
26108@item @samp{fabsd}
26109Unary absolute value.
26110
26111@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
26112Comparison operations.
26113
26114@item @samp{fmind}, @samp{fmaxd}
26115Double-precision minimum and maximum.  These instructions are only
26116generated if @option{-ffinite-math-only} is specified.
26117
26118@item @samp{fsqrtd}
26119Unary square root operation.
26120
26121@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
26122Double-precision trigonometric and exponential functions.  These instructions
26123are only generated if @option{-funsafe-math-optimizations} is also specified.
26124
26125@end table
26126
26127Conversions:
26128@table @asis
26129@item @samp{fextsd}
26130Conversion from single precision to double precision.
26131
26132@item @samp{ftruncds}
26133Conversion from double precision to single precision.
26134
26135@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
26136Conversion from floating point to signed or unsigned integer types, with
26137truncation towards zero.
26138
26139@item @samp{round}
26140Conversion from single-precision floating point to signed integer,
26141rounding to the nearest integer and ties away from zero.
26142This corresponds to the @code{__builtin_lroundf} function when
26143@option{-fno-math-errno} is used.
26144
26145@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
26146Conversion from signed or unsigned integer types to floating-point types.
26147
26148@end table
26149
26150In addition, all of the following transfer instructions for internal
26151registers X and Y must be provided to use any of the double-precision
26152floating-point instructions.  Custom instructions taking two
26153double-precision source operands expect the first operand in the
2615464-bit register X.  The other operand (or only operand of a unary
26155operation) is given to the custom arithmetic instruction with the
26156least significant half in source register @var{src1} and the most
26157significant half in @var{src2}.  A custom instruction that returns a
26158double-precision result returns the most significant 32 bits in the
26159destination register and the other half in 32-bit register Y.
26160GCC automatically generates the necessary code sequences to write
26161register X and/or read register Y when double-precision floating-point
26162instructions are used.
26163
26164@table @asis
26165
26166@item @samp{fwrx}
26167Write @var{src1} into the least significant half of X and @var{src2} into
26168the most significant half of X.
26169
26170@item @samp{fwry}
26171Write @var{src1} into Y.
26172
26173@item @samp{frdxhi}, @samp{frdxlo}
26174Read the most or least (respectively) significant half of X and store it in
26175@var{dest}.
26176
26177@item @samp{frdy}
26178Read the value of Y and store it into @var{dest}.
26179@end table
26180
26181Note that you can gain more local control over generation of Nios II custom
26182instructions by using the @code{target("custom-@var{insn}=@var{N}")}
26183and @code{target("no-custom-@var{insn}")} function attributes
26184(@pxref{Function Attributes})
26185or pragmas (@pxref{Function Specific Option Pragmas}).
26186
26187@item -mcustom-fpu-cfg=@var{name}
26188@opindex mcustom-fpu-cfg
26189
26190This option enables a predefined, named set of custom instruction encodings
26191(see @option{-mcustom-@var{insn}} above).
26192Currently, the following sets are defined:
26193
26194@option{-mcustom-fpu-cfg=60-1} is equivalent to:
26195@gccoptlist{-mcustom-fmuls=252 @gol
26196-mcustom-fadds=253 @gol
26197-mcustom-fsubs=254 @gol
26198-fsingle-precision-constant}
26199
26200@option{-mcustom-fpu-cfg=60-2} is equivalent to:
26201@gccoptlist{-mcustom-fmuls=252 @gol
26202-mcustom-fadds=253 @gol
26203-mcustom-fsubs=254 @gol
26204-mcustom-fdivs=255 @gol
26205-fsingle-precision-constant}
26206
26207@option{-mcustom-fpu-cfg=72-3} is equivalent to:
26208@gccoptlist{-mcustom-floatus=243 @gol
26209-mcustom-fixsi=244 @gol
26210-mcustom-floatis=245 @gol
26211-mcustom-fcmpgts=246 @gol
26212-mcustom-fcmples=249 @gol
26213-mcustom-fcmpeqs=250 @gol
26214-mcustom-fcmpnes=251 @gol
26215-mcustom-fmuls=252 @gol
26216-mcustom-fadds=253 @gol
26217-mcustom-fsubs=254 @gol
26218-mcustom-fdivs=255 @gol
26219-fsingle-precision-constant}
26220
26221@option{-mcustom-fpu-cfg=fph2} is equivalent to:
26222@gccoptlist{-mcustom-fabss=224 @gol
26223-mcustom-fnegs=225 @gol
26224-mcustom-fcmpnes=226 @gol
26225-mcustom-fcmpeqs=227 @gol
26226-mcustom-fcmpges=228 @gol
26227-mcustom-fcmpgts=229 @gol
26228-mcustom-fcmples=230 @gol
26229-mcustom-fcmplts=231 @gol
26230-mcustom-fmaxs=232 @gol
26231-mcustom-fmins=233 @gol
26232-mcustom-round=248 @gol
26233-mcustom-fixsi=249 @gol
26234-mcustom-floatis=250 @gol
26235-mcustom-fsqrts=251 @gol
26236-mcustom-fmuls=252 @gol
26237-mcustom-fadds=253 @gol
26238-mcustom-fsubs=254 @gol
26239-mcustom-fdivs=255 @gol}
26240
26241Custom instruction assignments given by individual
26242@option{-mcustom-@var{insn}=} options override those given by
26243@option{-mcustom-fpu-cfg=}, regardless of the
26244order of the options on the command line.
26245
26246Note that you can gain more local control over selection of a FPU
26247configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
26248function attribute (@pxref{Function Attributes})
26249or pragma (@pxref{Function Specific Option Pragmas}).
26250
26251The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
26252Hardware 2 Component}.  Please note that the custom instructions enabled by
26253@option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
26254if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
26255@option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
26256specified.  In contrast to the other configurations,
26257@option{-fsingle-precision-constant} is not set.
26258
26259@end table
26260
26261These additional @samp{-m} options are available for the Altera Nios II
26262ELF (bare-metal) target:
26263
26264@table @gcctabopt
26265
26266@item -mhal
26267@opindex mhal
26268Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
26269startup and termination code, and is typically used in conjunction with
26270@option{-msys-crt0=} to specify the location of the alternate startup code
26271provided by the HAL BSP.
26272
26273@item -msmallc
26274@opindex msmallc
26275Link with a limited version of the C library, @option{-lsmallc}, rather than
26276Newlib.
26277
26278@item -msys-crt0=@var{startfile}
26279@opindex msys-crt0
26280@var{startfile} is the file name of the startfile (crt0) to use
26281when linking.  This option is only useful in conjunction with @option{-mhal}.
26282
26283@item -msys-lib=@var{systemlib}
26284@opindex msys-lib
26285@var{systemlib} is the library name of the library that provides
26286low-level system calls required by the C library,
26287e.g.@: @code{read} and @code{write}.
26288This option is typically used to link with a library provided by a HAL BSP.
26289
26290@end table
26291
26292@node Nvidia PTX Options
26293@subsection Nvidia PTX Options
26294@cindex Nvidia PTX options
26295@cindex nvptx options
26296
26297These options are defined for Nvidia PTX:
26298
26299@table @gcctabopt
26300
26301@item -m64
26302@opindex m64
26303Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
26304supported.
26305
26306@item -misa=@var{ISA-string}
26307@opindex march
26308Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}).  ISA
26309strings must be lower-case.  Valid ISA strings include @samp{sm_30} and
26310@samp{sm_35}.  The default ISA is sm_35.
26311
26312@item -mmainkernel
26313@opindex mmainkernel
26314Link in code for a __main kernel.  This is for stand-alone instead of
26315offloading execution.
26316
26317@item -moptimize
26318@opindex moptimize
26319Apply partitioned execution optimizations.  This is the default when any
26320level of optimization is selected.
26321
26322@item -msoft-stack
26323@opindex msoft-stack
26324Generate code that does not use @code{.local} memory
26325directly for stack storage. Instead, a per-warp stack pointer is
26326maintained explicitly. This enables variable-length stack allocation (with
26327variable-length arrays or @code{alloca}), and when global memory is used for
26328underlying storage, makes it possible to access automatic variables from other
26329threads, or with atomic instructions. This code generation variant is used
26330for OpenMP offloading, but the option is exposed on its own for the purpose
26331of testing the compiler; to generate code suitable for linking into programs
26332using OpenMP offloading, use option @option{-mgomp}.
26333
26334@item -muniform-simt
26335@opindex muniform-simt
26336Switch to code generation variant that allows to execute all threads in each
26337warp, while maintaining memory state and side effects as if only one thread
26338in each warp was active outside of OpenMP SIMD regions.  All atomic operations
26339and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
26340current lane index equals the master lane index), and the register being
26341assigned is copied via a shuffle instruction from the master lane.  Outside of
26342SIMD regions lane 0 is the master; inside, each thread sees itself as the
26343master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
26344all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
26345regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
26346with current lane index to compute the master lane index.
26347
26348@item -mgomp
26349@opindex mgomp
26350Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
26351@option{-muniform-simt} options, and selects corresponding multilib variant.
26352
26353@end table
26354
26355@node OpenRISC Options
26356@subsection OpenRISC Options
26357@cindex OpenRISC Options
26358
26359These options are defined for OpenRISC:
26360
26361@table @gcctabopt
26362
26363@item -mboard=@var{name}
26364@opindex mboard
26365Configure a board specific runtime.  This will be passed to the linker for
26366newlib board library linking.  The default is @code{or1ksim}.
26367
26368@item -mnewlib
26369@opindex mnewlib
26370This option is ignored; it is for compatibility purposes only.  This used to
26371select linker and preprocessor options for use with newlib.
26372
26373@item -msoft-div
26374@itemx -mhard-div
26375@opindex msoft-div
26376@opindex mhard-div
26377Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
26378This default is hardware divide.
26379
26380@item -msoft-mul
26381@itemx -mhard-mul
26382@opindex msoft-mul
26383@opindex mhard-mul
26384Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
26385This default is hardware multiply.
26386
26387@item -msoft-float
26388@itemx -mhard-float
26389@opindex msoft-float
26390@opindex mhard-float
26391Select software or hardware for floating point operations.
26392The default is software.
26393
26394@item -mdouble-float
26395@opindex mdouble-float
26396When @option{-mhard-float} is selected, enables generation of double-precision
26397floating point instructions.  By default functions from @file{libgcc} are used
26398to perform double-precision floating point operations.
26399
26400@item -munordered-float
26401@opindex munordered-float
26402When @option{-mhard-float} is selected, enables generation of unordered
26403floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
26404functions from @file{libgcc} are used to perform unordered floating point
26405compare and set flag operations.
26406
26407@item -mcmov
26408@opindex mcmov
26409Enable generation of conditional move (@code{l.cmov}) instructions.  By
26410default the equivalent will be generated using set and branch.
26411
26412@item -mror
26413@opindex mror
26414Enable generation of rotate right (@code{l.ror}) instructions.  By default
26415functions from @file{libgcc} are used to perform rotate right operations.
26416
26417@item -mrori
26418@opindex mrori
26419Enable generation of rotate right with immediate (@code{l.rori}) instructions.
26420By default functions from @file{libgcc} are used to perform rotate right with
26421immediate operations.
26422
26423@item -msext
26424@opindex msext
26425Enable generation of sign extension (@code{l.ext*}) instructions.  By default
26426memory loads are used to perform sign extension.
26427
26428@item -msfimm
26429@opindex msfimm
26430Enable generation of compare and set flag with immediate (@code{l.sf*i})
26431instructions.  By default extra instructions will be generated to store the
26432immediate to a register first.
26433
26434@item -mshftimm
26435@opindex mshftimm
26436Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
26437@code{l.slli}) instructions.  By default extra instructions will be generated
26438to store the immediate to a register first.
26439
26440
26441@end table
26442
26443@node PDP-11 Options
26444@subsection PDP-11 Options
26445@cindex PDP-11 Options
26446
26447These options are defined for the PDP-11:
26448
26449@table @gcctabopt
26450@item -mfpu
26451@opindex mfpu
26452Use hardware FPP floating point.  This is the default.  (FIS floating
26453point on the PDP-11/40 is not supported.)  Implies -m45.
26454
26455@item -msoft-float
26456@opindex msoft-float
26457Do not use hardware floating point.
26458
26459@item -mac0
26460@opindex mac0
26461Return floating-point results in ac0 (fr0 in Unix assembler syntax).
26462
26463@item -mno-ac0
26464@opindex mno-ac0
26465Return floating-point results in memory.  This is the default.
26466
26467@item -m40
26468@opindex m40
26469Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
26470
26471@item -m45
26472@opindex m45
26473Generate code for a PDP-11/45.  This is the default.
26474
26475@item -m10
26476@opindex m10
26477Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
26478
26479@item -mint16
26480@itemx -mno-int32
26481@opindex mint16
26482@opindex mno-int32
26483Use 16-bit @code{int}.  This is the default.
26484
26485@item -mint32
26486@itemx -mno-int16
26487@opindex mint32
26488@opindex mno-int16
26489Use 32-bit @code{int}.
26490
26491@item -msplit
26492@opindex msplit
26493Target has split instruction and data space.  Implies -m45.
26494
26495@item -munix-asm
26496@opindex munix-asm
26497Use Unix assembler syntax.
26498
26499@item -mdec-asm
26500@opindex mdec-asm
26501Use DEC assembler syntax.
26502
26503@item -mgnu-asm
26504@opindex mgnu-asm
26505Use GNU assembler syntax.  This is the default.
26506
26507@item -mlra
26508@opindex mlra
26509Use the new LRA register allocator.  By default, the old ``reload''
26510allocator is used.
26511@end table
26512
26513@node picoChip Options
26514@subsection picoChip Options
26515@cindex picoChip options
26516
26517These @samp{-m} options are defined for picoChip implementations:
26518
26519@table @gcctabopt
26520
26521@item -mae=@var{ae_type}
26522@opindex mcpu
26523Set the instruction set, register set, and instruction scheduling
26524parameters for array element type @var{ae_type}.  Supported values
26525for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
26526
26527@option{-mae=ANY} selects a completely generic AE type.  Code
26528generated with this option runs on any of the other AE types.  The
26529code is not as efficient as it would be if compiled for a specific
26530AE type, and some types of operation (e.g., multiplication) do not
26531work properly on all types of AE.
26532
26533@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
26534for compiled code, and is the default.
26535
26536@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
26537option may suffer from poor performance of byte (char) manipulation,
26538since the DSP AE does not provide hardware support for byte load/stores.
26539
26540@item -msymbol-as-address
26541Enable the compiler to directly use a symbol name as an address in a
26542load/store instruction, without first loading it into a
26543register.  Typically, the use of this option generates larger
26544programs, which run faster than when the option isn't used.  However, the
26545results vary from program to program, so it is left as a user option,
26546rather than being permanently enabled.
26547
26548@item -mno-inefficient-warnings
26549Disables warnings about the generation of inefficient code.  These
26550warnings can be generated, for example, when compiling code that
26551performs byte-level memory operations on the MAC AE type.  The MAC AE has
26552no hardware support for byte-level memory operations, so all byte
26553load/stores must be synthesized from word load/store operations.  This is
26554inefficient and a warning is generated to indicate
26555that you should rewrite the code to avoid byte operations, or to target
26556an AE type that has the necessary hardware support.  This option disables
26557these warnings.
26558
26559@end table
26560
26561@node PowerPC Options
26562@subsection PowerPC Options
26563@cindex PowerPC options
26564
26565These are listed under @xref{RS/6000 and PowerPC Options}.
26566
26567@node PRU Options
26568@subsection PRU Options
26569@cindex PRU Options
26570
26571These command-line options are defined for PRU target:
26572
26573@table @gcctabopt
26574@item -minrt
26575@opindex minrt
26576Link with a minimum runtime environment, with no support for static
26577initializers and constructors.  Using this option can significantly reduce
26578the size of the final ELF binary.  Beware that the compiler could still
26579generate code with static initializers and constructors.  It is up to the
26580programmer to ensure that the source program will not use those features.
26581
26582@item -mmcu=@var{mcu}
26583@opindex mmcu
26584Specify the PRU MCU variant to use.  Check Newlib for the exact list of
26585supported MCUs.
26586
26587@item -mno-relax
26588@opindex mno-relax
26589Make GCC pass the @option{--no-relax} command-line option to the linker
26590instead of the @option{--relax} option.
26591
26592@item -mloop
26593@opindex mloop
26594Allow (or do not allow) GCC to use the LOOP instruction.
26595
26596@item -mabi=@var{variant}
26597@opindex mabi
26598Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
26599unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
26600more naturally with certain GCC assumptions.  These are the differences:
26601
26602@table @samp
26603@item Function Pointer Size
26604TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
26605supports only 32-bit data and code pointers.
26606
26607@item Optional Return Value Pointer
26608Function return values larger than 64 bits are passed by using a hidden
26609pointer as the first argument of the function.  TI ABI, though, mandates that
26610the pointer can be NULL in case the caller is not using the returned value.
26611GNU always passes and expects a valid return value pointer.
26612
26613@end table
26614
26615The current @option{-mabi=ti} implementation simply raises a compile error
26616when any of the above code constructs is detected.  As a consequence
26617the standard C library cannot be built and it is omitted when linking with
26618@option{-mabi=ti}.
26619
26620Relaxation is a GNU feature and for safety reasons is disabled when using
26621@option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
26622instructions, so the GNU linker cannot adjust them when shortening adjacent
26623LDI32 pseudo instructions.
26624
26625@end table
26626
26627@node RISC-V Options
26628@subsection RISC-V Options
26629@cindex RISC-V Options
26630
26631These command-line options are defined for RISC-V targets:
26632
26633@table @gcctabopt
26634@item -mbranch-cost=@var{n}
26635@opindex mbranch-cost
26636Set the cost of branches to roughly @var{n} instructions.
26637
26638@item -mplt
26639@itemx -mno-plt
26640@opindex plt
26641When generating PIC code, do or don't allow the use of PLTs. Ignored for
26642non-PIC.  The default is @option{-mplt}.
26643
26644@item -mabi=@var{ABI-string}
26645@opindex mabi
26646Specify integer and floating-point calling convention.  @var{ABI-string}
26647contains two parts: the size of integer types and the registers used for
26648floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
26649@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
2665032-bit), and that floating-point values up to 64 bits wide are passed in F
26651registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
26652allows the compiler to generate code that uses the F and D extensions but only
26653allows floating-point values up to 32 bits long to be passed in registers; or
26654@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
26655passed in registers.
26656
26657The default for this argument is system dependent, users who want a specific
26658calling convention should specify one explicitly.  The valid calling
26659conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
26660@samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
26661implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
26662invalid because the ABI requires 64-bit values be passed in F registers, but F
26663registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
26664only be used with the @samp{rv32e} architecture.  This ABI is not well
26665specified at present, and is subject to change.
26666
26667@item -mfdiv
26668@itemx -mno-fdiv
26669@opindex mfdiv
26670Do or don't use hardware floating-point divide and square root instructions.
26671This requires the F or D extensions for floating-point registers.  The default
26672is to use them if the specified architecture has these instructions.
26673
26674@item -mdiv
26675@itemx -mno-div
26676@opindex mdiv
26677Do or don't use hardware instructions for integer division.  This requires the
26678M extension.  The default is to use them if the specified architecture has
26679these instructions.
26680
26681@item -march=@var{ISA-string}
26682@opindex march
26683Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
26684lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
26685@samp{rv32imaf}.
26686
26687When @option{-march=} is not specified, use the setting from @option{-mcpu}.
26688
26689If both @option{-march} and @option{-mcpu=} are not specified, the default for
26690this argument is system dependent, users who want a specific architecture
26691extensions should specify one explicitly.
26692
26693@item -mcpu=@var{processor-string}
26694@opindex mcpu
26695Use architecture of and optimize the output for the given processor, specified
26696by particular CPU name.
26697Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
26698@samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
26699@samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
26700@samp{sifive-u54}, and @samp{sifive-u74}.
26701
26702@item -mtune=@var{processor-string}
26703@opindex mtune
26704Optimize the output for the given processor, specified by microarchitecture or
26705particular CPU name.  Permissible values for this option are: @samp{rocket},
26706@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
26707@samp{size}, and all valid options for @option{-mcpu=}.
26708
26709When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
26710the default is @samp{rocket} if both are not specified.
26711
26712The @samp{size} choice is not intended for use by end-users.  This is used
26713when @option{-Os} is specified.  It overrides the instruction cost info
26714provided by @option{-mtune=}, but does not override the pipeline info.  This
26715helps reduce code size while still giving good performance.
26716
26717@item -mpreferred-stack-boundary=@var{num}
26718@opindex mpreferred-stack-boundary
26719Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
26720byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
26721the default is 4 (16 bytes or 128-bits).
26722
26723@strong{Warning:} If you use this switch, then you must build all modules with
26724the same value, including any libraries.  This includes the system libraries
26725and startup modules.
26726
26727@item -msmall-data-limit=@var{n}
26728@opindex msmall-data-limit
26729Put global and static data smaller than @var{n} bytes into a special section
26730(on some targets).
26731
26732@item -msave-restore
26733@itemx -mno-save-restore
26734@opindex msave-restore
26735Do or don't use smaller but slower prologue and epilogue code that uses
26736library function calls.  The default is to use fast inline prologues and
26737epilogues.
26738
26739@item -mshorten-memrefs
26740@itemx -mno-shorten-memrefs
26741@opindex mshorten-memrefs
26742Do or do not attempt to make more use of compressed load/store instructions by
26743replacing a load/store of 'base register + large offset' with a new load/store
26744of 'new base + small offset'.  If the new base gets stored in a compressed
26745register, then the new load/store can be compressed.  Currently targets 32-bit
26746integer load/stores only.
26747
26748@item -mstrict-align
26749@itemx -mno-strict-align
26750@opindex mstrict-align
26751Do not or do generate unaligned memory accesses.  The default is set depending
26752on whether the processor we are optimizing for supports fast unaligned access
26753or not.
26754
26755@item -mcmodel=medlow
26756@opindex mcmodel=medlow
26757Generate code for the medium-low code model. The program and its statically
26758defined symbols must lie within a single 2 GiB address range and must lie
26759between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
26760statically or dynamically linked. This is the default code model.
26761
26762@item -mcmodel=medany
26763@opindex mcmodel=medany
26764Generate code for the medium-any code model. The program and its statically
26765defined symbols must be within any single 2 GiB address range. Programs can be
26766statically or dynamically linked.
26767
26768@item -mexplicit-relocs
26769@itemx -mno-exlicit-relocs
26770Use or do not use assembler relocation operators when dealing with symbolic
26771addresses.  The alternative is to use assembler macros instead, which may
26772limit optimization.
26773
26774@item -mrelax
26775@itemx -mno-relax
26776Take advantage of linker relaxations to reduce the number of instructions
26777required to materialize symbol addresses. The default is to take advantage of
26778linker relaxations.
26779
26780@item -memit-attribute
26781@itemx -mno-emit-attribute
26782Emit (do not emit) RISC-V attribute to record extra information into ELF
26783objects.  This feature requires at least binutils 2.32.
26784
26785@item -malign-data=@var{type}
26786@opindex malign-data
26787Control how GCC aligns variables and constants of array, structure, or union
26788types.  Supported values for @var{type} are @samp{xlen} which uses x register
26789width as the alignment value, and @samp{natural} which uses natural alignment.
26790@samp{xlen} is the default.
26791
26792@item -mbig-endian
26793@opindex mbig-endian
26794Generate big-endian code.  This is the default when GCC is configured for a
26795@samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
26796
26797@item -mlittle-endian
26798@opindex mlittle-endian
26799Generate little-endian code.  This is the default when GCC is configured for a
26800@samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
26801@samp{riscv32be-*-*} target.
26802
26803@item -mstack-protector-guard=@var{guard}
26804@itemx -mstack-protector-guard-reg=@var{reg}
26805@itemx -mstack-protector-guard-offset=@var{offset}
26806@opindex mstack-protector-guard
26807@opindex mstack-protector-guard-reg
26808@opindex mstack-protector-guard-offset
26809Generate stack protection code using canary at @var{guard}.  Supported
26810locations are @samp{global} for a global canary or @samp{tls} for per-thread
26811canary in the TLS block.
26812
26813With the latter choice the options
26814@option{-mstack-protector-guard-reg=@var{reg}} and
26815@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26816which register to use as base register for reading the canary,
26817and from what offset from that base register. There is no default
26818register or offset as this is entirely for use within the Linux
26819kernel.
26820@end table
26821
26822@node RL78 Options
26823@subsection RL78 Options
26824@cindex RL78 Options
26825
26826@table @gcctabopt
26827
26828@item -msim
26829@opindex msim
26830Links in additional target libraries to support operation within a
26831simulator.
26832
26833@item -mmul=none
26834@itemx -mmul=g10
26835@itemx -mmul=g13
26836@itemx -mmul=g14
26837@itemx -mmul=rl78
26838@opindex mmul
26839Specifies the type of hardware multiplication and division support to
26840be used.  The simplest is @code{none}, which uses software for both
26841multiplication and division.  This is the default.  The @code{g13}
26842value is for the hardware multiply/divide peripheral found on the
26843RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
26844the multiplication and division instructions supported by the RL78/G14
26845(S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
26846the value @code{mg10} is an alias for @code{none}.
26847
26848In addition a C preprocessor macro is defined, based upon the setting
26849of this option.  Possible values are: @code{__RL78_MUL_NONE__},
26850@code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
26851
26852@item -mcpu=g10
26853@itemx -mcpu=g13
26854@itemx -mcpu=g14
26855@itemx -mcpu=rl78
26856@opindex mcpu
26857Specifies the RL78 core to target.  The default is the G14 core, also
26858known as an S3 core or just RL78.  The G13 or S2 core does not have
26859multiply or divide instructions, instead it uses a hardware peripheral
26860for these operations.  The G10 or S1 core does not have register
26861banks, so it uses a different calling convention.
26862
26863If this option is set it also selects the type of hardware multiply
26864support to use, unless this is overridden by an explicit
26865@option{-mmul=none} option on the command line.  Thus specifying
26866@option{-mcpu=g13} enables the use of the G13 hardware multiply
26867peripheral and specifying @option{-mcpu=g10} disables the use of
26868hardware multiplications altogether.
26869
26870Note, although the RL78/G14 core is the default target, specifying
26871@option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
26872change the behavior of the toolchain since it also enables G14
26873hardware multiply support.  If these options are not specified on the
26874command line then software multiplication routines will be used even
26875though the code targets the RL78 core.  This is for backwards
26876compatibility with older toolchains which did not have hardware
26877multiply and divide support.
26878
26879In addition a C preprocessor macro is defined, based upon the setting
26880of this option.  Possible values are: @code{__RL78_G10__},
26881@code{__RL78_G13__} or @code{__RL78_G14__}.
26882
26883@item -mg10
26884@itemx -mg13
26885@itemx -mg14
26886@itemx -mrl78
26887@opindex mg10
26888@opindex mg13
26889@opindex mg14
26890@opindex mrl78
26891These are aliases for the corresponding @option{-mcpu=} option.  They
26892are provided for backwards compatibility.
26893
26894@item -mallregs
26895@opindex mallregs
26896Allow the compiler to use all of the available registers.  By default
26897registers @code{r24..r31} are reserved for use in interrupt handlers.
26898With this option enabled these registers can be used in ordinary
26899functions as well.
26900
26901@item -m64bit-doubles
26902@itemx -m32bit-doubles
26903@opindex m64bit-doubles
26904@opindex m32bit-doubles
26905Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26906or 32 bits (@option{-m32bit-doubles}) in size.  The default is
26907@option{-m32bit-doubles}.
26908
26909@item -msave-mduc-in-interrupts
26910@itemx -mno-save-mduc-in-interrupts
26911@opindex msave-mduc-in-interrupts
26912@opindex mno-save-mduc-in-interrupts
26913Specifies that interrupt handler functions should preserve the
26914MDUC registers.  This is only necessary if normal code might use
26915the MDUC registers, for example because it performs multiplication
26916and division operations.  The default is to ignore the MDUC registers
26917as this makes the interrupt handlers faster.  The target option -mg13
26918needs to be passed for this to work as this feature is only available
26919on the G13 target (S2 core).  The MDUC registers will only be saved
26920if the interrupt handler performs a multiplication or division
26921operation or it calls another function.
26922
26923@end table
26924
26925@node RS/6000 and PowerPC Options
26926@subsection IBM RS/6000 and PowerPC Options
26927@cindex RS/6000 and PowerPC Options
26928@cindex IBM RS/6000 and PowerPC Options
26929
26930These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
26931@table @gcctabopt
26932@item -mpowerpc-gpopt
26933@itemx -mno-powerpc-gpopt
26934@itemx -mpowerpc-gfxopt
26935@itemx -mno-powerpc-gfxopt
26936@need 800
26937@itemx -mpowerpc64
26938@itemx -mno-powerpc64
26939@itemx -mmfcrf
26940@itemx -mno-mfcrf
26941@itemx -mpopcntb
26942@itemx -mno-popcntb
26943@itemx -mpopcntd
26944@itemx -mno-popcntd
26945@itemx -mfprnd
26946@itemx -mno-fprnd
26947@need 800
26948@itemx -mcmpb
26949@itemx -mno-cmpb
26950@itemx -mhard-dfp
26951@itemx -mno-hard-dfp
26952@opindex mpowerpc-gpopt
26953@opindex mno-powerpc-gpopt
26954@opindex mpowerpc-gfxopt
26955@opindex mno-powerpc-gfxopt
26956@opindex mpowerpc64
26957@opindex mno-powerpc64
26958@opindex mmfcrf
26959@opindex mno-mfcrf
26960@opindex mpopcntb
26961@opindex mno-popcntb
26962@opindex mpopcntd
26963@opindex mno-popcntd
26964@opindex mfprnd
26965@opindex mno-fprnd
26966@opindex mcmpb
26967@opindex mno-cmpb
26968@opindex mhard-dfp
26969@opindex mno-hard-dfp
26970You use these options to specify which instructions are available on the
26971processor you are using.  The default value of these options is
26972determined when configuring GCC@.  Specifying the
26973@option{-mcpu=@var{cpu_type}} overrides the specification of these
26974options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
26975rather than the options listed above.
26976
26977Specifying @option{-mpowerpc-gpopt} allows
26978GCC to use the optional PowerPC architecture instructions in the
26979General Purpose group, including floating-point square root.  Specifying
26980@option{-mpowerpc-gfxopt} allows GCC to
26981use the optional PowerPC architecture instructions in the Graphics
26982group, including floating-point select.
26983
26984The @option{-mmfcrf} option allows GCC to generate the move from
26985condition register field instruction implemented on the POWER4
26986processor and other processors that support the PowerPC V2.01
26987architecture.
26988The @option{-mpopcntb} option allows GCC to generate the popcount and
26989double-precision FP reciprocal estimate instruction implemented on the
26990POWER5 processor and other processors that support the PowerPC V2.02
26991architecture.
26992The @option{-mpopcntd} option allows GCC to generate the popcount
26993instruction implemented on the POWER7 processor and other processors
26994that support the PowerPC V2.06 architecture.
26995The @option{-mfprnd} option allows GCC to generate the FP round to
26996integer instructions implemented on the POWER5+ processor and other
26997processors that support the PowerPC V2.03 architecture.
26998The @option{-mcmpb} option allows GCC to generate the compare bytes
26999instruction implemented on the POWER6 processor and other processors
27000that support the PowerPC V2.05 architecture.
27001The @option{-mhard-dfp} option allows GCC to generate the decimal
27002floating-point instructions implemented on some POWER processors.
27003
27004The @option{-mpowerpc64} option allows GCC to generate the additional
2700564-bit instructions that are found in the full PowerPC64 architecture
27006and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
27007@option{-mno-powerpc64}.
27008
27009@item -mcpu=@var{cpu_type}
27010@opindex mcpu
27011Set architecture type, register usage, and
27012instruction scheduling parameters for machine type @var{cpu_type}.
27013Supported values for @var{cpu_type} are @samp{401}, @samp{403},
27014@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
27015@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
27016@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
27017@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
27018@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
27019@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
27020@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
27021@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
27022@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
27023@samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
27024@samp{powerpc64le}, @samp{rs64}, and @samp{native}.
27025
27026@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
27027@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
27028endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
27029architecture machine types, with an appropriate, generic processor
27030model assumed for scheduling purposes.
27031
27032Specifying @samp{native} as cpu type detects and selects the
27033architecture option that corresponds to the host processor of the
27034system performing the compilation.
27035@option{-mcpu=native} has no effect if GCC does not recognize the
27036processor.
27037
27038The other options specify a specific processor.  Code generated under
27039those options runs best on that processor, and may not run at all on
27040others.
27041
27042The @option{-mcpu} options automatically enable or disable the
27043following options:
27044
27045@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
27046-mpopcntb  -mpopcntd  -mpowerpc64 @gol
27047-mpowerpc-gpopt  -mpowerpc-gfxopt @gol
27048-mmulhw  -mdlmzb  -mmfpgpr  -mvsx @gol
27049-mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector @gol
27050-mquad-memory  -mquad-memory-atomic  -mfloat128 @gol
27051-mfloat128-hardware -mprefixed -mpcrel -mmma @gol
27052-mrop-protect}
27053
27054The particular options set for any particular CPU varies between
27055compiler versions, depending on what setting seems to produce optimal
27056code for that CPU; it doesn't necessarily reflect the actual hardware's
27057capabilities.  If you wish to set an individual option to a particular
27058value, you may specify it after the @option{-mcpu} option, like
27059@option{-mcpu=970 -mno-altivec}.
27060
27061On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
27062not enabled or disabled by the @option{-mcpu} option at present because
27063AIX does not have full support for these options.  You may still
27064enable or disable them individually if you're sure it'll work in your
27065environment.
27066
27067@item -mtune=@var{cpu_type}
27068@opindex mtune
27069Set the instruction scheduling parameters for machine type
27070@var{cpu_type}, but do not set the architecture type or register usage,
27071as @option{-mcpu=@var{cpu_type}} does.  The same
27072values for @var{cpu_type} are used for @option{-mtune} as for
27073@option{-mcpu}.  If both are specified, the code generated uses the
27074architecture and registers set by @option{-mcpu}, but the
27075scheduling parameters set by @option{-mtune}.
27076
27077@item -mcmodel=small
27078@opindex mcmodel=small
27079Generate PowerPC64 code for the small model: The TOC is limited to
2708064k.
27081
27082@item -mcmodel=medium
27083@opindex mcmodel=medium
27084Generate PowerPC64 code for the medium model: The TOC and other static
27085data may be up to a total of 4G in size.  This is the default for 64-bit
27086Linux.
27087
27088@item -mcmodel=large
27089@opindex mcmodel=large
27090Generate PowerPC64 code for the large model: The TOC may be up to 4G
27091in size.  Other data and code is only limited by the 64-bit address
27092space.
27093
27094@item -maltivec
27095@itemx -mno-altivec
27096@opindex maltivec
27097@opindex mno-altivec
27098Generate code that uses (does not use) AltiVec instructions, and also
27099enable the use of built-in functions that allow more direct access to
27100the AltiVec instruction set.  You may also need to set
27101@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
27102enhancements.
27103
27104When @option{-maltivec} is used, the element order for AltiVec intrinsics
27105such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
27106match array element order corresponding to the endianness of the
27107target.  That is, element zero identifies the leftmost element in a
27108vector register when targeting a big-endian platform, and identifies
27109the rightmost element in a vector register when targeting a
27110little-endian platform.
27111
27112@item -mvrsave
27113@itemx -mno-vrsave
27114@opindex mvrsave
27115@opindex mno-vrsave
27116Generate VRSAVE instructions when generating AltiVec code.
27117
27118@item -msecure-plt
27119@opindex msecure-plt
27120Generate code that allows @command{ld} and @command{ld.so}
27121to build executables and shared
27122libraries with non-executable @code{.plt} and @code{.got} sections.
27123This is a PowerPC
2712432-bit SYSV ABI option.
27125
27126@item -mbss-plt
27127@opindex mbss-plt
27128Generate code that uses a BSS @code{.plt} section that @command{ld.so}
27129fills in, and
27130requires @code{.plt} and @code{.got}
27131sections that are both writable and executable.
27132This is a PowerPC 32-bit SYSV ABI option.
27133
27134@item -misel
27135@itemx -mno-isel
27136@opindex misel
27137@opindex mno-isel
27138This switch enables or disables the generation of ISEL instructions.
27139
27140@item -mvsx
27141@itemx -mno-vsx
27142@opindex mvsx
27143@opindex mno-vsx
27144Generate code that uses (does not use) vector/scalar (VSX)
27145instructions, and also enable the use of built-in functions that allow
27146more direct access to the VSX instruction set.
27147
27148@item -mcrypto
27149@itemx -mno-crypto
27150@opindex mcrypto
27151@opindex mno-crypto
27152Enable the use (disable) of the built-in functions that allow direct
27153access to the cryptographic instructions that were added in version
271542.07 of the PowerPC ISA.
27155
27156@item -mhtm
27157@itemx -mno-htm
27158@opindex mhtm
27159@opindex mno-htm
27160Enable (disable) the use of the built-in functions that allow direct
27161access to the Hardware Transactional Memory (HTM) instructions that
27162were added in version 2.07 of the PowerPC ISA.
27163
27164@item -mpower8-fusion
27165@itemx -mno-power8-fusion
27166@opindex mpower8-fusion
27167@opindex mno-power8-fusion
27168Generate code that keeps (does not keeps) some integer operations
27169adjacent so that the instructions can be fused together on power8 and
27170later processors.
27171
27172@item -mpower8-vector
27173@itemx -mno-power8-vector
27174@opindex mpower8-vector
27175@opindex mno-power8-vector
27176Generate code that uses (does not use) the vector and scalar
27177instructions that were added in version 2.07 of the PowerPC ISA.  Also
27178enable the use of built-in functions that allow more direct access to
27179the vector instructions.
27180
27181@item -mquad-memory
27182@itemx -mno-quad-memory
27183@opindex mquad-memory
27184@opindex mno-quad-memory
27185Generate code that uses (does not use) the non-atomic quad word memory
27186instructions.  The @option{-mquad-memory} option requires use of
2718764-bit mode.
27188
27189@item -mquad-memory-atomic
27190@itemx -mno-quad-memory-atomic
27191@opindex mquad-memory-atomic
27192@opindex mno-quad-memory-atomic
27193Generate code that uses (does not use) the atomic quad word memory
27194instructions.  The @option{-mquad-memory-atomic} option requires use of
2719564-bit mode.
27196
27197@item -mfloat128
27198@itemx -mno-float128
27199@opindex mfloat128
27200@opindex mno-float128
27201Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
27202and use either software emulation for IEEE 128-bit floating point or
27203hardware instructions.
27204
27205The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
27206@option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
27207use the IEEE 128-bit floating point support.  The IEEE 128-bit
27208floating point support only works on PowerPC Linux systems.
27209
27210The default for @option{-mfloat128} is enabled on PowerPC Linux
27211systems using the VSX instruction set, and disabled on other systems.
27212
27213If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
27214@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
27215point support will also enable the generation of ISA 3.0 IEEE 128-bit
27216floating point instructions.  Otherwise, if you do not specify to
27217generate ISA 3.0 instructions or you are targeting a 32-bit big endian
27218system, IEEE 128-bit floating point will be done with software
27219emulation.
27220
27221@item -mfloat128-hardware
27222@itemx -mno-float128-hardware
27223@opindex mfloat128-hardware
27224@opindex mno-float128-hardware
27225Enable/disable using ISA 3.0 hardware instructions to support the
27226@var{__float128} data type.
27227
27228The default for @option{-mfloat128-hardware} is enabled on PowerPC
27229Linux systems using the ISA 3.0 instruction set, and disabled on other
27230systems.
27231
27232@item -m32
27233@itemx -m64
27234@opindex m32
27235@opindex m64
27236Generate code for 32-bit or 64-bit environments of Darwin and SVR4
27237targets (including GNU/Linux).  The 32-bit environment sets int, long
27238and pointer to 32 bits and generates code that runs on any PowerPC
27239variant.  The 64-bit environment sets int to 32 bits and long and
27240pointer to 64 bits, and generates code for PowerPC64, as for
27241@option{-mpowerpc64}.
27242
27243@item -mfull-toc
27244@itemx -mno-fp-in-toc
27245@itemx -mno-sum-in-toc
27246@itemx -mminimal-toc
27247@opindex mfull-toc
27248@opindex mno-fp-in-toc
27249@opindex mno-sum-in-toc
27250@opindex mminimal-toc
27251Modify generation of the TOC (Table Of Contents), which is created for
27252every executable file.  The @option{-mfull-toc} option is selected by
27253default.  In that case, GCC allocates at least one TOC entry for
27254each unique non-automatic variable reference in your program.  GCC
27255also places floating-point constants in the TOC@.  However, only
2725616,384 entries are available in the TOC@.
27257
27258If you receive a linker error message that saying you have overflowed
27259the available TOC space, you can reduce the amount of TOC space used
27260with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
27261@option{-mno-fp-in-toc} prevents GCC from putting floating-point
27262constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
27263generate code to calculate the sum of an address and a constant at
27264run time instead of putting that sum into the TOC@.  You may specify one
27265or both of these options.  Each causes GCC to produce very slightly
27266slower and larger code at the expense of conserving TOC space.
27267
27268If you still run out of space in the TOC even when you specify both of
27269these options, specify @option{-mminimal-toc} instead.  This option causes
27270GCC to make only one TOC entry for every file.  When you specify this
27271option, GCC produces code that is slower and larger but which
27272uses extremely little TOC space.  You may wish to use this option
27273only on files that contain less frequently-executed code.
27274
27275@item -maix64
27276@itemx -maix32
27277@opindex maix64
27278@opindex maix32
27279Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
27280@code{long} type, and the infrastructure needed to support them.
27281Specifying @option{-maix64} implies @option{-mpowerpc64},
27282while @option{-maix32} disables the 64-bit ABI and
27283implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
27284
27285@item -mxl-compat
27286@itemx -mno-xl-compat
27287@opindex mxl-compat
27288@opindex mno-xl-compat
27289Produce code that conforms more closely to IBM XL compiler semantics
27290when using AIX-compatible ABI@.  Pass floating-point arguments to
27291prototyped functions beyond the register save area (RSA) on the stack
27292in addition to argument FPRs.  Do not assume that most significant
27293double in 128-bit long double value is properly rounded when comparing
27294values and converting to double.  Use XL symbol names for long double
27295support routines.
27296
27297The AIX calling convention was extended but not initially documented to
27298handle an obscure K&R C case of calling a function that takes the
27299address of its arguments with fewer arguments than declared.  IBM XL
27300compilers access floating-point arguments that do not fit in the
27301RSA from the stack when a subroutine is compiled without
27302optimization.  Because always storing floating-point arguments on the
27303stack is inefficient and rarely needed, this option is not enabled by
27304default and only is necessary when calling subroutines compiled by IBM
27305XL compilers without optimization.
27306
27307@item -mpe
27308@opindex mpe
27309Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
27310application written to use message passing with special startup code to
27311enable the application to run.  The system must have PE installed in the
27312standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
27313must be overridden with the @option{-specs=} option to specify the
27314appropriate directory location.  The Parallel Environment does not
27315support threads, so the @option{-mpe} option and the @option{-pthread}
27316option are incompatible.
27317
27318@item -malign-natural
27319@itemx -malign-power
27320@opindex malign-natural
27321@opindex malign-power
27322On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
27323@option{-malign-natural} overrides the ABI-defined alignment of larger
27324types, such as floating-point doubles, on their natural size-based boundary.
27325The option @option{-malign-power} instructs GCC to follow the ABI-specified
27326alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
27327
27328On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
27329is not supported.
27330
27331@item -msoft-float
27332@itemx -mhard-float
27333@opindex msoft-float
27334@opindex mhard-float
27335Generate code that does not use (uses) the floating-point register set.
27336Software floating-point emulation is provided if you use the
27337@option{-msoft-float} option, and pass the option to GCC when linking.
27338
27339@item -mmultiple
27340@itemx -mno-multiple
27341@opindex mmultiple
27342@opindex mno-multiple
27343Generate code that uses (does not use) the load multiple word
27344instructions and the store multiple word instructions.  These
27345instructions are generated by default on POWER systems, and not
27346generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
27347PowerPC systems, since those instructions do not work when the
27348processor is in little-endian mode.  The exceptions are PPC740 and
27349PPC750 which permit these instructions in little-endian mode.
27350
27351@item -mupdate
27352@itemx -mno-update
27353@opindex mupdate
27354@opindex mno-update
27355Generate code that uses (does not use) the load or store instructions
27356that update the base register to the address of the calculated memory
27357location.  These instructions are generated by default.  If you use
27358@option{-mno-update}, there is a small window between the time that the
27359stack pointer is updated and the address of the previous frame is
27360stored, which means code that walks the stack frame across interrupts or
27361signals may get corrupted data.
27362
27363@item -mavoid-indexed-addresses
27364@itemx -mno-avoid-indexed-addresses
27365@opindex mavoid-indexed-addresses
27366@opindex mno-avoid-indexed-addresses
27367Generate code that tries to avoid (not avoid) the use of indexed load
27368or store instructions. These instructions can incur a performance
27369penalty on Power6 processors in certain situations, such as when
27370stepping through large arrays that cross a 16M boundary.  This option
27371is enabled by default when targeting Power6 and disabled otherwise.
27372
27373@item -mfused-madd
27374@itemx -mno-fused-madd
27375@opindex mfused-madd
27376@opindex mno-fused-madd
27377Generate code that uses (does not use) the floating-point multiply and
27378accumulate instructions.  These instructions are generated by default
27379if hardware floating point is used.  The machine-dependent
27380@option{-mfused-madd} option is now mapped to the machine-independent
27381@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27382mapped to @option{-ffp-contract=off}.
27383
27384@item -mmulhw
27385@itemx -mno-mulhw
27386@opindex mmulhw
27387@opindex mno-mulhw
27388Generate code that uses (does not use) the half-word multiply and
27389multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
27390These instructions are generated by default when targeting those
27391processors.
27392
27393@item -mdlmzb
27394@itemx -mno-dlmzb
27395@opindex mdlmzb
27396@opindex mno-dlmzb
27397Generate code that uses (does not use) the string-search @samp{dlmzb}
27398instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
27399generated by default when targeting those processors.
27400
27401@item -mno-bit-align
27402@itemx -mbit-align
27403@opindex mno-bit-align
27404@opindex mbit-align
27405On System V.4 and embedded PowerPC systems do not (do) force structures
27406and unions that contain bit-fields to be aligned to the base type of the
27407bit-field.
27408
27409For example, by default a structure containing nothing but 8
27410@code{unsigned} bit-fields of length 1 is aligned to a 4-byte
27411boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
27412the structure is aligned to a 1-byte boundary and is 1 byte in
27413size.
27414
27415@item -mno-strict-align
27416@itemx -mstrict-align
27417@opindex mno-strict-align
27418@opindex mstrict-align
27419On System V.4 and embedded PowerPC systems do not (do) assume that
27420unaligned memory references are handled by the system.
27421
27422@item -mrelocatable
27423@itemx -mno-relocatable
27424@opindex mrelocatable
27425@opindex mno-relocatable
27426Generate code that allows (does not allow) a static executable to be
27427relocated to a different address at run time.  A simple embedded
27428PowerPC system loader should relocate the entire contents of
27429@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
27430a table of 32-bit addresses generated by this option.  For this to
27431work, all objects linked together must be compiled with
27432@option{-mrelocatable} or @option{-mrelocatable-lib}.
27433@option{-mrelocatable} code aligns the stack to an 8-byte boundary.
27434
27435@item -mrelocatable-lib
27436@itemx -mno-relocatable-lib
27437@opindex mrelocatable-lib
27438@opindex mno-relocatable-lib
27439Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
27440@code{.fixup} section to allow static executables to be relocated at
27441run time, but @option{-mrelocatable-lib} does not use the smaller stack
27442alignment of @option{-mrelocatable}.  Objects compiled with
27443@option{-mrelocatable-lib} may be linked with objects compiled with
27444any combination of the @option{-mrelocatable} options.
27445
27446@item -mno-toc
27447@itemx -mtoc
27448@opindex mno-toc
27449@opindex mtoc
27450On System V.4 and embedded PowerPC systems do not (do) assume that
27451register 2 contains a pointer to a global area pointing to the addresses
27452used in the program.
27453
27454@item -mlittle
27455@itemx -mlittle-endian
27456@opindex mlittle
27457@opindex mlittle-endian
27458On System V.4 and embedded PowerPC systems compile code for the
27459processor in little-endian mode.  The @option{-mlittle-endian} option is
27460the same as @option{-mlittle}.
27461
27462@item -mbig
27463@itemx -mbig-endian
27464@opindex mbig
27465@opindex mbig-endian
27466On System V.4 and embedded PowerPC systems compile code for the
27467processor in big-endian mode.  The @option{-mbig-endian} option is
27468the same as @option{-mbig}.
27469
27470@item -mdynamic-no-pic
27471@opindex mdynamic-no-pic
27472On Darwin and Mac OS X systems, compile code so that it is not
27473relocatable, but that its external references are relocatable.  The
27474resulting code is suitable for applications, but not shared
27475libraries.
27476
27477@item -msingle-pic-base
27478@opindex msingle-pic-base
27479Treat the register used for PIC addressing as read-only, rather than
27480loading it in the prologue for each function.  The runtime system is
27481responsible for initializing this register with an appropriate value
27482before execution begins.
27483
27484@item -mprioritize-restricted-insns=@var{priority}
27485@opindex mprioritize-restricted-insns
27486This option controls the priority that is assigned to
27487dispatch-slot restricted instructions during the second scheduling
27488pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
27489or @samp{2} to assign no, highest, or second-highest (respectively)
27490priority to dispatch-slot restricted
27491instructions.
27492
27493@item -msched-costly-dep=@var{dependence_type}
27494@opindex msched-costly-dep
27495This option controls which dependences are considered costly
27496by the target during instruction scheduling.  The argument
27497@var{dependence_type} takes one of the following values:
27498
27499@table @asis
27500@item @samp{no}
27501No dependence is costly.
27502
27503@item @samp{all}
27504All dependences are costly.
27505
27506@item @samp{true_store_to_load}
27507A true dependence from store to load is costly.
27508
27509@item @samp{store_to_load}
27510Any dependence from store to load is costly.
27511
27512@item @var{number}
27513Any dependence for which the latency is greater than or equal to
27514@var{number} is costly.
27515@end table
27516
27517@item -minsert-sched-nops=@var{scheme}
27518@opindex minsert-sched-nops
27519This option controls which NOP insertion scheme is used during
27520the second scheduling pass.  The argument @var{scheme} takes one of the
27521following values:
27522
27523@table @asis
27524@item @samp{no}
27525Don't insert NOPs.
27526
27527@item @samp{pad}
27528Pad with NOPs any dispatch group that has vacant issue slots,
27529according to the scheduler's grouping.
27530
27531@item @samp{regroup_exact}
27532Insert NOPs to force costly dependent insns into
27533separate groups.  Insert exactly as many NOPs as needed to force an insn
27534to a new group, according to the estimated processor grouping.
27535
27536@item @var{number}
27537Insert NOPs to force costly dependent insns into
27538separate groups.  Insert @var{number} NOPs to force an insn to a new group.
27539@end table
27540
27541@item -mcall-sysv
27542@opindex mcall-sysv
27543On System V.4 and embedded PowerPC systems compile code using calling
27544conventions that adhere to the March 1995 draft of the System V
27545Application Binary Interface, PowerPC processor supplement.  This is the
27546default unless you configured GCC using @samp{powerpc-*-eabiaix}.
27547
27548@item -mcall-sysv-eabi
27549@itemx -mcall-eabi
27550@opindex mcall-sysv-eabi
27551@opindex mcall-eabi
27552Specify both @option{-mcall-sysv} and @option{-meabi} options.
27553
27554@item -mcall-sysv-noeabi
27555@opindex mcall-sysv-noeabi
27556Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
27557
27558@item -mcall-aixdesc
27559@opindex m
27560On System V.4 and embedded PowerPC systems compile code for the AIX
27561operating system.
27562
27563@item -mcall-linux
27564@opindex mcall-linux
27565On System V.4 and embedded PowerPC systems compile code for the
27566Linux-based GNU system.
27567
27568@item -mcall-freebsd
27569@opindex mcall-freebsd
27570On System V.4 and embedded PowerPC systems compile code for the
27571FreeBSD operating system.
27572
27573@item -mcall-netbsd
27574@opindex mcall-netbsd
27575On System V.4 and embedded PowerPC systems compile code for the
27576NetBSD operating system.
27577
27578@item -mcall-openbsd
27579@opindex mcall-netbsd
27580On System V.4 and embedded PowerPC systems compile code for the
27581OpenBSD operating system.
27582
27583@item -mtraceback=@var{traceback_type}
27584@opindex mtraceback
27585Select the type of traceback table. Valid values for @var{traceback_type}
27586are @samp{full}, @samp{part}, and @samp{no}.
27587
27588@item -maix-struct-return
27589@opindex maix-struct-return
27590Return all structures in memory (as specified by the AIX ABI)@.
27591
27592@item -msvr4-struct-return
27593@opindex msvr4-struct-return
27594Return structures smaller than 8 bytes in registers (as specified by the
27595SVR4 ABI)@.
27596
27597@item -mabi=@var{abi-type}
27598@opindex mabi
27599Extend the current ABI with a particular extension, or remove such extension.
27600Valid values are: @samp{altivec}, @samp{no-altivec},
27601@samp{ibmlongdouble}, @samp{ieeelongdouble},
27602@samp{elfv1}, @samp{elfv2},
27603and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
27604
27605@item -mabi=ibmlongdouble
27606@opindex mabi=ibmlongdouble
27607Change the current ABI to use IBM extended-precision long double.
27608This is not likely to work if your system defaults to using IEEE
27609extended-precision long double.  If you change the long double type
27610from IEEE extended-precision, the compiler will issue a warning unless
27611you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
27612to be enabled.
27613
27614@item -mabi=ieeelongdouble
27615@opindex mabi=ieeelongdouble
27616Change the current ABI to use IEEE extended-precision long double.
27617This is not likely to work if your system defaults to using IBM
27618extended-precision long double.  If you change the long double type
27619from IBM extended-precision, the compiler will issue a warning unless
27620you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
27621to be enabled.
27622
27623@item -mabi=elfv1
27624@opindex mabi=elfv1
27625Change the current ABI to use the ELFv1 ABI.
27626This is the default ABI for big-endian PowerPC 64-bit Linux.
27627Overriding the default ABI requires special system support and is
27628likely to fail in spectacular ways.
27629
27630@item -mabi=elfv2
27631@opindex mabi=elfv2
27632Change the current ABI to use the ELFv2 ABI.
27633This is the default ABI for little-endian PowerPC 64-bit Linux.
27634Overriding the default ABI requires special system support and is
27635likely to fail in spectacular ways.
27636
27637@item -mgnu-attribute
27638@itemx -mno-gnu-attribute
27639@opindex mgnu-attribute
27640@opindex mno-gnu-attribute
27641Emit .gnu_attribute assembly directives to set tag/value pairs in a
27642.gnu.attributes section that specify ABI variations in function
27643parameters or return values.
27644
27645@item -mprototype
27646@itemx -mno-prototype
27647@opindex mprototype
27648@opindex mno-prototype
27649On System V.4 and embedded PowerPC systems assume that all calls to
27650variable argument functions are properly prototyped.  Otherwise, the
27651compiler must insert an instruction before every non-prototyped call to
27652set or clear bit 6 of the condition code register (@code{CR}) to
27653indicate whether floating-point values are passed in the floating-point
27654registers in case the function takes variable arguments.  With
27655@option{-mprototype}, only calls to prototyped variable argument functions
27656set or clear the bit.
27657
27658@item -msim
27659@opindex msim
27660On embedded PowerPC systems, assume that the startup module is called
27661@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
27662@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
27663configurations.
27664
27665@item -mmvme
27666@opindex mmvme
27667On embedded PowerPC systems, assume that the startup module is called
27668@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
27669@file{libc.a}.
27670
27671@item -mads
27672@opindex mads
27673On embedded PowerPC systems, assume that the startup module is called
27674@file{crt0.o} and the standard C libraries are @file{libads.a} and
27675@file{libc.a}.
27676
27677@item -myellowknife
27678@opindex myellowknife
27679On embedded PowerPC systems, assume that the startup module is called
27680@file{crt0.o} and the standard C libraries are @file{libyk.a} and
27681@file{libc.a}.
27682
27683@item -mvxworks
27684@opindex mvxworks
27685On System V.4 and embedded PowerPC systems, specify that you are
27686compiling for a VxWorks system.
27687
27688@item -memb
27689@opindex memb
27690On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
27691header to indicate that @samp{eabi} extended relocations are used.
27692
27693@item -meabi
27694@itemx -mno-eabi
27695@opindex meabi
27696@opindex mno-eabi
27697On System V.4 and embedded PowerPC systems do (do not) adhere to the
27698Embedded Applications Binary Interface (EABI), which is a set of
27699modifications to the System V.4 specifications.  Selecting @option{-meabi}
27700means that the stack is aligned to an 8-byte boundary, a function
27701@code{__eabi} is called from @code{main} to set up the EABI
27702environment, and the @option{-msdata} option can use both @code{r2} and
27703@code{r13} to point to two separate small data areas.  Selecting
27704@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
27705no EABI initialization function is called from @code{main}, and the
27706@option{-msdata} option only uses @code{r13} to point to a single
27707small data area.  The @option{-meabi} option is on by default if you
27708configured GCC using one of the @samp{powerpc*-*-eabi*} options.
27709
27710@item -msdata=eabi
27711@opindex msdata=eabi
27712On System V.4 and embedded PowerPC systems, put small initialized
27713@code{const} global and static data in the @code{.sdata2} section, which
27714is pointed to by register @code{r2}.  Put small initialized
27715non-@code{const} global and static data in the @code{.sdata} section,
27716which is pointed to by register @code{r13}.  Put small uninitialized
27717global and static data in the @code{.sbss} section, which is adjacent to
27718the @code{.sdata} section.  The @option{-msdata=eabi} option is
27719incompatible with the @option{-mrelocatable} option.  The
27720@option{-msdata=eabi} option also sets the @option{-memb} option.
27721
27722@item -msdata=sysv
27723@opindex msdata=sysv
27724On System V.4 and embedded PowerPC systems, put small global and static
27725data in the @code{.sdata} section, which is pointed to by register
27726@code{r13}.  Put small uninitialized global and static data in the
27727@code{.sbss} section, which is adjacent to the @code{.sdata} section.
27728The @option{-msdata=sysv} option is incompatible with the
27729@option{-mrelocatable} option.
27730
27731@item -msdata=default
27732@itemx -msdata
27733@opindex msdata=default
27734@opindex msdata
27735On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
27736compile code the same as @option{-msdata=eabi}, otherwise compile code the
27737same as @option{-msdata=sysv}.
27738
27739@item -msdata=data
27740@opindex msdata=data
27741On System V.4 and embedded PowerPC systems, put small global
27742data in the @code{.sdata} section.  Put small uninitialized global
27743data in the @code{.sbss} section.  Do not use register @code{r13}
27744to address small data however.  This is the default behavior unless
27745other @option{-msdata} options are used.
27746
27747@item -msdata=none
27748@itemx -mno-sdata
27749@opindex msdata=none
27750@opindex mno-sdata
27751On embedded PowerPC systems, put all initialized global and static data
27752in the @code{.data} section, and all uninitialized data in the
27753@code{.bss} section.
27754
27755@item -mreadonly-in-sdata
27756@opindex mreadonly-in-sdata
27757@opindex mno-readonly-in-sdata
27758Put read-only objects in the @code{.sdata} section as well.  This is the
27759default.
27760
27761@item -mblock-move-inline-limit=@var{num}
27762@opindex mblock-move-inline-limit
27763Inline all block moves (such as calls to @code{memcpy} or structure
27764copies) less than or equal to @var{num} bytes.  The minimum value for
27765@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
27766targets.  The default value is target-specific.
27767
27768@item -mblock-compare-inline-limit=@var{num}
27769@opindex mblock-compare-inline-limit
27770Generate non-looping inline code for all block compares (such as calls
27771to @code{memcmp} or structure compares) less than or equal to @var{num}
27772bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
27773block compare is disabled. The default value is target-specific.
27774
27775@item -mblock-compare-inline-loop-limit=@var{num}
27776@opindex mblock-compare-inline-loop-limit
27777Generate an inline expansion using loop code for all block compares that
27778are less than or equal to @var{num} bytes, but greater than the limit
27779for non-loop inline block compare expansion. If the block length is not
27780constant, at most @var{num} bytes will be compared before @code{memcmp}
27781is called to compare the remainder of the block. The default value is
27782target-specific.
27783
27784@item -mstring-compare-inline-limit=@var{num}
27785@opindex mstring-compare-inline-limit
27786Compare at most @var{num} string bytes with inline code.
27787If the difference or end of string is not found at the
27788end of the inline compare a call to @code{strcmp} or @code{strncmp} will
27789take care of the rest of the comparison. The default is 64 bytes.
27790
27791@item -G @var{num}
27792@opindex G
27793@cindex smaller data references (PowerPC)
27794@cindex .sdata/.sdata2 references (PowerPC)
27795On embedded PowerPC systems, put global and static items less than or
27796equal to @var{num} bytes into the small data or BSS sections instead of
27797the normal data or BSS section.  By default, @var{num} is 8.  The
27798@option{-G @var{num}} switch is also passed to the linker.
27799All modules should be compiled with the same @option{-G @var{num}} value.
27800
27801@item -mregnames
27802@itemx -mno-regnames
27803@opindex mregnames
27804@opindex mno-regnames
27805On System V.4 and embedded PowerPC systems do (do not) emit register
27806names in the assembly language output using symbolic forms.
27807
27808@item -mlongcall
27809@itemx -mno-longcall
27810@opindex mlongcall
27811@opindex mno-longcall
27812By default assume that all calls are far away so that a longer and more
27813expensive calling sequence is required.  This is required for calls
27814farther than 32 megabytes (33,554,432 bytes) from the current location.
27815A short call is generated if the compiler knows
27816the call cannot be that far away.  This setting can be overridden by
27817the @code{shortcall} function attribute, or by @code{#pragma
27818longcall(0)}.
27819
27820Some linkers are capable of detecting out-of-range calls and generating
27821glue code on the fly.  On these systems, long calls are unnecessary and
27822generate slower code.  As of this writing, the AIX linker can do this,
27823as can the GNU linker for PowerPC/64.  It is planned to add this feature
27824to the GNU linker for 32-bit PowerPC systems as well.
27825
27826On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
27827GCC can generate long calls using an inline PLT call sequence (see
27828@option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
27829ELFv1 (big-endian) do not support inline PLT calls.
27830
27831On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
27832callee, L42}, plus a @dfn{branch island} (glue code).  The two target
27833addresses represent the callee and the branch island.  The
27834Darwin/PPC linker prefers the first address and generates a @code{bl
27835callee} if the PPC @code{bl} instruction reaches the callee directly;
27836otherwise, the linker generates @code{bl L42} to call the branch
27837island.  The branch island is appended to the body of the
27838calling function; it computes the full 32-bit address of the callee
27839and jumps to it.
27840
27841On Mach-O (Darwin) systems, this option directs the compiler emit to
27842the glue for every direct call, and the Darwin linker decides whether
27843to use or discard it.
27844
27845In the future, GCC may ignore all longcall specifications
27846when the linker is known to generate glue.
27847
27848@item -mpltseq
27849@itemx -mno-pltseq
27850@opindex mpltseq
27851@opindex mno-pltseq
27852Implement (do not implement) -fno-plt and long calls using an inline
27853PLT call sequence that supports lazy linking and long calls to
27854functions in dlopen'd shared libraries.  Inline PLT calls are only
27855supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
27856linkers, and are enabled by default if the support is detected when
27857configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
27858configured with @option{--enable-secureplt}.  @option{-mpltseq} code
27859and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
27860linked together.
27861
27862@item -mtls-markers
27863@itemx -mno-tls-markers
27864@opindex mtls-markers
27865@opindex mno-tls-markers
27866Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
27867specifying the function argument.  The relocation allows the linker to
27868reliably associate function call with argument setup instructions for
27869TLS optimization, which in turn allows GCC to better schedule the
27870sequence.
27871
27872@item -mrecip
27873@itemx -mno-recip
27874@opindex mrecip
27875This option enables use of the reciprocal estimate and
27876reciprocal square root estimate instructions with additional
27877Newton-Raphson steps to increase precision instead of doing a divide or
27878square root and divide for floating-point arguments.  You should use
27879the @option{-ffast-math} option when using @option{-mrecip} (or at
27880least @option{-funsafe-math-optimizations},
27881@option{-ffinite-math-only}, @option{-freciprocal-math} and
27882@option{-fno-trapping-math}).  Note that while the throughput of the
27883sequence is generally higher than the throughput of the non-reciprocal
27884instruction, the precision of the sequence can be decreased by up to 2
27885ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
27886roots.
27887
27888@item -mrecip=@var{opt}
27889@opindex mrecip=opt
27890This option controls which reciprocal estimate instructions
27891may be used.  @var{opt} is a comma-separated list of options, which may
27892be preceded by a @code{!} to invert the option:
27893
27894@table @samp
27895
27896@item all
27897Enable all estimate instructions.
27898
27899@item default
27900Enable the default instructions, equivalent to @option{-mrecip}.
27901
27902@item none
27903Disable all estimate instructions, equivalent to @option{-mno-recip}.
27904
27905@item div
27906Enable the reciprocal approximation instructions for both
27907single and double precision.
27908
27909@item divf
27910Enable the single-precision reciprocal approximation instructions.
27911
27912@item divd
27913Enable the double-precision reciprocal approximation instructions.
27914
27915@item rsqrt
27916Enable the reciprocal square root approximation instructions for both
27917single and double precision.
27918
27919@item rsqrtf
27920Enable the single-precision reciprocal square root approximation instructions.
27921
27922@item rsqrtd
27923Enable the double-precision reciprocal square root approximation instructions.
27924
27925@end table
27926
27927So, for example, @option{-mrecip=all,!rsqrtd} enables
27928all of the reciprocal estimate instructions, except for the
27929@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
27930which handle the double-precision reciprocal square root calculations.
27931
27932@item -mrecip-precision
27933@itemx -mno-recip-precision
27934@opindex mrecip-precision
27935Assume (do not assume) that the reciprocal estimate instructions
27936provide higher-precision estimates than is mandated by the PowerPC
27937ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
27938@option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
27939The double-precision square root estimate instructions are not generated by
27940default on low-precision machines, since they do not provide an
27941estimate that converges after three steps.
27942
27943@item -mveclibabi=@var{type}
27944@opindex mveclibabi
27945Specifies the ABI type to use for vectorizing intrinsics using an
27946external library.  The only type supported at present is @samp{mass},
27947which specifies to use IBM's Mathematical Acceleration Subsystem
27948(MASS) libraries for vectorizing intrinsics using external libraries.
27949GCC currently emits calls to @code{acosd2}, @code{acosf4},
27950@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
27951@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
27952@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
27953@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
27954@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
27955@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
27956@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
27957@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
27958@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
27959@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
27960@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
27961@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
27962@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
27963for power7.  Both @option{-ftree-vectorize} and
27964@option{-funsafe-math-optimizations} must also be enabled.  The MASS
27965libraries must be specified at link time.
27966
27967@item -mfriz
27968@itemx -mno-friz
27969@opindex mfriz
27970Generate (do not generate) the @code{friz} instruction when the
27971@option{-funsafe-math-optimizations} option is used to optimize
27972rounding of floating-point values to 64-bit integer and back to floating
27973point.  The @code{friz} instruction does not return the same value if
27974the floating-point number is too large to fit in an integer.
27975
27976@item -mpointers-to-nested-functions
27977@itemx -mno-pointers-to-nested-functions
27978@opindex mpointers-to-nested-functions
27979Generate (do not generate) code to load up the static chain register
27980(@code{r11}) when calling through a pointer on AIX and 64-bit Linux
27981systems where a function pointer points to a 3-word descriptor giving
27982the function address, TOC value to be loaded in register @code{r2}, and
27983static chain value to be loaded in register @code{r11}.  The
27984@option{-mpointers-to-nested-functions} is on by default.  You cannot
27985call through pointers to nested functions or pointers
27986to functions compiled in other languages that use the static chain if
27987you use @option{-mno-pointers-to-nested-functions}.
27988
27989@item -msave-toc-indirect
27990@itemx -mno-save-toc-indirect
27991@opindex msave-toc-indirect
27992Generate (do not generate) code to save the TOC value in the reserved
27993stack location in the function prologue if the function calls through
27994a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
27995saved in the prologue, it is saved just before the call through the
27996pointer.  The @option{-mno-save-toc-indirect} option is the default.
27997
27998@item -mcompat-align-parm
27999@itemx -mno-compat-align-parm
28000@opindex mcompat-align-parm
28001Generate (do not generate) code to pass structure parameters with a
28002maximum alignment of 64 bits, for compatibility with older versions
28003of GCC.
28004
28005Older versions of GCC (prior to 4.9.0) incorrectly did not align a
28006structure parameter on a 128-bit boundary when that structure contained
28007a member requiring 128-bit alignment.  This is corrected in more
28008recent versions of GCC.  This option may be used to generate code
28009that is compatible with functions compiled with older versions of
28010GCC.
28011
28012The @option{-mno-compat-align-parm} option is the default.
28013
28014@item -mstack-protector-guard=@var{guard}
28015@itemx -mstack-protector-guard-reg=@var{reg}
28016@itemx -mstack-protector-guard-offset=@var{offset}
28017@itemx -mstack-protector-guard-symbol=@var{symbol}
28018@opindex mstack-protector-guard
28019@opindex mstack-protector-guard-reg
28020@opindex mstack-protector-guard-offset
28021@opindex mstack-protector-guard-symbol
28022Generate stack protection code using canary at @var{guard}.  Supported
28023locations are @samp{global} for global canary or @samp{tls} for per-thread
28024canary in the TLS block (the default with GNU libc version 2.4 or later).
28025
28026With the latter choice the options
28027@option{-mstack-protector-guard-reg=@var{reg}} and
28028@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28029which register to use as base register for reading the canary, and from what
28030offset from that base register. The default for those is as specified in the
28031relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
28032the offset with a symbol reference to a canary in the TLS block.
28033
28034@item -mpcrel
28035@itemx -mno-pcrel
28036@opindex mpcrel
28037@opindex mno-pcrel
28038Generate (do not generate) pc-relative addressing when the option
28039@option{-mcpu=future} is used.  The @option{-mpcrel} option requires
28040that the medium code model (@option{-mcmodel=medium}) and prefixed
28041addressing (@option{-mprefixed}) options are enabled.
28042
28043@item -mprefixed
28044@itemx -mno-prefixed
28045@opindex mprefixed
28046@opindex mno-prefixed
28047Generate (do not generate) addressing modes using prefixed load and
28048store instructions when the option @option{-mcpu=future} is used.
28049
28050@item -mmma
28051@itemx -mno-mma
28052@opindex mmma
28053@opindex mno-mma
28054Generate (do not generate) the MMA instructions when the option
28055@option{-mcpu=future} is used.
28056
28057@item -mrop-protect
28058@itemx -mno-rop-protect
28059@opindex mrop-protect
28060@opindex mno-rop-protect
28061Generate (do not generate) ROP protection instructions when the target
28062processor supports them.  Currently this option disables the shrink-wrap
28063optimization (@option{-fshrink-wrap}).
28064
28065@item -mprivileged
28066@itemx -mno-privileged
28067@opindex mprivileged
28068@opindex mno-privileged
28069Generate (do not generate) code that will run in privileged state.
28070
28071@item -mblock-ops-unaligned-vsx
28072@itemx -mno-block-ops-unaligned-vsx
28073@opindex block-ops-unaligned-vsx
28074@opindex no-block-ops-unaligned-vsx
28075Generate (do not generate) unaligned vsx loads and stores for
28076inline expansion of @code{memcpy} and @code{memmove}.
28077@end table
28078
28079@node RX Options
28080@subsection RX Options
28081@cindex RX Options
28082
28083These command-line options are defined for RX targets:
28084
28085@table @gcctabopt
28086@item -m64bit-doubles
28087@itemx -m32bit-doubles
28088@opindex m64bit-doubles
28089@opindex m32bit-doubles
28090Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
28091or 32 bits (@option{-m32bit-doubles}) in size.  The default is
28092@option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
28093works on 32-bit values, which is why the default is
28094@option{-m32bit-doubles}.
28095
28096@item -fpu
28097@itemx -nofpu
28098@opindex fpu
28099@opindex nofpu
28100Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
28101floating-point hardware.  The default is enabled for the RX600
28102series and disabled for the RX200 series.
28103
28104Floating-point instructions are only generated for 32-bit floating-point
28105values, however, so the FPU hardware is not used for doubles if the
28106@option{-m64bit-doubles} option is used.
28107
28108@emph{Note} If the @option{-fpu} option is enabled then
28109@option{-funsafe-math-optimizations} is also enabled automatically.
28110This is because the RX FPU instructions are themselves unsafe.
28111
28112@item -mcpu=@var{name}
28113@opindex mcpu
28114Selects the type of RX CPU to be targeted.  Currently three types are
28115supported, the generic @samp{RX600} and @samp{RX200} series hardware and
28116the specific @samp{RX610} CPU.  The default is @samp{RX600}.
28117
28118The only difference between @samp{RX600} and @samp{RX610} is that the
28119@samp{RX610} does not support the @code{MVTIPL} instruction.
28120
28121The @samp{RX200} series does not have a hardware floating-point unit
28122and so @option{-nofpu} is enabled by default when this type is
28123selected.
28124
28125@item -mbig-endian-data
28126@itemx -mlittle-endian-data
28127@opindex mbig-endian-data
28128@opindex mlittle-endian-data
28129Store data (but not code) in the big-endian format.  The default is
28130@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
28131format.
28132
28133@item -msmall-data-limit=@var{N}
28134@opindex msmall-data-limit
28135Specifies the maximum size in bytes of global and static variables
28136which can be placed into the small data area.  Using the small data
28137area can lead to smaller and faster code, but the size of area is
28138limited and it is up to the programmer to ensure that the area does
28139not overflow.  Also when the small data area is used one of the RX's
28140registers (usually @code{r13}) is reserved for use pointing to this
28141area, so it is no longer available for use by the compiler.  This
28142could result in slower and/or larger code if variables are pushed onto
28143the stack instead of being held in this register.
28144
28145Note, common variables (variables that have not been initialized) and
28146constants are not placed into the small data area as they are assigned
28147to other sections in the output executable.
28148
28149The default value is zero, which disables this feature.  Note, this
28150feature is not enabled by default with higher optimization levels
28151(@option{-O2} etc) because of the potentially detrimental effects of
28152reserving a register.  It is up to the programmer to experiment and
28153discover whether this feature is of benefit to their program.  See the
28154description of the @option{-mpid} option for a description of how the
28155actual register to hold the small data area pointer is chosen.
28156
28157@item -msim
28158@itemx -mno-sim
28159@opindex msim
28160@opindex mno-sim
28161Use the simulator runtime.  The default is to use the libgloss
28162board-specific runtime.
28163
28164@item -mas100-syntax
28165@itemx -mno-as100-syntax
28166@opindex mas100-syntax
28167@opindex mno-as100-syntax
28168When generating assembler output use a syntax that is compatible with
28169Renesas's AS100 assembler.  This syntax can also be handled by the GAS
28170assembler, but it has some restrictions so it is not generated by default.
28171
28172@item -mmax-constant-size=@var{N}
28173@opindex mmax-constant-size
28174Specifies the maximum size, in bytes, of a constant that can be used as
28175an operand in a RX instruction.  Although the RX instruction set does
28176allow constants of up to 4 bytes in length to be used in instructions,
28177a longer value equates to a longer instruction.  Thus in some
28178circumstances it can be beneficial to restrict the size of constants
28179that are used in instructions.  Constants that are too big are instead
28180placed into a constant pool and referenced via register indirection.
28181
28182The value @var{N} can be between 0 and 4.  A value of 0 (the default)
28183or 4 means that constants of any size are allowed.
28184
28185@item -mrelax
28186@opindex mrelax
28187Enable linker relaxation.  Linker relaxation is a process whereby the
28188linker attempts to reduce the size of a program by finding shorter
28189versions of various instructions.  Disabled by default.
28190
28191@item -mint-register=@var{N}
28192@opindex mint-register
28193Specify the number of registers to reserve for fast interrupt handler
28194functions.  The value @var{N} can be between 0 and 4.  A value of 1
28195means that register @code{r13} is reserved for the exclusive use
28196of fast interrupt handlers.  A value of 2 reserves @code{r13} and
28197@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
28198@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
28199A value of 0, the default, does not reserve any registers.
28200
28201@item -msave-acc-in-interrupts
28202@opindex msave-acc-in-interrupts
28203Specifies that interrupt handler functions should preserve the
28204accumulator register.  This is only necessary if normal code might use
28205the accumulator register, for example because it performs 64-bit
28206multiplications.  The default is to ignore the accumulator as this
28207makes the interrupt handlers faster.
28208
28209@item -mpid
28210@itemx -mno-pid
28211@opindex mpid
28212@opindex mno-pid
28213Enables the generation of position independent data.  When enabled any
28214access to constant data is done via an offset from a base address
28215held in a register.  This allows the location of constant data to be
28216determined at run time without requiring the executable to be
28217relocated, which is a benefit to embedded applications with tight
28218memory constraints.  Data that can be modified is not affected by this
28219option.
28220
28221Note, using this feature reserves a register, usually @code{r13}, for
28222the constant data base address.  This can result in slower and/or
28223larger code, especially in complicated functions.
28224
28225The actual register chosen to hold the constant data base address
28226depends upon whether the @option{-msmall-data-limit} and/or the
28227@option{-mint-register} command-line options are enabled.  Starting
28228with register @code{r13} and proceeding downwards, registers are
28229allocated first to satisfy the requirements of @option{-mint-register},
28230then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
28231is possible for the small data area register to be @code{r8} if both
28232@option{-mint-register=4} and @option{-mpid} are specified on the
28233command line.
28234
28235By default this feature is not enabled.  The default can be restored
28236via the @option{-mno-pid} command-line option.
28237
28238@item -mno-warn-multiple-fast-interrupts
28239@itemx -mwarn-multiple-fast-interrupts
28240@opindex mno-warn-multiple-fast-interrupts
28241@opindex mwarn-multiple-fast-interrupts
28242Prevents GCC from issuing a warning message if it finds more than one
28243fast interrupt handler when it is compiling a file.  The default is to
28244issue a warning for each extra fast interrupt handler found, as the RX
28245only supports one such interrupt.
28246
28247@item -mallow-string-insns
28248@itemx -mno-allow-string-insns
28249@opindex mallow-string-insns
28250@opindex mno-allow-string-insns
28251Enables or disables the use of the string manipulation instructions
28252@code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
28253@code{SWHILE} and also the @code{RMPA} instruction.  These
28254instructions may prefetch data, which is not safe to do if accessing
28255an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
28256for more information).
28257
28258The default is to allow these instructions, but it is not possible for
28259GCC to reliably detect all circumstances where a string instruction
28260might be used to access an I/O register, so their use cannot be
28261disabled automatically.  Instead it is reliant upon the programmer to
28262use the @option{-mno-allow-string-insns} option if their program
28263accesses I/O space.
28264
28265When the instructions are enabled GCC defines the C preprocessor
28266symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
28267symbol @code{__RX_DISALLOW_STRING_INSNS__}.
28268
28269@item -mjsr
28270@itemx -mno-jsr
28271@opindex mjsr
28272@opindex mno-jsr
28273Use only (or not only) @code{JSR} instructions to access functions.
28274This option can be used when code size exceeds the range of @code{BSR}
28275instructions.  Note that @option{-mno-jsr} does not mean to not use
28276@code{JSR} but instead means that any type of branch may be used.
28277@end table
28278
28279@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
28280has special significance to the RX port when used with the
28281@code{interrupt} function attribute.  This attribute indicates a
28282function intended to process fast interrupts.  GCC ensures
28283that it only uses the registers @code{r10}, @code{r11}, @code{r12}
28284and/or @code{r13} and only provided that the normal use of the
28285corresponding registers have been restricted via the
28286@option{-ffixed-@var{reg}} or @option{-mint-register} command-line
28287options.
28288
28289@node S/390 and zSeries Options
28290@subsection S/390 and zSeries Options
28291@cindex S/390 and zSeries Options
28292
28293These are the @samp{-m} options defined for the S/390 and zSeries architecture.
28294
28295@table @gcctabopt
28296@item -mhard-float
28297@itemx -msoft-float
28298@opindex mhard-float
28299@opindex msoft-float
28300Use (do not use) the hardware floating-point instructions and registers
28301for floating-point operations.  When @option{-msoft-float} is specified,
28302functions in @file{libgcc.a} are used to perform floating-point
28303operations.  When @option{-mhard-float} is specified, the compiler
28304generates IEEE floating-point instructions.  This is the default.
28305
28306@item -mhard-dfp
28307@itemx -mno-hard-dfp
28308@opindex mhard-dfp
28309@opindex mno-hard-dfp
28310Use (do not use) the hardware decimal-floating-point instructions for
28311decimal-floating-point operations.  When @option{-mno-hard-dfp} is
28312specified, functions in @file{libgcc.a} are used to perform
28313decimal-floating-point operations.  When @option{-mhard-dfp} is
28314specified, the compiler generates decimal-floating-point hardware
28315instructions.  This is the default for @option{-march=z9-ec} or higher.
28316
28317@item -mlong-double-64
28318@itemx -mlong-double-128
28319@opindex mlong-double-64
28320@opindex mlong-double-128
28321These switches control the size of @code{long double} type. A size
28322of 64 bits makes the @code{long double} type equivalent to the @code{double}
28323type. This is the default.
28324
28325@item -mbackchain
28326@itemx -mno-backchain
28327@opindex mbackchain
28328@opindex mno-backchain
28329Store (do not store) the address of the caller's frame as backchain pointer
28330into the callee's stack frame.
28331A backchain may be needed to allow debugging using tools that do not understand
28332DWARF call frame information.
28333When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
28334at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
28335the backchain is placed into the topmost word of the 96/160 byte register
28336save area.
28337
28338In general, code compiled with @option{-mbackchain} is call-compatible with
28339code compiled with @option{-mno-backchain}; however, use of the backchain
28340for debugging purposes usually requires that the whole binary is built with
28341@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
28342@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
28343to build a linux kernel use @option{-msoft-float}.
28344
28345The default is to not maintain the backchain.
28346
28347@item -mpacked-stack
28348@itemx -mno-packed-stack
28349@opindex mpacked-stack
28350@opindex mno-packed-stack
28351Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
28352specified, the compiler uses the all fields of the 96/160 byte register save
28353area only for their default purpose; unused fields still take up stack space.
28354When @option{-mpacked-stack} is specified, register save slots are densely
28355packed at the top of the register save area; unused space is reused for other
28356purposes, allowing for more efficient use of the available stack space.
28357However, when @option{-mbackchain} is also in effect, the topmost word of
28358the save area is always used to store the backchain, and the return address
28359register is always saved two words below the backchain.
28360
28361As long as the stack frame backchain is not used, code generated with
28362@option{-mpacked-stack} is call-compatible with code generated with
28363@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
28364S/390 or zSeries generated code that uses the stack frame backchain at run
28365time, not just for debugging purposes.  Such code is not call-compatible
28366with code compiled with @option{-mpacked-stack}.  Also, note that the
28367combination of @option{-mbackchain},
28368@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
28369to build a linux kernel use @option{-msoft-float}.
28370
28371The default is to not use the packed stack layout.
28372
28373@item -msmall-exec
28374@itemx -mno-small-exec
28375@opindex msmall-exec
28376@opindex mno-small-exec
28377Generate (or do not generate) code using the @code{bras} instruction
28378to do subroutine calls.
28379This only works reliably if the total executable size does not
28380exceed 64k.  The default is to use the @code{basr} instruction instead,
28381which does not have this limitation.
28382
28383@item -m64
28384@itemx -m31
28385@opindex m64
28386@opindex m31
28387When @option{-m31} is specified, generate code compliant to the
28388GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
28389code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
28390particular to generate 64-bit instructions.  For the @samp{s390}
28391targets, the default is @option{-m31}, while the @samp{s390x}
28392targets default to @option{-m64}.
28393
28394@item -mzarch
28395@itemx -mesa
28396@opindex mzarch
28397@opindex mesa
28398When @option{-mzarch} is specified, generate code using the
28399instructions available on z/Architecture.
28400When @option{-mesa} is specified, generate code using the
28401instructions available on ESA/390.  Note that @option{-mesa} is
28402not possible with @option{-m64}.
28403When generating code compliant to the GNU/Linux for S/390 ABI,
28404the default is @option{-mesa}.  When generating code compliant
28405to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
28406
28407@item -mhtm
28408@itemx -mno-htm
28409@opindex mhtm
28410@opindex mno-htm
28411The @option{-mhtm} option enables a set of builtins making use of
28412instructions available with the transactional execution facility
28413introduced with the IBM zEnterprise EC12 machine generation
28414@ref{S/390 System z Built-in Functions}.
28415@option{-mhtm} is enabled by default when using @option{-march=zEC12}.
28416
28417@item -mvx
28418@itemx -mno-vx
28419@opindex mvx
28420@opindex mno-vx
28421When @option{-mvx} is specified, generate code using the instructions
28422available with the vector extension facility introduced with the IBM
28423z13 machine generation.
28424This option changes the ABI for some vector type values with regard to
28425alignment and calling conventions.  In case vector type values are
28426being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
28427command will be added to mark the resulting binary with the ABI used.
28428@option{-mvx} is enabled by default when using @option{-march=z13}.
28429
28430@item -mzvector
28431@itemx -mno-zvector
28432@opindex mzvector
28433@opindex mno-zvector
28434The @option{-mzvector} option enables vector language extensions and
28435builtins using instructions available with the vector extension
28436facility introduced with the IBM z13 machine generation.
28437This option adds support for @samp{vector} to be used as a keyword to
28438define vector type variables and arguments.  @samp{vector} is only
28439available when GNU extensions are enabled.  It will not be expanded
28440when requesting strict standard compliance e.g.@: with @option{-std=c99}.
28441In addition to the GCC low-level builtins @option{-mzvector} enables
28442a set of builtins added for compatibility with AltiVec-style
28443implementations like Power and Cell.  In order to make use of these
28444builtins the header file @file{vecintrin.h} needs to be included.
28445@option{-mzvector} is disabled by default.
28446
28447@item -mmvcle
28448@itemx -mno-mvcle
28449@opindex mmvcle
28450@opindex mno-mvcle
28451Generate (or do not generate) code using the @code{mvcle} instruction
28452to perform block moves.  When @option{-mno-mvcle} is specified,
28453use a @code{mvc} loop instead.  This is the default unless optimizing for
28454size.
28455
28456@item -mdebug
28457@itemx -mno-debug
28458@opindex mdebug
28459@opindex mno-debug
28460Print (or do not print) additional debug information when compiling.
28461The default is to not print debug information.
28462
28463@item -march=@var{cpu-type}
28464@opindex march
28465Generate code that runs on @var{cpu-type}, which is the name of a
28466system representing a certain processor type.  Possible values for
28467@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
28468@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
28469@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
28470@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
28471
28472The default is @option{-march=z900}.
28473
28474Specifying @samp{native} as cpu type can be used to select the best
28475architecture option for the host processor.
28476@option{-march=native} has no effect if GCC does not recognize the
28477processor.
28478
28479@item -mtune=@var{cpu-type}
28480@opindex mtune
28481Tune to @var{cpu-type} everything applicable about the generated code,
28482except for the ABI and the set of available instructions.
28483The list of @var{cpu-type} values is the same as for @option{-march}.
28484The default is the value used for @option{-march}.
28485
28486@item -mtpf-trace
28487@itemx -mno-tpf-trace
28488@opindex mtpf-trace
28489@opindex mno-tpf-trace
28490Generate code that adds (does not add) in TPF OS specific branches to trace
28491routines in the operating system.  This option is off by default, even
28492when compiling for the TPF OS@.
28493
28494@item -mtpf-trace-skip
28495@itemx -mno-tpf-trace-skip
28496@opindex mtpf-trace-skip
28497@opindex mno-tpf-trace-skip
28498Generate code that changes (does not change) the default branch
28499targets enabled by @option{-mtpf-trace} to point to specialized trace
28500routines providing the ability of selectively skipping function trace
28501entries for the TPF OS.  This option is off by default, even when
28502compiling for the TPF OS and specifying @option{-mtpf-trace}.
28503
28504@item -mfused-madd
28505@itemx -mno-fused-madd
28506@opindex mfused-madd
28507@opindex mno-fused-madd
28508Generate code that uses (does not use) the floating-point multiply and
28509accumulate instructions.  These instructions are generated by default if
28510hardware floating point is used.
28511
28512@item -mwarn-framesize=@var{framesize}
28513@opindex mwarn-framesize
28514Emit a warning if the current function exceeds the given frame size.  Because
28515this is a compile-time check it doesn't need to be a real problem when the program
28516runs.  It is intended to identify functions that most probably cause
28517a stack overflow.  It is useful to be used in an environment with limited stack
28518size e.g.@: the linux kernel.
28519
28520@item -mwarn-dynamicstack
28521@opindex mwarn-dynamicstack
28522Emit a warning if the function calls @code{alloca} or uses dynamically-sized
28523arrays.  This is generally a bad idea with a limited stack size.
28524
28525@item -mstack-guard=@var{stack-guard}
28526@itemx -mstack-size=@var{stack-size}
28527@opindex mstack-guard
28528@opindex mstack-size
28529If these options are provided the S/390 back end emits additional instructions in
28530the function prologue that trigger a trap if the stack size is @var{stack-guard}
28531bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
28532If the @var{stack-guard} option is omitted the smallest power of 2 larger than
28533the frame size of the compiled function is chosen.
28534These options are intended to be used to help debugging stack overflow problems.
28535The additionally emitted code causes only little overhead and hence can also be
28536used in production-like systems without greater performance degradation.  The given
28537values have to be exact powers of 2 and @var{stack-size} has to be greater than
28538@var{stack-guard} without exceeding 64k.
28539In order to be efficient the extra code makes the assumption that the stack starts
28540at an address aligned to the value given by @var{stack-size}.
28541The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
28542
28543@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
28544@opindex mhotpatch
28545If the hotpatch option is enabled, a ``hot-patching'' function
28546prologue is generated for all functions in the compilation unit.
28547The funtion label is prepended with the given number of two-byte
28548NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
28549the label, 2 * @var{post-halfwords} bytes are appended, using the
28550largest NOP like instructions the architecture allows (maximum
285511000000).
28552
28553If both arguments are zero, hotpatching is disabled.
28554
28555This option can be overridden for individual functions with the
28556@code{hotpatch} attribute.
28557@end table
28558
28559@node Score Options
28560@subsection Score Options
28561@cindex Score Options
28562
28563These options are defined for Score implementations:
28564
28565@table @gcctabopt
28566@item -meb
28567@opindex meb
28568Compile code for big-endian mode.  This is the default.
28569
28570@item -mel
28571@opindex mel
28572Compile code for little-endian mode.
28573
28574@item -mnhwloop
28575@opindex mnhwloop
28576Disable generation of @code{bcnz} instructions.
28577
28578@item -muls
28579@opindex muls
28580Enable generation of unaligned load and store instructions.
28581
28582@item -mmac
28583@opindex mmac
28584Enable the use of multiply-accumulate instructions. Disabled by default.
28585
28586@item -mscore5
28587@opindex mscore5
28588Specify the SCORE5 as the target architecture.
28589
28590@item -mscore5u
28591@opindex mscore5u
28592Specify the SCORE5U of the target architecture.
28593
28594@item -mscore7
28595@opindex mscore7
28596Specify the SCORE7 as the target architecture. This is the default.
28597
28598@item -mscore7d
28599@opindex mscore7d
28600Specify the SCORE7D as the target architecture.
28601@end table
28602
28603@node SH Options
28604@subsection SH Options
28605
28606These @samp{-m} options are defined for the SH implementations:
28607
28608@table @gcctabopt
28609@item -m1
28610@opindex m1
28611Generate code for the SH1.
28612
28613@item -m2
28614@opindex m2
28615Generate code for the SH2.
28616
28617@item -m2e
28618Generate code for the SH2e.
28619
28620@item -m2a-nofpu
28621@opindex m2a-nofpu
28622Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
28623that the floating-point unit is not used.
28624
28625@item -m2a-single-only
28626@opindex m2a-single-only
28627Generate code for the SH2a-FPU, in such a way that no double-precision
28628floating-point operations are used.
28629
28630@item -m2a-single
28631@opindex m2a-single
28632Generate code for the SH2a-FPU assuming the floating-point unit is in
28633single-precision mode by default.
28634
28635@item -m2a
28636@opindex m2a
28637Generate code for the SH2a-FPU assuming the floating-point unit is in
28638double-precision mode by default.
28639
28640@item -m3
28641@opindex m3
28642Generate code for the SH3.
28643
28644@item -m3e
28645@opindex m3e
28646Generate code for the SH3e.
28647
28648@item -m4-nofpu
28649@opindex m4-nofpu
28650Generate code for the SH4 without a floating-point unit.
28651
28652@item -m4-single-only
28653@opindex m4-single-only
28654Generate code for the SH4 with a floating-point unit that only
28655supports single-precision arithmetic.
28656
28657@item -m4-single
28658@opindex m4-single
28659Generate code for the SH4 assuming the floating-point unit is in
28660single-precision mode by default.
28661
28662@item -m4
28663@opindex m4
28664Generate code for the SH4.
28665
28666@item -m4-100
28667@opindex m4-100
28668Generate code for SH4-100.
28669
28670@item -m4-100-nofpu
28671@opindex m4-100-nofpu
28672Generate code for SH4-100 in such a way that the
28673floating-point unit is not used.
28674
28675@item -m4-100-single
28676@opindex m4-100-single
28677Generate code for SH4-100 assuming the floating-point unit is in
28678single-precision mode by default.
28679
28680@item -m4-100-single-only
28681@opindex m4-100-single-only
28682Generate code for SH4-100 in such a way that no double-precision
28683floating-point operations are used.
28684
28685@item -m4-200
28686@opindex m4-200
28687Generate code for SH4-200.
28688
28689@item -m4-200-nofpu
28690@opindex m4-200-nofpu
28691Generate code for SH4-200 without in such a way that the
28692floating-point unit is not used.
28693
28694@item -m4-200-single
28695@opindex m4-200-single
28696Generate code for SH4-200 assuming the floating-point unit is in
28697single-precision mode by default.
28698
28699@item -m4-200-single-only
28700@opindex m4-200-single-only
28701Generate code for SH4-200 in such a way that no double-precision
28702floating-point operations are used.
28703
28704@item -m4-300
28705@opindex m4-300
28706Generate code for SH4-300.
28707
28708@item -m4-300-nofpu
28709@opindex m4-300-nofpu
28710Generate code for SH4-300 without in such a way that the
28711floating-point unit is not used.
28712
28713@item -m4-300-single
28714@opindex m4-300-single
28715Generate code for SH4-300 in such a way that no double-precision
28716floating-point operations are used.
28717
28718@item -m4-300-single-only
28719@opindex m4-300-single-only
28720Generate code for SH4-300 in such a way that no double-precision
28721floating-point operations are used.
28722
28723@item -m4-340
28724@opindex m4-340
28725Generate code for SH4-340 (no MMU, no FPU).
28726
28727@item -m4-500
28728@opindex m4-500
28729Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
28730assembler.
28731
28732@item -m4a-nofpu
28733@opindex m4a-nofpu
28734Generate code for the SH4al-dsp, or for a SH4a in such a way that the
28735floating-point unit is not used.
28736
28737@item -m4a-single-only
28738@opindex m4a-single-only
28739Generate code for the SH4a, in such a way that no double-precision
28740floating-point operations are used.
28741
28742@item -m4a-single
28743@opindex m4a-single
28744Generate code for the SH4a assuming the floating-point unit is in
28745single-precision mode by default.
28746
28747@item -m4a
28748@opindex m4a
28749Generate code for the SH4a.
28750
28751@item -m4al
28752@opindex m4al
28753Same as @option{-m4a-nofpu}, except that it implicitly passes
28754@option{-dsp} to the assembler.  GCC doesn't generate any DSP
28755instructions at the moment.
28756
28757@item -mb
28758@opindex mb
28759Compile code for the processor in big-endian mode.
28760
28761@item -ml
28762@opindex ml
28763Compile code for the processor in little-endian mode.
28764
28765@item -mdalign
28766@opindex mdalign
28767Align doubles at 64-bit boundaries.  Note that this changes the calling
28768conventions, and thus some functions from the standard C library do
28769not work unless you recompile it first with @option{-mdalign}.
28770
28771@item -mrelax
28772@opindex mrelax
28773Shorten some address references at link time, when possible; uses the
28774linker option @option{-relax}.
28775
28776@item -mbigtable
28777@opindex mbigtable
28778Use 32-bit offsets in @code{switch} tables.  The default is to use
2877916-bit offsets.
28780
28781@item -mbitops
28782@opindex mbitops
28783Enable the use of bit manipulation instructions on SH2A.
28784
28785@item -mfmovd
28786@opindex mfmovd
28787Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
28788alignment constraints.
28789
28790@item -mrenesas
28791@opindex mrenesas
28792Comply with the calling conventions defined by Renesas.
28793
28794@item -mno-renesas
28795@opindex mno-renesas
28796Comply with the calling conventions defined for GCC before the Renesas
28797conventions were available.  This option is the default for all
28798targets of the SH toolchain.
28799
28800@item -mnomacsave
28801@opindex mnomacsave
28802Mark the @code{MAC} register as call-clobbered, even if
28803@option{-mrenesas} is given.
28804
28805@item -mieee
28806@itemx -mno-ieee
28807@opindex mieee
28808@opindex mno-ieee
28809Control the IEEE compliance of floating-point comparisons, which affects the
28810handling of cases where the result of a comparison is unordered.  By default
28811@option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
28812enabled @option{-mno-ieee} is implicitly set, which results in faster
28813floating-point greater-equal and less-equal comparisons.  The implicit settings
28814can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
28815
28816@item -minline-ic_invalidate
28817@opindex minline-ic_invalidate
28818Inline code to invalidate instruction cache entries after setting up
28819nested function trampolines.
28820This option has no effect if @option{-musermode} is in effect and the selected
28821code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
28822instruction.
28823If the selected code generation option does not allow the use of the @code{icbi}
28824instruction, and @option{-musermode} is not in effect, the inlined code
28825manipulates the instruction cache address array directly with an associative
28826write.  This not only requires privileged mode at run time, but it also
28827fails if the cache line had been mapped via the TLB and has become unmapped.
28828
28829@item -misize
28830@opindex misize
28831Dump instruction size and location in the assembly code.
28832
28833@item -mpadstruct
28834@opindex mpadstruct
28835This option is deprecated.  It pads structures to multiple of 4 bytes,
28836which is incompatible with the SH ABI@.
28837
28838@item -matomic-model=@var{model}
28839@opindex matomic-model=@var{model}
28840Sets the model of atomic operations and additional parameters as a comma
28841separated list.  For details on the atomic built-in functions see
28842@ref{__atomic Builtins}.  The following models and parameters are supported:
28843
28844@table @samp
28845
28846@item none
28847Disable compiler generated atomic sequences and emit library calls for atomic
28848operations.  This is the default if the target is not @code{sh*-*-linux*}.
28849
28850@item soft-gusa
28851Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
28852built-in functions.  The generated atomic sequences require additional support
28853from the interrupt/exception handling code of the system and are only suitable
28854for SH3* and SH4* single-core systems.  This option is enabled by default when
28855the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
28856this option also partially utilizes the hardware atomic instructions
28857@code{movli.l} and @code{movco.l} to create more efficient code, unless
28858@samp{strict} is specified.
28859
28860@item soft-tcb
28861Generate software atomic sequences that use a variable in the thread control
28862block.  This is a variation of the gUSA sequences which can also be used on
28863SH1* and SH2* targets.  The generated atomic sequences require additional
28864support from the interrupt/exception handling code of the system and are only
28865suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
28866parameter has to be specified as well.
28867
28868@item soft-imask
28869Generate software atomic sequences that temporarily disable interrupts by
28870setting @code{SR.IMASK = 1111}.  This model works only when the program runs
28871in privileged mode and is only suitable for single-core systems.  Additional
28872support from the interrupt/exception handling code of the system is not
28873required.  This model is enabled by default when the target is
28874@code{sh*-*-linux*} and SH1* or SH2*.
28875
28876@item hard-llcs
28877Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
28878instructions only.  This is only available on SH4A and is suitable for
28879multi-core systems.  Since the hardware instructions support only 32 bit atomic
28880variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
28881Code compiled with this option is also compatible with other software
28882atomic model interrupt/exception handling systems if executed on an SH4A
28883system.  Additional support from the interrupt/exception handling code of the
28884system is not required for this model.
28885
28886@item gbr-offset=
28887This parameter specifies the offset in bytes of the variable in the thread
28888control block structure that should be used by the generated atomic sequences
28889when the @samp{soft-tcb} model has been selected.  For other models this
28890parameter is ignored.  The specified value must be an integer multiple of four
28891and in the range 0-1020.
28892
28893@item strict
28894This parameter prevents mixed usage of multiple atomic models, even if they
28895are compatible, and makes the compiler generate atomic sequences of the
28896specified model only.
28897
28898@end table
28899
28900@item -mtas
28901@opindex mtas
28902Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
28903Notice that depending on the particular hardware and software configuration
28904this can degrade overall performance due to the operand cache line flushes
28905that are implied by the @code{tas.b} instruction.  On multi-core SH4A
28906processors the @code{tas.b} instruction must be used with caution since it
28907can result in data corruption for certain cache configurations.
28908
28909@item -mprefergot
28910@opindex mprefergot
28911When generating position-independent code, emit function calls using
28912the Global Offset Table instead of the Procedure Linkage Table.
28913
28914@item -musermode
28915@itemx -mno-usermode
28916@opindex musermode
28917@opindex mno-usermode
28918Don't allow (allow) the compiler generating privileged mode code.  Specifying
28919@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
28920inlined code would not work in user mode.  @option{-musermode} is the default
28921when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
28922@option{-musermode} has no effect, since there is no user mode.
28923
28924@item -multcost=@var{number}
28925@opindex multcost=@var{number}
28926Set the cost to assume for a multiply insn.
28927
28928@item -mdiv=@var{strategy}
28929@opindex mdiv=@var{strategy}
28930Set the division strategy to be used for integer division operations.
28931@var{strategy} can be one of:
28932
28933@table @samp
28934
28935@item call-div1
28936Calls a library function that uses the single-step division instruction
28937@code{div1} to perform the operation.  Division by zero calculates an
28938unspecified result and does not trap.  This is the default except for SH4,
28939SH2A and SHcompact.
28940
28941@item call-fp
28942Calls a library function that performs the operation in double precision
28943floating point.  Division by zero causes a floating-point exception.  This is
28944the default for SHcompact with FPU.  Specifying this for targets that do not
28945have a double precision FPU defaults to @code{call-div1}.
28946
28947@item call-table
28948Calls a library function that uses a lookup table for small divisors and
28949the @code{div1} instruction with case distinction for larger divisors.  Division
28950by zero calculates an unspecified result and does not trap.  This is the default
28951for SH4.  Specifying this for targets that do not have dynamic shift
28952instructions defaults to @code{call-div1}.
28953
28954@end table
28955
28956When a division strategy has not been specified the default strategy is
28957selected based on the current target.  For SH2A the default strategy is to
28958use the @code{divs} and @code{divu} instructions instead of library function
28959calls.
28960
28961@item -maccumulate-outgoing-args
28962@opindex maccumulate-outgoing-args
28963Reserve space once for outgoing arguments in the function prologue rather
28964than around each call.  Generally beneficial for performance and size.  Also
28965needed for unwinding to avoid changing the stack frame around conditional code.
28966
28967@item -mdivsi3_libfunc=@var{name}
28968@opindex mdivsi3_libfunc=@var{name}
28969Set the name of the library function used for 32-bit signed division to
28970@var{name}.
28971This only affects the name used in the @samp{call} division strategies, and
28972the compiler still expects the same sets of input/output/clobbered registers as
28973if this option were not present.
28974
28975@item -mfixed-range=@var{register-range}
28976@opindex mfixed-range
28977Generate code treating the given register range as fixed registers.
28978A fixed register is one that the register allocator cannot use.  This is
28979useful when compiling kernel code.  A register range is specified as
28980two registers separated by a dash.  Multiple register ranges can be
28981specified separated by a comma.
28982
28983@item -mbranch-cost=@var{num}
28984@opindex mbranch-cost=@var{num}
28985Assume @var{num} to be the cost for a branch instruction.  Higher numbers
28986make the compiler try to generate more branch-free code if possible.
28987If not specified the value is selected depending on the processor type that
28988is being compiled for.
28989
28990@item -mzdcbranch
28991@itemx -mno-zdcbranch
28992@opindex mzdcbranch
28993@opindex mno-zdcbranch
28994Assume (do not assume) that zero displacement conditional branch instructions
28995@code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
28996compiler prefers zero displacement branch code sequences.  This is
28997enabled by default when generating code for SH4 and SH4A.  It can be explicitly
28998disabled by specifying @option{-mno-zdcbranch}.
28999
29000@item -mcbranch-force-delay-slot
29001@opindex mcbranch-force-delay-slot
29002Force the usage of delay slots for conditional branches, which stuffs the delay
29003slot with a @code{nop} if a suitable instruction cannot be found.  By default
29004this option is disabled.  It can be enabled to work around hardware bugs as
29005found in the original SH7055.
29006
29007@item -mfused-madd
29008@itemx -mno-fused-madd
29009@opindex mfused-madd
29010@opindex mno-fused-madd
29011Generate code that uses (does not use) the floating-point multiply and
29012accumulate instructions.  These instructions are generated by default
29013if hardware floating point is used.  The machine-dependent
29014@option{-mfused-madd} option is now mapped to the machine-independent
29015@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29016mapped to @option{-ffp-contract=off}.
29017
29018@item -mfsca
29019@itemx -mno-fsca
29020@opindex mfsca
29021@opindex mno-fsca
29022Allow or disallow the compiler to emit the @code{fsca} instruction for sine
29023and cosine approximations.  The option @option{-mfsca} must be used in
29024combination with @option{-funsafe-math-optimizations}.  It is enabled by default
29025when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
29026approximations even if @option{-funsafe-math-optimizations} is in effect.
29027
29028@item -mfsrra
29029@itemx -mno-fsrra
29030@opindex mfsrra
29031@opindex mno-fsrra
29032Allow or disallow the compiler to emit the @code{fsrra} instruction for
29033reciprocal square root approximations.  The option @option{-mfsrra} must be used
29034in combination with @option{-funsafe-math-optimizations} and
29035@option{-ffinite-math-only}.  It is enabled by default when generating code for
29036SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
29037even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
29038in effect.
29039
29040@item -mpretend-cmove
29041@opindex mpretend-cmove
29042Prefer zero-displacement conditional branches for conditional move instruction
29043patterns.  This can result in faster code on the SH4 processor.
29044
29045@item -mfdpic
29046@opindex fdpic
29047Generate code using the FDPIC ABI.
29048
29049@end table
29050
29051@node Solaris 2 Options
29052@subsection Solaris 2 Options
29053@cindex Solaris 2 options
29054
29055These @samp{-m} options are supported on Solaris 2:
29056
29057@table @gcctabopt
29058@item -mclear-hwcap
29059@opindex mclear-hwcap
29060@option{-mclear-hwcap} tells the compiler to remove the hardware
29061capabilities generated by the Solaris assembler.  This is only necessary
29062when object files use ISA extensions not supported by the current
29063machine, but check at runtime whether or not to use them.
29064
29065@item -mimpure-text
29066@opindex mimpure-text
29067@option{-mimpure-text}, used in addition to @option{-shared}, tells
29068the compiler to not pass @option{-z text} to the linker when linking a
29069shared object.  Using this option, you can link position-dependent
29070code into a shared object.
29071
29072@option{-mimpure-text} suppresses the ``relocations remain against
29073allocatable but non-writable sections'' linker error message.
29074However, the necessary relocations trigger copy-on-write, and the
29075shared object is not actually shared across processes.  Instead of
29076using @option{-mimpure-text}, you should compile all source code with
29077@option{-fpic} or @option{-fPIC}.
29078
29079@end table
29080
29081These switches are supported in addition to the above on Solaris 2:
29082
29083@table @gcctabopt
29084@item -pthreads
29085@opindex pthreads
29086This is a synonym for @option{-pthread}.
29087@end table
29088
29089@node SPARC Options
29090@subsection SPARC Options
29091@cindex SPARC options
29092
29093These @samp{-m} options are supported on the SPARC:
29094
29095@table @gcctabopt
29096@item -mno-app-regs
29097@itemx -mapp-regs
29098@opindex mno-app-regs
29099@opindex mapp-regs
29100Specify @option{-mapp-regs} to generate output using the global registers
291012 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
29102global register 1, each global register 2 through 4 is then treated as an
29103allocable register that is clobbered by function calls.  This is the default.
29104
29105To be fully SVR4 ABI-compliant at the cost of some performance loss,
29106specify @option{-mno-app-regs}.  You should compile libraries and system
29107software with this option.
29108
29109@item -mflat
29110@itemx -mno-flat
29111@opindex mflat
29112@opindex mno-flat
29113With @option{-mflat}, the compiler does not generate save/restore instructions
29114and uses a ``flat'' or single register window model.  This model is compatible
29115with the regular register window model.  The local registers and the input
29116registers (0--5) are still treated as ``call-saved'' registers and are
29117saved on the stack as needed.
29118
29119With @option{-mno-flat} (the default), the compiler generates save/restore
29120instructions (except for leaf functions).  This is the normal operating mode.
29121
29122@item -mfpu
29123@itemx -mhard-float
29124@opindex mfpu
29125@opindex mhard-float
29126Generate output containing floating-point instructions.  This is the
29127default.
29128
29129@item -mno-fpu
29130@itemx -msoft-float
29131@opindex mno-fpu
29132@opindex msoft-float
29133Generate output containing library calls for floating point.
29134@strong{Warning:} the requisite libraries are not available for all SPARC
29135targets.  Normally the facilities of the machine's usual C compiler are
29136used, but this cannot be done directly in cross-compilation.  You must make
29137your own arrangements to provide suitable library functions for
29138cross-compilation.  The embedded targets @samp{sparc-*-aout} and
29139@samp{sparclite-*-*} do provide software floating-point support.
29140
29141@option{-msoft-float} changes the calling convention in the output file;
29142therefore, it is only useful if you compile @emph{all} of a program with
29143this option.  In particular, you need to compile @file{libgcc.a}, the
29144library that comes with GCC, with @option{-msoft-float} in order for
29145this to work.
29146
29147@item -mhard-quad-float
29148@opindex mhard-quad-float
29149Generate output containing quad-word (long double) floating-point
29150instructions.
29151
29152@item -msoft-quad-float
29153@opindex msoft-quad-float
29154Generate output containing library calls for quad-word (long double)
29155floating-point instructions.  The functions called are those specified
29156in the SPARC ABI@.  This is the default.
29157
29158As of this writing, there are no SPARC implementations that have hardware
29159support for the quad-word floating-point instructions.  They all invoke
29160a trap handler for one of these instructions, and then the trap handler
29161emulates the effect of the instruction.  Because of the trap handler overhead,
29162this is much slower than calling the ABI library routines.  Thus the
29163@option{-msoft-quad-float} option is the default.
29164
29165@item -mno-unaligned-doubles
29166@itemx -munaligned-doubles
29167@opindex mno-unaligned-doubles
29168@opindex munaligned-doubles
29169Assume that doubles have 8-byte alignment.  This is the default.
29170
29171With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
29172alignment only if they are contained in another type, or if they have an
29173absolute address.  Otherwise, it assumes they have 4-byte alignment.
29174Specifying this option avoids some rare compatibility problems with code
29175generated by other compilers.  It is not the default because it results
29176in a performance loss, especially for floating-point code.
29177
29178@item -muser-mode
29179@itemx -mno-user-mode
29180@opindex muser-mode
29181@opindex mno-user-mode
29182Do not generate code that can only run in supervisor mode.  This is relevant
29183only for the @code{casa} instruction emitted for the LEON3 processor.  This
29184is the default.
29185
29186@item -mfaster-structs
29187@itemx -mno-faster-structs
29188@opindex mfaster-structs
29189@opindex mno-faster-structs
29190With @option{-mfaster-structs}, the compiler assumes that structures
29191should have 8-byte alignment.  This enables the use of pairs of
29192@code{ldd} and @code{std} instructions for copies in structure
29193assignment, in place of twice as many @code{ld} and @code{st} pairs.
29194However, the use of this changed alignment directly violates the SPARC
29195ABI@.  Thus, it's intended only for use on targets where the developer
29196acknowledges that their resulting code is not directly in line with
29197the rules of the ABI@.
29198
29199@item -mstd-struct-return
29200@itemx -mno-std-struct-return
29201@opindex mstd-struct-return
29202@opindex mno-std-struct-return
29203With @option{-mstd-struct-return}, the compiler generates checking code
29204in functions returning structures or unions to detect size mismatches
29205between the two sides of function calls, as per the 32-bit ABI@.
29206
29207The default is @option{-mno-std-struct-return}.  This option has no effect
29208in 64-bit mode.
29209
29210@item -mlra
29211@itemx -mno-lra
29212@opindex mlra
29213@opindex mno-lra
29214Enable Local Register Allocation.  This is the default for SPARC since GCC 7
29215so @option{-mno-lra} needs to be passed to get old Reload.
29216
29217@item -mcpu=@var{cpu_type}
29218@opindex mcpu
29219Set the instruction set, register set, and instruction scheduling parameters
29220for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
29221@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
29222@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
29223@samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
29224@samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
29225@samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
29226@samp{m8}.
29227
29228Native Solaris and GNU/Linux toolchains also support the value @samp{native},
29229which selects the best architecture option for the host processor.
29230@option{-mcpu=native} has no effect if GCC does not recognize
29231the processor.
29232
29233Default instruction scheduling parameters are used for values that select
29234an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
29235@samp{sparclite}, @samp{sparclet}, @samp{v9}.
29236
29237Here is a list of each supported architecture and their supported
29238implementations.
29239
29240@table @asis
29241@item v7
29242cypress, leon3v7
29243
29244@item v8
29245supersparc, hypersparc, leon, leon3, leon5
29246
29247@item sparclite
29248f930, f934, sparclite86x
29249
29250@item sparclet
29251tsc701
29252
29253@item v9
29254ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
29255niagara7, m8
29256@end table
29257
29258By default (unless configured otherwise), GCC generates code for the V7
29259variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
29260additionally optimizes it for the Cypress CY7C602 chip, as used in the
29261SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
29262SPARCStation 1, 2, IPX etc.
29263
29264With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
29265architecture.  The only difference from V7 code is that the compiler emits
29266the integer multiply and integer divide instructions which exist in SPARC-V8
29267but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
29268optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
292692000 series.
29270
29271With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
29272the SPARC architecture.  This adds the integer multiply, integer divide step
29273and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
29274With @option{-mcpu=f930}, the compiler additionally optimizes it for the
29275Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
29276@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
29277MB86934 chip, which is the more recent SPARClite with FPU@.
29278
29279With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
29280the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
29281integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
29282but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
29283optimizes it for the TEMIC SPARClet chip.
29284
29285With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
29286architecture.  This adds 64-bit integer and floating-point move instructions,
292873 additional floating-point condition code registers and conditional move
29288instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
29289optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
29290@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
29291Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
29292@option{-mcpu=niagara}, the compiler additionally optimizes it for
29293Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
29294additionally optimizes it for Sun UltraSPARC T2 chips. With
29295@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
29296UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
29297additionally optimizes it for Sun UltraSPARC T4 chips.  With
29298@option{-mcpu=niagara7}, the compiler additionally optimizes it for
29299Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
29300additionally optimizes it for Oracle M8 chips.
29301
29302@item -mtune=@var{cpu_type}
29303@opindex mtune
29304Set the instruction scheduling parameters for machine type
29305@var{cpu_type}, but do not set the instruction set or register set that the
29306option @option{-mcpu=@var{cpu_type}} does.
29307
29308The same values for @option{-mcpu=@var{cpu_type}} can be used for
29309@option{-mtune=@var{cpu_type}}, but the only useful values are those
29310that select a particular CPU implementation.  Those are
29311@samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
29312@samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
29313@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
29314@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
29315@samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
29316and GNU/Linux toolchains, @samp{native} can also be used.
29317
29318@item -mv8plus
29319@itemx -mno-v8plus
29320@opindex mv8plus
29321@opindex mno-v8plus
29322With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
29323difference from the V8 ABI is that the global and out registers are
29324considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
29325mode for all SPARC-V9 processors.
29326
29327@item -mvis
29328@itemx -mno-vis
29329@opindex mvis
29330@opindex mno-vis
29331With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
29332Visual Instruction Set extensions.  The default is @option{-mno-vis}.
29333
29334@item -mvis2
29335@itemx -mno-vis2
29336@opindex mvis2
29337@opindex mno-vis2
29338With @option{-mvis2}, GCC generates code that takes advantage of
29339version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
29340default is @option{-mvis2} when targeting a cpu that supports such
29341instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
29342also sets @option{-mvis}.
29343
29344@item -mvis3
29345@itemx -mno-vis3
29346@opindex mvis3
29347@opindex mno-vis3
29348With @option{-mvis3}, GCC generates code that takes advantage of
29349version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
29350default is @option{-mvis3} when targeting a cpu that supports such
29351instructions, such as niagara-3 and later.  Setting @option{-mvis3}
29352also sets @option{-mvis2} and @option{-mvis}.
29353
29354@item -mvis4
29355@itemx -mno-vis4
29356@opindex mvis4
29357@opindex mno-vis4
29358With @option{-mvis4}, GCC generates code that takes advantage of
29359version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
29360default is @option{-mvis4} when targeting a cpu that supports such
29361instructions, such as niagara-7 and later.  Setting @option{-mvis4}
29362also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
29363
29364@item -mvis4b
29365@itemx -mno-vis4b
29366@opindex mvis4b
29367@opindex mno-vis4b
29368With @option{-mvis4b}, GCC generates code that takes advantage of
29369version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
29370the additional VIS instructions introduced in the Oracle SPARC
29371Architecture 2017.  The default is @option{-mvis4b} when targeting a
29372cpu that supports such instructions, such as m8 and later.  Setting
29373@option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
29374@option{-mvis2} and @option{-mvis}.
29375
29376@item -mcbcond
29377@itemx -mno-cbcond
29378@opindex mcbcond
29379@opindex mno-cbcond
29380With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
29381Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
29382when targeting a CPU that supports such instructions, such as Niagara-4 and
29383later.
29384
29385@item -mfmaf
29386@itemx -mno-fmaf
29387@opindex mfmaf
29388@opindex mno-fmaf
29389With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
29390Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
29391when targeting a CPU that supports such instructions, such as Niagara-3 and
29392later.
29393
29394@item -mfsmuld
29395@itemx -mno-fsmuld
29396@opindex mfsmuld
29397@opindex mno-fsmuld
29398With @option{-mfsmuld}, GCC generates code that takes advantage of the
29399Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
29400@option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
29401or V9 with FPU except @option{-mcpu=leon}.
29402
29403@item -mpopc
29404@itemx -mno-popc
29405@opindex mpopc
29406@opindex mno-popc
29407With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
29408Population Count instruction.  The default is @option{-mpopc}
29409when targeting a CPU that supports such an instruction, such as Niagara-2 and
29410later.
29411
29412@item -msubxc
29413@itemx -mno-subxc
29414@opindex msubxc
29415@opindex mno-subxc
29416With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
29417Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
29418when targeting a CPU that supports such an instruction, such as Niagara-7 and
29419later.
29420
29421@item -mfix-at697f
29422@opindex mfix-at697f
29423Enable the documented workaround for the single erratum of the Atmel AT697F
29424processor (which corresponds to erratum #13 of the AT697E processor).
29425
29426@item -mfix-ut699
29427@opindex mfix-ut699
29428Enable the documented workarounds for the floating-point errata and the data
29429cache nullify errata of the UT699 processor.
29430
29431@item -mfix-ut700
29432@opindex mfix-ut700
29433Enable the documented workaround for the back-to-back store errata of
29434the UT699E/UT700 processor.
29435
29436@item -mfix-gr712rc
29437@opindex mfix-gr712rc
29438Enable the documented workaround for the back-to-back store errata of
29439the GR712RC processor.
29440@end table
29441
29442These @samp{-m} options are supported in addition to the above
29443on SPARC-V9 processors in 64-bit environments:
29444
29445@table @gcctabopt
29446@item -m32
29447@itemx -m64
29448@opindex m32
29449@opindex m64
29450Generate code for a 32-bit or 64-bit environment.
29451The 32-bit environment sets int, long and pointer to 32 bits.
29452The 64-bit environment sets int to 32 bits and long and pointer
29453to 64 bits.
29454
29455@item -mcmodel=@var{which}
29456@opindex mcmodel
29457Set the code model to one of
29458
29459@table @samp
29460@item medlow
29461The Medium/Low code model: 64-bit addresses, programs
29462must be linked in the low 32 bits of memory.  Programs can be statically
29463or dynamically linked.
29464
29465@item medmid
29466The Medium/Middle code model: 64-bit addresses, programs
29467must be linked in the low 44 bits of memory, the text and data segments must
29468be less than 2GB in size and the data segment must be located within 2GB of
29469the text segment.
29470
29471@item medany
29472The Medium/Anywhere code model: 64-bit addresses, programs
29473may be linked anywhere in memory, the text and data segments must be less
29474than 2GB in size and the data segment must be located within 2GB of the
29475text segment.
29476
29477@item embmedany
29478The Medium/Anywhere code model for embedded systems:
2947964-bit addresses, the text and data segments must be less than 2GB in
29480size, both starting anywhere in memory (determined at link time).  The
29481global register %g4 points to the base of the data segment.  Programs
29482are statically linked and PIC is not supported.
29483@end table
29484
29485@item -mmemory-model=@var{mem-model}
29486@opindex mmemory-model
29487Set the memory model in force on the processor to one of
29488
29489@table @samp
29490@item default
29491The default memory model for the processor and operating system.
29492
29493@item rmo
29494Relaxed Memory Order
29495
29496@item pso
29497Partial Store Order
29498
29499@item tso
29500Total Store Order
29501
29502@item sc
29503Sequential Consistency
29504@end table
29505
29506These memory models are formally defined in Appendix D of the SPARC-V9
29507architecture manual, as set in the processor's @code{PSTATE.MM} field.
29508
29509@item -mstack-bias
29510@itemx -mno-stack-bias
29511@opindex mstack-bias
29512@opindex mno-stack-bias
29513With @option{-mstack-bias}, GCC assumes that the stack pointer, and
29514frame pointer if present, are offset by @minus{}2047 which must be added back
29515when making stack frame references.  This is the default in 64-bit mode.
29516Otherwise, assume no such offset is present.
29517@end table
29518
29519@node System V Options
29520@subsection Options for System V
29521
29522These additional options are available on System V Release 4 for
29523compatibility with other compilers on those systems:
29524
29525@table @gcctabopt
29526@item -G
29527@opindex G
29528Create a shared object.
29529It is recommended that @option{-symbolic} or @option{-shared} be used instead.
29530
29531@item -Qy
29532@opindex Qy
29533Identify the versions of each tool used by the compiler, in a
29534@code{.ident} assembler directive in the output.
29535
29536@item -Qn
29537@opindex Qn
29538Refrain from adding @code{.ident} directives to the output file (this is
29539the default).
29540
29541@item -YP,@var{dirs}
29542@opindex YP
29543Search the directories @var{dirs}, and no others, for libraries
29544specified with @option{-l}.
29545
29546@item -Ym,@var{dir}
29547@opindex Ym
29548Look in the directory @var{dir} to find the M4 preprocessor.
29549The assembler uses this option.
29550@c This is supposed to go with a -Yd for predefined M4 macro files, but
29551@c the generic assembler that comes with Solaris takes just -Ym.
29552@end table
29553
29554@node TILE-Gx Options
29555@subsection TILE-Gx Options
29556@cindex TILE-Gx options
29557
29558These @samp{-m} options are supported on the TILE-Gx:
29559
29560@table @gcctabopt
29561@item -mcmodel=small
29562@opindex mcmodel=small
29563Generate code for the small model.  The distance for direct calls is
29564limited to 500M in either direction.  PC-relative addresses are 32
29565bits.  Absolute addresses support the full address range.
29566
29567@item -mcmodel=large
29568@opindex mcmodel=large
29569Generate code for the large model.  There is no limitation on call
29570distance, pc-relative addresses, or absolute addresses.
29571
29572@item -mcpu=@var{name}
29573@opindex mcpu
29574Selects the type of CPU to be targeted.  Currently the only supported
29575type is @samp{tilegx}.
29576
29577@item -m32
29578@itemx -m64
29579@opindex m32
29580@opindex m64
29581Generate code for a 32-bit or 64-bit environment.  The 32-bit
29582environment sets int, long, and pointer to 32 bits.  The 64-bit
29583environment sets int to 32 bits and long and pointer to 64 bits.
29584
29585@item -mbig-endian
29586@itemx -mlittle-endian
29587@opindex mbig-endian
29588@opindex mlittle-endian
29589Generate code in big/little endian mode, respectively.
29590@end table
29591
29592@node TILEPro Options
29593@subsection TILEPro Options
29594@cindex TILEPro options
29595
29596These @samp{-m} options are supported on the TILEPro:
29597
29598@table @gcctabopt
29599@item -mcpu=@var{name}
29600@opindex mcpu
29601Selects the type of CPU to be targeted.  Currently the only supported
29602type is @samp{tilepro}.
29603
29604@item -m32
29605@opindex m32
29606Generate code for a 32-bit environment, which sets int, long, and
29607pointer to 32 bits.  This is the only supported behavior so the flag
29608is essentially ignored.
29609@end table
29610
29611@node V850 Options
29612@subsection V850 Options
29613@cindex V850 Options
29614
29615These @samp{-m} options are defined for V850 implementations:
29616
29617@table @gcctabopt
29618@item -mlong-calls
29619@itemx -mno-long-calls
29620@opindex mlong-calls
29621@opindex mno-long-calls
29622Treat all calls as being far away (near).  If calls are assumed to be
29623far away, the compiler always loads the function's address into a
29624register, and calls indirect through the pointer.
29625
29626@item -mno-ep
29627@itemx -mep
29628@opindex mno-ep
29629@opindex mep
29630Do not optimize (do optimize) basic blocks that use the same index
29631pointer 4 or more times to copy pointer into the @code{ep} register, and
29632use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
29633option is on by default if you optimize.
29634
29635@item -mno-prolog-function
29636@itemx -mprolog-function
29637@opindex mno-prolog-function
29638@opindex mprolog-function
29639Do not use (do use) external functions to save and restore registers
29640at the prologue and epilogue of a function.  The external functions
29641are slower, but use less code space if more than one function saves
29642the same number of registers.  The @option{-mprolog-function} option
29643is on by default if you optimize.
29644
29645@item -mspace
29646@opindex mspace
29647Try to make the code as small as possible.  At present, this just turns
29648on the @option{-mep} and @option{-mprolog-function} options.
29649
29650@item -mtda=@var{n}
29651@opindex mtda
29652Put static or global variables whose size is @var{n} bytes or less into
29653the tiny data area that register @code{ep} points to.  The tiny data
29654area can hold up to 256 bytes in total (128 bytes for byte references).
29655
29656@item -msda=@var{n}
29657@opindex msda
29658Put static or global variables whose size is @var{n} bytes or less into
29659the small data area that register @code{gp} points to.  The small data
29660area can hold up to 64 kilobytes.
29661
29662@item -mzda=@var{n}
29663@opindex mzda
29664Put static or global variables whose size is @var{n} bytes or less into
29665the first 32 kilobytes of memory.
29666
29667@item -mv850
29668@opindex mv850
29669Specify that the target processor is the V850.
29670
29671@item -mv850e3v5
29672@opindex mv850e3v5
29673Specify that the target processor is the V850E3V5.  The preprocessor
29674constant @code{__v850e3v5__} is defined if this option is used.
29675
29676@item -mv850e2v4
29677@opindex mv850e2v4
29678Specify that the target processor is the V850E3V5.  This is an alias for
29679the @option{-mv850e3v5} option.
29680
29681@item -mv850e2v3
29682@opindex mv850e2v3
29683Specify that the target processor is the V850E2V3.  The preprocessor
29684constant @code{__v850e2v3__} is defined if this option is used.
29685
29686@item -mv850e2
29687@opindex mv850e2
29688Specify that the target processor is the V850E2.  The preprocessor
29689constant @code{__v850e2__} is defined if this option is used.
29690
29691@item -mv850e1
29692@opindex mv850e1
29693Specify that the target processor is the V850E1.  The preprocessor
29694constants @code{__v850e1__} and @code{__v850e__} are defined if
29695this option is used.
29696
29697@item -mv850es
29698@opindex mv850es
29699Specify that the target processor is the V850ES.  This is an alias for
29700the @option{-mv850e1} option.
29701
29702@item -mv850e
29703@opindex mv850e
29704Specify that the target processor is the V850E@.  The preprocessor
29705constant @code{__v850e__} is defined if this option is used.
29706
29707If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
29708nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
29709are defined then a default target processor is chosen and the
29710relevant @samp{__v850*__} preprocessor constant is defined.
29711
29712The preprocessor constants @code{__v850} and @code{__v851__} are always
29713defined, regardless of which processor variant is the target.
29714
29715@item -mdisable-callt
29716@itemx -mno-disable-callt
29717@opindex mdisable-callt
29718@opindex mno-disable-callt
29719This option suppresses generation of the @code{CALLT} instruction for the
29720v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
29721architecture.
29722
29723This option is enabled by default when the RH850 ABI is
29724in use (see @option{-mrh850-abi}), and disabled by default when the
29725GCC ABI is in use.  If @code{CALLT} instructions are being generated
29726then the C preprocessor symbol @code{__V850_CALLT__} is defined.
29727
29728@item -mrelax
29729@itemx -mno-relax
29730@opindex mrelax
29731@opindex mno-relax
29732Pass on (or do not pass on) the @option{-mrelax} command-line option
29733to the assembler.
29734
29735@item -mlong-jumps
29736@itemx -mno-long-jumps
29737@opindex mlong-jumps
29738@opindex mno-long-jumps
29739Disable (or re-enable) the generation of PC-relative jump instructions.
29740
29741@item -msoft-float
29742@itemx -mhard-float
29743@opindex msoft-float
29744@opindex mhard-float
29745Disable (or re-enable) the generation of hardware floating point
29746instructions.  This option is only significant when the target
29747architecture is @samp{V850E2V3} or higher.  If hardware floating point
29748instructions are being generated then the C preprocessor symbol
29749@code{__FPU_OK__} is defined, otherwise the symbol
29750@code{__NO_FPU__} is defined.
29751
29752@item -mloop
29753@opindex mloop
29754Enables the use of the e3v5 LOOP instruction.  The use of this
29755instruction is not enabled by default when the e3v5 architecture is
29756selected because its use is still experimental.
29757
29758@item -mrh850-abi
29759@itemx -mghs
29760@opindex mrh850-abi
29761@opindex mghs
29762Enables support for the RH850 version of the V850 ABI.  This is the
29763default.  With this version of the ABI the following rules apply:
29764
29765@itemize
29766@item
29767Integer sized structures and unions are returned via a memory pointer
29768rather than a register.
29769
29770@item
29771Large structures and unions (more than 8 bytes in size) are passed by
29772value.
29773
29774@item
29775Functions are aligned to 16-bit boundaries.
29776
29777@item
29778The @option{-m8byte-align} command-line option is supported.
29779
29780@item
29781The @option{-mdisable-callt} command-line option is enabled by
29782default.  The @option{-mno-disable-callt} command-line option is not
29783supported.
29784@end itemize
29785
29786When this version of the ABI is enabled the C preprocessor symbol
29787@code{__V850_RH850_ABI__} is defined.
29788
29789@item -mgcc-abi
29790@opindex mgcc-abi
29791Enables support for the old GCC version of the V850 ABI.  With this
29792version of the ABI the following rules apply:
29793
29794@itemize
29795@item
29796Integer sized structures and unions are returned in register @code{r10}.
29797
29798@item
29799Large structures and unions (more than 8 bytes in size) are passed by
29800reference.
29801
29802@item
29803Functions are aligned to 32-bit boundaries, unless optimizing for
29804size.
29805
29806@item
29807The @option{-m8byte-align} command-line option is not supported.
29808
29809@item
29810The @option{-mdisable-callt} command-line option is supported but not
29811enabled by default.
29812@end itemize
29813
29814When this version of the ABI is enabled the C preprocessor symbol
29815@code{__V850_GCC_ABI__} is defined.
29816
29817@item -m8byte-align
29818@itemx -mno-8byte-align
29819@opindex m8byte-align
29820@opindex mno-8byte-align
29821Enables support for @code{double} and @code{long long} types to be
29822aligned on 8-byte boundaries.  The default is to restrict the
29823alignment of all objects to at most 4-bytes.  When
29824@option{-m8byte-align} is in effect the C preprocessor symbol
29825@code{__V850_8BYTE_ALIGN__} is defined.
29826
29827@item -mbig-switch
29828@opindex mbig-switch
29829Generate code suitable for big switch tables.  Use this option only if
29830the assembler/linker complain about out of range branches within a switch
29831table.
29832
29833@item -mapp-regs
29834@opindex mapp-regs
29835This option causes r2 and r5 to be used in the code generated by
29836the compiler.  This setting is the default.
29837
29838@item -mno-app-regs
29839@opindex mno-app-regs
29840This option causes r2 and r5 to be treated as fixed registers.
29841
29842@end table
29843
29844@node VAX Options
29845@subsection VAX Options
29846@cindex VAX options
29847
29848These @samp{-m} options are defined for the VAX:
29849
29850@table @gcctabopt
29851@item -munix
29852@opindex munix
29853Do not output certain jump instructions (@code{aobleq} and so on)
29854that the Unix assembler for the VAX cannot handle across long
29855ranges.
29856
29857@item -mgnu
29858@opindex mgnu
29859Do output those jump instructions, on the assumption that the
29860GNU assembler is being used.
29861
29862@item -mg
29863@opindex mg
29864Output code for G-format floating-point numbers instead of D-format.
29865@end table
29866
29867@node Visium Options
29868@subsection Visium Options
29869@cindex Visium options
29870
29871@table @gcctabopt
29872
29873@item -mdebug
29874@opindex mdebug
29875A program which performs file I/O and is destined to run on an MCM target
29876should be linked with this option.  It causes the libraries libc.a and
29877libdebug.a to be linked.  The program should be run on the target under
29878the control of the GDB remote debugging stub.
29879
29880@item -msim
29881@opindex msim
29882A program which performs file I/O and is destined to run on the simulator
29883should be linked with option.  This causes libraries libc.a and libsim.a to
29884be linked.
29885
29886@item -mfpu
29887@itemx -mhard-float
29888@opindex mfpu
29889@opindex mhard-float
29890Generate code containing floating-point instructions.  This is the
29891default.
29892
29893@item -mno-fpu
29894@itemx -msoft-float
29895@opindex mno-fpu
29896@opindex msoft-float
29897Generate code containing library calls for floating-point.
29898
29899@option{-msoft-float} changes the calling convention in the output file;
29900therefore, it is only useful if you compile @emph{all} of a program with
29901this option.  In particular, you need to compile @file{libgcc.a}, the
29902library that comes with GCC, with @option{-msoft-float} in order for
29903this to work.
29904
29905@item -mcpu=@var{cpu_type}
29906@opindex mcpu
29907Set the instruction set, register set, and instruction scheduling parameters
29908for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
29909@samp{mcm}, @samp{gr5} and @samp{gr6}.
29910
29911@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
29912
29913By default (unless configured otherwise), GCC generates code for the GR5
29914variant of the Visium architecture.
29915
29916With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
29917architecture.  The only difference from GR5 code is that the compiler will
29918generate block move instructions.
29919
29920@item -mtune=@var{cpu_type}
29921@opindex mtune
29922Set the instruction scheduling parameters for machine type @var{cpu_type},
29923but do not set the instruction set or register set that the option
29924@option{-mcpu=@var{cpu_type}} would.
29925
29926@item -msv-mode
29927@opindex msv-mode
29928Generate code for the supervisor mode, where there are no restrictions on
29929the access to general registers.  This is the default.
29930
29931@item -muser-mode
29932@opindex muser-mode
29933Generate code for the user mode, where the access to some general registers
29934is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
29935mode; on the GR6, only registers r29 to r31 are affected.
29936@end table
29937
29938@node VMS Options
29939@subsection VMS Options
29940
29941These @samp{-m} options are defined for the VMS implementations:
29942
29943@table @gcctabopt
29944@item -mvms-return-codes
29945@opindex mvms-return-codes
29946Return VMS condition codes from @code{main}. The default is to return POSIX-style
29947condition (e.g.@: error) codes.
29948
29949@item -mdebug-main=@var{prefix}
29950@opindex mdebug-main=@var{prefix}
29951Flag the first routine whose name starts with @var{prefix} as the main
29952routine for the debugger.
29953
29954@item -mmalloc64
29955@opindex mmalloc64
29956Default to 64-bit memory allocation routines.
29957
29958@item -mpointer-size=@var{size}
29959@opindex mpointer-size=@var{size}
29960Set the default size of pointers. Possible options for @var{size} are
29961@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
29962for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
29963The later option disables @code{pragma pointer_size}.
29964@end table
29965
29966@node VxWorks Options
29967@subsection VxWorks Options
29968@cindex VxWorks Options
29969
29970The options in this section are defined for all VxWorks targets.
29971Options specific to the target hardware are listed with the other
29972options for that target.
29973
29974@table @gcctabopt
29975@item -mrtp
29976@opindex mrtp
29977GCC can generate code for both VxWorks kernels and real time processes
29978(RTPs).  This option switches from the former to the latter.  It also
29979defines the preprocessor macro @code{__RTP__}.
29980
29981@item -non-static
29982@opindex non-static
29983Link an RTP executable against shared libraries rather than static
29984libraries.  The options @option{-static} and @option{-shared} can
29985also be used for RTPs (@pxref{Link Options}); @option{-static}
29986is the default.
29987
29988@item -Bstatic
29989@itemx -Bdynamic
29990@opindex Bstatic
29991@opindex Bdynamic
29992These options are passed down to the linker.  They are defined for
29993compatibility with Diab.
29994
29995@item -Xbind-lazy
29996@opindex Xbind-lazy
29997Enable lazy binding of function calls.  This option is equivalent to
29998@option{-Wl,-z,now} and is defined for compatibility with Diab.
29999
30000@item -Xbind-now
30001@opindex Xbind-now
30002Disable lazy binding of function calls.  This option is the default and
30003is defined for compatibility with Diab.
30004@end table
30005
30006@node x86 Options
30007@subsection x86 Options
30008@cindex x86 Options
30009
30010These @samp{-m} options are defined for the x86 family of computers.
30011
30012@table @gcctabopt
30013
30014@item -march=@var{cpu-type}
30015@opindex march
30016Generate instructions for the machine type @var{cpu-type}.  In contrast to
30017@option{-mtune=@var{cpu-type}}, which merely tunes the generated code
30018for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
30019to generate code that may not run at all on processors other than the one
30020indicated.  Specifying @option{-march=@var{cpu-type}} implies
30021@option{-mtune=@var{cpu-type}}, except where noted otherwise.
30022
30023The choices for @var{cpu-type} are:
30024
30025@table @samp
30026@item native
30027This selects the CPU to generate code for at compilation time by determining
30028the processor type of the compiling machine.  Using @option{-march=native}
30029enables all instruction subsets supported by the local machine (hence
30030the result might not run on different machines).  Using @option{-mtune=native}
30031produces code optimized for the local machine under the constraints
30032of the selected instruction set.
30033
30034@item x86-64
30035A generic CPU with 64-bit extensions.
30036
30037@item x86-64-v2
30038@itemx x86-64-v3
30039@itemx x86-64-v4
30040These choices for @var{cpu-type} select the corresponding
30041micro-architecture level from the x86-64 psABI.  On ABIs other than
30042the x86-64 psABI they select the same CPU features as the x86-64 psABI
30043documents for the particular micro-architecture level.
30044
30045Since these @var{cpu-type} values do not have a corresponding
30046@option{-mtune} setting, using @option{-march} with these values enables
30047generic tuning.  Specific tuning can be enabled using the
30048@option{-mtune=@var{other-cpu-type}} option with an appropriate
30049@var{other-cpu-type} value.
30050
30051@item i386
30052Original Intel i386 CPU@.
30053
30054@item i486
30055Intel i486 CPU@.  (No scheduling is implemented for this chip.)
30056
30057@item i586
30058@itemx pentium
30059Intel Pentium CPU with no MMX support.
30060
30061@item lakemont
30062Intel Lakemont MCU, based on Intel Pentium CPU.
30063
30064@item pentium-mmx
30065Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
30066
30067@item pentiumpro
30068Intel Pentium Pro CPU@.
30069
30070@item i686
30071When used with @option{-march}, the Pentium Pro
30072instruction set is used, so the code runs on all i686 family chips.
30073When used with @option{-mtune}, it has the same meaning as @samp{generic}.
30074
30075@item pentium2
30076Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
30077support.
30078
30079@item pentium3
30080@itemx pentium3m
30081Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
30082set support.
30083
30084@item pentium-m
30085Intel Pentium M; low-power version of Intel Pentium III CPU
30086with MMX, SSE and SSE2 instruction set support.  Used by Centrino notebooks.
30087
30088@item pentium4
30089@itemx pentium4m
30090Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
30091
30092@item prescott
30093Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
30094set support.
30095
30096@item nocona
30097Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
30098SSE2 and SSE3 instruction set support.
30099
30100@item core2
30101Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
30102instruction set support.
30103
30104@item nehalem
30105Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30106SSE4.1, SSE4.2 and POPCNT instruction set support.
30107
30108@item westmere
30109Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30110SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
30111
30112@item sandybridge
30113Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30114SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
30115
30116@item ivybridge
30117Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
30118SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
30119instruction set support.
30120
30121@item haswell
30122Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30123SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30124BMI, BMI2 and F16C instruction set support.
30125
30126@item broadwell
30127Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30128SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
30129F16C, RDSEED ADCX and PREFETCHW instruction set support.
30130
30131@item skylake
30132Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30133SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30134BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES
30135instruction set support.
30136
30137@item bonnell
30138Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
30139instruction set support.
30140
30141@item silvermont
30142Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30143SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
30144
30145@item goldmont
30146Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30147SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30148XSAVEOPT and FSGSBASE instruction set support.
30149
30150@item goldmont-plus
30151Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30152SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
30153XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
30154
30155@item tremont
30156Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30157SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30158XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30159MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
30160
30161@item knl
30162Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30163SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30164BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30165AVX512ER and AVX512CD instruction set support.
30166
30167@item knm
30168Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30169SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30170BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF,
30171AVX512ER, AVX512CD, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction
30172set support.
30173
30174@item skylake-avx512
30175Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30176SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
30177BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30178CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
30179
30180@item cannonlake
30181Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30182SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30183RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30184XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30185AVX512IFMA, SHA and UMIP instruction set support.
30186
30187@item icelake-client
30188Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30189SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30190RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30191XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30192AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30193AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30194
30195@item icelake-server
30196Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30197SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30198RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30199XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30200AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30201AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
30202set support.
30203
30204@item cascadelake
30205Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30206SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30207BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30208AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
30209
30210@item cooperlake
30211Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30212SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30213BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
30214AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
30215set support.
30216
30217@item tigerlake
30218Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30219SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
30220BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
30221AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
30222RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
30223VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
30224instruction set support.
30225
30226@item sapphirerapids
30227Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
30228SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
30229FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
30230AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
30231MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
30232SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8 and AVX-VNNI
30233instruction set support.
30234
30235@item alderlake
30236Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
30237SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
30238XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
30239MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
30240PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI
30241instruction set support.
30242
30243@item rocketlake
30244Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
30245SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
30246RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
30247XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
30248AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
30249AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
30250
30251@item k6
30252AMD K6 CPU with MMX instruction set support.
30253
30254@item k6-2
30255@itemx k6-3
30256Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
30257
30258@item athlon
30259@itemx athlon-tbird
30260AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
30261support.
30262
30263@item athlon-4
30264@itemx athlon-xp
30265@itemx athlon-mp
30266Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
30267instruction set support.
30268
30269@item k8
30270@itemx opteron
30271@itemx athlon64
30272@itemx athlon-fx
30273Processors based on the AMD K8 core with x86-64 instruction set support,
30274including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
30275(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
30276instruction set extensions.)
30277
30278@item k8-sse3
30279@itemx opteron-sse3
30280@itemx athlon64-sse3
30281Improved versions of AMD K8 cores with SSE3 instruction set support.
30282
30283@item amdfam10
30284@itemx barcelona
30285CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
30286supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
30287instruction set extensions.)
30288
30289@item bdver1
30290CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
30291supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
30292SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
30293
30294@item bdver2
30295AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
30296supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
30297SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
30298extensions.)
30299
30300@item bdver3
30301AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
30302supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
30303PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
3030464-bit instruction set extensions.)
30305
30306@item bdver4
30307AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
30308supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
30309AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
30310SSE4.2, ABM and 64-bit instruction set extensions.)
30311
30312@item znver1
30313AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
30314supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
30315SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
30316SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
30317instruction set extensions.)
30318
30319@item znver2
30320AMD Family 17h core based CPUs with x86-64 instruction set support. (This
30321supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30322MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30323SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30324WBNOINVD, and 64-bit instruction set extensions.)
30325
30326@item znver3
30327AMD Family 19h core based CPUs with x86-64 instruction set support. (This
30328supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
30329MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
30330SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
30331WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
30332
30333@item btver1
30334CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
30335supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
30336instruction set extensions.)
30337
30338@item btver2
30339CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
30340includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
30341SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
30342
30343@item winchip-c6
30344IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
30345set support.
30346
30347@item winchip2
30348IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
30349instruction set support.
30350
30351@item c3
30352VIA C3 CPU with MMX and 3DNow!@: instruction set support.
30353(No scheduling is implemented for this chip.)
30354
30355@item c3-2
30356VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
30357(No scheduling is implemented for this chip.)
30358
30359@item c7
30360VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30361(No scheduling is implemented for this chip.)
30362
30363@item samuel-2
30364VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
30365(No scheduling is implemented for this chip.)
30366
30367@item nehemiah
30368VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
30369(No scheduling is implemented for this chip.)
30370
30371@item esther
30372VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
30373(No scheduling is implemented for this chip.)
30374
30375@item eden-x2
30376VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
30377(No scheduling is implemented for this chip.)
30378
30379@item eden-x4
30380VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
30381AVX and AVX2 instruction set support.
30382(No scheduling is implemented for this chip.)
30383
30384@item nano
30385Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30386instruction set support.
30387(No scheduling is implemented for this chip.)
30388
30389@item nano-1000
30390VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30391instruction set support.
30392(No scheduling is implemented for this chip.)
30393
30394@item nano-2000
30395VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
30396instruction set support.
30397(No scheduling is implemented for this chip.)
30398
30399@item nano-3000
30400VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30401instruction set support.
30402(No scheduling is implemented for this chip.)
30403
30404@item nano-x2
30405VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30406instruction set support.
30407(No scheduling is implemented for this chip.)
30408
30409@item nano-x4
30410VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
30411instruction set support.
30412(No scheduling is implemented for this chip.)
30413
30414@item geode
30415AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
30416@end table
30417
30418@item -mtune=@var{cpu-type}
30419@opindex mtune
30420Tune to @var{cpu-type} everything applicable about the generated code, except
30421for the ABI and the set of available instructions.
30422While picking a specific @var{cpu-type} schedules things appropriately
30423for that particular chip, the compiler does not generate any code that
30424cannot run on the default machine type unless you use a
30425@option{-march=@var{cpu-type}} option.
30426For example, if GCC is configured for i686-pc-linux-gnu
30427then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
30428but still runs on i686 machines.
30429
30430The choices for @var{cpu-type} are the same as for @option{-march}.
30431In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
30432
30433@table @samp
30434@item generic
30435Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
30436If you know the CPU on which your code will run, then you should use
30437the corresponding @option{-mtune} or @option{-march} option instead of
30438@option{-mtune=generic}.  But, if you do not know exactly what CPU users
30439of your application will have, then you should use this option.
30440
30441As new processors are deployed in the marketplace, the behavior of this
30442option will change.  Therefore, if you upgrade to a newer version of
30443GCC, code generation controlled by this option will change to reflect
30444the processors
30445that are most common at the time that version of GCC is released.
30446
30447There is no @option{-march=generic} option because @option{-march}
30448indicates the instruction set the compiler can use, and there is no
30449generic instruction set applicable to all processors.  In contrast,
30450@option{-mtune} indicates the processor (or, in this case, collection of
30451processors) for which the code is optimized.
30452
30453@item intel
30454Produce code optimized for the most current Intel processors, which are
30455Haswell and Silvermont for this version of GCC.  If you know the CPU
30456on which your code will run, then you should use the corresponding
30457@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
30458But, if you want your application performs better on both Haswell and
30459Silvermont, then you should use this option.
30460
30461As new Intel processors are deployed in the marketplace, the behavior of
30462this option will change.  Therefore, if you upgrade to a newer version of
30463GCC, code generation controlled by this option will change to reflect
30464the most current Intel processors at the time that version of GCC is
30465released.
30466
30467There is no @option{-march=intel} option because @option{-march} indicates
30468the instruction set the compiler can use, and there is no common
30469instruction set applicable to all processors.  In contrast,
30470@option{-mtune} indicates the processor (or, in this case, collection of
30471processors) for which the code is optimized.
30472@end table
30473
30474@item -mcpu=@var{cpu-type}
30475@opindex mcpu
30476A deprecated synonym for @option{-mtune}.
30477
30478@item -mfpmath=@var{unit}
30479@opindex mfpmath
30480Generate floating-point arithmetic for selected unit @var{unit}.  The choices
30481for @var{unit} are:
30482
30483@table @samp
30484@item 387
30485Use the standard 387 floating-point coprocessor present on the majority of chips and
30486emulated otherwise.  Code compiled with this option runs almost everywhere.
30487The temporary results are computed in 80-bit precision instead of the precision
30488specified by the type, resulting in slightly different results compared to most
30489of other chips.  See @option{-ffloat-store} for more detailed description.
30490
30491This is the default choice for non-Darwin x86-32 targets.
30492
30493@item sse
30494Use scalar floating-point instructions present in the SSE instruction set.
30495This instruction set is supported by Pentium III and newer chips,
30496and in the AMD line
30497by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
30498instruction set supports only single-precision arithmetic, thus the double and
30499extended-precision arithmetic are still done using 387.  A later version, present
30500only in Pentium 4 and AMD x86-64 chips, supports double-precision
30501arithmetic too.
30502
30503For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
30504or @option{-msse2} switches to enable SSE extensions and make this option
30505effective.  For the x86-64 compiler, these extensions are enabled by default.
30506
30507The resulting code should be considerably faster in the majority of cases and avoid
30508the numerical instability problems of 387 code, but may break some existing
30509code that expects temporaries to be 80 bits.
30510
30511This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
30512and the default choice for x86-32 targets with the SSE2 instruction set
30513when @option{-ffast-math} is enabled.
30514
30515@item sse,387
30516@itemx sse+387
30517@itemx both
30518Attempt to utilize both instruction sets at once.  This effectively doubles the
30519amount of available registers, and on chips with separate execution units for
30520387 and SSE the execution resources too.  Use this option with care, as it is
30521still experimental, because the GCC register allocator does not model separate
30522functional units well, resulting in unstable performance.
30523@end table
30524
30525@item -masm=@var{dialect}
30526@opindex masm=@var{dialect}
30527Output assembly instructions using selected @var{dialect}.  Also affects
30528which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
30529extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
30530order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
30531not support @samp{intel}.
30532
30533@item -mieee-fp
30534@itemx -mno-ieee-fp
30535@opindex mieee-fp
30536@opindex mno-ieee-fp
30537Control whether or not the compiler uses IEEE floating-point
30538comparisons.  These correctly handle the case where the result of a
30539comparison is unordered.
30540
30541@item -m80387
30542@itemx -mhard-float
30543@opindex 80387
30544@opindex mhard-float
30545Generate output containing 80387 instructions for floating point.
30546
30547@item -mno-80387
30548@itemx -msoft-float
30549@opindex no-80387
30550@opindex msoft-float
30551Generate output containing library calls for floating point.
30552
30553@strong{Warning:} the requisite libraries are not part of GCC@.
30554Normally the facilities of the machine's usual C compiler are used, but
30555this cannot be done directly in cross-compilation.  You must make your
30556own arrangements to provide suitable library functions for
30557cross-compilation.
30558
30559On machines where a function returns floating-point results in the 80387
30560register stack, some floating-point opcodes may be emitted even if
30561@option{-msoft-float} is used.
30562
30563@item -mno-fp-ret-in-387
30564@opindex mno-fp-ret-in-387
30565@opindex mfp-ret-in-387
30566Do not use the FPU registers for return values of functions.
30567
30568The usual calling convention has functions return values of types
30569@code{float} and @code{double} in an FPU register, even if there
30570is no FPU@.  The idea is that the operating system should emulate
30571an FPU@.
30572
30573The option @option{-mno-fp-ret-in-387} causes such values to be returned
30574in ordinary CPU registers instead.
30575
30576@item -mno-fancy-math-387
30577@opindex mno-fancy-math-387
30578@opindex mfancy-math-387
30579Some 387 emulators do not support the @code{sin}, @code{cos} and
30580@code{sqrt} instructions for the 387.  Specify this option to avoid
30581generating those instructions.
30582This option is overridden when @option{-march}
30583indicates that the target CPU always has an FPU and so the
30584instruction does not need emulation.  These
30585instructions are not generated unless you also use the
30586@option{-funsafe-math-optimizations} switch.
30587
30588@item -malign-double
30589@itemx -mno-align-double
30590@opindex malign-double
30591@opindex mno-align-double
30592Control whether GCC aligns @code{double}, @code{long double}, and
30593@code{long long} variables on a two-word boundary or a one-word
30594boundary.  Aligning @code{double} variables on a two-word boundary
30595produces code that runs somewhat faster on a Pentium at the
30596expense of more memory.
30597
30598On x86-64, @option{-malign-double} is enabled by default.
30599
30600@strong{Warning:} if you use the @option{-malign-double} switch,
30601structures containing the above types are aligned differently than
30602the published application binary interface specifications for the x86-32
30603and are not binary compatible with structures in code compiled
30604without that switch.
30605
30606@item -m96bit-long-double
30607@itemx -m128bit-long-double
30608@opindex m96bit-long-double
30609@opindex m128bit-long-double
30610These switches control the size of @code{long double} type.  The x86-32
30611application binary interface specifies the size to be 96 bits,
30612so @option{-m96bit-long-double} is the default in 32-bit mode.
30613
30614Modern architectures (Pentium and newer) prefer @code{long double}
30615to be aligned to an 8- or 16-byte boundary.  In arrays or structures
30616conforming to the ABI, this is not possible.  So specifying
30617@option{-m128bit-long-double} aligns @code{long double}
30618to a 16-byte boundary by padding the @code{long double} with an additional
3061932-bit zero.
30620
30621In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
30622its ABI specifies that @code{long double} is aligned on 16-byte boundary.
30623
30624Notice that neither of these options enable any extra precision over the x87
30625standard of 80 bits for a @code{long double}.
30626
30627@strong{Warning:} if you override the default value for your target ABI, this
30628changes the size of
30629structures and arrays containing @code{long double} variables,
30630as well as modifying the function calling convention for functions taking
30631@code{long double}.  Hence they are not binary-compatible
30632with code compiled without that switch.
30633
30634@item -mlong-double-64
30635@itemx -mlong-double-80
30636@itemx -mlong-double-128
30637@opindex mlong-double-64
30638@opindex mlong-double-80
30639@opindex mlong-double-128
30640These switches control the size of @code{long double} type. A size
30641of 64 bits makes the @code{long double} type equivalent to the @code{double}
30642type. This is the default for 32-bit Bionic C library.  A size
30643of 128 bits makes the @code{long double} type equivalent to the
30644@code{__float128} type. This is the default for 64-bit Bionic C library.
30645
30646@strong{Warning:} if you override the default value for your target ABI, this
30647changes the size of
30648structures and arrays containing @code{long double} variables,
30649as well as modifying the function calling convention for functions taking
30650@code{long double}.  Hence they are not binary-compatible
30651with code compiled without that switch.
30652
30653@item -malign-data=@var{type}
30654@opindex malign-data
30655Control how GCC aligns variables.  Supported values for @var{type} are
30656@samp{compat} uses increased alignment value compatible uses GCC 4.8
30657and earlier, @samp{abi} uses alignment value as specified by the
30658psABI, and @samp{cacheline} uses increased alignment value to match
30659the cache line size.  @samp{compat} is the default.
30660
30661@item -mlarge-data-threshold=@var{threshold}
30662@opindex mlarge-data-threshold
30663When @option{-mcmodel=medium} is specified, data objects larger than
30664@var{threshold} are placed in the large data section.  This value must be the
30665same across all objects linked into the binary, and defaults to 65535.
30666
30667@item -mrtd
30668@opindex mrtd
30669Use a different function-calling convention, in which functions that
30670take a fixed number of arguments return with the @code{ret @var{num}}
30671instruction, which pops their arguments while returning.  This saves one
30672instruction in the caller since there is no need to pop the arguments
30673there.
30674
30675You can specify that an individual function is called with this calling
30676sequence with the function attribute @code{stdcall}.  You can also
30677override the @option{-mrtd} option by using the function attribute
30678@code{cdecl}.  @xref{Function Attributes}.
30679
30680@strong{Warning:} this calling convention is incompatible with the one
30681normally used on Unix, so you cannot use it if you need to call
30682libraries compiled with the Unix compiler.
30683
30684Also, you must provide function prototypes for all functions that
30685take variable numbers of arguments (including @code{printf});
30686otherwise incorrect code is generated for calls to those
30687functions.
30688
30689In addition, seriously incorrect code results if you call a
30690function with too many arguments.  (Normally, extra arguments are
30691harmlessly ignored.)
30692
30693@item -mregparm=@var{num}
30694@opindex mregparm
30695Control how many registers are used to pass integer arguments.  By
30696default, no registers are used to pass arguments, and at most 3
30697registers can be used.  You can control this behavior for a specific
30698function by using the function attribute @code{regparm}.
30699@xref{Function Attributes}.
30700
30701@strong{Warning:} if you use this switch, and
30702@var{num} is nonzero, then you must build all modules with the same
30703value, including any libraries.  This includes the system libraries and
30704startup modules.
30705
30706@item -msseregparm
30707@opindex msseregparm
30708Use SSE register passing conventions for float and double arguments
30709and return values.  You can control this behavior for a specific
30710function by using the function attribute @code{sseregparm}.
30711@xref{Function Attributes}.
30712
30713@strong{Warning:} if you use this switch then you must build all
30714modules with the same value, including any libraries.  This includes
30715the system libraries and startup modules.
30716
30717@item -mvect8-ret-in-mem
30718@opindex mvect8-ret-in-mem
30719Return 8-byte vectors in memory instead of MMX registers.  This is the
30720default on VxWorks to match the ABI of the Sun Studio compilers until
30721version 12.  @emph{Only} use this option if you need to remain
30722compatible with existing code produced by those previous compiler
30723versions or older versions of GCC@.
30724
30725@item -mpc32
30726@itemx -mpc64
30727@itemx -mpc80
30728@opindex mpc32
30729@opindex mpc64
30730@opindex mpc80
30731
30732Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
30733is specified, the significands of results of floating-point operations are
30734rounded to 24 bits (single precision); @option{-mpc64} rounds the
30735significands of results of floating-point operations to 53 bits (double
30736precision) and @option{-mpc80} rounds the significands of results of
30737floating-point operations to 64 bits (extended double precision), which is
30738the default.  When this option is used, floating-point operations in higher
30739precisions are not available to the programmer without setting the FPU
30740control word explicitly.
30741
30742Setting the rounding of floating-point operations to less than the default
3074380 bits can speed some programs by 2% or more.  Note that some mathematical
30744libraries assume that extended-precision (80-bit) floating-point operations
30745are enabled by default; routines in such libraries could suffer significant
30746loss of accuracy, typically through so-called ``catastrophic cancellation'',
30747when this option is used to set the precision to less than extended precision.
30748
30749@item -mstackrealign
30750@opindex mstackrealign
30751Realign the stack at entry.  On the x86, the @option{-mstackrealign}
30752option generates an alternate prologue and epilogue that realigns the
30753run-time stack if necessary.  This supports mixing legacy codes that keep
307544-byte stack alignment with modern codes that keep 16-byte stack alignment for
30755SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
30756applicable to individual functions.
30757
30758@item -mpreferred-stack-boundary=@var{num}
30759@opindex mpreferred-stack-boundary
30760Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
30761byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
30762the default is 4 (16 bytes or 128 bits).
30763
30764@strong{Warning:} When generating code for the x86-64 architecture with
30765SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
30766used to keep the stack boundary aligned to 8 byte boundary.  Since
30767x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
30768intended to be used in controlled environment where stack space is
30769important limitation.  This option leads to wrong code when functions
30770compiled with 16 byte stack alignment (such as functions from a standard
30771library) are called with misaligned stack.  In this case, SSE
30772instructions may lead to misaligned memory access traps.  In addition,
30773variable arguments are handled incorrectly for 16 byte aligned
30774objects (including x87 long double and __int128), leading to wrong
30775results.  You must build all modules with
30776@option{-mpreferred-stack-boundary=3}, including any libraries.  This
30777includes the system libraries and startup modules.
30778
30779@item -mincoming-stack-boundary=@var{num}
30780@opindex mincoming-stack-boundary
30781Assume the incoming stack is aligned to a 2 raised to @var{num} byte
30782boundary.  If @option{-mincoming-stack-boundary} is not specified,
30783the one specified by @option{-mpreferred-stack-boundary} is used.
30784
30785On Pentium and Pentium Pro, @code{double} and @code{long double} values
30786should be aligned to an 8-byte boundary (see @option{-malign-double}) or
30787suffer significant run time performance penalties.  On Pentium III, the
30788Streaming SIMD Extension (SSE) data type @code{__m128} may not work
30789properly if it is not 16-byte aligned.
30790
30791To ensure proper alignment of this values on the stack, the stack boundary
30792must be as aligned as that required by any value stored on the stack.
30793Further, every function must be generated such that it keeps the stack
30794aligned.  Thus calling a function compiled with a higher preferred
30795stack boundary from a function compiled with a lower preferred stack
30796boundary most likely misaligns the stack.  It is recommended that
30797libraries that use callbacks always use the default setting.
30798
30799This extra alignment does consume extra stack space, and generally
30800increases code size.  Code that is sensitive to stack space usage, such
30801as embedded systems and operating system kernels, may want to reduce the
30802preferred alignment to @option{-mpreferred-stack-boundary=2}.
30803
30804@need 200
30805@item -mmmx
30806@opindex mmmx
30807@need 200
30808@itemx -msse
30809@opindex msse
30810@need 200
30811@itemx -msse2
30812@opindex msse2
30813@need 200
30814@itemx -msse3
30815@opindex msse3
30816@need 200
30817@itemx -mssse3
30818@opindex mssse3
30819@need 200
30820@itemx -msse4
30821@opindex msse4
30822@need 200
30823@itemx -msse4a
30824@opindex msse4a
30825@need 200
30826@itemx -msse4.1
30827@opindex msse4.1
30828@need 200
30829@itemx -msse4.2
30830@opindex msse4.2
30831@need 200
30832@itemx -mavx
30833@opindex mavx
30834@need 200
30835@itemx -mavx2
30836@opindex mavx2
30837@need 200
30838@itemx -mavx512f
30839@opindex mavx512f
30840@need 200
30841@itemx -mavx512pf
30842@opindex mavx512pf
30843@need 200
30844@itemx -mavx512er
30845@opindex mavx512er
30846@need 200
30847@itemx -mavx512cd
30848@opindex mavx512cd
30849@need 200
30850@itemx -mavx512vl
30851@opindex mavx512vl
30852@need 200
30853@itemx -mavx512bw
30854@opindex mavx512bw
30855@need 200
30856@itemx -mavx512dq
30857@opindex mavx512dq
30858@need 200
30859@itemx -mavx512ifma
30860@opindex mavx512ifma
30861@need 200
30862@itemx -mavx512vbmi
30863@opindex mavx512vbmi
30864@need 200
30865@itemx -msha
30866@opindex msha
30867@need 200
30868@itemx -maes
30869@opindex maes
30870@need 200
30871@itemx -mpclmul
30872@opindex mpclmul
30873@need 200
30874@itemx -mclflushopt
30875@opindex mclflushopt
30876@need 200
30877@itemx -mclwb
30878@opindex mclwb
30879@need 200
30880@itemx -mfsgsbase
30881@opindex mfsgsbase
30882@need 200
30883@itemx -mptwrite
30884@opindex mptwrite
30885@need 200
30886@itemx -mrdrnd
30887@opindex mrdrnd
30888@need 200
30889@itemx -mf16c
30890@opindex mf16c
30891@need 200
30892@itemx -mfma
30893@opindex mfma
30894@need 200
30895@itemx -mpconfig
30896@opindex mpconfig
30897@need 200
30898@itemx -mwbnoinvd
30899@opindex mwbnoinvd
30900@need 200
30901@itemx -mfma4
30902@opindex mfma4
30903@need 200
30904@itemx -mprfchw
30905@opindex mprfchw
30906@need 200
30907@itemx -mrdpid
30908@opindex mrdpid
30909@need 200
30910@itemx -mprefetchwt1
30911@opindex mprefetchwt1
30912@need 200
30913@itemx -mrdseed
30914@opindex mrdseed
30915@need 200
30916@itemx -msgx
30917@opindex msgx
30918@need 200
30919@itemx -mxop
30920@opindex mxop
30921@need 200
30922@itemx -mlwp
30923@opindex mlwp
30924@need 200
30925@itemx -m3dnow
30926@opindex m3dnow
30927@need 200
30928@itemx -m3dnowa
30929@opindex m3dnowa
30930@need 200
30931@itemx -mpopcnt
30932@opindex mpopcnt
30933@need 200
30934@itemx -mabm
30935@opindex mabm
30936@need 200
30937@itemx -madx
30938@opindex madx
30939@need 200
30940@itemx -mbmi
30941@opindex mbmi
30942@need 200
30943@itemx -mbmi2
30944@opindex mbmi2
30945@need 200
30946@itemx -mlzcnt
30947@opindex mlzcnt
30948@need 200
30949@itemx -mfxsr
30950@opindex mfxsr
30951@need 200
30952@itemx -mxsave
30953@opindex mxsave
30954@need 200
30955@itemx -mxsaveopt
30956@opindex mxsaveopt
30957@need 200
30958@itemx -mxsavec
30959@opindex mxsavec
30960@need 200
30961@itemx -mxsaves
30962@opindex mxsaves
30963@need 200
30964@itemx -mrtm
30965@opindex mrtm
30966@need 200
30967@itemx -mhle
30968@opindex mhle
30969@need 200
30970@itemx -mtbm
30971@opindex mtbm
30972@need 200
30973@itemx -mmwaitx
30974@opindex mmwaitx
30975@need 200
30976@itemx -mclzero
30977@opindex mclzero
30978@need 200
30979@itemx -mpku
30980@opindex mpku
30981@need 200
30982@itemx -mavx512vbmi2
30983@opindex mavx512vbmi2
30984@need 200
30985@itemx -mavx512bf16
30986@opindex mavx512bf16
30987@need 200
30988@itemx -mgfni
30989@opindex mgfni
30990@need 200
30991@itemx -mvaes
30992@opindex mvaes
30993@need 200
30994@itemx -mwaitpkg
30995@opindex mwaitpkg
30996@need 200
30997@itemx -mvpclmulqdq
30998@opindex mvpclmulqdq
30999@need 200
31000@itemx -mavx512bitalg
31001@opindex mavx512bitalg
31002@need 200
31003@itemx -mmovdiri
31004@opindex mmovdiri
31005@need 200
31006@itemx -mmovdir64b
31007@opindex mmovdir64b
31008@need 200
31009@itemx -menqcmd
31010@opindex menqcmd
31011@itemx -muintr
31012@opindex muintr
31013@need 200
31014@itemx -mtsxldtrk
31015@opindex mtsxldtrk
31016@need 200
31017@itemx -mavx512vpopcntdq
31018@opindex mavx512vpopcntdq
31019@need 200
31020@itemx -mavx512vp2intersect
31021@opindex mavx512vp2intersect
31022@need 200
31023@itemx -mavx5124fmaps
31024@opindex mavx5124fmaps
31025@need 200
31026@itemx -mavx512vnni
31027@opindex mavx512vnni
31028@need 200
31029@itemx -mavxvnni
31030@opindex mavxvnni
31031@need 200
31032@itemx -mavx5124vnniw
31033@opindex mavx5124vnniw
31034@need 200
31035@itemx -mcldemote
31036@opindex mcldemote
31037@need 200
31038@itemx -mserialize
31039@opindex mserialize
31040@need 200
31041@itemx -mamx-tile
31042@opindex mamx-tile
31043@need 200
31044@itemx -mamx-int8
31045@opindex mamx-int8
31046@need 200
31047@itemx -mamx-bf16
31048@opindex mamx-bf16
31049@need 200
31050@itemx -mhreset
31051@opindex mhreset
31052@itemx -mkl
31053@opindex mkl
31054@need 200
31055@itemx -mwidekl
31056@opindex mwidekl
31057These switches enable the use of instructions in the MMX, SSE,
31058SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
31059AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
31060AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
31061WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
310623DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
31063XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
31064GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
31065ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
31066UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE
31067extended instruction sets. Each has a corresponding @option{-mno-} option to
31068disable use of these instructions.
31069
31070These extensions are also available as built-in functions: see
31071@ref{x86 Built-in Functions}, for details of the functions enabled and
31072disabled by these switches.
31073
31074To generate SSE/SSE2 instructions automatically from floating-point
31075code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
31076
31077GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
31078generates new AVX instructions or AVX equivalence for all SSEx instructions
31079when needed.
31080
31081These options enable GCC to use these extended instructions in
31082generated code, even without @option{-mfpmath=sse}.  Applications that
31083perform run-time CPU detection must compile separate files for each
31084supported architecture, using the appropriate flags.  In particular,
31085the file containing the CPU detection code should be compiled without
31086these options.
31087
31088@item -mdump-tune-features
31089@opindex mdump-tune-features
31090This option instructs GCC to dump the names of the x86 performance
31091tuning features and default settings. The names can be used in
31092@option{-mtune-ctrl=@var{feature-list}}.
31093
31094@item -mtune-ctrl=@var{feature-list}
31095@opindex mtune-ctrl=@var{feature-list}
31096This option is used to do fine grain control of x86 code generation features.
31097@var{feature-list} is a comma separated list of @var{feature} names. See also
31098@option{-mdump-tune-features}. When specified, the @var{feature} is turned
31099on if it is not preceded with @samp{^}, otherwise, it is turned off.
31100@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
31101developers. Using it may lead to code paths not covered by testing and can
31102potentially result in compiler ICEs or runtime errors.
31103
31104@item -mno-default
31105@opindex mno-default
31106This option instructs GCC to turn off all tunable features. See also
31107@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
31108
31109@item -mcld
31110@opindex mcld
31111This option instructs GCC to emit a @code{cld} instruction in the prologue
31112of functions that use string instructions.  String instructions depend on
31113the DF flag to select between autoincrement or autodecrement mode.  While the
31114ABI specifies the DF flag to be cleared on function entry, some operating
31115systems violate this specification by not clearing the DF flag in their
31116exception dispatchers.  The exception handler can be invoked with the DF flag
31117set, which leads to wrong direction mode when string instructions are used.
31118This option can be enabled by default on 32-bit x86 targets by configuring
31119GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
31120instructions can be suppressed with the @option{-mno-cld} compiler option
31121in this case.
31122
31123@item -mvzeroupper
31124@opindex mvzeroupper
31125This option instructs GCC to emit a @code{vzeroupper} instruction
31126before a transfer of control flow out of the function to minimize
31127the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
31128intrinsics.
31129
31130@item -mprefer-avx128
31131@opindex mprefer-avx128
31132This option instructs GCC to use 128-bit AVX instructions instead of
31133256-bit AVX instructions in the auto-vectorizer.
31134
31135@item -mprefer-vector-width=@var{opt}
31136@opindex mprefer-vector-width
31137This option instructs GCC to use @var{opt}-bit vector width in instructions
31138instead of default on the selected platform.
31139
31140@table @samp
31141@item none
31142No extra limitations applied to GCC other than defined by the selected platform.
31143
31144@item 128
31145Prefer 128-bit vector width for instructions.
31146
31147@item 256
31148Prefer 256-bit vector width for instructions.
31149
31150@item 512
31151Prefer 512-bit vector width for instructions.
31152@end table
31153
31154@item -mcx16
31155@opindex mcx16
31156This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
31157code to implement compare-and-exchange operations on 16-byte aligned 128-bit
31158objects.  This is useful for atomic updates of data structures exceeding one
31159machine word in size.  The compiler uses this instruction to implement
31160@ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
31161128-bit integers, a library call is always used.
31162
31163@item -msahf
31164@opindex msahf
31165This option enables generation of @code{SAHF} instructions in 64-bit code.
31166Early Intel Pentium 4 CPUs with Intel 64 support,
31167prior to the introduction of Pentium 4 G1 step in December 2005,
31168lacked the @code{LAHF} and @code{SAHF} instructions
31169which are supported by AMD64.
31170These are load and store instructions, respectively, for certain status flags.
31171In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
31172@code{drem}, and @code{remainder} built-in functions;
31173see @ref{Other Builtins} for details.
31174
31175@item -mmovbe
31176@opindex mmovbe
31177This option enables use of the @code{movbe} instruction to implement
31178@code{__builtin_bswap32} and @code{__builtin_bswap64}.
31179
31180@item -mshstk
31181@opindex mshstk
31182The @option{-mshstk} option enables shadow stack built-in functions
31183from x86 Control-flow Enforcement Technology (CET).
31184
31185@item -mcrc32
31186@opindex mcrc32
31187This option enables built-in functions @code{__builtin_ia32_crc32qi},
31188@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
31189@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
31190
31191@item -mmwait
31192@opindex mmwait
31193This option enables built-in functions @code{__builtin_ia32_monitor},
31194and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
31195@code{mwait} machine instructions.
31196
31197@item -mrecip
31198@opindex mrecip
31199This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
31200(and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
31201with an additional Newton-Raphson step
31202to increase precision instead of @code{DIVSS} and @code{SQRTSS}
31203(and their vectorized
31204variants) for single-precision floating-point arguments.  These instructions
31205are generated only when @option{-funsafe-math-optimizations} is enabled
31206together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
31207Note that while the throughput of the sequence is higher than the throughput
31208of the non-reciprocal instruction, the precision of the sequence can be
31209decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
31210
31211Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
31212(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
31213combination), and doesn't need @option{-mrecip}.
31214
31215Also note that GCC emits the above sequence with additional Newton-Raphson step
31216for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
31217already with @option{-ffast-math} (or the above option combination), and
31218doesn't need @option{-mrecip}.
31219
31220@item -mrecip=@var{opt}
31221@opindex mrecip=opt
31222This option controls which reciprocal estimate instructions
31223may be used.  @var{opt} is a comma-separated list of options, which may
31224be preceded by a @samp{!} to invert the option:
31225
31226@table @samp
31227@item all
31228Enable all estimate instructions.
31229
31230@item default
31231Enable the default instructions, equivalent to @option{-mrecip}.
31232
31233@item none
31234Disable all estimate instructions, equivalent to @option{-mno-recip}.
31235
31236@item div
31237Enable the approximation for scalar division.
31238
31239@item vec-div
31240Enable the approximation for vectorized division.
31241
31242@item sqrt
31243Enable the approximation for scalar square root.
31244
31245@item vec-sqrt
31246Enable the approximation for vectorized square root.
31247@end table
31248
31249So, for example, @option{-mrecip=all,!sqrt} enables
31250all of the reciprocal approximations, except for square root.
31251
31252@item -mveclibabi=@var{type}
31253@opindex mveclibabi
31254Specifies the ABI type to use for vectorizing intrinsics using an
31255external library.  Supported values for @var{type} are @samp{svml}
31256for the Intel short
31257vector math library and @samp{acml} for the AMD math core library.
31258To use this option, both @option{-ftree-vectorize} and
31259@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
31260ABI-compatible library must be specified at link time.
31261
31262GCC currently emits calls to @code{vmldExp2},
31263@code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
31264@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
31265@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
31266@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
31267@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
31268@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
31269@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
31270@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
31271@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
31272function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
31273@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
31274@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
31275@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
31276@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
31277when @option{-mveclibabi=acml} is used.
31278
31279@item -mabi=@var{name}
31280@opindex mabi
31281Generate code for the specified calling convention.  Permissible values
31282are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
31283@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
31284ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
31285You can control this behavior for specific functions by
31286using the function attributes @code{ms_abi} and @code{sysv_abi}.
31287@xref{Function Attributes}.
31288
31289@item -mforce-indirect-call
31290@opindex mforce-indirect-call
31291Force all calls to functions to be indirect. This is useful
31292when using Intel Processor Trace where it generates more precise timing
31293information for function calls.
31294
31295@item -mmanual-endbr
31296@opindex mmanual-endbr
31297Insert ENDBR instruction at function entry only via the @code{cf_check}
31298function attribute. This is useful when used with the option
31299@option{-fcf-protection=branch} to control ENDBR insertion at the
31300function entry.
31301
31302@item -mcall-ms2sysv-xlogues
31303@opindex mcall-ms2sysv-xlogues
31304@opindex mno-call-ms2sysv-xlogues
31305Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
31306System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
31307default, the code for saving and restoring these registers is emitted inline,
31308resulting in fairly lengthy prologues and epilogues.  Using
31309@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
31310use stubs in the static portion of libgcc to perform these saves and restores,
31311thus reducing function size at the cost of a few extra instructions.
31312
31313@item -mtls-dialect=@var{type}
31314@opindex mtls-dialect
31315Generate code to access thread-local storage using the @samp{gnu} or
31316@samp{gnu2} conventions.  @samp{gnu} is the conservative default;
31317@samp{gnu2} is more efficient, but it may add compile- and run-time
31318requirements that cannot be satisfied on all systems.
31319
31320@item -mpush-args
31321@itemx -mno-push-args
31322@opindex mpush-args
31323@opindex mno-push-args
31324Use PUSH operations to store outgoing parameters.  This method is shorter
31325and usually equally fast as method using SUB/MOV operations and is enabled
31326by default.  In some cases disabling it may improve performance because of
31327improved scheduling and reduced dependencies.
31328
31329@item -maccumulate-outgoing-args
31330@opindex maccumulate-outgoing-args
31331If enabled, the maximum amount of space required for outgoing arguments is
31332computed in the function prologue.  This is faster on most modern CPUs
31333because of reduced dependencies, improved scheduling and reduced stack usage
31334when the preferred stack boundary is not equal to 2.  The drawback is a notable
31335increase in code size.  This switch implies @option{-mno-push-args}.
31336
31337@item -mthreads
31338@opindex mthreads
31339Support thread-safe exception handling on MinGW.  Programs that rely
31340on thread-safe exception handling must compile and link all code with the
31341@option{-mthreads} option.  When compiling, @option{-mthreads} defines
31342@option{-D_MT}; when linking, it links in a special thread helper library
31343@option{-lmingwthrd} which cleans up per-thread exception-handling data.
31344
31345@item -mms-bitfields
31346@itemx -mno-ms-bitfields
31347@opindex mms-bitfields
31348@opindex mno-ms-bitfields
31349
31350Enable/disable bit-field layout compatible with the native Microsoft
31351Windows compiler.
31352
31353If @code{packed} is used on a structure, or if bit-fields are used,
31354it may be that the Microsoft ABI lays out the structure differently
31355than the way GCC normally does.  Particularly when moving packed
31356data between functions compiled with GCC and the native Microsoft compiler
31357(either via function call or as data in a file), it may be necessary to access
31358either format.
31359
31360This option is enabled by default for Microsoft Windows
31361targets.  This behavior can also be controlled locally by use of variable
31362or type attributes.  For more information, see @ref{x86 Variable Attributes}
31363and @ref{x86 Type Attributes}.
31364
31365The Microsoft structure layout algorithm is fairly simple with the exception
31366of the bit-field packing.
31367The padding and alignment of members of structures and whether a bit-field
31368can straddle a storage-unit boundary are determine by these rules:
31369
31370@enumerate
31371@item Structure members are stored sequentially in the order in which they are
31372declared: the first member has the lowest memory address and the last member
31373the highest.
31374
31375@item Every data object has an alignment requirement.  The alignment requirement
31376for all data except structures, unions, and arrays is either the size of the
31377object or the current packing size (specified with either the
31378@code{aligned} attribute or the @code{pack} pragma),
31379whichever is less.  For structures, unions, and arrays,
31380the alignment requirement is the largest alignment requirement of its members.
31381Every object is allocated an offset so that:
31382
31383@smallexample
31384offset % alignment_requirement == 0
31385@end smallexample
31386
31387@item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
31388unit if the integral types are the same size and if the next bit-field fits
31389into the current allocation unit without crossing the boundary imposed by the
31390common alignment requirements of the bit-fields.
31391@end enumerate
31392
31393MSVC interprets zero-length bit-fields in the following ways:
31394
31395@enumerate
31396@item If a zero-length bit-field is inserted between two bit-fields that
31397are normally coalesced, the bit-fields are not coalesced.
31398
31399For example:
31400
31401@smallexample
31402struct
31403 @{
31404   unsigned long bf_1 : 12;
31405   unsigned long : 0;
31406   unsigned long bf_2 : 12;
31407 @} t1;
31408@end smallexample
31409
31410@noindent
31411The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
31412zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
31413
31414@item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
31415alignment of the zero-length bit-field is greater than the member that follows it,
31416@code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
31417
31418For example:
31419
31420@smallexample
31421struct
31422 @{
31423   char foo : 4;
31424   short : 0;
31425   char bar;
31426 @} t2;
31427
31428struct
31429 @{
31430   char foo : 4;
31431   short : 0;
31432   double bar;
31433 @} t3;
31434@end smallexample
31435
31436@noindent
31437For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
31438Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
31439bit-field does not affect the alignment of @code{bar} or, as a result, the size
31440of the structure.
31441
31442Taking this into account, it is important to note the following:
31443
31444@enumerate
31445@item If a zero-length bit-field follows a normal bit-field, the type of the
31446zero-length bit-field may affect the alignment of the structure as whole. For
31447example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
31448normal bit-field, and is of type short.
31449
31450@item Even if a zero-length bit-field is not followed by a normal bit-field, it may
31451still affect the alignment of the structure:
31452
31453@smallexample
31454struct
31455 @{
31456   char foo : 6;
31457   long : 0;
31458 @} t4;
31459@end smallexample
31460
31461@noindent
31462Here, @code{t4} takes up 4 bytes.
31463@end enumerate
31464
31465@item Zero-length bit-fields following non-bit-field members are ignored:
31466
31467@smallexample
31468struct
31469 @{
31470   char foo;
31471   long : 0;
31472   char bar;
31473 @} t5;
31474@end smallexample
31475
31476@noindent
31477Here, @code{t5} takes up 2 bytes.
31478@end enumerate
31479
31480
31481@item -mno-align-stringops
31482@opindex mno-align-stringops
31483@opindex malign-stringops
31484Do not align the destination of inlined string operations.  This switch reduces
31485code size and improves performance in case the destination is already aligned,
31486but GCC doesn't know about it.
31487
31488@item -minline-all-stringops
31489@opindex minline-all-stringops
31490By default GCC inlines string operations only when the destination is
31491known to be aligned to least a 4-byte boundary.
31492This enables more inlining and increases code
31493size, but may improve performance of code that depends on fast
31494@code{memcpy} and @code{memset} for short lengths.
31495The option enables inline expansion of @code{strlen} for all
31496pointer alignments.
31497
31498@item -minline-stringops-dynamically
31499@opindex minline-stringops-dynamically
31500For string operations of unknown size, use run-time checks with
31501inline code for small blocks and a library call for large blocks.
31502
31503@item -mstringop-strategy=@var{alg}
31504@opindex mstringop-strategy=@var{alg}
31505Override the internal decision heuristic for the particular algorithm to use
31506for inlining string operations.  The allowed values for @var{alg} are:
31507
31508@table @samp
31509@item rep_byte
31510@itemx rep_4byte
31511@itemx rep_8byte
31512Expand using i386 @code{rep} prefix of the specified size.
31513
31514@item byte_loop
31515@itemx loop
31516@itemx unrolled_loop
31517Expand into an inline loop.
31518
31519@item libcall
31520Always use a library call.
31521@end table
31522
31523@item -mmemcpy-strategy=@var{strategy}
31524@opindex mmemcpy-strategy=@var{strategy}
31525Override the internal decision heuristic to decide if @code{__builtin_memcpy}
31526should be inlined and what inline algorithm to use when the expected size
31527of the copy operation is known. @var{strategy}
31528is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
31529@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
31530the max byte size with which inline algorithm @var{alg} is allowed.  For the last
31531triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
31532in the list must be specified in increasing order.  The minimal byte size for
31533@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
31534preceding range.
31535
31536@item -mmemset-strategy=@var{strategy}
31537@opindex mmemset-strategy=@var{strategy}
31538The option is similar to @option{-mmemcpy-strategy=} except that it is to control
31539@code{__builtin_memset} expansion.
31540
31541@item -momit-leaf-frame-pointer
31542@opindex momit-leaf-frame-pointer
31543Don't keep the frame pointer in a register for leaf functions.  This
31544avoids the instructions to save, set up, and restore frame pointers and
31545makes an extra register available in leaf functions.  The option
31546@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
31547which might make debugging harder.
31548
31549@item -mtls-direct-seg-refs
31550@itemx -mno-tls-direct-seg-refs
31551@opindex mtls-direct-seg-refs
31552Controls whether TLS variables may be accessed with offsets from the
31553TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
31554or whether the thread base pointer must be added.  Whether or not this
31555is valid depends on the operating system, and whether it maps the
31556segment to cover the entire TLS area.
31557
31558For systems that use the GNU C Library, the default is on.
31559
31560@item -msse2avx
31561@itemx -mno-sse2avx
31562@opindex msse2avx
31563Specify that the assembler should encode SSE instructions with VEX
31564prefix.  The option @option{-mavx} turns this on by default.
31565
31566@item -mfentry
31567@itemx -mno-fentry
31568@opindex mfentry
31569If profiling is active (@option{-pg}), put the profiling
31570counter call before the prologue.
31571Note: On x86 architectures the attribute @code{ms_hook_prologue}
31572isn't possible at the moment for @option{-mfentry} and @option{-pg}.
31573
31574@item -mrecord-mcount
31575@itemx -mno-record-mcount
31576@opindex mrecord-mcount
31577If profiling is active (@option{-pg}), generate a __mcount_loc section
31578that contains pointers to each profiling call. This is useful for
31579automatically patching and out calls.
31580
31581@item -mnop-mcount
31582@itemx -mno-nop-mcount
31583@opindex mnop-mcount
31584If profiling is active (@option{-pg}), generate the calls to
31585the profiling functions as NOPs. This is useful when they
31586should be patched in later dynamically. This is likely only
31587useful together with @option{-mrecord-mcount}.
31588
31589@item -minstrument-return=@var{type}
31590@opindex minstrument-return
31591Instrument function exit in -pg -mfentry instrumented functions with
31592call to specified function. This only instruments true returns ending
31593with ret, but not sibling calls ending with jump. Valid types
31594are @var{none} to not instrument, @var{call} to generate a call to __return__,
31595or @var{nop5} to generate a 5 byte nop.
31596
31597@item -mrecord-return
31598@itemx -mno-record-return
31599@opindex mrecord-return
31600Generate a __return_loc section pointing to all return instrumentation code.
31601
31602@item -mfentry-name=@var{name}
31603@opindex mfentry-name
31604Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
31605
31606@item -mfentry-section=@var{name}
31607@opindex mfentry-section
31608Set name of section to record -mrecord-mcount calls (default __mcount_loc).
31609
31610@item -mskip-rax-setup
31611@itemx -mno-skip-rax-setup
31612@opindex mskip-rax-setup
31613When generating code for the x86-64 architecture with SSE extensions
31614disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
31615register when there are no variable arguments passed in vector registers.
31616
31617@strong{Warning:} Since RAX register is used to avoid unnecessarily
31618saving vector registers on stack when passing variable arguments, the
31619impacts of this option are callees may waste some stack space,
31620misbehave or jump to a random location.  GCC 4.4 or newer don't have
31621those issues, regardless the RAX register value.
31622
31623@item -m8bit-idiv
31624@itemx -mno-8bit-idiv
31625@opindex m8bit-idiv
31626On some processors, like Intel Atom, 8-bit unsigned integer divide is
31627much faster than 32-bit/64-bit integer divide.  This option generates a
31628run-time check.  If both dividend and divisor are within range of 0
31629to 255, 8-bit unsigned integer divide is used instead of
3163032-bit/64-bit integer divide.
31631
31632@item -mavx256-split-unaligned-load
31633@itemx -mavx256-split-unaligned-store
31634@opindex mavx256-split-unaligned-load
31635@opindex mavx256-split-unaligned-store
31636Split 32-byte AVX unaligned load and store.
31637
31638@item -mstack-protector-guard=@var{guard}
31639@itemx -mstack-protector-guard-reg=@var{reg}
31640@itemx -mstack-protector-guard-offset=@var{offset}
31641@opindex mstack-protector-guard
31642@opindex mstack-protector-guard-reg
31643@opindex mstack-protector-guard-offset
31644Generate stack protection code using canary at @var{guard}.  Supported
31645locations are @samp{global} for global canary or @samp{tls} for per-thread
31646canary in the TLS block (the default).  This option has effect only when
31647@option{-fstack-protector} or @option{-fstack-protector-all} is specified.
31648
31649With the latter choice the options
31650@option{-mstack-protector-guard-reg=@var{reg}} and
31651@option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
31652which segment register (@code{%fs} or @code{%gs}) to use as base register
31653for reading the canary, and from what offset from that base register.
31654The default for those is as specified in the relevant ABI.
31655
31656@item -mgeneral-regs-only
31657@opindex mgeneral-regs-only
31658Generate code that uses only the general-purpose registers.  This
31659prevents the compiler from using floating-point, vector, mask and bound
31660registers.
31661
31662@item -mindirect-branch=@var{choice}
31663@opindex mindirect-branch
31664Convert indirect call and jump with @var{choice}.  The default is
31665@samp{keep}, which keeps indirect call and jump unmodified.
31666@samp{thunk} converts indirect call and jump to call and return thunk.
31667@samp{thunk-inline} converts indirect call and jump to inlined call
31668and return thunk.  @samp{thunk-extern} converts indirect call and jump
31669to external call and return thunk provided in a separate object file.
31670You can control this behavior for a specific function by using the
31671function attribute @code{indirect_branch}.  @xref{Function Attributes}.
31672
31673Note that @option{-mcmodel=large} is incompatible with
31674@option{-mindirect-branch=thunk} and
31675@option{-mindirect-branch=thunk-extern} since the thunk function may
31676not be reachable in the large code model.
31677
31678Note that @option{-mindirect-branch=thunk-extern} is compatible with
31679@option{-fcf-protection=branch} since the external thunk can be made
31680to enable control-flow check.
31681
31682@item -mfunction-return=@var{choice}
31683@opindex mfunction-return
31684Convert function return with @var{choice}.  The default is @samp{keep},
31685which keeps function return unmodified.  @samp{thunk} converts function
31686return to call and return thunk.  @samp{thunk-inline} converts function
31687return to inlined call and return thunk.  @samp{thunk-extern} converts
31688function return to external call and return thunk provided in a separate
31689object file.  You can control this behavior for a specific function by
31690using the function attribute @code{function_return}.
31691@xref{Function Attributes}.
31692
31693Note that @option{-mindirect-return=thunk-extern} is compatible with
31694@option{-fcf-protection=branch} since the external thunk can be made
31695to enable control-flow check.
31696
31697Note that @option{-mcmodel=large} is incompatible with
31698@option{-mfunction-return=thunk} and
31699@option{-mfunction-return=thunk-extern} since the thunk function may
31700not be reachable in the large code model.
31701
31702
31703@item -mindirect-branch-register
31704@opindex mindirect-branch-register
31705Force indirect call and jump via register.
31706
31707@end table
31708
31709These @samp{-m} switches are supported in addition to the above
31710on x86-64 processors in 64-bit environments.
31711
31712@table @gcctabopt
31713@item -m32
31714@itemx -m64
31715@itemx -mx32
31716@itemx -m16
31717@itemx -miamcu
31718@opindex m32
31719@opindex m64
31720@opindex mx32
31721@opindex m16
31722@opindex miamcu
31723Generate code for a 16-bit, 32-bit or 64-bit environment.
31724The @option{-m32} option sets @code{int}, @code{long}, and pointer types
31725to 32 bits, and
31726generates code that runs on any i386 system.
31727
31728The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
31729types to 64 bits, and generates code for the x86-64 architecture.
31730For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
31731and @option{-mdynamic-no-pic} options.
31732
31733The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
31734to 32 bits, and
31735generates code for the x86-64 architecture.
31736
31737The @option{-m16} option is the same as @option{-m32}, except for that
31738it outputs the @code{.code16gcc} assembly directive at the beginning of
31739the assembly output so that the binary can run in 16-bit mode.
31740
31741The @option{-miamcu} option generates code which conforms to Intel MCU
31742psABI.  It requires the @option{-m32} option to be turned on.
31743
31744@item -mno-red-zone
31745@opindex mno-red-zone
31746@opindex mred-zone
31747Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
31748by the x86-64 ABI; it is a 128-byte area beyond the location of the
31749stack pointer that is not modified by signal or interrupt handlers
31750and therefore can be used for temporary data without adjusting the stack
31751pointer.  The flag @option{-mno-red-zone} disables this red zone.
31752
31753@item -mcmodel=small
31754@opindex mcmodel=small
31755Generate code for the small code model: the program and its symbols must
31756be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
31757Programs can be statically or dynamically linked.  This is the default
31758code model.
31759
31760@item -mcmodel=kernel
31761@opindex mcmodel=kernel
31762Generate code for the kernel code model.  The kernel runs in the
31763negative 2 GB of the address space.
31764This model has to be used for Linux kernel code.
31765
31766@item -mcmodel=medium
31767@opindex mcmodel=medium
31768Generate code for the medium model: the program is linked in the lower 2
31769GB of the address space.  Small symbols are also placed there.  Symbols
31770with sizes larger than @option{-mlarge-data-threshold} are put into
31771large data or BSS sections and can be located above 2GB.  Programs can
31772be statically or dynamically linked.
31773
31774@item -mcmodel=large
31775@opindex mcmodel=large
31776Generate code for the large model.  This model makes no assumptions
31777about addresses and sizes of sections.
31778
31779@item -maddress-mode=long
31780@opindex maddress-mode=long
31781Generate code for long address mode.  This is only supported for 64-bit
31782and x32 environments.  It is the default address mode for 64-bit
31783environments.
31784
31785@item -maddress-mode=short
31786@opindex maddress-mode=short
31787Generate code for short address mode.  This is only supported for 32-bit
31788and x32 environments.  It is the default address mode for 32-bit and
31789x32 environments.
31790
31791@item -mneeded
31792@itemx -mno-needed
31793@opindex mneeded
31794Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
31795indicate the micro-architecture ISA level required to execute the binary.
31796@end table
31797
31798@node x86 Windows Options
31799@subsection x86 Windows Options
31800@cindex x86 Windows Options
31801@cindex Windows Options for x86
31802
31803These additional options are available for Microsoft Windows targets:
31804
31805@table @gcctabopt
31806@item -mconsole
31807@opindex mconsole
31808This option
31809specifies that a console application is to be generated, by
31810instructing the linker to set the PE header subsystem type
31811required for console applications.
31812This option is available for Cygwin and MinGW targets and is
31813enabled by default on those targets.
31814
31815@item -mdll
31816@opindex mdll
31817This option is available for Cygwin and MinGW targets.  It
31818specifies that a DLL---a dynamic link library---is to be
31819generated, enabling the selection of the required runtime
31820startup object and entry point.
31821
31822@item -mnop-fun-dllimport
31823@opindex mnop-fun-dllimport
31824This option is available for Cygwin and MinGW targets.  It
31825specifies that the @code{dllimport} attribute should be ignored.
31826
31827@item -mthread
31828@opindex mthread
31829This option is available for MinGW targets. It specifies
31830that MinGW-specific thread support is to be used.
31831
31832@item -municode
31833@opindex municode
31834This option is available for MinGW-w64 targets.  It causes
31835the @code{UNICODE} preprocessor macro to be predefined, and
31836chooses Unicode-capable runtime startup code.
31837
31838@item -mwin32
31839@opindex mwin32
31840This option is available for Cygwin and MinGW targets.  It
31841specifies that the typical Microsoft Windows predefined macros are to
31842be set in the pre-processor, but does not influence the choice
31843of runtime library/startup code.
31844
31845@item -mwindows
31846@opindex mwindows
31847This option is available for Cygwin and MinGW targets.  It
31848specifies that a GUI application is to be generated by
31849instructing the linker to set the PE header subsystem type
31850appropriately.
31851
31852@item -fno-set-stack-executable
31853@opindex fno-set-stack-executable
31854@opindex fset-stack-executable
31855This option is available for MinGW targets. It specifies that
31856the executable flag for the stack used by nested functions isn't
31857set. This is necessary for binaries running in kernel mode of
31858Microsoft Windows, as there the User32 API, which is used to set executable
31859privileges, isn't available.
31860
31861@item -fwritable-relocated-rdata
31862@opindex fno-writable-relocated-rdata
31863@opindex fwritable-relocated-rdata
31864This option is available for MinGW and Cygwin targets.  It specifies
31865that relocated-data in read-only section is put into the @code{.data}
31866section.  This is a necessary for older runtimes not supporting
31867modification of @code{.rdata} sections for pseudo-relocation.
31868
31869@item -mpe-aligned-commons
31870@opindex mpe-aligned-commons
31871This option is available for Cygwin and MinGW targets.  It
31872specifies that the GNU extension to the PE file format that
31873permits the correct alignment of COMMON variables should be
31874used when generating code.  It is enabled by default if
31875GCC detects that the target assembler found during configuration
31876supports the feature.
31877@end table
31878
31879See also under @ref{x86 Options} for standard options.
31880
31881@node Xstormy16 Options
31882@subsection Xstormy16 Options
31883@cindex Xstormy16 Options
31884
31885These options are defined for Xstormy16:
31886
31887@table @gcctabopt
31888@item -msim
31889@opindex msim
31890Choose startup files and linker script suitable for the simulator.
31891@end table
31892
31893@node Xtensa Options
31894@subsection Xtensa Options
31895@cindex Xtensa Options
31896
31897These options are supported for Xtensa targets:
31898
31899@table @gcctabopt
31900@item -mconst16
31901@itemx -mno-const16
31902@opindex mconst16
31903@opindex mno-const16
31904Enable or disable use of @code{CONST16} instructions for loading
31905constant values.  The @code{CONST16} instruction is currently not a
31906standard option from Tensilica.  When enabled, @code{CONST16}
31907instructions are always used in place of the standard @code{L32R}
31908instructions.  The use of @code{CONST16} is enabled by default only if
31909the @code{L32R} instruction is not available.
31910
31911@item -mfused-madd
31912@itemx -mno-fused-madd
31913@opindex mfused-madd
31914@opindex mno-fused-madd
31915Enable or disable use of fused multiply/add and multiply/subtract
31916instructions in the floating-point option.  This has no effect if the
31917floating-point option is not also enabled.  Disabling fused multiply/add
31918and multiply/subtract instructions forces the compiler to use separate
31919instructions for the multiply and add/subtract operations.  This may be
31920desirable in some cases where strict IEEE 754-compliant results are
31921required: the fused multiply add/subtract instructions do not round the
31922intermediate result, thereby producing results with @emph{more} bits of
31923precision than specified by the IEEE standard.  Disabling fused multiply
31924add/subtract instructions also ensures that the program output is not
31925sensitive to the compiler's ability to combine multiply and add/subtract
31926operations.
31927
31928@item -mserialize-volatile
31929@itemx -mno-serialize-volatile
31930@opindex mserialize-volatile
31931@opindex mno-serialize-volatile
31932When this option is enabled, GCC inserts @code{MEMW} instructions before
31933@code{volatile} memory references to guarantee sequential consistency.
31934The default is @option{-mserialize-volatile}.  Use
31935@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
31936
31937@item -mforce-no-pic
31938@opindex mforce-no-pic
31939For targets, like GNU/Linux, where all user-mode Xtensa code must be
31940position-independent code (PIC), this option disables PIC for compiling
31941kernel code.
31942
31943@item -mtext-section-literals
31944@itemx -mno-text-section-literals
31945@opindex mtext-section-literals
31946@opindex mno-text-section-literals
31947These options control the treatment of literal pools.  The default is
31948@option{-mno-text-section-literals}, which places literals in a separate
31949section in the output file.  This allows the literal pool to be placed
31950in a data RAM/ROM, and it also allows the linker to combine literal
31951pools from separate object files to remove redundant literals and
31952improve code size.  With @option{-mtext-section-literals}, the literals
31953are interspersed in the text section in order to keep them as close as
31954possible to their references.  This may be necessary for large assembly
31955files.  Literals for each function are placed right before that function.
31956
31957@item -mauto-litpools
31958@itemx -mno-auto-litpools
31959@opindex mauto-litpools
31960@opindex mno-auto-litpools
31961These options control the treatment of literal pools.  The default is
31962@option{-mno-auto-litpools}, which places literals in a separate
31963section in the output file unless @option{-mtext-section-literals} is
31964used.  With @option{-mauto-litpools} the literals are interspersed in
31965the text section by the assembler.  Compiler does not produce explicit
31966@code{.literal} directives and loads literals into registers with
31967@code{MOVI} instructions instead of @code{L32R} to let the assembler
31968do relaxation and place literals as necessary.  This option allows
31969assembler to create several literal pools per function and assemble
31970very big functions, which may not be possible with
31971@option{-mtext-section-literals}.
31972
31973@item -mtarget-align
31974@itemx -mno-target-align
31975@opindex mtarget-align
31976@opindex mno-target-align
31977When this option is enabled, GCC instructs the assembler to
31978automatically align instructions to reduce branch penalties at the
31979expense of some code density.  The assembler attempts to widen density
31980instructions to align branch targets and the instructions following call
31981instructions.  If there are not enough preceding safe density
31982instructions to align a target, no widening is performed.  The
31983default is @option{-mtarget-align}.  These options do not affect the
31984treatment of auto-aligned instructions like @code{LOOP}, which the
31985assembler always aligns, either by widening density instructions or
31986by inserting NOP instructions.
31987
31988@item -mlongcalls
31989@itemx -mno-longcalls
31990@opindex mlongcalls
31991@opindex mno-longcalls
31992When this option is enabled, GCC instructs the assembler to translate
31993direct calls to indirect calls unless it can determine that the target
31994of a direct call is in the range allowed by the call instruction.  This
31995translation typically occurs for calls to functions in other source
31996files.  Specifically, the assembler translates a direct @code{CALL}
31997instruction into an @code{L32R} followed by a @code{CALLX} instruction.
31998The default is @option{-mno-longcalls}.  This option should be used in
31999programs where the call target can potentially be out of range.  This
32000option is implemented in the assembler, not the compiler, so the
32001assembly code generated by GCC still shows direct call
32002instructions---look at the disassembled object code to see the actual
32003instructions.  Note that the assembler uses an indirect call for
32004every cross-file call, not just those that really are out of range.
32005
32006@item -mabi=@var{name}
32007@opindex mabi
32008Generate code for the specified ABI@.  Permissible values are: @samp{call0},
32009@samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
32010
32011@item -mabi=call0
32012@opindex mabi=call0
32013When this option is enabled function parameters are passed in registers
32014@code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
32015caller-saved, and register @code{a15} may be used as a frame pointer.
32016When this version of the ABI is enabled the C preprocessor symbol
32017@code{__XTENSA_CALL0_ABI__} is defined.
32018
32019@item -mabi=windowed
32020@opindex mabi=windowed
32021When this option is enabled function parameters are passed in registers
32022@code{a10} through @code{a15}, and called function rotates register window
32023by 8 registers on entry so that its arguments are found in registers
32024@code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
32025pointer.  Register window is rotated 8 registers back upon return.
32026When this version of the ABI is enabled the C preprocessor symbol
32027@code{__XTENSA_WINDOWED_ABI__} is defined.
32028@end table
32029
32030@node zSeries Options
32031@subsection zSeries Options
32032@cindex zSeries options
32033
32034These are listed under @xref{S/390 and zSeries Options}.
32035
32036
32037@c man end
32038
32039@node Spec Files
32040@section Specifying Subprocesses and the Switches to Pass to Them
32041@cindex Spec Files
32042
32043@command{gcc} is a driver program.  It performs its job by invoking a
32044sequence of other programs to do the work of compiling, assembling and
32045linking.  GCC interprets its command-line parameters and uses these to
32046deduce which programs it should invoke, and which command-line options
32047it ought to place on their command lines.  This behavior is controlled
32048by @dfn{spec strings}.  In most cases there is one spec string for each
32049program that GCC can invoke, but a few programs have multiple spec
32050strings to control their behavior.  The spec strings built into GCC can
32051be overridden by using the @option{-specs=} command-line switch to specify
32052a spec file.
32053
32054@dfn{Spec files} are plain-text files that are used to construct spec
32055strings.  They consist of a sequence of directives separated by blank
32056lines.  The type of directive is determined by the first non-whitespace
32057character on the line, which can be one of the following:
32058
32059@table @code
32060@item %@var{command}
32061Issues a @var{command} to the spec file processor.  The commands that can
32062appear here are:
32063
32064@table @code
32065@item %include <@var{file}>
32066@cindex @code{%include}
32067Search for @var{file} and insert its text at the current point in the
32068specs file.
32069
32070@item %include_noerr <@var{file}>
32071@cindex @code{%include_noerr}
32072Just like @samp{%include}, but do not generate an error message if the include
32073file cannot be found.
32074
32075@item %rename @var{old_name} @var{new_name}
32076@cindex @code{%rename}
32077Rename the spec string @var{old_name} to @var{new_name}.
32078
32079@end table
32080
32081@item *[@var{spec_name}]:
32082This tells the compiler to create, override or delete the named spec
32083string.  All lines after this directive up to the next directive or
32084blank line are considered to be the text for the spec string.  If this
32085results in an empty string then the spec is deleted.  (Or, if the
32086spec did not exist, then nothing happens.)  Otherwise, if the spec
32087does not currently exist a new spec is created.  If the spec does
32088exist then its contents are overridden by the text of this
32089directive, unless the first character of that text is the @samp{+}
32090character, in which case the text is appended to the spec.
32091
32092@item [@var{suffix}]:
32093Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
32094and up to the next directive or blank line are considered to make up the
32095spec string for the indicated suffix.  When the compiler encounters an
32096input file with the named suffix, it processes the spec string in
32097order to work out how to compile that file.  For example:
32098
32099@smallexample
32100.ZZ:
32101z-compile -input %i
32102@end smallexample
32103
32104This says that any input file whose name ends in @samp{.ZZ} should be
32105passed to the program @samp{z-compile}, which should be invoked with the
32106command-line switch @option{-input} and with the result of performing the
32107@samp{%i} substitution.  (See below.)
32108
32109As an alternative to providing a spec string, the text following a
32110suffix directive can be one of the following:
32111
32112@table @code
32113@item @@@var{language}
32114This says that the suffix is an alias for a known @var{language}.  This is
32115similar to using the @option{-x} command-line switch to GCC to specify a
32116language explicitly.  For example:
32117
32118@smallexample
32119.ZZ:
32120@@c++
32121@end smallexample
32122
32123Says that .ZZ files are, in fact, C++ source files.
32124
32125@item #@var{name}
32126This causes an error messages saying:
32127
32128@smallexample
32129@var{name} compiler not installed on this system.
32130@end smallexample
32131@end table
32132
32133GCC already has an extensive list of suffixes built into it.
32134This directive adds an entry to the end of the list of suffixes, but
32135since the list is searched from the end backwards, it is effectively
32136possible to override earlier entries using this technique.
32137
32138@end table
32139
32140GCC has the following spec strings built into it.  Spec files can
32141override these strings or create their own.  Note that individual
32142targets can also add their own spec strings to this list.
32143
32144@smallexample
32145asm          Options to pass to the assembler
32146asm_final    Options to pass to the assembler post-processor
32147cpp          Options to pass to the C preprocessor
32148cc1          Options to pass to the C compiler
32149cc1plus      Options to pass to the C++ compiler
32150endfile      Object files to include at the end of the link
32151link         Options to pass to the linker
32152lib          Libraries to include on the command line to the linker
32153libgcc       Decides which GCC support library to pass to the linker
32154linker       Sets the name of the linker
32155predefines   Defines to be passed to the C preprocessor
32156signed_char  Defines to pass to CPP to say whether @code{char} is signed
32157             by default
32158startfile    Object files to include at the start of the link
32159@end smallexample
32160
32161Here is a small example of a spec file:
32162
32163@smallexample
32164%rename lib                 old_lib
32165
32166*lib:
32167--start-group -lgcc -lc -leval1 --end-group %(old_lib)
32168@end smallexample
32169
32170This example renames the spec called @samp{lib} to @samp{old_lib} and
32171then overrides the previous definition of @samp{lib} with a new one.
32172The new definition adds in some extra command-line options before
32173including the text of the old definition.
32174
32175@dfn{Spec strings} are a list of command-line options to be passed to their
32176corresponding program.  In addition, the spec strings can contain
32177@samp{%}-prefixed sequences to substitute variable text or to
32178conditionally insert text into the command line.  Using these constructs
32179it is possible to generate quite complex command lines.
32180
32181Here is a table of all defined @samp{%}-sequences for spec
32182strings.  Note that spaces are not generated automatically around the
32183results of expanding these sequences.  Therefore you can concatenate them
32184together or combine them with constant text in a single argument.
32185
32186@table @code
32187@item %%
32188Substitute one @samp{%} into the program name or argument.
32189
32190@item %"
32191Substitute an empty argument.
32192
32193@item %i
32194Substitute the name of the input file being processed.
32195
32196@item %b
32197Substitute the basename for outputs related with the input file being
32198processed.  This is often the substring up to (and not including) the
32199last period and not including the directory but, unless %w is active, it
32200expands to the basename for auxiliary outputs, which may be influenced
32201by an explicit output name, and by various other options that control
32202how auxiliary outputs are named.
32203
32204@item %B
32205This is the same as @samp{%b}, but include the file suffix (text after
32206the last period).  Without %w, it expands to the basename for dump
32207outputs.
32208
32209@item %d
32210Marks the argument containing or following the @samp{%d} as a
32211temporary file name, so that that file is deleted if GCC exits
32212successfully.  Unlike @samp{%g}, this contributes no text to the
32213argument.
32214
32215@item %g@var{suffix}
32216Substitute a file name that has suffix @var{suffix} and is chosen
32217once per compilation, and mark the argument in the same way as
32218@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
32219name is now chosen in a way that is hard to predict even when previously
32220chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
32221might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
32222the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
32223treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
32224was simply substituted with a file name chosen once per compilation,
32225without regard to any appended suffix (which was therefore treated
32226just like ordinary text), making such attacks more likely to succeed.
32227
32228@item %u@var{suffix}
32229Like @samp{%g}, but generates a new temporary file name
32230each time it appears instead of once per compilation.
32231
32232@item %U@var{suffix}
32233Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
32234new one if there is no such last file name.  In the absence of any
32235@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
32236the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
32237involves the generation of two distinct file names, one
32238for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
32239simply substituted with a file name chosen for the previous @samp{%u},
32240without regard to any appended suffix.
32241
32242@item %j@var{suffix}
32243Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
32244writable, and if @option{-save-temps} is not used;
32245otherwise, substitute the name
32246of a temporary file, just like @samp{%u}.  This temporary file is not
32247meant for communication between processes, but rather as a junk
32248disposal mechanism.
32249
32250@item %|@var{suffix}
32251@itemx %m@var{suffix}
32252Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
32253@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
32254all.  These are the two most common ways to instruct a program that it
32255should read from standard input or write to standard output.  If you
32256need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
32257construct: see for example @file{gcc/fortran/lang-specs.h}.
32258
32259@item %.@var{SUFFIX}
32260Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
32261when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
32262terminated by the next space or %.
32263
32264@item %w
32265Marks the argument containing or following the @samp{%w} as the
32266designated output file of this compilation.  This puts the argument
32267into the sequence of arguments that @samp{%o} substitutes.
32268
32269@item %V
32270Indicates that this compilation produces no output file.
32271
32272@item %o
32273Substitutes the names of all the output files, with spaces
32274automatically placed around them.  You should write spaces
32275around the @samp{%o} as well or the results are undefined.
32276@samp{%o} is for use in the specs for running the linker.
32277Input files whose names have no recognized suffix are not compiled
32278at all, but they are included among the output files, so they are
32279linked.
32280
32281@item %O
32282Substitutes the suffix for object files.  Note that this is
32283handled specially when it immediately follows @samp{%g, %u, or %U},
32284because of the need for those to form complete file names.  The
32285handling is such that @samp{%O} is treated exactly as if it had already
32286been substituted, except that @samp{%g, %u, and %U} do not currently
32287support additional @var{suffix} characters following @samp{%O} as they do
32288following, for example, @samp{.o}.
32289
32290@item %I
32291Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
32292@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
32293@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
32294and @option{-imultilib} as necessary.
32295
32296@item %s
32297Current argument is the name of a library or startup file of some sort.
32298Search for that file in a standard list of directories and substitute
32299the full name found.  The current working directory is included in the
32300list of directories scanned.
32301
32302@item %T
32303Current argument is the name of a linker script.  Search for that file
32304in the current list of directories to scan for libraries. If the file
32305is located insert a @option{--script} option into the command line
32306followed by the full path name found.  If the file is not found then
32307generate an error message.  Note: the current working directory is not
32308searched.
32309
32310@item %e@var{str}
32311Print @var{str} as an error message.  @var{str} is terminated by a newline.
32312Use this when inconsistent options are detected.
32313
32314@item %n@var{str}
32315Print @var{str} as a notice.  @var{str} is terminated by a newline.
32316
32317@item %(@var{name})
32318Substitute the contents of spec string @var{name} at this point.
32319
32320@item %x@{@var{option}@}
32321Accumulate an option for @samp{%X}.
32322
32323@item %X
32324Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
32325spec string.
32326
32327@item %Y
32328Output the accumulated assembler options specified by @option{-Wa}.
32329
32330@item %Z
32331Output the accumulated preprocessor options specified by @option{-Wp}.
32332
32333@item %M
32334Output @code{multilib_os_dir}.
32335
32336@item %R
32337Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
32338
32339@item %a
32340Process the @code{asm} spec.  This is used to compute the
32341switches to be passed to the assembler.
32342
32343@item %A
32344Process the @code{asm_final} spec.  This is a spec string for
32345passing switches to an assembler post-processor, if such a program is
32346needed.
32347
32348@item %l
32349Process the @code{link} spec.  This is the spec for computing the
32350command line passed to the linker.  Typically it makes use of the
32351@samp{%L %G %S %D and %E} sequences.
32352
32353@item %D
32354Dump out a @option{-L} option for each directory that GCC believes might
32355contain startup files.  If the target supports multilibs then the
32356current multilib directory is prepended to each of these paths.
32357
32358@item %L
32359Process the @code{lib} spec.  This is a spec string for deciding which
32360libraries are included on the command line to the linker.
32361
32362@item %G
32363Process the @code{libgcc} spec.  This is a spec string for deciding
32364which GCC support library is included on the command line to the linker.
32365
32366@item %S
32367Process the @code{startfile} spec.  This is a spec for deciding which
32368object files are the first ones passed to the linker.  Typically
32369this might be a file named @file{crt0.o}.
32370
32371@item %E
32372Process the @code{endfile} spec.  This is a spec string that specifies
32373the last object files that are passed to the linker.
32374
32375@item %C
32376Process the @code{cpp} spec.  This is used to construct the arguments
32377to be passed to the C preprocessor.
32378
32379@item %1
32380Process the @code{cc1} spec.  This is used to construct the options to be
32381passed to the actual C compiler (@command{cc1}).
32382
32383@item %2
32384Process the @code{cc1plus} spec.  This is used to construct the options to be
32385passed to the actual C++ compiler (@command{cc1plus}).
32386
32387@item %*
32388Substitute the variable part of a matched option.  See below.
32389Note that each comma in the substituted string is replaced by
32390a single space.
32391
32392@item %<S
32393Remove all occurrences of @code{-S} from the command line.  Note---this
32394command is position dependent.  @samp{%} commands in the spec string
32395before this one see @code{-S}, @samp{%} commands in the spec string
32396after this one do not.
32397
32398@item %<S*
32399Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
32400
32401@item %>S
32402Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
32403
32404@item %:@var{function}(@var{args})
32405Call the named function @var{function}, passing it @var{args}.
32406@var{args} is first processed as a nested spec string, then split
32407into an argument vector in the usual fashion.  The function returns
32408a string which is processed as if it had appeared literally as part
32409of the current spec.
32410
32411The following built-in spec functions are provided:
32412
32413@table @code
32414@item @code{getenv}
32415The @code{getenv} spec function takes two arguments: an environment
32416variable name and a string.  If the environment variable is not
32417defined, a fatal error is issued.  Otherwise, the return value is the
32418value of the environment variable concatenated with the string.  For
32419example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
32420
32421@smallexample
32422%:getenv(TOPDIR /include)
32423@end smallexample
32424
32425expands to @file{/path/to/top/include}.
32426
32427@item @code{if-exists}
32428The @code{if-exists} spec function takes one argument, an absolute
32429pathname to a file.  If the file exists, @code{if-exists} returns the
32430pathname.  Here is a small example of its usage:
32431
32432@smallexample
32433*startfile:
32434crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
32435@end smallexample
32436
32437@item @code{if-exists-else}
32438The @code{if-exists-else} spec function is similar to the @code{if-exists}
32439spec function, except that it takes two arguments.  The first argument is
32440an absolute pathname to a file.  If the file exists, @code{if-exists-else}
32441returns the pathname.  If it does not exist, it returns the second argument.
32442This way, @code{if-exists-else} can be used to select one file or another,
32443based on the existence of the first.  Here is a small example of its usage:
32444
32445@smallexample
32446*startfile:
32447crt0%O%s %:if-exists(crti%O%s) \
32448%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
32449@end smallexample
32450
32451@item @code{if-exists-then-else}
32452The @code{if-exists-then-else} spec function takes at least two arguments
32453and an optional third one. The first argument is an absolute pathname to a
32454file.  If the file exists, the function returns the second argument.
32455If the file does not exist, the function returns the third argument if there
32456is one, or NULL otherwise. This can be used to expand one text, or optionally
32457another, based on the existence of a file.  Here is a small example of its
32458usage:
32459
32460@smallexample
32461-l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
32462@end smallexample
32463
32464@item @code{sanitize}
32465The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
32466any address, thread or undefined behavior sanitizers are active.
32467
32468@smallexample
32469%@{%:sanitize(address):-funwind-tables@}
32470@end smallexample
32471
32472@item @code{replace-outfile}
32473The @code{replace-outfile} spec function takes two arguments.  It looks for the
32474first argument in the outfiles array and replaces it with the second argument.  Here
32475is a small example of its usage:
32476
32477@smallexample
32478%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
32479@end smallexample
32480
32481@item @code{remove-outfile}
32482The @code{remove-outfile} spec function takes one argument.  It looks for the
32483first argument in the outfiles array and removes it.  Here is a small example
32484its usage:
32485
32486@smallexample
32487%:remove-outfile(-lm)
32488@end smallexample
32489
32490@item @code{version-compare}
32491The @code{version-compare} spec function takes four or five arguments of the following
32492form:
32493
32494@smallexample
32495<comparison-op> <arg1> [<arg2>] <switch> <result>
32496@end smallexample
32497
32498It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
32499The supported @code{comparison-op} values are:
32500
32501@table @code
32502@item >=
32503True if @code{switch} is a later (or same) version than @code{arg1}
32504
32505@item !>
32506Opposite of @code{>=}
32507
32508@item <
32509True if @code{switch} is an earlier version than @code{arg1}
32510
32511@item !<
32512Opposite of @code{<}
32513
32514@item ><
32515True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
32516
32517@item <>
32518True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
32519@end table
32520
32521If the @code{switch} is not present at all, the condition is false unless the first character
32522of the @code{comparison-op} is @code{!}.
32523
32524@smallexample
32525%:version-compare(>= 10.3 mmacosx-version-min= -lmx)
32526@end smallexample
32527
32528The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
32529passed.
32530
32531@item @code{include}
32532The @code{include} spec function behaves much like @code{%include}, with the advantage
32533that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
32534the filename, and looks for it in the startfile path.  It always returns NULL.
32535
32536@smallexample
32537%@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
32538@end smallexample
32539
32540@item @code{pass-through-libs}
32541The @code{pass-through-libs} spec function takes any number of arguments.  It
32542finds any @option{-l} options and any non-options ending in @file{.a} (which it
32543assumes are the names of linker input library archive files) and returns a
32544result containing all the found arguments each prepended by
32545@option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
32546intended to be passed to the LTO linker plugin.
32547
32548@smallexample
32549%:pass-through-libs(%G %L %G)
32550@end smallexample
32551
32552@item @code{print-asm-header}
32553The @code{print-asm-header} function takes no arguments and simply
32554prints a banner like:
32555
32556@smallexample
32557Assembler options
32558=================
32559
32560Use "-Wa,OPTION" to pass "OPTION" to the assembler.
32561@end smallexample
32562
32563It is used to separate compiler options from assembler options
32564in the @option{--target-help} output.
32565
32566@item @code{gt}
32567The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
32568empty string) if the second-to-last argument is greater than the last argument, and NULL
32569otherwise.  The following example inserts the @code{link_gomp} spec if the last
32570@option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
32571
32572@smallexample
32573%@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
32574@end smallexample
32575
32576@item @code{debug-level-gt}
32577The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
32578empty string) if @code{debug_info_level} is greater than the specified number, and NULL
32579otherwise.
32580
32581@smallexample
32582%@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
32583@end smallexample
32584@end table
32585
32586@item %@{S@}
32587Substitutes the @code{-S} switch, if that switch is given to GCC@.
32588If that switch is not specified, this substitutes nothing.  Note that
32589the leading dash is omitted when specifying this option, and it is
32590automatically inserted if the substitution is performed.  Thus the spec
32591string @samp{%@{foo@}} matches the command-line option @option{-foo}
32592and outputs the command-line option @option{-foo}.
32593
32594@item %W@{S@}
32595Like %@{@code{S}@} but mark last argument supplied within as a file to be
32596deleted on failure.
32597
32598@item %@@@{S@}
32599Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
32600@code{@@FILE} if an @code{@@file} argument has been supplied.
32601
32602@item %@{S*@}
32603Substitutes all the switches specified to GCC whose names start
32604with @code{-S}, but which also take an argument.  This is used for
32605switches like @option{-o}, @option{-D}, @option{-I}, etc.
32606GCC considers @option{-o foo} as being
32607one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
32608text, including the space.  Thus two arguments are generated.
32609
32610@item %@{S*&T*@}
32611Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
32612(the order of @code{S} and @code{T} in the spec is not significant).
32613There can be any number of ampersand-separated variables; for each the
32614wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
32615
32616@item %@{S:X@}
32617Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
32618
32619@item %@{!S:X@}
32620Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
32621
32622@item %@{S*:X@}
32623Substitutes @code{X} if one or more switches whose names start with
32624@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
32625once, no matter how many such switches appeared.  However, if @code{%*}
32626appears somewhere in @code{X}, then @code{X} is substituted once
32627for each matching switch, with the @code{%*} replaced by the part of
32628that switch matching the @code{*}.
32629
32630If @code{%*} appears as the last part of a spec sequence then a space
32631is added after the end of the last substitution.  If there is more
32632text in the sequence, however, then a space is not generated.  This
32633allows the @code{%*} substitution to be used as part of a larger
32634string.  For example, a spec string like this:
32635
32636@smallexample
32637%@{mcu=*:--script=%*/memory.ld@}
32638@end smallexample
32639
32640@noindent
32641when matching an option like @option{-mcu=newchip} produces:
32642
32643@smallexample
32644--script=newchip/memory.ld
32645@end smallexample
32646
32647@item %@{.S:X@}
32648Substitutes @code{X}, if processing a file with suffix @code{S}.
32649
32650@item %@{!.S:X@}
32651Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
32652
32653@item %@{,S:X@}
32654Substitutes @code{X}, if processing a file for language @code{S}.
32655
32656@item %@{!,S:X@}
32657Substitutes @code{X}, if not processing a file for language @code{S}.
32658
32659@item %@{S|P:X@}
32660Substitutes @code{X} if either @code{-S} or @code{-P} is given to
32661GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
32662@code{*} sequences as well, although they have a stronger binding than
32663the @samp{|}.  If @code{%*} appears in @code{X}, all of the
32664alternatives must be starred, and only the first matching alternative
32665is substituted.
32666
32667For example, a spec string like this:
32668
32669@smallexample
32670%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
32671@end smallexample
32672
32673@noindent
32674outputs the following command-line options from the following input
32675command-line options:
32676
32677@smallexample
32678fred.c        -foo -baz
32679jim.d         -bar -boggle
32680-d fred.c     -foo -baz -boggle
32681-d jim.d      -bar -baz -boggle
32682@end smallexample
32683
32684@item %@{%:@var{function}(@var{args}):X@}
32685
32686Call function named @var{function} with args @var{args}.  If the
32687function returns non-NULL, then @code{X} is substituted, if it returns
32688NULL, it isn't substituted.
32689
32690@item %@{S:X; T:Y; :D@}
32691
32692If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
32693given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
32694be as many clauses as you need.  This may be combined with @code{.},
32695@code{,}, @code{!}, @code{|}, and @code{*} as needed.
32696
32697
32698@end table
32699
32700The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
32701or similar construct can use a backslash to ignore the special meaning
32702of the character following it, thus allowing literal matching of a
32703character that is otherwise specially treated.  For example,
32704@samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
32705@option{-std=iso9899:1999} option is given.
32706
32707The conditional text @code{X} in a @samp{%@{S:X@}} or similar
32708construct may contain other nested @samp{%} constructs or spaces, or
32709even newlines.  They are processed as usual, as described above.
32710Trailing white space in @code{X} is ignored.  White space may also
32711appear anywhere on the left side of the colon in these constructs,
32712except between @code{.} or @code{*} and the corresponding word.
32713
32714The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
32715handled specifically in these constructs.  If another value of
32716@option{-O} or the negated form of a @option{-f}, @option{-m}, or
32717@option{-W} switch is found later in the command line, the earlier
32718switch value is ignored, except with @{@code{S}*@} where @code{S} is
32719just one letter, which passes all matching options.
32720
32721The character @samp{|} at the beginning of the predicate text is used to
32722indicate that a command should be piped to the following command, but
32723only if @option{-pipe} is specified.
32724
32725It is built into GCC which switches take arguments and which do not.
32726(You might think it would be useful to generalize this to allow each
32727compiler's spec to say which switches take arguments.  But this cannot
32728be done in a consistent fashion.  GCC cannot even decide which input
32729files have been specified without knowing which switches take arguments,
32730and it must know which input files to compile in order to tell which
32731compilers to run).
32732
32733GCC also knows implicitly that arguments starting in @option{-l} are to be
32734treated as compiler output files, and passed to the linker in their
32735proper position among the other output files.
32736
32737@node Environment Variables
32738@section Environment Variables Affecting GCC
32739@cindex environment variables
32740
32741@c man begin ENVIRONMENT
32742This section describes several environment variables that affect how GCC
32743operates.  Some of them work by specifying directories or prefixes to use
32744when searching for various kinds of files.  Some are used to specify other
32745aspects of the compilation environment.
32746
32747Note that you can also specify places to search using options such as
32748@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
32749take precedence over places specified using environment variables, which
32750in turn take precedence over those specified by the configuration of GCC@.
32751@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
32752GNU Compiler Collection (GCC) Internals}.
32753
32754@table @env
32755@item LANG
32756@itemx LC_CTYPE
32757@c @itemx LC_COLLATE
32758@itemx LC_MESSAGES
32759@c @itemx LC_MONETARY
32760@c @itemx LC_NUMERIC
32761@c @itemx LC_TIME
32762@itemx LC_ALL
32763@findex LANG
32764@findex LC_CTYPE
32765@c @findex LC_COLLATE
32766@findex LC_MESSAGES
32767@c @findex LC_MONETARY
32768@c @findex LC_NUMERIC
32769@c @findex LC_TIME
32770@findex LC_ALL
32771@cindex locale
32772These environment variables control the way that GCC uses
32773localization information which allows GCC to work with different
32774national conventions.  GCC inspects the locale categories
32775@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
32776so.  These locale categories can be set to any value supported by your
32777installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
32778Kingdom encoded in UTF-8.
32779
32780The @env{LC_CTYPE} environment variable specifies character
32781classification.  GCC uses it to determine the character boundaries in
32782a string; this is needed for some multibyte encodings that contain quote
32783and escape characters that are otherwise interpreted as a string
32784end or escape.
32785
32786The @env{LC_MESSAGES} environment variable specifies the language to
32787use in diagnostic messages.
32788
32789If the @env{LC_ALL} environment variable is set, it overrides the value
32790of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
32791and @env{LC_MESSAGES} default to the value of the @env{LANG}
32792environment variable.  If none of these variables are set, GCC
32793defaults to traditional C English behavior.
32794
32795@item TMPDIR
32796@findex TMPDIR
32797If @env{TMPDIR} is set, it specifies the directory to use for temporary
32798files.  GCC uses temporary files to hold the output of one stage of
32799compilation which is to be used as input to the next stage: for example,
32800the output of the preprocessor, which is the input to the compiler
32801proper.
32802
32803@item GCC_COMPARE_DEBUG
32804@findex GCC_COMPARE_DEBUG
32805Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
32806@option{-fcompare-debug} to the compiler driver.  See the documentation
32807of this option for more details.
32808
32809@item GCC_EXEC_PREFIX
32810@findex GCC_EXEC_PREFIX
32811If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
32812names of the subprograms executed by the compiler.  No slash is added
32813when this prefix is combined with the name of a subprogram, but you can
32814specify a prefix that ends with a slash if you wish.
32815
32816If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
32817an appropriate prefix to use based on the pathname it is invoked with.
32818
32819If GCC cannot find the subprogram using the specified prefix, it
32820tries looking in the usual places for the subprogram.
32821
32822The default value of @env{GCC_EXEC_PREFIX} is
32823@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
32824the installed compiler. In many cases @var{prefix} is the value
32825of @code{prefix} when you ran the @file{configure} script.
32826
32827Other prefixes specified with @option{-B} take precedence over this prefix.
32828
32829This prefix is also used for finding files such as @file{crt0.o} that are
32830used for linking.
32831
32832In addition, the prefix is used in an unusual way in finding the
32833directories to search for header files.  For each of the standard
32834directories whose name normally begins with @samp{/usr/local/lib/gcc}
32835(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
32836replacing that beginning with the specified prefix to produce an
32837alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
32838@file{foo/bar} just before it searches the standard directory
32839@file{/usr/local/lib/bar}.
32840If a standard directory begins with the configured
32841@var{prefix} then the value of @var{prefix} is replaced by
32842@env{GCC_EXEC_PREFIX} when looking for header files.
32843
32844@item COMPILER_PATH
32845@findex COMPILER_PATH
32846The value of @env{COMPILER_PATH} is a colon-separated list of
32847directories, much like @env{PATH}.  GCC tries the directories thus
32848specified when searching for subprograms, if it cannot find the
32849subprograms using @env{GCC_EXEC_PREFIX}.
32850
32851@item LIBRARY_PATH
32852@findex LIBRARY_PATH
32853The value of @env{LIBRARY_PATH} is a colon-separated list of
32854directories, much like @env{PATH}.  When configured as a native compiler,
32855GCC tries the directories thus specified when searching for special
32856linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
32857using GCC also uses these directories when searching for ordinary
32858libraries for the @option{-l} option (but directories specified with
32859@option{-L} come first).
32860
32861@item LANG
32862@findex LANG
32863@cindex locale definition
32864This variable is used to pass locale information to the compiler.  One way in
32865which this information is used is to determine the character set to be used
32866when character literals, string literals and comments are parsed in C and C++.
32867When the compiler is configured to allow multibyte characters,
32868the following values for @env{LANG} are recognized:
32869
32870@table @samp
32871@item C-JIS
32872Recognize JIS characters.
32873@item C-SJIS
32874Recognize SJIS characters.
32875@item C-EUCJP
32876Recognize EUCJP characters.
32877@end table
32878
32879If @env{LANG} is not defined, or if it has some other value, then the
32880compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
32881recognize and translate multibyte characters.
32882
32883@item GCC_EXTRA_DIAGNOSTIC_OUTPUT
32884@findex GCC_EXTRA_DIAGNOSTIC_OUTPUT
32885If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
32886then additional text will be emitted to stderr when fix-it hints are
32887emitted.  @option{-fdiagnostics-parseable-fixits} and
32888@option{-fno-diagnostics-parseable-fixits} take precedence over this
32889environment variable.
32890
32891@table @samp
32892@item fixits-v1
32893Emit parseable fix-it hints, equivalent to
32894@option{-fdiagnostics-parseable-fixits}.  In particular, columns are
32895expressed as a count of bytes, starting at byte 1 for the initial column.
32896
32897@item fixits-v2
32898As @code{fixits-v1}, but columns are expressed as display columns,
32899as per @option{-fdiagnostics-column-unit=display}.
32900@end table
32901
32902@end table
32903
32904@noindent
32905Some additional environment variables affect the behavior of the
32906preprocessor.
32907
32908@include cppenv.texi
32909
32910@c man end
32911
32912@node Precompiled Headers
32913@section Using Precompiled Headers
32914@cindex precompiled headers
32915@cindex speed of compilation
32916
32917Often large projects have many header files that are included in every
32918source file.  The time the compiler takes to process these header files
32919over and over again can account for nearly all of the time required to
32920build the project.  To make builds faster, GCC allows you to
32921@dfn{precompile} a header file.
32922
32923To create a precompiled header file, simply compile it as you would any
32924other file, if necessary using the @option{-x} option to make the driver
32925treat it as a C or C++ header file.  You may want to use a
32926tool like @command{make} to keep the precompiled header up-to-date when
32927the headers it contains change.
32928
32929A precompiled header file is searched for when @code{#include} is
32930seen in the compilation.  As it searches for the included file
32931(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
32932compiler looks for a precompiled header in each directory just before it
32933looks for the include file in that directory.  The name searched for is
32934the name specified in the @code{#include} with @samp{.gch} appended.  If
32935the precompiled header file cannot be used, it is ignored.
32936
32937For instance, if you have @code{#include "all.h"}, and you have
32938@file{all.h.gch} in the same directory as @file{all.h}, then the
32939precompiled header file is used if possible, and the original
32940header is used otherwise.
32941
32942Alternatively, you might decide to put the precompiled header file in a
32943directory and use @option{-I} to ensure that directory is searched
32944before (or instead of) the directory containing the original header.
32945Then, if you want to check that the precompiled header file is always
32946used, you can put a file of the same name as the original header in this
32947directory containing an @code{#error} command.
32948
32949This also works with @option{-include}.  So yet another way to use
32950precompiled headers, good for projects not designed with precompiled
32951header files in mind, is to simply take most of the header files used by
32952a project, include them from another header file, precompile that header
32953file, and @option{-include} the precompiled header.  If the header files
32954have guards against multiple inclusion, they are skipped because
32955they've already been included (in the precompiled header).
32956
32957If you need to precompile the same header file for different
32958languages, targets, or compiler options, you can instead make a
32959@emph{directory} named like @file{all.h.gch}, and put each precompiled
32960header in the directory, perhaps using @option{-o}.  It doesn't matter
32961what you call the files in the directory; every precompiled header in
32962the directory is considered.  The first precompiled header
32963encountered in the directory that is valid for this compilation is
32964used; they're searched in no particular order.
32965
32966There are many other possibilities, limited only by your imagination,
32967good sense, and the constraints of your build system.
32968
32969A precompiled header file can be used only when these conditions apply:
32970
32971@itemize
32972@item
32973Only one precompiled header can be used in a particular compilation.
32974
32975@item
32976A precompiled header cannot be used once the first C token is seen.  You
32977can have preprocessor directives before a precompiled header; you cannot
32978include a precompiled header from inside another header.
32979
32980@item
32981The precompiled header file must be produced for the same language as
32982the current compilation.  You cannot use a C precompiled header for a C++
32983compilation.
32984
32985@item
32986The precompiled header file must have been produced by the same compiler
32987binary as the current compilation is using.
32988
32989@item
32990Any macros defined before the precompiled header is included must
32991either be defined in the same way as when the precompiled header was
32992generated, or must not affect the precompiled header, which usually
32993means that they don't appear in the precompiled header at all.
32994
32995The @option{-D} option is one way to define a macro before a
32996precompiled header is included; using a @code{#define} can also do it.
32997There are also some options that define macros implicitly, like
32998@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
32999defined this way.
33000
33001@item If debugging information is output when using the precompiled
33002header, using @option{-g} or similar, the same kind of debugging information
33003must have been output when building the precompiled header.  However,
33004a precompiled header built using @option{-g} can be used in a compilation
33005when no debugging information is being output.
33006
33007@item The same @option{-m} options must generally be used when building
33008and using the precompiled header.  @xref{Submodel Options},
33009for any cases where this rule is relaxed.
33010
33011@item Each of the following options must be the same when building and using
33012the precompiled header:
33013
33014@gccoptlist{-fexceptions}
33015
33016@item
33017Some other command-line options starting with @option{-f},
33018@option{-p}, or @option{-O} must be defined in the same way as when
33019the precompiled header was generated.  At present, it's not clear
33020which options are safe to change and which are not; the safest choice
33021is to use exactly the same options when generating and using the
33022precompiled header.  The following are known to be safe:
33023
33024@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
33025-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
33026-fsched-verbose=@var{number}  -fschedule-insns  -fvisibility= @gol
33027-pedantic-errors}
33028
33029@item Address space layout randomization (ASLR) can lead to not binary identical
33030PCH files.  If you rely on stable PCH file contents disable ASLR when generating
33031PCH files.
33032
33033@end itemize
33034
33035For all of these except the last, the compiler automatically
33036ignores the precompiled header if the conditions aren't met.  If you
33037find an option combination that doesn't work and doesn't cause the
33038precompiled header to be ignored, please consider filing a bug report,
33039see @ref{Bugs}.
33040
33041If you do use differing options when generating and using the
33042precompiled header, the actual behavior is a mixture of the
33043behavior for the options.  For instance, if you use @option{-g} to
33044generate the precompiled header but not when using it, you may or may
33045not get debugging information for routines in the precompiled header.
33046
33047@node C++ Modules
33048@section C++ Modules
33049@cindex speed of compilation
33050
33051Modules are a C++20 language feature.  As the name suggests, they
33052provides a modular compilation system, intending to provide both
33053faster builds and better library isolation.  The ``Merging Modules''
33054paper @uref{https://wg21.link/p1103}, provides the easiest to read set
33055of changes to the standard, although it does not capture later
33056changes.  That specification is now part of C++20,
33057@uref{git@@github.com:cplusplus/draft.git}, it is considered complete
33058(there may be defect reports to come).
33059
33060@emph{G++'s modules support is not complete.}  Other than bugs, the
33061known missing pieces are:
33062
33063@table @emph
33064
33065@item Private Module Fragment
33066The Private Module Fragment is recognized, but an error is emitted.
33067
33068@item Partition definition visibility rules
33069Entities may be defined in implementation partitions, and those
33070definitions are not available outside of the module.  This is not
33071implemented, and the definitions are available to extra-module use.
33072
33073@item Textual merging of reachable GM entities
33074Entities may be multiply defined across different header-units.
33075These must be de-duplicated, and this is implemented across imports,
33076or when an import redefines a textually-defined entity.  However the
33077reverse is not implemented---textually redefining an entity that has
33078been defined in an imported header-unit.  A redefinition error is
33079emitted.
33080
33081@item Translation-Unit local referencing rules
33082Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
33083(@uref{https://wg21.link/p2003}) add limitations on which entities an
33084exported region may reference (for instance, the entities an exported
33085template definition may reference).  These are not fully implemented.
33086
33087@item Language-linkage module attachment
33088Declarations with explicit language linkage (@code{extern "C"} or
33089@code{extern "C++"}) are attached to the global module, even when in
33090the purview of a named module.  This is not implemented.  Such
33091declarations will be attached to the module, if any, in which they are
33092declared.
33093
33094@item Standard Library Header Units
33095The Standard Library is not provided as importable header units.  If
33096you want to import such units, you must explicitly build them first.
33097If you do not do this with care, you may have multiple declarations,
33098which the module machinery must merge---compiler resource usage can be
33099affected by how you partition header files into header units.
33100
33101@end table
33102
33103Modular compilation is @emph{not} enabled with just the
33104@option{-std=c++20} option.  You must explicitly enable it with the
33105@option{-fmodules-ts} option.  It is independent of the language
33106version selected, although in pre-C++20 versions, it is of course an
33107extension.
33108
33109No new source file suffixes are required or supported.  If you wish to
33110use a non-standard suffix (@xref{Overall Options}), you also need
33111to provide a @option{-x c++} option too.@footnote{Some users like to
33112distinguish module interface files with a new suffix, such as naming
33113the source @code{module.cppm}, which involves
33114teaching all tools about the new suffix.  A different scheme, such as
33115naming @code{module-m.cpp} would be less invasive.}
33116
33117Compiling a module interface unit produces an additional output (to
33118the assembly or object file), called a Compiled Module Interface
33119(CMI).  This encodes the exported declarations of the module.
33120Importing a module reads in the CMI.  The import graph is a Directed
33121Acyclic Graph (DAG).  You must build imports before the importer.
33122
33123Header files may themselves be compiled to header units, which are a
33124transitional ability aiming at faster compilation.  The
33125@option{-fmodule-header} option is used to enable this, and implies
33126the @option{-fmodules-ts} option.  These CMIs are named by the fully
33127resolved underlying header file, and thus may be a complete pathname
33128containing subdirectories.  If the header file is found at an absolute
33129pathname, the CMI location is still relative to a CMI root directory.
33130
33131As header files often have no suffix, you commonly have to specify a
33132@option{-x} option to tell the compiler the source is a header file.
33133You may use @option{-x c++-header}, @option{-x c++-user-header} or
33134@option{-x c++-system-header}.  When used in conjunction with
33135@option{-fmodules-ts}, these all imply an appropriate
33136@option{-fmodule-header} option.  The latter two variants use the
33137user or system include path to search for the file specified.  This
33138allows you to, for instance, compile standard library header files as
33139header units, without needing to know exactly where they are
33140installed.  Specifying the language as one of these variants also
33141inhibits output of the object file, as header files have no associated
33142object file.
33143
33144The @option{-fmodule-only} option disables generation of the
33145associated object file for compiling a module interface.  Only the CMI
33146is generated.  This option is implied when using the
33147@option{-fmodule-header} option.
33148
33149The @option{-flang-info-include-translate} and
33150@option{-flang-info-include-translate-not} options notes whether
33151include translation occurs or not.  With no argument, the first will
33152note all include translation.  The second will note all
33153non-translations of include files not known to intentionally be
33154textual.  With an argument, queries about include translation of a
33155header files with that particular trailing pathname are noted.  You
33156may repeat this form to cover several different header files.  This
33157option may be helpful in determining whether include translation is
33158happening---if it is working correctly, it behaves as if it isn't
33159there at all.
33160
33161The @option{-flang-info-module-cmi} option can be used to determine
33162where the compiler is reading a CMI from.  Without the option, the
33163compiler is silent when such a read is successful.  This option has an
33164optional argument, which will restrict the notification to just the
33165set of named modules or header units specified.
33166
33167The @option{-Winvalid-imported-macros} option causes all imported macros
33168to be resolved at the end of compilation.  Without this, imported
33169macros are only resolved when expanded or (re)defined.  This option
33170detects conflicting import definitions for all macros.
33171
33172@xref{C++ Module Mapper} for details of the @option{-fmodule-mapper}
33173family of options.
33174
33175@menu
33176* C++ Module Mapper::       Module Mapper
33177* C++ Module Preprocessing::  Module Preprocessing
33178* C++ Compiled Module Interface:: Compiled Module Interface
33179@end menu
33180
33181@node C++ Module Mapper
33182@subsection Module Mapper
33183@cindex C++ Module Mapper
33184
33185A module mapper provides a server or file that the compiler queries to
33186determine the mapping between module names and CMI files.  It is also
33187used to build CMIs on demand.  @emph{Mapper functionality is in its
33188infancy and is intended for experimentation with build system
33189interactions.}
33190
33191You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
33192option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
33193have one of the following forms:
33194
33195@table @gcctabopt
33196
33197@item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
33198An optional hostname and a numeric port number to connect to.  If the
33199hostname is omitted, the loopback address is used.  If the hostname
33200corresponds to multiple IPV6 addresses, these are tried in turn, until
33201one is successful.  If your host lacks IPv6, this form is
33202non-functional.  If you must use IPv4 use
33203@option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
33204
33205@item =@var{socket}@r{[}?@var{ident}@r{]}
33206A local domain socket.  If your host lacks local domain sockets, this
33207form is non-functional.
33208
33209@item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
33210A program to spawn, and communicate with on its stdin/stdout streams.
33211Your @var{PATH} environment variable is searched for the program.
33212Arguments are separated by space characters, (it is not possible for
33213one of the arguments delivered to the program to contain a space).  An
33214exception is if @var{program} begins with @@.  In that case
33215@var{program} (sans @@) is looked for in the compiler's internal
33216binary directory.  Thus the sample mapper-server can be specified
33217with @code{@@g++-mapper-server}.
33218
33219@item <>@r{[}?@var{ident}@r{]}
33220@item <>@var{inout}@r{[}?@var{ident}@r{]}
33221@item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
33222Named pipes or file descriptors to communicate over.  The first form,
33223@option{<>}, communicates over stdin and stdout.  The other forms
33224allow you to specify a file descriptor or name a pipe.  A numeric value
33225is interpreted as a file descriptor, otherwise named pipe is opened.
33226The second form specifies a bidirectional pipe and the last form
33227allows specifying two independent pipes.  Using file descriptors
33228directly in this manner is fragile in general, as it can require the
33229cooperation of intermediate processes.  In particular using stdin &
33230stdout is fraught with danger as other compiler options might also
33231cause the compiler to read stdin or write stdout, and it can have
33232unfortunate interactions with signal delivery from the terminal.
33233
33234@item @var{file}@r{[}?@var{ident}@r{]}
33235A mapping file consisting of space-separated module-name, filename
33236pairs, one per line.  Only the mappings for the direct imports and any
33237module export name need be provided.  If other mappings are provided,
33238they override those stored in any imported CMI files.  A repository
33239root may be specified in the mapping file by using @samp{$root} as the
33240module name in the first active line.  Use of this option will disable
33241any default module->CMI name mapping.
33242
33243@end table
33244
33245As shown, an optional @var{ident} may suffix the first word of the
33246option, indicated by a @samp{?} prefix.  The value is used in the
33247initial handshake with the module server, or to specify a prefix on
33248mapping file lines.  In the server case, the main source file name is
33249used if no @var{ident} is specified.  In the file case, all non-blank
33250lines are significant, unless a value is specified, in which case only
33251lines beginning with @var{ident} are significant.  The @var{ident}
33252must be separated by whitespace from the module name.  Be aware that
33253@samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
33254significant to the shell, and therefore may need quoting.
33255
33256The mapper is connected to or loaded lazily, when the first module
33257mapping is required.  The networking protocols are only supported on
33258hosts that provide networking.  If no mapper is specified a default is
33259provided.
33260
33261A project-specific mapper is expected to be provided by the build
33262system that invokes the compiler.  It is not expected that a
33263general-purpose server is provided for all compilations.  As such, the
33264server will know the build configuration, the compiler it invoked, and
33265the environment (such as working directory) in which that is
33266operating.  As it may parallelize builds, several compilations may
33267connect to the same socket.
33268
33269The default mapper generates CMI files in a @samp{gcm.cache}
33270directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
33271is used directly to provide the basename.  Header units construct a
33272relative path using the underlying header file name.  If the path is
33273already relative, a @samp{,} directory is prepended.  Internal
33274@samp{..} components are translated to @samp{,,}.  No attempt is made
33275to canonicalize these filenames beyond that done by the preprocessor's
33276include search algorithm, as in general it is ambiguous when symbolic
33277links are present.
33278
33279The mapper protocol was published as ``A Module Mapper''
33280@uref{https://wg21.link/p1184}.  The implementation is provided by
33281@command{libcody}, @uref{https://github.com/urnathan/libcody},
33282which specifies the canonical protocol definition.  A proof of concept
33283server implementation embedded in @command{make} was described in
33284''Make Me A Module'', @uref{https://wg21.link/p1602}.
33285
33286@node C++ Module Preprocessing
33287@subsection Module Preprocessing
33288@cindex C++ Module Preprocessing
33289
33290Modules affect preprocessing because of header units and include
33291translation.  Some uses of the preprocessor as a separate step either
33292do not produce a correct output, or require CMIs to be available.
33293
33294Header units import macros.  These macros can affect later conditional
33295inclusion, which therefore can cascade to differing import sets.  When
33296preprocessing, it is necessary to load the CMI.  If a header unit is
33297unavailable, the preprocessor issues a warning and continue (when
33298not just preprocessing, an error is emitted).  Detecting such imports
33299requires preprocessor tokenization of the input stream to phase 4
33300(macro expansion).
33301
33302Include translation converts @code{#include}, @code{#include_next} and
33303@code{#import} directives to internal @code{import} declarations.
33304Whether a particular directive is translated is controlled by the
33305module mapper.  Header unit names are canonicalized during
33306preprocessing.
33307
33308Dependency information can be emitted for macro import, extending the
33309functionality of @option{-MD} and @option{-MMD} options.  Detection of
33310import declarations also requires phase 4 preprocessing, and thus
33311requires full preprocessing (or compilation).
33312
33313The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
33314preprocessing before phase 4.
33315
33316The @option{-save-temps} option uses @option{-fdirectives-only} for
33317preprocessing, and preserve the macro definitions in the preprocessed
33318output.  Usually you also want to use this option when explicitly
33319preprocessing a header-unit, or consuming such preprocessed output:
33320
33321@smallexample
33322g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
33323g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
33324@end smallexample
33325
33326@node C++ Compiled Module Interface
33327@subsection Compiled Module Interface
33328@cindex C++ Compiled Module Interface
33329
33330CMIs are an additional artifact when compiling named module
33331interfaces, partitions or header units.  These are read when
33332importing.  CMI contents are implementation-specific, and in GCC's
33333case tied to the compiler version.  Consider them a rebuildable cache
33334artifact, not a distributable object.
33335
33336When creating an output CMI, any missing directory components are
33337created in a manner that is safe for concurrent builds creating
33338multiple, different, CMIs within a common subdirectory tree.
33339
33340CMI contents are written to a temporary file, which is then atomically
33341renamed.  Observers either see old contents (if there is an
33342existing file), or complete new contents.  They do not observe the
33343CMI during its creation.  This is unlike object file writing, which
33344may be observed by an external process.
33345
33346CMIs are read in lazily, if the host OS provides @code{mmap}
33347functionality.  Generally blocks are read when name lookup or template
33348instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
33349option may be used.
33350
33351The @option{--param lazy-modules=@var{n}} parameter controls the limit
33352on the number of concurrently open module files during lazy loading.
33353Should more modules be imported, an LRU algorithm is used to determine
33354which files to close---until that file is needed again.  This limit
33355may be exceeded with deep module dependency hierarchies.  With large
33356code bases there may be more imports than the process limit of file
33357descriptors.  By default, the limit is a few less than the per-process
33358file descriptor hard limit, if that is determinable.@footnote{Where
33359applicable the soft limit is incremented as needed towards the hard limit.}
33360
33361GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
33362You may use @command{readelf} to inspect them, although section
33363contents are largely undecipherable.  There is a section named
33364@code{.gnu.c++.README}, which contains human-readable text.  Other
33365than the first line, each line consists of @code{@var{tag}: @code{value}}
33366tuples.
33367
33368@smallexample
33369> @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
33370
33371String dump of section '.gnu.c++.README':
33372  [     0]  GNU C++ primary module interface
33373  [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
33374  [    6f]  version: 2020/11/16-04:54
33375  [    89]  module: foo
33376  [    95]  source: c_b.ii
33377  [    a4]  dialect: C++20/coroutines
33378  [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
33379  [    ee]  repository: gcm.cache
33380  [   104]  buildtime: 2020/11/16 15:03:21 UTC
33381  [   127]  localtime: 2020/11/16 07:03:21 PST
33382  [   14a]  export: foo:part1 foo-part1.gcm
33383@end smallexample
33384
33385Amongst other things, this lists the source that was built, C++
33386dialect used and imports of the module.@footnote{The precise contents
33387of this output may change.} The timestamp is the same value as that
33388provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
33389explicitly specified with the environment variable
33390@code{SOURCE_DATE_EPOCH}.  @xref{Environment Variables} for further
33391details.
33392
33393A set of related CMIs may be copied, provided the relative pathnames
33394are preserved.
33395
33396The @code{.gnu.c++.README} contents do not affect CMI integrity, and
33397it may be removed or altered.  The section numbering of the sections
33398whose names do not begin with @code{.gnu.c++.}, or are not the string
33399section is significant and must not be altered.
33400